[antlr-interest] putting an Object into a token

Terence Parr parrt at cs.usfca.edu
Wed Jan 21 13:43:51 PST 2004


Hi :)

You can derive a new class with your required fields and then tell 
antlr to create tokens of that type. :)  It's setTokenClass or some 
such method on the lexer/parser.

Ter
On Wednesday, January 21, 2004, at 10:44 AM, William Lam wrote:

> Hi all,
>
> I have a lexer rule that lexes a complicated token, and I would like
> to process it, and put the results into an arbitrary Object and then
> pass the object to the parser rule that uses the token.  Protected
> lexer rules can return something, but public ones can not.
>
> How can I do this?  The antlr.Token class does not have a #setObject
> (Object) method.  And I do not want to use a static Object in the
> Lexer/Parser.
>
>
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
>  http://groups.yahoo.com/group/antlr-interest/
>
> To unsubscribe from this group, send an email to:
>  antlr-interest-unsubscribe at yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
>  http://docs.yahoo.com/info/terms/
>
>
>
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com pure link sharing




 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

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




More information about the antlr-interest mailing list