[antlr-interest] A question regarding Token Stream Multiplexing (aka "Lexer states")

johnclarke72 johnclarke at hotmail.com
Sun May 5 17:11:36 PDT 2002

Is there a very simple example that demonstrates how to change lexer 
states in the lexer when parsing ?  

For example I have one lexer that processes text but if it sees <!-- 
or </ or < it should go to the one that processes tags.  In my code I 
have put : 

HTMLCOMMENT : "<!" {selector.select("HTMLTagLexer");};

Unfortunately when I enter a valid HTML comment(For example <!-- 
Hello -->) I get the following error message :

line 1: unexpected token: <!
exception: antlr.TokenStreamRecognitionException: unexpected char: -

What is causing this and how can I solve it ?

I would appreciate all advice offered.

Thanks in advance



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

More information about the antlr-interest mailing list