[antlr-interest] Rewind one token?

Ric Klaren klaren at cs.utwente.nl
Mon Aug 16 01:54:07 PDT 2004


On Mon, Aug 16, 2004 at 09:03:42AM -0400, Ingo Maier wrote:
> Well, my question seemed to be misleading. I don't want to know where
> mark/rewind is used (a call hierarchy check tells me that, I use eclipse
> :)). I want to know, if there is a possibility to
> rewind/backtrack/whatever an already read token? 
> 
> I use two lexers on the same stream with a multiplexer. First lexer
> starts. When it passes a specific token (sequence) to the parser, lexers
> will be switched. But the tokens already read by the first lexer and
> indicating the switch will be needed by the second one.
> 
> Any ideas how to do that?

Call mark at the start of the switch sequence then switch to the other
lexer and rewind directly at the start of the second lexer (e.g. pass the
mark id and call rewind in the init action of the startrule)?

I'm not sure wether you do but.. it sounds like you switch lexers from the
parser. In general this does not work (especially if there's some
predicates in the parser (mark/rewind again)) (just checking)

Cheers,

Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893755  ----
-----+++++*****************************************************+++++++++-------
  Xander: "Buffy, we need to do something *now*"
  Angel: "We need a distraction."
  Buffy: "Right."
  Angel: "What are you going to do?"
  Buffy: "I'm going to kill them all. That oughtta distract 'em..."



 
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