mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Parser
- ::findSubstitution moves branch prining out of the iterated loop.
This commit is contained in:
parent
6753176d89
commit
e26f0f0dc9
1 changed files with 7 additions and 4 deletions
|
@ -874,8 +874,8 @@ void Parser::findPattern ()
|
||||||
void Parser::findSubstitution ()
|
void Parser::findSubstitution ()
|
||||||
{
|
{
|
||||||
context.debug ("Parser::findSubstitution");
|
context.debug ("Parser::findSubstitution");
|
||||||
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;
|
||||||
|
@ -898,17 +898,20 @@ void Parser::findSubstitution ()
|
||||||
!Directory (raw).exists ())
|
!Directory (raw).exists ())
|
||||||
{
|
{
|
||||||
(*i)->unTag ("?");
|
(*i)->unTag ("?");
|
||||||
(*i)->removeAllBranches ();
|
|
||||||
(*i)->tag ("SUBSTITUTION");
|
(*i)->tag ("SUBSTITUTION");
|
||||||
(*i)->attribute ("from", from);
|
(*i)->attribute ("from", from);
|
||||||
(*i)->attribute ("to", to);
|
(*i)->attribute ("to", to);
|
||||||
(*i)->attribute ("global", global ? 1 : 0);
|
(*i)->attribute ("global", global ? 1 : 0);
|
||||||
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