Sam Barnett-Cormack schrieb:
> Patrick Schönbach wrote:
>
>> On 16.04.2009 17:29, Sam Barnett-Cormack wrote:
>>
>>> Why do you want the parse methods to be non-final? You can subclass
>>> the lexer/parser as long as the *class* isn't final. You just can't
>>> override the final methods, and it's probably not a great idea to be
>>> overriding the actual parse methods themselves.
>>>
>> For example, think of a parser that adds location info.
>>
>
> What do you mean by "location info"?
>
> Sam
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
In the past I would have liked the same, but.... As a workaround you
could add for each parser method an @init and @after which calls some
custom added methods (in the @members section) which are non-final, have
some default behavior and can be overriden in a subclass of a parser. I
think this is the closest you can get to "overriden parser methods"
out-of-the-box. And also some action methods.
I.e. with Java-target
@members {
public void fooInit() { }
public void fooAfter() { }
public void fooBAR() { }
}
foo
@init {
fooInit();
}
@after {
fooAfter();
}
:
BAR { fooBAR(); }
;
--
Paul Bouché
Voice: +49 30 590080-1284
Nokia Siemens Networks GmbH & Co. KG, An den Treptowers 1, 12435 Berlin, Germany
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRA 88537
WEEE-Reg.-Nr.: DE 52984304
Persönlich haftende Gesellschafterin / General Partner: Nokia Siemens Networks
Management GmbH
Geschäftsleitung / Board of Directors: Lydia Sommer, Olaf Horsthemke
Vorsitzender des Aufsichtsrats / Chairman of supervisory board: Lauri Kivinen
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRB 163416
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address