Example #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;
 }
Example #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;
 }
Example #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;
 }
Example #4
0
 double match(iterator& begin, iterator end)
 {
     iterator current = begin;
     double result = match_explicit(current, end);
     if(result == 0.0)
     {
         current = begin;
         result = match_initializer(current, end);
         if(result == 0.0)
         {
             if(this->subparsers.size() == 1)
             {
                 current = begin;
                 result = match_params(current, end);
             }
             if(result == 0.0) return 0.0;
         }
     }
     traits.skip_space(current, end);
     begin = current;
     return result;
 }