mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Parser
- ::findPattern moves branch pruning out of the iterated loop.
This commit is contained in:
parent
1b39a03e96
commit
6753176d89
1 changed files with 7 additions and 4 deletions
|
@ -831,8 +831,8 @@ std::string Parser::getCommand () const
|
||||||
void Parser::findPattern ()
|
void Parser::findPattern ()
|
||||||
{
|
{
|
||||||
context.debug ("Parser::findPattern");
|
context.debug ("Parser::findPattern");
|
||||||
bool action = false;
|
|
||||||
|
|
||||||
|
std::vector <Tree*> prune;
|
||||||
std::vector <Tree*> nodes;
|
std::vector <Tree*> nodes;
|
||||||
collect (nodes);
|
collect (nodes);
|
||||||
std::vector <Tree*>::iterator i;
|
std::vector <Tree*>::iterator i;
|
||||||
|
@ -845,8 +845,8 @@ void Parser::findPattern ()
|
||||||
pattern.length () > 0)
|
pattern.length () > 0)
|
||||||
{
|
{
|
||||||
(*i)->unTag ("?");
|
(*i)->unTag ("?");
|
||||||
(*i)->removeAllBranches ();
|
|
||||||
(*i)->tag ("PATTERN");
|
(*i)->tag ("PATTERN");
|
||||||
|
prune.push_back (*i);
|
||||||
|
|
||||||
Tree* branch = (*i)->addBranch (new Tree ("argPat"));
|
Tree* branch = (*i)->addBranch (new Tree ("argPat"));
|
||||||
branch->attribute ("raw", "description");
|
branch->attribute ("raw", "description");
|
||||||
|
@ -858,11 +858,14 @@ void Parser::findPattern ()
|
||||||
branch = (*i)->addBranch (new Tree ("argPat"));
|
branch = (*i)->addBranch (new Tree ("argPat"));
|
||||||
branch->attribute ("raw", pattern);
|
branch->attribute ("raw", pattern);
|
||||||
branch->tag ("STRING");
|
branch->tag ("STRING");
|
||||||
action = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action)
|
// Prune branches outside the loop.
|
||||||
|
for (i = prune.begin (); i != prune.end (); ++i)
|
||||||
|
(*i)->removeAllBranches ();
|
||||||
|
|
||||||
|
if (prune.size ())
|
||||||
context.debug (_tree->dump ());
|
context.debug (_tree->dump ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue