1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- TODO:
- SwitchCASE incompleto
- */
- grammar Template;
- //DEFINICAO DE TOKENS ----------------------------------------------------------
- fragment DIGITO : [0-9] ;
- fragment CHARACTER : [a-zA-Z_] ;
- fragment CHARACTER_UP: [A-Z];
- ID : CHARACTER ( CHARACTER | DIGITO )* ;
- T_INTEIRO : DIGITO+ ;
- R_WS : ('\t'|'\r'|'\n')+ -> skip ;//' '|
- init
- : (expression | literal)+ EOF
- ;
- literal
- : '\'' any '\''
- ;
- any
- : (ID|T_INTEIRO|','|':'|'='|'-'|'_'|'<'|'>'|' ')+
- ;
- expression
- : '{' part ('|' part)* '}'
- ;
- part
- : pre=literal? '[' stmt ']' pos=literal?
- ;
- stmt
- : arg
- | call
- ;
-
- call
- : ID '(' args? ')'
- ;
- args
- : arg (',' arg)*
- ;
- arg
- : literal
- | seletor
- | number
- | call
- ;
- seletor
- : ID ('.' ID)*
- ;
- number
- : (T_INTEIRO '.')? T_INTEIRO
- ;
|