[antlr-interest] overriding BaseRecognizer methods for lexer, parser and tree parser

Mark Volkmann r.mark.volkmann at gmail.com
Fri Dec 21 06:33:54 PST 2007


I'd like to override the displayRecognitionError method for all three
of my generated parser classes, the lexer, the token parser and the
tree parser. It seems that the only way to do this is to repeat my new
version of that method three times in my grammar files. Is there a
better way? My first thought was to create my own subclass of
BaseRecognizer and then tell ANTLR to use that instead of
BaseRecognizer as the superclass of Lexer, Parser and TreeParser which
are the superclasses of the generated classes. Of course that doesn't
make sense because Java can't just switch the superclass of classes
that aren't generated.

-- 
R. Mark Volkmann
Object Computing, Inc.


More information about the antlr-interest mailing list