• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1grammar t014parser;
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@parser::init {
20self.events = []
21self.reportedErrors = []
22}
23
24@parser::members {
25def emitErrorMessage(self, msg):
26    self.reportedErrors.append(msg)
27}
28
29
30document:
31        ( declaration
32        | call
33        )*
34        EOF
35    ;
36
37declaration:
38        'var' t=IDENTIFIER ';'
39        {self.events.append(('decl', $t.text))}
40    ;
41
42call:
43        t=IDENTIFIER '(' ')' ';'
44        {self.events.append(('call', $t.text))}
45    ;
46
47IDENTIFIER: ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*;
48WS:  (' '|'\r'|'\t'|'\n') {$channel=HIDDEN;};
49