diff --git a/src/Parser.cpp b/src/Parser.cpp index c7caae526..c2f27d1e8 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -183,7 +183,7 @@ Tree* Parser::parse () scan (&Parser::findTag); scan (&Parser::findAttribute); scan (&Parser::findAttributeModifier); - findOperator (); + scan (&Parser::findOperator); findCommand (); findUUIDList (); findIdSequence (); @@ -1388,8 +1388,11 @@ void Parser::findUUIDList () } //////////////////////////////////////////////////////////////////////////////// -void Parser::findOperator () +void Parser::findOperator (Tree* t) { + context.debug ("findOperator"); + context.debug (t->dump ()); + // Find the category. std::pair ::const_iterator, std::multimap ::const_iterator> c; c = _entities.equal_range ("operator"); @@ -1400,29 +1403,17 @@ void Parser::findOperator () for (e = c.first; e != c.second; ++e) options.push_back (e->second); - std::vector ::iterator i; - for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i) + std::string raw = t->attribute ("raw"); + + std::vector ::iterator opt; + for (opt = options.begin (); opt != options.end (); ++opt) { - // Parser override operator. - if ((*i)->attribute ("raw") == "--") - break; - - // Skip known args. - if (! (*i)->hasTag ("?")) - continue; - - std::string raw = (*i)->attribute ("raw"); - - std::vector ::iterator opt; - for (opt = options.begin (); opt != options.end (); ++opt) + if (*opt == raw) { - if (*opt == raw) - { - (*i)->unTag ("?"); - (*i)->removeAllBranches (); - (*i)->tag ("OP"); - break; - } + t->unTag ("?"); + t->removeAllBranches (); + t->tag ("OP"); + break; } } } diff --git a/src/Parser.h b/src/Parser.h index 7f5f9e44e..3bbc8bdac 100644 --- a/src/Parser.h +++ b/src/Parser.h @@ -75,7 +75,7 @@ private: void findTag (Tree*); void findAttribute (Tree*); void findAttributeModifier (Tree*); - void findOperator (); + void findOperator (Tree*); void findFilter (); void findModifications (); void findStrayModifications ();