mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-03 07:07:19 +02:00
Parser
- Converted ::findOperator to use recursive scan.
This commit is contained in:
parent
34215449a8
commit
6a9cca82d7
2 changed files with 15 additions and 24 deletions
|
@ -183,7 +183,7 @@ Tree* Parser::parse ()
|
||||||
scan (&Parser::findTag);
|
scan (&Parser::findTag);
|
||||||
scan (&Parser::findAttribute);
|
scan (&Parser::findAttribute);
|
||||||
scan (&Parser::findAttributeModifier);
|
scan (&Parser::findAttributeModifier);
|
||||||
findOperator ();
|
scan (&Parser::findOperator);
|
||||||
findCommand ();
|
findCommand ();
|
||||||
findUUIDList ();
|
findUUIDList ();
|
||||||
findIdSequence ();
|
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.
|
// Find the category.
|
||||||
std::pair <std::multimap <std::string, std::string>::const_iterator, std::multimap <std::string, std::string>::const_iterator> c;
|
std::pair <std::multimap <std::string, std::string>::const_iterator, std::multimap <std::string, std::string>::const_iterator> c;
|
||||||
c = _entities.equal_range ("operator");
|
c = _entities.equal_range ("operator");
|
||||||
|
@ -1400,29 +1403,17 @@ void Parser::findOperator ()
|
||||||
for (e = c.first; e != c.second; ++e)
|
for (e = c.first; e != c.second; ++e)
|
||||||
options.push_back (e->second);
|
options.push_back (e->second);
|
||||||
|
|
||||||
std::vector <Tree*>::iterator i;
|
std::string raw = t->attribute ("raw");
|
||||||
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
|
||||||
|
std::vector <std::string>::iterator opt;
|
||||||
|
for (opt = options.begin (); opt != options.end (); ++opt)
|
||||||
{
|
{
|
||||||
// Parser override operator.
|
if (*opt == raw)
|
||||||
if ((*i)->attribute ("raw") == "--")
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Skip known args.
|
|
||||||
if (! (*i)->hasTag ("?"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
std::string raw = (*i)->attribute ("raw");
|
|
||||||
|
|
||||||
std::vector <std::string>::iterator opt;
|
|
||||||
for (opt = options.begin (); opt != options.end (); ++opt)
|
|
||||||
{
|
{
|
||||||
if (*opt == raw)
|
t->unTag ("?");
|
||||||
{
|
t->removeAllBranches ();
|
||||||
(*i)->unTag ("?");
|
t->tag ("OP");
|
||||||
(*i)->removeAllBranches ();
|
break;
|
||||||
(*i)->tag ("OP");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ private:
|
||||||
void findTag (Tree*);
|
void findTag (Tree*);
|
||||||
void findAttribute (Tree*);
|
void findAttribute (Tree*);
|
||||||
void findAttributeModifier (Tree*);
|
void findAttributeModifier (Tree*);
|
||||||
void findOperator ();
|
void findOperator (Tree*);
|
||||||
void findFilter ();
|
void findFilter ();
|
||||||
void findModifications ();
|
void findModifications ();
|
||||||
void findStrayModifications ();
|
void findStrayModifications ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue