xref: /aosp_15_r20/external/antlr/runtime/Python/tests/t030specialStates.g (revision 16467b971bd3e2009fad32dd79016f2c7e421deb)
1grammar t030specialStates;
2options {
3  language = Python;
4}
5
6@init {
7self.cond = True
8}
9
10@members {
11def recover(self, input, re):
12    # no error recovery yet, just crash!
13    raise re
14}
15
16r
17    : ( {self.cond}? NAME
18        | {not self.cond}? NAME WS+ NAME
19        )
20        ( WS+ NAME )?
21        EOF
22    ;
23
24NAME: ('a'..'z') ('a'..'z' | '0'..'9')+;
25NUMBER: ('0'..'9')+;
26WS: ' '+;
27