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 ()
|
void Parser::findTag ()
|
||||||
{
|
{
|
||||||
context.debug ("Parser::findTag");
|
context.debug ("Parser::findTag");
|
||||||
bool action = false;
|
bool action = true;
|
||||||
|
|
||||||
std::vector <Tree*> nodes;
|
do
|
||||||
collect (nodes);
|
|
||||||
std::vector <Tree*>::iterator i;
|
|
||||||
for (i = nodes.begin (); i != nodes.end (); ++i)
|
|
||||||
{
|
{
|
||||||
std::string raw = (*i)->attribute ("raw");
|
action = false;
|
||||||
Nibbler n (raw);
|
std::vector <Tree*> nodes;
|
||||||
|
collect (nodes, collectAll);
|
||||||
std::string tag;
|
std::vector <Tree*>::iterator i;
|
||||||
std::string sign;
|
for (i = nodes.begin (); i != nodes.end (); ++i)
|
||||||
if (n.getN (1, sign) &&
|
|
||||||
(sign == "+" || sign == "-") &&
|
|
||||||
n.getUntilEOS (tag) &&
|
|
||||||
tag.find (' ') == std::string::npos)
|
|
||||||
{
|
{
|
||||||
(*i)->unTag ("?");
|
if (! (*i)->hasTag ("?"))
|
||||||
(*i)->removeAllBranches ();
|
continue;
|
||||||
(*i)->tag ("TAG");
|
|
||||||
(*i)->attribute ("sign", sign);
|
|
||||||
(*i)->attribute ("tag", tag);
|
|
||||||
|
|
||||||
Tree* branch = (*i)->addBranch (new Tree ("argTag"));
|
if ((*i)->hasTag ("TERMINATOR") ||
|
||||||
branch->attribute ("raw", "tags");
|
(*i)->hasTag ("TERMINATED"))
|
||||||
|
break;
|
||||||
|
|
||||||
branch = (*i)->addBranch (new Tree ("argTag"));
|
std::string raw = (*i)->attribute ("raw");
|
||||||
branch->attribute ("raw", (sign == "+" ? "_hastag_" : "_notag_"));
|
Nibbler n (raw);
|
||||||
branch->tag ("OP");
|
|
||||||
|
|
||||||
branch = (*i)->addBranch (new Tree ("argTag"));
|
std::string tag;
|
||||||
branch->attribute ("raw", tag);
|
std::string sign;
|
||||||
action = true;
|
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