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.
40 lines
547 B
40 lines
547 B
7 months ago
|
grammar t030specialStates;
|
||
|
options {
|
||
|
language =Cpp;
|
||
|
}
|
||
|
|
||
|
@lexer::includes
|
||
|
{
|
||
|
#include "UserTestTraits.hpp"
|
||
|
}
|
||
|
@lexer::namespace
|
||
|
{ Antlr3Test }
|
||
|
|
||
|
@parser::includes {
|
||
|
#include "UserTestTraits.hpp"
|
||
|
}
|
||
|
@parser::namespace
|
||
|
{ Antlr3Test }
|
||
|
|
||
|
@init {
|
||
|
self.cond = True
|
||
|
}
|
||
|
|
||
|
@members {
|
||
|
def recover(self, input, re):
|
||
|
# no error recovery yet, just crash!
|
||
|
raise re
|
||
|
}
|
||
|
|
||
|
r
|
||
|
: ( {self.cond}? NAME
|
||
|
| {not self.cond}? NAME WS+ NAME
|
||
|
)
|
||
|
( WS+ NAME )?
|
||
|
EOF
|
||
|
;
|
||
|
|
||
|
NAME: ('a'..'z') ('a'..'z' | '0'..'9')+;
|
||
|
NUMBER: ('0'..'9')+;
|
||
|
WS: ' '+;
|