mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 19:03:07 +02:00
Code Cleanup
- Removed obsolete parser info.
This commit is contained in:
parent
93f0e14073
commit
7ec24658b5
3 changed files with 0 additions and 207 deletions
|
@ -1,94 +0,0 @@
|
|||
The main focus of the 2.4.0 release is a new command line parser that has more
|
||||
capabilities with fewer quirks and bugs.
|
||||
|
||||
|
||||
Improvements needed:
|
||||
|
||||
- Assorted quoting issues. If this command is issued, then the quoting should
|
||||
be obeyed:
|
||||
|
||||
task add one project:'Bob\'s Project'
|
||||
task add "one 'two' three"
|
||||
task add 'one "two" three'
|
||||
task add 'one \'two\' three'
|
||||
task add "one \"two\" three"
|
||||
|
||||
- The process of splitting and rejoining tokens causes this kind of problem:
|
||||
|
||||
"one (two) three" --> "one ( two) three"
|
||||
|
||||
- Any formatting in the input that makes it past the shell should be preserved.
|
||||
|
||||
- The '--' token should faithfully cause no further parsing - lexing only.
|
||||
|
||||
- The ability to perform simple math:
|
||||
|
||||
task add one due:eoy wait:due-2wks scheduled:wait-1wk
|
||||
|
||||
When processed left to right, this command has referential integrity.
|
||||
|
||||
- An attribute value must be a single argument, but can be presented in several
|
||||
equivalent ways:
|
||||
|
||||
wait:due-2wks
|
||||
wait:'due-2wks'
|
||||
wait:"due-2wks'
|
||||
wait:"due -2wks'
|
||||
wait:"due - 2wks'
|
||||
wait:due\ -\ 2wks
|
||||
|
||||
|
||||
Grammar:
|
||||
|
||||
To achieve the above, a formal grammar will be developed, otherwise a hand-
|
||||
crafted parser is going to be unmaintainable. See the grammar.txt file for the
|
||||
formal definition.
|
||||
|
||||
This grammar.txt will be embedded into task as a single-string document, then
|
||||
itself parsed and used. This has several advantages:
|
||||
|
||||
- It allows the grammar to be discussed in its purest form, with an
|
||||
authoritative document as a definition.
|
||||
- It allows the grammar to be tweaked at a high level without code changes.
|
||||
- It allows a developer to experiment with grammar.
|
||||
|
||||
|
||||
Expressions:
|
||||
|
||||
The expression evaluator will be capable of applying any supported filter.
|
||||
|
||||
The expression evaluator will also be capable of evaluating fragments of output
|
||||
from the parser, yielding a single value. As an example, the command line:
|
||||
|
||||
task add one due:eoy wait:due-2wks
|
||||
|
||||
Is to be parsed as:
|
||||
|
||||
index | 0 1 2 3 4
|
||||
--------+-----------------------------------------------
|
||||
raw | task add one due:eoy wait:due-2wks
|
||||
type | command string attr attr
|
||||
subtype | read
|
||||
attr | desc due wait
|
||||
value | eval 'eoy' eval 'due-2wks'
|
||||
|
||||
The eval needs of this command are:
|
||||
|
||||
'eoy' == date literal
|
||||
'due-2wks' == <dom> - <duration>
|
||||
|
||||
The parse tree should be:
|
||||
|
||||
+- add COMMAND
|
||||
+- "one" WORD
|
||||
+- attr
|
||||
| +- due ATTRIBUTE
|
||||
| +- expr
|
||||
| | + "eoy" LITERAL DATE
|
||||
+- attr
|
||||
+- wait ATTRIBUTE
|
||||
+- expr
|
||||
+= "due" DOM DATE
|
||||
+= "-" OP
|
||||
+= "2wks" LITERAL DURATION
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
The expression evaluator allows powerful filters and modifications.
|
||||
|
||||
There are four data types, just like UDAs:
|
||||
|
||||
string project, description
|
||||
date due, wait ...
|
||||
duration recur
|
||||
numeric urgency
|
||||
|
||||
There are several forms of literals:
|
||||
|
||||
rc.name configuration
|
||||
<dom> task-specific data
|
||||
<numeric> numbers
|
||||
<date> either ISO-8601 or rc.dateformat dates
|
||||
<duration> either ISO-8601 or durations
|
||||
|
||||
There are many supported operators:
|
||||
|
||||
+ addition, concatenation
|
||||
- subtraction, unary minus
|
||||
* multiplication
|
||||
/ division
|
||||
( ) precedence
|
||||
and or xor not ! logical operators
|
||||
< <= > >= relation operators
|
||||
= != equality operators
|
||||
~ !~ match operators
|
||||
|
||||
There are helper operators to perform odd operations:
|
||||
|
||||
__hastag__ presence of a tag
|
||||
__notag__ absence of a tag
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
# The command line needs to obey a grammar. It is then against this grammar
|
||||
# that bugs will be identified.
|
||||
#
|
||||
# Conventions:
|
||||
# - Literals are always double-quoted.
|
||||
# - "*", "+" and "?" suffixes have POSIX semantics.
|
||||
# - Low-level primitives are in <brackets>.
|
||||
# - @reports for dynamic lists such as custom report names.
|
||||
#
|
||||
# The general form of commands is:
|
||||
# task [ all-commands ]
|
||||
#
|
||||
|
||||
grammar ::= all-commands?
|
||||
;
|
||||
|
||||
all-commands ::= custom-report
|
||||
| read-command
|
||||
| write-command
|
||||
| special-command
|
||||
;
|
||||
|
||||
custom-report ::= filter? @report ;
|
||||
read-command ::= filter? @readcmd ;
|
||||
write-command ::= filter? @writecmd modifiers ;
|
||||
special-command ::= ;
|
||||
|
||||
filter ::= expression ;
|
||||
|
||||
expression ::= ;
|
||||
|
||||
modifiers ::= ;
|
||||
|
||||
# Low-level:
|
||||
|
||||
dom ::= context-value
|
||||
| system-value
|
||||
| rc-value
|
||||
| task-value
|
||||
;
|
||||
|
||||
context-value ::= "context.program"
|
||||
| "context.args"
|
||||
| "context.width"
|
||||
| "context.height"
|
||||
;
|
||||
|
||||
system-value ::= "system.version"
|
||||
| "system.os"
|
||||
;
|
||||
|
||||
rc-value ::= /rc\.[a-zA-Z.]+/
|
||||
;
|
||||
|
||||
task-value ::= <id> "." attribute
|
||||
| <uuid> "." attribute
|
||||
;
|
||||
|
||||
literal ::= <string>
|
||||
| <numeric>
|
||||
| <date>
|
||||
| <duration>
|
||||
;
|
||||
|
||||
# Supported primitives:
|
||||
#
|
||||
# <id>
|
||||
# <uuid>
|
||||
# <override>
|
||||
# <string>
|
||||
# <numeric>
|
||||
# <date>
|
||||
# <duration>
|
||||
# @command all commands
|
||||
# @report all custom reports
|
||||
# @attributes all attributes, UDAs
|
||||
# @readcmd all read-only commands
|
||||
# @writecmd all write commands
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue