[antlr-interest] A question about Tokens

Terence Parr parrt at jguru.com
Tue Jul 2 20:23:27 PDT 2002

On Tuesday, July 2, 2002, at 01:04  PM, johnclarke72 wrote:

> In my Lexer I create a token using my own custom Token Class.  This
> class has some custom methods in it (eg getAttributes - returns a
> Hashtable).  However I don't know how to access these methods from my
> parser.
> How can I access methods from a custom Token Class in my parser ?

label a token reference and then probably have to cast it to your token 
object then just access like normal method call.

rule : label:A {((MyToken)label).myMethod();} ;

Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list