• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1grammar t030specialStates;
2options {
3  language =Cpp;
4}
5
6@lexer::includes
7{
8#include "UserTestTraits.hpp"
9}
10@lexer::namespace
11{ Antlr3Test }
12
13@parser::includes {
14#include "UserTestTraits.hpp"
15}
16@parser::namespace
17{ Antlr3Test }
18
19@init {
20self.cond = True
21}
22
23@members {
24def recover(self, input, re):
25    # no error recovery yet, just crash!
26    raise re
27}
28
29r
30    : ( {self.cond}? NAME
31        | {not self.cond}? NAME WS+ NAME
32        )
33        ( WS+ NAME )?
34        EOF
35    ;
36
37NAME: ('a'..'z') ('a'..'z' | '0'..'9')+;
38NUMBER: ('0'..'9')+;
39WS: ' '+;
40