mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI
- Implemented ::desugarPlainArgs to upgrade WORD to PATTERN when found in a FILTER context.
This commit is contained in:
parent
0c4b447c77
commit
a780bd0193
2 changed files with 36 additions and 0 deletions
35
src/CLI.cpp
35
src/CLI.cpp
|
@ -318,6 +318,7 @@ void CLI::analyze ()
|
|||
desugarPatterns ();
|
||||
desugarIDs ();
|
||||
desugarUUIDs ();
|
||||
//desugarPlainArgs ();
|
||||
findOperators ();
|
||||
insertJunctions ();
|
||||
|
||||
|
@ -1250,6 +1251,40 @@ void CLI::desugarUUIDs ()
|
|||
_args = reconstructed;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void CLI::desugarPlainArgs ()
|
||||
{
|
||||
std::vector <A> reconstructed;
|
||||
std::vector <A>::iterator a;
|
||||
for (a = _args.begin (); a != _args.end (); ++a)
|
||||
{
|
||||
if (a->hasTag ("FILTER") &&
|
||||
! a->hasTag ("ATTRIBUTE") &&
|
||||
! a->hasTag ("OP") &&
|
||||
! a->hasTag ("LITERAL"))
|
||||
{
|
||||
A lhs ("argPattern", "description");
|
||||
lhs.tag ("ATTRIBUTE");
|
||||
lhs.tag ("FILTER");
|
||||
reconstructed.push_back (lhs);
|
||||
|
||||
A op ("argPattern", "~");
|
||||
op.tag ("OP");
|
||||
op.tag ("FILTER");
|
||||
reconstructed.push_back (op);
|
||||
|
||||
A rhs ("argPattern", "'" + a->attribute ("raw") + "'");
|
||||
rhs.tag ("LITERAL");
|
||||
rhs.tag ("FILTER");
|
||||
reconstructed.push_back (rhs);
|
||||
}
|
||||
else
|
||||
reconstructed.push_back (*a);
|
||||
}
|
||||
|
||||
_args = reconstructed;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void CLI::findOperators ()
|
||||
{
|
||||
|
|
|
@ -87,6 +87,7 @@ private:
|
|||
void desugarPatterns ();
|
||||
void desugarIDs ();
|
||||
void desugarUUIDs ();
|
||||
void desugarPlainArgs ();
|
||||
void findOperators ();
|
||||
void insertJunctions ();
|
||||
void decomposeModAttributes ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue