[antlr-interest] antlr 2.7.6: newbie question - getting the
lastmatched token
Loring Craymer
lgcraymer at yahoo.com
Tue Aug 8 12:44:16 PDT 2006
Use LT(1) before the match.
--Loring
Costa Basil <costa_basil at yahoo.ca> wrote: There's got to be an easier way. Would LT(0) work?
Micheal J <open.zone at virgin.net> wrote: Message Declare as a subrule and lebel the reference to the subrule. It has a cost of at least an extra method call but, it does what you want right?
Micheal
-----------------------
The best way to contact me is via the list/forum. My time is very limited.
-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Costa Basil
Sent: 08 August 2006 08:48
To: antlr-interest at antlr.org
Subject: [antlr-interest] antlr 2.7.6: newbie question - getting the lastmatched token
How can I get the last matched token? I have the following case:
(T1 | T2 ... | Tn) { action }
where Ti are terminals. In my action I want to get the token that was matched and I don't want to declare labels to each of the tokens because it is too cumbersome. Also for whatever reason, antlr doesn't let me use identical labels for each alternative.
Thanks
---------------------------------
Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060808/6e4e7833/attachment.html
More information about the antlr-interest
mailing list