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
424 B
24 lines
424 B
grammar t013parser;
|
|
options {
|
|
language = Python;
|
|
}
|
|
|
|
@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'|'_')*;
|