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