[antlr-interest] saving the token stream

Rodrigo B. de Oliveira rodrigobamboo at acm.org
Mon Aug 18 05:20:16 PDT 2003


I have achieved something similar with a custom TokenStream implementation
that just records the token it receives for later playback (a
TokenStreamRecorder).

The playback is done with a TokenStreamSelector.push(recorder). When the
TokenStreamRecorder runs out of tokens it just pops
(TokenStreamSelector.pop) to the previous lexer/parser.

I'm gonna post the entire sample to the antlr website later today but I can
email it to you privately if you want. It's C# based but you should have no
problems converting it to java.

Regards,
Rodrigo


----- Original Message ----- 
From: "marcschellens" <m_schellens at hotmail.com>
To: <antlr-interest at yahoogroups.com>
Sent: Monday, August 18, 2003 5:43 AM
Subject: [antlr-interest] saving the token stream


> I have a string which is parsed, but in some cases the
> last few parsed 'commands' (within the string) must be repeated.
> Is there a simple way to save the token stream for this purpose.
> Of course I could write a tree parser, but for this relatively simple
> issue, I would prefer to reuse the token stream and do all necessary
> actions in the parser.
> Thanks,
> marc
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


 

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




More information about the antlr-interest mailing list