Restrict evaluation of string attributes, support empty paren expressions and other parser improvements#2405
Merged
Restrict evaluation of string attributes, support empty paren expressions and other parser improvements#2405
Conversation
…to be evaluated Attribute names are often words from natural language (such as start, end or entry). The ColumnTypeString supports resolving DOM references, such that task commands like 'task add proj:3.proj' work. However, the current implementation of the ColumnTypeString::modify only looks at the first token to determine whether the input is a DOM reference or not. This mischaracterizes inputs like 'task add "description:start something"', where the first token of the attribute value looks like a DOM reference (the 'start' attribute), but is in fact, a part of larger string. Since all DOM references are single tokens, only interpret the input as a possible DOM reference if and only if one token was found. Closes #1908.
It could be argued we should not support this syntax (i.e. the ')' character needs to be surrounded by a space. Note that the ability to contain ')' as part of the attribute value was explicitly requested (as a bug report) in TW-1455 (#1481).
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.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This MR implements more restricted behaviour when evaluating and desugaring filter string attributes, namely:
Also implements support for dealing with empty parentheses expressions, see #1896.
Closes #2388.
Closes #2386.
Closes #2257.
Closes #1908.
Closes #1896.