[antlr-interest] Popping a lexer upon EOF

Ric Klaren klaren at cs.utwente.nl
Thu Mar 11 02:46:54 PST 2004


On Wed, Mar 10, 2004 at 05:04:02AM -0000, Paul J. Lucas wrote:
> According to the FAQ, "How do I handle #include files or other nested
> input streams?", it says in part:
> 
> When you see an #include, create a new lexer just like you've been doing
> (no parser), and then notify the TokenStreamSelector (push state and point
> at new lexer). At the close of the included stream, tell the selector to
> pop it's state.
> 
> The question is: how do you catch "the close of the included stream" in
> order to pop it's state?

Override uponEOF() ? I'm not 100% sure if it's the best thing to do since
it behaves sometimes a bit fuzzy (it may get called multiple times after
seeing EOF (depeding on tracing/guessing) so you might have to put a guard
in it)

Cheers,

Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
   Words fly like arrows
      as if we knew what was right and wrong. --- Chuang Tsu



 
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