mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-29 07:57:20 +02:00
CLI2: Added ::insertJunctions
This commit is contained in:
parent
cd8eb4b1b0
commit
706ca72a75
2 changed files with 9 additions and 13 deletions
18
src/CLI2.cpp
18
src/CLI2.cpp
|
@ -521,10 +521,10 @@ void CLI2::prepareFilter (bool applyContext)
|
||||||
findStrayModifications ();
|
findStrayModifications ();
|
||||||
desugarFilterAttributes ();
|
desugarFilterAttributes ();
|
||||||
desugarFilterPatterns ();
|
desugarFilterPatterns ();
|
||||||
/*
|
|
||||||
insertJunctions (); // Deliberately after all desugar calls.
|
insertJunctions (); // Deliberately after all desugar calls.
|
||||||
|
|
||||||
// Decompose the elements for MODIFICATIONs.
|
// Decompose the elements for MODIFICATIONs.
|
||||||
|
/*
|
||||||
decomposeModAttributes ();
|
decomposeModAttributes ();
|
||||||
decomposeModAttributeModifiers ();
|
decomposeModAttributeModifiers ();
|
||||||
decomposeModTags ();
|
decomposeModTags ();
|
||||||
|
@ -1360,7 +1360,6 @@ void CLI2::desugarFilterPlainArgs ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Two consecutive FILTER, non-OP arguments that are not "(" or ")" need an
|
// Two consecutive FILTER, non-OP arguments that are not "(" or ")" need an
|
||||||
// "and" operator inserted between them.
|
// "and" operator inserted between them.
|
||||||
|
@ -1373,8 +1372,9 @@ void CLI2::desugarFilterPlainArgs ()
|
||||||
void CLI2::insertJunctions ()
|
void CLI2::insertJunctions ()
|
||||||
{
|
{
|
||||||
bool changes = false;
|
bool changes = false;
|
||||||
std::vector <A> reconstructed;
|
std::vector <A2> reconstructed;
|
||||||
auto prev = _args.begin ();
|
auto prev = _args.begin ();
|
||||||
|
|
||||||
for (auto a = _args.begin (); a != _args.end (); ++a)
|
for (auto a = _args.begin (); a != _args.end (); ++a)
|
||||||
{
|
{
|
||||||
if (a->hasTag ("FILTER"))
|
if (a->hasTag ("FILTER"))
|
||||||
|
@ -1386,14 +1386,13 @@ void CLI2::insertJunctions ()
|
||||||
// Insert AND between terms.
|
// Insert AND between terms.
|
||||||
else if (a != prev)
|
else if (a != prev)
|
||||||
{
|
{
|
||||||
if ((! prev->hasTag ("OP") && a->attribute ("raw") == "(") ||
|
if ((prev->_lextype != Lexer::Type::op && a->attribute ("raw") == "(") ||
|
||||||
(! prev->hasTag ("OP") && ! a->hasTag ("OP")) ||
|
(prev->_lextype != Lexer::Type::op && a->_lextype != Lexer::Type::op) ||
|
||||||
(prev->attribute ("raw") == ")" && ! a->hasTag ("OP")) ||
|
(prev->attribute ("raw") == ")" && a->_lextype != Lexer::Type::op) ||
|
||||||
(prev->attribute ("raw") == ")" && a->attribute ("raw") == "("))
|
(prev->attribute ("raw") == ")" && a->attribute ("raw") == "("))
|
||||||
{
|
{
|
||||||
A opOr ("argOp", "and");
|
A2 opOr ("and", Lexer::Type::op);
|
||||||
opOr.tag ("FILTER");
|
opOr.tag ("FILTER");
|
||||||
opOr.tag ("OP");
|
|
||||||
reconstructed.push_back (opOr);
|
reconstructed.push_back (opOr);
|
||||||
changes = true;
|
changes = true;
|
||||||
}
|
}
|
||||||
|
@ -1411,10 +1410,9 @@ void CLI2::insertJunctions ()
|
||||||
_args = reconstructed;
|
_args = reconstructed;
|
||||||
|
|
||||||
if (context.config.getInteger ("debug.parser") >= 3)
|
if (context.config.getInteger ("debug.parser") >= 3)
|
||||||
context.debug (dump ("CLI2::analyze insertJunctions"));
|
context.debug (dump ("CLI2::prepareFilter insertJunctions"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CLI2::defaultCommand ()
|
void CLI2::defaultCommand ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -108,9 +108,7 @@ private:
|
||||||
void findUUIDs ();
|
void findUUIDs ();
|
||||||
void insertIDExpr ();
|
void insertIDExpr ();
|
||||||
void desugarFilterPlainArgs ();
|
void desugarFilterPlainArgs ();
|
||||||
/*
|
|
||||||
void insertJunctions ();
|
void insertJunctions ();
|
||||||
*/
|
|
||||||
void defaultCommand ();
|
void defaultCommand ();
|
||||||
/*
|
/*
|
||||||
void decomposeModAttributes ();
|
void decomposeModAttributes ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue