To accept a syntax '@command some text', the space character should be treated separately from STRING and WS.

This commit is contained in:
Feufochmar 2023-06-03 12:38:44 +02:00
parent 486a41258b
commit 76bb17cf4b
2 changed files with 12 additions and 9 deletions

View File

@ -1,13 +1,14 @@
lexer grammar ScribblyLexer;
WS: [ \t\n\r\f]+ ;
ARROBE : '@' ;
LBLOCK : '[' ;
RBLOCK : ']' ;
LCURLY : '{' ;
RCURLY : '}' ;
COLON : ':' ;
WS: [\t\n\r\f]+ ;
SPACE: ' '+ ;
ARROBE: '@' ;
LBLOCK: '[' ;
RBLOCK: ']' ;
LCURLY: '{' ;
RCURLY: '}' ;
COLON: ':' ;
ID: [a-z]+ ;
STRING: (~([:@{}\t\n\r\f] | '[' | ']'))+ ;
STRING: (~([:@{}\t\n\r\f ] | '[' | ']'))+ ;

View File

@ -11,7 +11,7 @@ item
;
command
: ARROBE commandName WS? (LBLOCK attributeKey COLON attributeValue+ RBLOCK WS?)* (LCURLY commandVal* RCURLY)?
: ARROBE commandName (WS? SPACE? LBLOCK attributeKey COLON attributeValue+ RBLOCK)* (WS? SPACE? LCURLY commandVal* RCURLY)?
;
commandName
@ -27,6 +27,7 @@ attributeValue
| STRING
| ARROBE (ARROBE | LBLOCK | RBLOCK | LCURLY | RCURLY)
| COLON
| SPACE
;
commandVal
@ -40,4 +41,5 @@ text
| ARROBE (ARROBE | LBLOCK | RBLOCK | LCURLY | RCURLY)
| COLON
| WS
| SPACE
;