mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-01 09:17:19 +02:00
Parser
- Modified ::findPlainArgs to use collect.
This commit is contained in:
parent
1f0ce08042
commit
f4807db6d9
1 changed files with 19 additions and 5 deletions
|
@ -191,9 +191,9 @@ Tree* Parser::parse ()
|
||||||
findFilter ();
|
findFilter ();
|
||||||
findModifications ();
|
findModifications ();
|
||||||
findStrayModifications ();
|
findStrayModifications ();
|
||||||
// GOOD ^^^
|
|
||||||
|
|
||||||
findPlainArgs ();
|
findPlainArgs ();
|
||||||
|
// GOOD ^^^
|
||||||
findMissingOperators ();
|
findMissingOperators ();
|
||||||
|
|
||||||
validate ();
|
validate ();
|
||||||
|
@ -1579,7 +1579,7 @@ void Parser::findModifications ()
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Parser::findStrayModifications ()
|
void Parser::findStrayModifications ()
|
||||||
{
|
{
|
||||||
context.debug ("Parser::findModifications");
|
context.debug ("Parser::findStrayModifications");
|
||||||
bool action = false;
|
bool action = false;
|
||||||
|
|
||||||
std::string command = getCommand ();
|
std::string command = getCommand ();
|
||||||
|
@ -1610,8 +1610,13 @@ void Parser::findStrayModifications ()
|
||||||
// are not otherwise recognized, and potentially promote them to patterns.
|
// are not otherwise recognized, and potentially promote them to patterns.
|
||||||
void Parser::findPlainArgs ()
|
void Parser::findPlainArgs ()
|
||||||
{
|
{
|
||||||
|
context.debug ("Parser::findPlainArgs");
|
||||||
|
bool action = false;
|
||||||
|
|
||||||
|
std::vector <Tree*> nodes;
|
||||||
|
collect (nodes, false);
|
||||||
std::vector <Tree*>::iterator i;
|
std::vector <Tree*>::iterator i;
|
||||||
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
for (i = nodes.begin (); i != nodes.end (); ++i)
|
||||||
{
|
{
|
||||||
if ((*i)->hasTag ("FILTER") &&
|
if ((*i)->hasTag ("FILTER") &&
|
||||||
(*i)->hasTag ("ORIGINAL") && // TODO Wrong, can come in through alias/filter
|
(*i)->hasTag ("ORIGINAL") && // TODO Wrong, can come in through alias/filter
|
||||||
|
@ -1641,20 +1646,29 @@ void Parser::findPlainArgs ()
|
||||||
branch = (*i)->addBranch (new Tree ("argPat"));
|
branch = (*i)->addBranch (new Tree ("argPat"));
|
||||||
branch->attribute ("raw", raw);
|
branch->attribute ("raw", raw);
|
||||||
branch->tag ("STRING");
|
branch->tag ("STRING");
|
||||||
|
action = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (action)
|
||||||
|
context.debug (_tree->dump ());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Parser::findMissingOperators ()
|
void Parser::findMissingOperators ()
|
||||||
{
|
{
|
||||||
|
bool action = false;
|
||||||
|
|
||||||
while (insertOr ())
|
while (insertOr ())
|
||||||
;
|
action = true;
|
||||||
|
|
||||||
while (insertAnd ())
|
while (insertAnd ())
|
||||||
;
|
action = true;
|
||||||
|
|
||||||
|
if (action)
|
||||||
|
context.debug (_tree->dump ());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue