mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Parser
- Rewrote ::collect to be simpler.
This commit is contained in:
parent
a735c7eb63
commit
3aef4f74b9
1 changed files with 13 additions and 22 deletions
|
@ -309,32 +309,23 @@ void Parser::collect (
|
||||||
if (tree == NULL)
|
if (tree == NULL)
|
||||||
tree = _tree;
|
tree = _tree;
|
||||||
|
|
||||||
|
if (type == collectAll || tree->_branches.size () == 0)
|
||||||
|
nodes.push_back (tree);
|
||||||
|
|
||||||
std::vector <Tree*>::iterator i;
|
std::vector <Tree*>::iterator i;
|
||||||
for (i = tree->_branches.begin (); i != tree->_branches.end (); ++i)
|
for (i = tree->_branches.begin (); i != tree->_branches.end (); ++i)
|
||||||
{
|
|
||||||
if ((*i)->_branches.size ())
|
|
||||||
{
|
|
||||||
if (type == collectAll)
|
|
||||||
nodes.push_back (*i);
|
|
||||||
|
|
||||||
collect (nodes, type, *i);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (type == collectLeaf)
|
if (type == collectLeaf)
|
||||||
{
|
{
|
||||||
// Parser override operator.
|
|
||||||
if ((*i)->hasTag ("TERMINATOR") ||
|
if ((*i)->hasTag ("TERMINATOR") ||
|
||||||
(*i)->hasTag ("TERMINATED"))
|
(*i)->hasTag ("TERMINATED"))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Skip known args.
|
|
||||||
if (! (*i)->hasTag ("?"))
|
if (! (*i)->hasTag ("?"))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes.push_back (*i);
|
collect (nodes, type, *i);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1593,7 +1584,6 @@ void Parser::findModifications ()
|
||||||
{
|
{
|
||||||
context.debug ("Parser::findModifications");
|
context.debug ("Parser::findModifications");
|
||||||
bool action = false;
|
bool action = false;
|
||||||
|
|
||||||
bool after_writecmd = false;
|
bool after_writecmd = false;
|
||||||
|
|
||||||
std::vector <Tree*> nodes;
|
std::vector <Tree*> nodes;
|
||||||
|
@ -1602,9 +1592,10 @@ void Parser::findModifications ()
|
||||||
for (i = nodes.begin (); i != nodes.end (); ++i)
|
for (i = nodes.begin (); i != nodes.end (); ++i)
|
||||||
{
|
{
|
||||||
if ((*i)->hasTag ("WRITECMD"))
|
if ((*i)->hasTag ("WRITECMD"))
|
||||||
|
{
|
||||||
after_writecmd = true;
|
after_writecmd = true;
|
||||||
|
}
|
||||||
if (after_writecmd &&
|
else if (after_writecmd &&
|
||||||
! (*i)->hasTag ("CMD") &&
|
! (*i)->hasTag ("CMD") &&
|
||||||
! (*i)->hasTag ("TERMINATOR") &&
|
! (*i)->hasTag ("TERMINATOR") &&
|
||||||
! (*i)->hasTag ("BINARY") &&
|
! (*i)->hasTag ("BINARY") &&
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue