• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1grammar t014parser;
2options {
3  language = Python;
4}
5
6@parser::init {
7self.events = []
8self.reportedErrors = []
9}
10
11@parser::members {
12def emitErrorMessage(self, msg):
13    self.reportedErrors.append(msg)
14}
15
16
17document:
18        ( declaration
19        | call
20        )*
21        EOF
22    ;
23
24declaration:
25        'var' t=IDENTIFIER ';'
26        {self.events.append(('decl', $t.text))}
27    ;
28
29call:
30        t=IDENTIFIER '(' ')' ';'
31        {self.events.append(('call', $t.text))}
32    ;
33
34IDENTIFIER: ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*;
35WS:  (' '|'\r'|'\t'|'\n') {$channel=HIDDEN;};
36