I have a problem with the @members rule in ANTLR. I want to overwrite the default error handling, so I read http://www.antlr.org/wiki/display/ANTLR3/Error+reporting+and+recovery and write this simple code for my grammar:
@members {
def displayRecognitionError(self, tokenNames, e):
print 'Test'
}
I have no @lexer :: members or @parser :: members for my grammar. The code (python runtime) from this rule is included only in the analyzer file, and not in lexer. This is mistake? I think that @members should add content for both lexer and parser according to the documentation. I am using Python runtime, 3.1.3.
Btw. Does stackoverflow inline code work for Opera?
Galmi source
share