CLI2: Handle empty parentheses expressions

Since taskwarrior is a CLI tool, it is likely that it is interacted with
programmatically. As such, expressions that a human would not type, but
are syntactically correct are bound to occur. In particular, task
currently is not able to handle empty parentheses expressions:

    task +PENDING '(' ')'

This is due to "and" operator being injected between +PENDING (which
translates to '( status = pending )' and '('.

Modify the insertJunctions to not insert the 'and' operator between two
sub-expressions if one of them is an empty parentheses expression.

Closes #1896.
This commit is contained in:
Tomas Babej 2021-01-30 21:06:53 -05:00
parent c6fdb7e590
commit 456dfdc8cf
2 changed files with 47 additions and 4 deletions

View file

@ -99,6 +99,7 @@ private:
void findUUIDs ();
void insertIDExpr ();
void lexFilterArgs ();
bool isEmptyParenExpression (std::vector<A2>::iterator it, bool forward = true) const;
void desugarFilterPlainArgs ();
void insertJunctions ();
void defaultCommand ();