Skip to content

Instantly share code, notes, and snippets.

@melchisedech333
Created March 28, 2022 17:45
Show Gist options
  • Save melchisedech333/7e9668a1dce0d5b1eee4b31ac9965752 to your computer and use it in GitHub Desktop.
Save melchisedech333/7e9668a1dce0d5b1eee4b31ac9965752 to your computer and use it in GitHub Desktop.
Lexer
lexer grammar TLexer;
@lexer::postinclude {
#ifndef _WIN32
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
}
/* Tokens. */
STRING : '"' .*? '"' ;
INTEGER : [0-9]+ ;
VAR : 'var' ;
TYPE : [:][a-zA-Z]+ ;
VARIABLE : [a-zA-Z]+ ;
ATTR : '=' ;
SEPARATOR : ',' ;
END : ';' ;
ARRAY_OPEN : '[' ;
ARRAY_CLOSE : ']' ;
/* Ignora-os... */
SPACETABS : (' ' | '\t' | '\r' | '\n' ) -> skip;
/* Tokens desconhecidos. */
UNKNOWN : . ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment