[antlr-interest] multiple lexer

hst_12345 hst_12345 at yahoo.com
Fri Nov 5 18:21:02 PST 2004




I am wokring on a project to parse expressions which is part of the 
doc.  So I wrote a seperate parser for the expression. And use 
multiple lexer. The problem I have is that when switch back, one 
token is eaten from the expression parser. Here is my doc syntax:
main parser:

EXP { '1.2+3.5' T;  '3.6+6.8' H;}
So the main parser rule:
expression:
     EXP LCURLY 
     ( SINGLE_QUOTE {
           _selector.select("expressionLex");
           expressionParser.Parse();
           _selector.select("mainLex");
           }
       SINGLE_QUOTE character
      )+
      ;
The problem is when switch back, it complains to look for SINGLE_QUOTE 
but get T which is next token. I do print out the expression which is 
OK that does not include the single quote. So I do not know where 
the single quote. why when it gets back to main parser and the single 
quote went away.

Please help me out. I do not know what I can do.

Thanks









 
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