[antlr-interest] Overriding default constructor generation in Java
Johannes Luber
jaluber at gmx.de
Fri May 2 13:35:23 PDT 2008
Bill Andersen schrieb:
> Folks,
>
> I have a ANTLR 3 tree grammar where I use the superClass option to
> provide a class that handles some semantic bookkeeping chores. Thing I
> added an extra argument to the constructors inherited from TreeParser.
> When ANTLR generates the Java for the grammar everything is fine except
> that the default constructors for the generated parser class are still
> there with no super class that can catch their argument signatures.
>
> Is there a way to modify this behavior? I can supply my own
> constructors in the members section and delete the generated ones from
> the java source but that's a step I'd rather avoid.
There are only two ways. The first is to change the template files
yourselves, but you have to update them manually. The second is still to
provide the additional construcotrs and throw an exception when someone
wants to use them.
Johannes
More information about the antlr-interest
mailing list