You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
425 B

grammar t013parser;
options {
language = Python3;
}
@parser::init {
self.identifiers = []
self.reportedErrors = []
}
@parser::members {
def foundIdentifier(self, name):
self.identifiers.append(name)
def emitErrorMessage(self, msg):
self.reportedErrors.append(msg)
}
document:
t=IDENTIFIER {self.foundIdentifier($t.text)}
;
IDENTIFIER: ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*;