This commit is contained in:
Yarmo Mackenbach 2024-08-12 10:47:19 +02:00
commit dad77f64ec
No known key found for this signature in database
GPG key ID: 2B71CD64664999B6
6 changed files with 209 additions and 0 deletions

98
takentaal.g4 Normal file
View file

@ -0,0 +1,98 @@
grammar takentaal;
takentaal
: line+ EOF
;
line
: plan
| task
| subtask
| comment
;
plan
: PLAN_TOKEN TEXT
| PLAN_TOKEN TEXT AMOUNT
;
task
: TASK_TOKEN TEXT
| TASK_TOKEN TEXT AMOUNT
;
subtask
: subtask_new
| subtask_partial
| subtask_complete
| subtask_obsolete
;
subtask_new
: SUBTASK_NEW_TOKEN TEXT AMOUNT?
;
subtask_partial
: SUBTASK_PARTIAL_TOKEN TEXT AMOUNT?
;
subtask_complete
: SUBTASK_COMPLETE_TOKEN TEXT AMOUNT?
;
subtask_obsolete
: SUBTASK_OBSOLETE_TOKEN TEXT AMOUNT?
;
comment
: TEXT
;
PLAN_TOKEN
: '# '
;
TASK_TOKEN
: '## '
;
SUBTASK_NEW_TOKEN
: '- '
;
SUBTASK_PARTIAL_TOKEN
: '/ '
;
SUBTASK_COMPLETE_TOKEN
: '* '
;
SUBTASK_OBSOLETE_TOKEN
: '! '
;
WS
: [ \r\n\t]+ -> skip
;
AMOUNT
: '{' INT+ '}'
;
fragment INT
: [0-9]
;
TEXT
: TEXTHEAD TEXTBODY*
;
fragment TEXTHEAD
: [a-zA-Z]
;
fragment TEXTBODY
: TEXTHEAD
| [0-9_()., ]
;