mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-01 09:17:19 +02:00
Parser
- ::findTerminator now moves branch pruning out of the iterated loop.
This commit is contained in:
parent
9f9c07a955
commit
6dad8ddb1b
1 changed files with 8 additions and 6 deletions
|
@ -369,7 +369,7 @@ void Parser::findTerminator ()
|
||||||
{
|
{
|
||||||
context.debug ("Parser::findTerminator");
|
context.debug ("Parser::findTerminator");
|
||||||
bool found = false;
|
bool found = false;
|
||||||
bool action = false;
|
std::vector <Tree*> prune;
|
||||||
|
|
||||||
std::vector <Tree*> nodes;
|
std::vector <Tree*> nodes;
|
||||||
collect (nodes, collectTerminated);
|
collect (nodes, collectTerminated);
|
||||||
|
@ -381,24 +381,26 @@ void Parser::findTerminator ()
|
||||||
(*i)->attribute ("raw") == "--")
|
(*i)->attribute ("raw") == "--")
|
||||||
{
|
{
|
||||||
(*i)->unTag ("?");
|
(*i)->unTag ("?");
|
||||||
(*i)->removeAllBranches ();
|
|
||||||
(*i)->tag ("TERMINATOR");
|
(*i)->tag ("TERMINATOR");
|
||||||
|
prune.push_back (*i);
|
||||||
found = true;
|
found = true;
|
||||||
action = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark subsequent nodes.
|
// Mark subsequent nodes.
|
||||||
else if (found)
|
else if (found)
|
||||||
{
|
{
|
||||||
(*i)->unTag ("?");
|
(*i)->unTag ("?");
|
||||||
(*i)->removeAllBranches ();
|
|
||||||
(*i)->tag ("WORD");
|
(*i)->tag ("WORD");
|
||||||
(*i)->tag ("TERMINATED");
|
(*i)->tag ("TERMINATED");
|
||||||
action = true;
|
prune.push_back (*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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