mirror of
https://codeberg.org/NLnet/takentaal.git
synced 2025-08-29 22:10:07 +00:00
This solved parsing the example, but is suboptimal. The real fix is to know why STARTCHAR takes precedence over S and START_AMOUNT
105 lines
1.1 KiB
ANTLR
105 lines
1.1 KiB
ANTLR
grammar takentaal;
|
|
|
|
takentaal
|
|
: header
|
|
plan
|
|
;
|
|
|
|
header
|
|
: 'takentaal v0.1.0' EOL
|
|
;
|
|
|
|
plan
|
|
: PLAN_TOKEN S* amount TEXT EOL
|
|
description
|
|
task+
|
|
;
|
|
|
|
description
|
|
: (TEXT EOL)*
|
|
;
|
|
|
|
task
|
|
: TASK_TOKEN S* amount TEXT EOL
|
|
description
|
|
subtask*
|
|
;
|
|
|
|
subtask
|
|
: SUBTASK_TOKEN S* amount TEXT EOL
|
|
description
|
|
;
|
|
|
|
amount
|
|
: START_AMOUNT S* INT END_AMOUNT
|
|
|
|
|
;
|
|
|
|
PLAN_TOKEN
|
|
: '#'
|
|
;
|
|
|
|
TASK_TOKEN
|
|
: '##'
|
|
;
|
|
|
|
SUBTASK_TOKEN
|
|
: (SUBTASK_NEW_TOKEN | SUBTASK_PARTIAL_TOKEN | SUBTASK_COMPLETE_TOKEN | SUBTASK_OBSOLETE_TOKEN)
|
|
;
|
|
|
|
SUBTASK_NEW_TOKEN
|
|
: '-'
|
|
;
|
|
|
|
SUBTASK_PARTIAL_TOKEN
|
|
: '/'
|
|
;
|
|
|
|
SUBTASK_COMPLETE_TOKEN
|
|
: '*'
|
|
;
|
|
|
|
SUBTASK_OBSOLETE_TOKEN
|
|
: '!'
|
|
;
|
|
|
|
S
|
|
: ' ' -> skip
|
|
;
|
|
|
|
|
|
WS
|
|
: [ ] -> skip
|
|
;
|
|
|
|
EOL
|
|
: '\n'+
|
|
;
|
|
|
|
INT
|
|
: DIGIT+
|
|
;
|
|
|
|
DIGIT
|
|
: [0-9]
|
|
;
|
|
|
|
START_AMOUNT
|
|
: '{'
|
|
;
|
|
|
|
END_AMOUNT
|
|
: '}'
|
|
;
|
|
|
|
STARTCHAR
|
|
: [!-"$-/:-\u007A\u007C\u007E]
|
|
;
|
|
|
|
CHAR
|
|
: [ -\u007E\u00A0-\u33FF] // ASCII and UNICODE
|
|
;
|
|
|
|
TEXT
|
|
: STARTCHAR CHAR*
|
|
;
|