Loading ...
Sorry, an error occurred while loading the content.

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

Expand Messages
  • Terence Parr
    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
    Message 1 of 2 , Jun 30, 2003
    • 0 Attachment
      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 message has been successfully submitted and would be delivered to recipients shortly.