1grammar t013parser; 2options { 3 language = Python3; 4} 5 6@parser::init { 7self.identifiers = [] 8self.reportedErrors = [] 9} 10 11@parser::members { 12def foundIdentifier(self, name): 13 self.identifiers.append(name) 14 15def emitErrorMessage(self, msg): 16 self.reportedErrors.append(msg) 17} 18 19document: 20 t=IDENTIFIER {self.foundIdentifier($t.text)} 21 ; 22 23IDENTIFIER: ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*; 24