[antlr-interest] how to access rule attributes in a tree grammar in release 3.1
Johannes Luber
jaluber at gmx.de
Fri Aug 8 03:26:32 PDT 2008
Gerard van de Glind schrieb:
> Hey hello,
>
> I updated to the ANTLR 3.1b2 release to try it out for the upcoming 3.1
> release. Btw when will 3.1 be released, is that already known?
>
> It seems that quite a lot has changed since the 3.0 release. Also, I get
> a lot of errors now when I generate Java code from my grammar.
>
> In the Changes.txt I read the following:
>
> match() returns Object matched now (parser, tree parser) so we can set
> labels on token refs properly after single token ins/del error recovery.
>
> And a close examination of the generated Java code reveals that many
> things have now become a direct instance of class Object.
>
> However, this causes problems if I want to access the predefined ANTLR
> attributes (see 6.4 of the Definitive ANTLR Reference).
>
> Is there a new notation to access these?
>
> Thanks a lot!
>
> Regards, Gerard
Can't you simply downcast the Object to the correct type?
Johannes
More information about the antlr-interest
mailing list