[antlr-interest] Multiplexed lexers and stream insertion problem

Torkild Ulvøy Resheim torkildr at resheim.no
Fri Oct 29 13:42:37 PDT 2004


I'm doing a project where I have several lexers and parsers, switching between 
these depending on the context. One of these lexers reads a macro definition, 
ignores the content, just storing it into a hashtable. The code can be 
something like this:

#COMMAND macro
  // Something interesting is supposed to happen here
#ENDCOMMAND

So when the main parser sees "macro" it inserts the contents of the macro into 
a new lexer (same class as the main lexer) using a StringReader and treats it 
like any other code. The problem occurs when the lexer is done with the macro 
contents. I'm getting an EOF and can't get back to the original lexer.

Any ideas?
-- 
Med vennlig hilsen / Kind regards                                  ((
Torkild Ulvøy Resheim, Senior Systemutvikler / Software Engineer    ))
Emma EDB AS, Trondheim, Norway. http://www.emmaedb.no             |----|_
Private pages: http://resheim.no - "Any sufficiently advanced     |    | )
bug is indistinguishable from a feature."                         |____|'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20041029/5ce8fa5b/attachment.bin


More information about the antlr-interest mailing list