mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-06 17:37:21 +02:00
Parser
- ::findPlainArgs will now only upgrade an arg to a search if the arg itself cannot be lexed into subtokens.
This commit is contained in:
parent
cf5eb73f04
commit
a1ee44ac17
1 changed files with 23 additions and 11 deletions
|
@ -1377,21 +1377,33 @@ void Parser::findPlainArgs ()
|
||||||
(*i)->hasTag ("ORIGINAL") && // TODO Wrong, can come in through alias/filter
|
(*i)->hasTag ("ORIGINAL") && // TODO Wrong, can come in through alias/filter
|
||||||
(*i)->countTags () <= 2)
|
(*i)->countTags () <= 2)
|
||||||
{
|
{
|
||||||
// This tag also prevents further expanѕion.
|
// A word can be upgraded to a pattern only if it does not itself contain
|
||||||
(*i)->tag ("PATTERN");
|
// multiple tokens.
|
||||||
|
std::string raw = (*i)->attribute ("raw");
|
||||||
|
std::vector <std::string> lexed;
|
||||||
|
Lexer::token_split (lexed, raw);
|
||||||
|
|
||||||
std::string pattern = (*i)->attribute ("raw");
|
if (lexed.size () == 1)
|
||||||
|
{
|
||||||
|
// This tag also prevents further expanѕion.
|
||||||
|
(*i)->tag ("PATTERN");
|
||||||
|
|
||||||
Tree* branch = (*i)->addBranch (new Tree ("argPat"));
|
Tree* branch = (*i)->addBranch (new Tree ("argPat"));
|
||||||
branch->attribute ("raw", "description");
|
branch->attribute ("raw", "description");
|
||||||
|
|
||||||
branch = (*i)->addBranch (new Tree ("argPat"));
|
branch = (*i)->addBranch (new Tree ("argPat"));
|
||||||
branch->attribute ("raw", "~");
|
branch->attribute ("raw", "~");
|
||||||
branch->tag ("OP");
|
branch->tag ("OP");
|
||||||
|
|
||||||
branch = (*i)->addBranch (new Tree ("argPat"));
|
branch = (*i)->addBranch (new Tree ("argPat"));
|
||||||
branch->attribute ("raw", pattern);
|
branch->attribute ("raw", raw);
|
||||||
branch->tag ("STRING");
|
branch->tag ("STRING");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "# ::findPlainArgs '" << raw << "' is compounded\n";
|
||||||
|
// TODO Add the lexed elements as separate tokens.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue