[antlr-interest] Abstract tree parser

Terence Parr parrt at cs.usfca.edu
Wed Feb 24 11:38:16 PST 2010


oh, i do:

protected abstract void foo() {}

Ter
On Feb 24, 2010, at 11:36 AM, Christian Pontesegger wrote:

> Terence Parr wrote:
>> You can either define abstract methods within @members and then subclass the parser or you can create a subclass of Parser with the abstract methods or concrete methods then use superClass.
>> 
> Thats what I intend to do, have
> 
> @members {
> 
>    protected abstract void foo();
>    ...
> }
> 
> but then the generated class will have an error due to the missing
> "abstract" modifier in the class definition. Unfortunately the @headers
> section is pasted right before some other imports. If it were the last
> before the class definition I could put my "abstract" modifier there.
> 
> I want to derive from my abstract parser and have several implementing
> parsers with different functionality. Right now I am declaring dummy
> methods within @members and overwrite them in my subclasses. But thats
> not the way java is meant to be, right?
> 
> So if it is not possible to do that now, maybe this is some input for a
> future version of ANTLR.
> 
> Christian
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list