Ejemplo n.º 1
0
 double match_initializer(iterator& current, iterator end)
 {
     traits.skip_space(current, end);
     if(!traits.match(current, end, "{")) return 0.0;
     double res = match_params(current, end);
     if(res == 0.0) return 0.0;
     traits.skip_space(current, end);
     if(!traits.match(current, end, "}")) return 0.0;
     traits.skip_space(current, end);
     return res;
 }
Ejemplo n.º 2
0
 double match_explicit(iterator& current, iterator end)
 {
     traits.skip_space(current, end);
     if(!traits.match_skip_space(
                 current,
                 end,
                 traits.get_shared_string(shared_data, type_name)
             )) return 0.0;
     traits.skip_space(current, end);
     if(!traits.match(current, end, "(")) return 0.0;
     if(match_params(current, end) == 0.0) return 0.0;
     traits.skip_space(current, end);
     if(!traits.match(current, end, ")")) return 0.0;
     traits.skip_space(current, end);
     return 1.0;
 }
Ejemplo n.º 3
0
 double match_params(iterator& current, iterator end)
 {
     double result = 1.0;
     auto i = this->subparsers.begin(), e = this->subparsers.end();
     while(i != e)
     {
         traits.skip_space(current, end);
         result *= (*i)->match(current, end);
         if(result == 0.0) return 0.0;
         traits.skip_space(current, end);
         ++i;
         if(i != e)
         {
             if(!traits.match(current, end, ","))
                 return 0.0;
             traits.skip_space(current, end);
         }
     }
     return result;
 }