[antlr-interest] Inheritance problem
bob.temp at gmail.com
Mon Apr 4 13:38:20 PDT 2005
I'm having a problem with the inheritance in ANTLR. I am working on a
series of parsers that are based off one another. In order to
implement some additional features, I created a subclass of
antlr.LLkParser that my first parser extends. The next parser must
also extend my subclass, but also inherit all of the grammar from the
first parser. So my setup basically looks like this:
public abstract class GenericParser extends antlr.LLkParser ...
class Parser1 extends Parser( "com.myparser.GenericParser" );
class Parser2 extends Parser1( "com.myparser.GenericParser" );
Parser1 works fine, but the expandedParser2.g file that's generated is
wrong. The parser definition line looks like this:
class Parser2 extends ( "com.embarcadero.sqlparsers.GenericParser" );
Of course, I get an error because that's not valid syntax. If I try to
leave the ("com...") stuff off in parser2.g, then it's base class is
just antlr.LLkParser, which is wrong.
How do I accomplish this?
More information about the antlr-interest