Split up description text into smaller tokens so they have lowest precedence

Tokens that should appear at the start of a line are now prepended with EOL
to make them precise.
This commit is contained in:
Jos van den Oever 2024-09-02 14:15:32 +02:00
parent f9e92b8152
commit c116614208
2 changed files with 12 additions and 17 deletions

View file

@ -14,7 +14,7 @@ This description has # ' " [] symbols and ü © Ð Latin-1 chars.
## {1000} Second task
This is the description of the second task.
This is the description of the {} second task for project 10.
* {500} First subtask
- {500} \2nd subtask
- {500} 2nd subtask

View file

@ -17,14 +17,17 @@ grammar takentaal;
takentaal
: header
plan
EOL*
;
header
: 'takentaal v0.1.0'
;
// Any implicit and explity lexer token that may appear in a text should be listed
// in this definition.
text
: (S | CHAR | WORD)+
: (INT | '{' | '}' | S | CHAR | WORD)+
;
plan
@ -49,7 +52,7 @@ subtask
;
amount
: START_AMOUNT S* INT END_AMOUNT
: '{' S* INT '}'
|
;
@ -62,23 +65,23 @@ TASK_TOKEN
;
SUBTASK_TOKEN
: EOL+ (SUBTASK_NEW_TOKEN | SUBTASK_PARTIAL_TOKEN | SUBTASK_COMPLETE_TOKEN | SUBTASK_OBSOLETE_TOKEN)
: (SUBTASK_NEW_TOKEN | SUBTASK_PARTIAL_TOKEN | SUBTASK_COMPLETE_TOKEN | SUBTASK_OBSOLETE_TOKEN)
;
SUBTASK_NEW_TOKEN
: '-'
: EOL+ '-'
;
SUBTASK_PARTIAL_TOKEN
: '/'
: EOL+ '/'
;
SUBTASK_COMPLETE_TOKEN
: '*'
: EOL+ '*'
;
SUBTASK_OBSOLETE_TOKEN
: '!'
: EOL+ '!'
;
S
@ -102,14 +105,6 @@ fragment DIGIT
: [0-9]
;
START_AMOUNT
: '{'
;
END_AMOUNT
: '}'
;
// Match printable characters, except space which is covered by S
CHAR
: [!-~\u00A0-\u33FF] // ASCII and UNICODE