You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
423 B
37 lines
423 B
7 months ago
|
grammar StringTemplateOutput;
|
||
|
|
||
|
options {
|
||
|
language=CSharp3;
|
||
|
TokenLabelType=CommonToken;
|
||
|
output=template;
|
||
|
}
|
||
|
|
||
|
@lexer::namespace{Antlr3.Runtime.Test}
|
||
|
@parser::namespace{Antlr3.Runtime.Test}
|
||
|
|
||
|
/*
|
||
|
* Parser Rules
|
||
|
*/
|
||
|
|
||
|
public
|
||
|
compileUnit
|
||
|
: ID integer EOF
|
||
|
-> new(id={$ID.text}, value={$integer.st})
|
||
|
;
|
||
|
|
||
|
integer
|
||
|
: i='int' -> {%{$i.text}}
|
||
|
;
|
||
|
|
||
|
/*
|
||
|
* Lexer Rules
|
||
|
*/
|
||
|
|
||
|
ID
|
||
|
: 'a'..'z'*
|
||
|
;
|
||
|
|
||
|
WS
|
||
|
: ' '
|
||
|
;
|