[antlr-interest] How do I use a custom token object?
Tom MacEllen
tt.slot at mail.ru
Thu Jul 24 07:42:36 PDT 2008
Hi Johannes,
thank you for your answer. I just tried what you suggested.
Unfortunately "INT.x" doesn't work.
I looked at the generated source code and found out that the variable(s) which are named after the rule-names are public final integers.
So the expression "INT.x" results in an compiler error: "int cannot be dereferenced".
Tom
> > Is there a way to alter this value from the action in the grammar.
> > Something like:
> > ID : 'a'..'z'+ {/* set the integer x from here */};
> > INT : '0'..'9'+ {/* and here */};
> >
> > I am just curious if that is possible?
>
> Doesn't ID.x or INT.x work?
>
> Johannes
More information about the antlr-interest
mailing list