[antlr-interest] How do I use a custom token obj ect?

Gavin Lambert antlr at mirality.co.nz
Thu Jul 24 14:44:01 PDT 2008


At 02:42 25/07/2008, Tom MacEllen wrote:
 >thank you for your answer. I just tried what you suggested.
 >Unfortunately "INT.x" doesn't work.

Try $INT.x.  Or assign it a label (eg. 'a=INT') and use $a.x.

Also have a look at scopes.  Note though that you cannot pass 
additional information this way between lexer and parser (unless 
you create a custom token type, or use the additional data fields 
built into the C runtime's token); only between rules in the same 
recogniser.



More information about the antlr-interest mailing list