feat(package): hemar: antlr grammar, but still does not work
This commit is contained in:
28
package/hemar/grammar/antlr/GoodTry.g4
Normal file
28
package/hemar/grammar/antlr/GoodTry.g4
Normal file
@@ -0,0 +1,28 @@
|
||||
grammar Hemar;
|
||||
|
||||
// ----------------- parser rules -----------------
|
||||
|
||||
hemar: elements? EOF ;
|
||||
|
||||
elements: element+ ;
|
||||
|
||||
element
|
||||
: segment
|
||||
| interpoltion
|
||||
;
|
||||
|
||||
segment : for elements? end ;
|
||||
|
||||
for : 'for' 'in' ;
|
||||
|
||||
end: 'end' ;
|
||||
|
||||
interpoltion : 'mcha' ;
|
||||
|
||||
OPEN : '{[' ;
|
||||
CLOSE : ']}' ;
|
||||
|
||||
WS : [ \t\n\r]+ -> skip ;
|
||||
LEADING_TEXT : { getCharPositionInLine() == 0 }? (~'{'|'{'~'[')* OPEN -> skip;
|
||||
MIDLE_TEXT : CLOSE (~'{'|'{'~'[')* OPEN -> skip;
|
||||
ENDING_TEXT : CLOSE (~'{'|'{'~'[')* EOF -> skip ;
|
||||
Reference in New Issue
Block a user