[antlr-interest] lookahead using multiple lexers is not possible to simulate in ANTLR?

Terence Parr parrt at cs.usfca.edu
Mon Jun 30 11:21:26 PDT 2003


You might be able to use token streams for this.  There is a 
TokenRetryException that you can throw that makes one of the 
TOkenStream objects retry (after perhaps you've switched lexers).  
Loook at the javadoc parsing examples.

Ter

On Saturday, June 28, 2003, at 05:51  AM, Andrei Timisescu wrote:

> I have multiple lexeres and would like to look ahead a token with one 
> lexer, and if it is not the token I expect, try another lexer. 
> Something like this is not possible in ANTLR I see:
>  
> host
>    : {selector->push("hostnameLexer");}  HOSTNAME
>    | {selector->push("ipAddressLexer");}  ADDRESS
>    ;
>  
> ANTLR gets the first token (even if I only look ahead: LA(1)) using 
> current parser and consumes the characteres from the input stream.
>  
> Is it possible to simulate someting like the above in ANTLR?
>  
>  
>  
>  
>  
>  
>
>
>
<image.tiff>
>
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com link sharing, pure-n-simple
Professor Comp. Sci., University of San Francisco




 

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




More information about the antlr-interest mailing list