mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Parser
- Modified ::findTag to perform one action and repeat, rather than attempt everything at once, with an invalid iterator.
This commit is contained in:
parent
2ce350b3bf
commit
af77e2e150
1 changed files with 41 additions and 29 deletions
|
@ -920,44 +920,56 @@ void Parser::findSubstitution ()
|
|||
void Parser::findTag ()
|
||||
{
|
||||
context.debug ("Parser::findTag");
|
||||
bool action = false;
|
||||
bool action = true;
|
||||
|
||||
std::vector <Tree*> nodes;
|
||||
collect (nodes);
|
||||
std::vector <Tree*>::iterator i;
|
||||
for (i = nodes.begin (); i != nodes.end (); ++i)
|
||||
do
|
||||
{
|
||||
std::string raw = (*i)->attribute ("raw");
|
||||
Nibbler n (raw);
|
||||
|
||||
std::string tag;
|
||||
std::string sign;
|
||||
if (n.getN (1, sign) &&
|
||||
(sign == "+" || sign == "-") &&
|
||||
n.getUntilEOS (tag) &&
|
||||
tag.find (' ') == std::string::npos)
|
||||
action = false;
|
||||
std::vector <Tree*> nodes;
|
||||
collect (nodes, collectAll);
|
||||
std::vector <Tree*>::iterator i;
|
||||
for (i = nodes.begin (); i != nodes.end (); ++i)
|
||||
{
|
||||
(*i)->unTag ("?");
|
||||
(*i)->removeAllBranches ();
|
||||
(*i)->tag ("TAG");
|
||||
(*i)->attribute ("sign", sign);
|
||||
(*i)->attribute ("tag", tag);
|
||||
if (! (*i)->hasTag ("?"))
|
||||
continue;
|
||||
|
||||
Tree* branch = (*i)->addBranch (new Tree ("argTag"));
|
||||
branch->attribute ("raw", "tags");
|
||||
if ((*i)->hasTag ("TERMINATOR") ||
|
||||
(*i)->hasTag ("TERMINATED"))
|
||||
break;
|
||||
|
||||
branch = (*i)->addBranch (new Tree ("argTag"));
|
||||
branch->attribute ("raw", (sign == "+" ? "_hastag_" : "_notag_"));
|
||||
branch->tag ("OP");
|
||||
std::string raw = (*i)->attribute ("raw");
|
||||
Nibbler n (raw);
|
||||
|
||||
branch = (*i)->addBranch (new Tree ("argTag"));
|
||||
branch->attribute ("raw", tag);
|
||||
action = true;
|
||||
std::string tag;
|
||||
std::string sign;
|
||||
if (n.getN (1, sign) &&
|
||||
(sign == "+" || sign == "-") &&
|
||||
n.getUntilEOS (tag) &&
|
||||
tag.find (' ') == std::string::npos)
|
||||
{
|
||||
(*i)->unTag ("?");
|
||||
(*i)->removeAllBranches ();
|
||||
(*i)->tag ("TAG");
|
||||
(*i)->attribute ("sign", sign);
|
||||
(*i)->attribute ("tag", tag);
|
||||
|
||||
Tree* branch = (*i)->addBranch (new Tree ("argTag"));
|
||||
branch->attribute ("raw", "tags");
|
||||
|
||||
branch = (*i)->addBranch (new Tree ("argTag"));
|
||||
branch->attribute ("raw", (sign == "+" ? "_hastag_" : "_notag_"));
|
||||
branch->tag ("OP");
|
||||
|
||||
branch = (*i)->addBranch (new Tree ("argTag"));
|
||||
branch->attribute ("raw", tag);
|
||||
action = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (action);
|
||||
|
||||
if (action)
|
||||
context.debug (_tree->dump ());
|
||||
context.debug (_tree->dump ());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue