[antlr-interest] warning: The following token definitions areunreachable: PLUS

Lloyd Dupont ld at galador.net
Wed Jul 11 05:15:15 PDT 2007


Messagemmhh.. obviously I have to read the explanation about this tokens section.
mmhh.. the book is so BIG, and I'm so keen to finish quickly!!
  ----- Original Message ----- 
  From: Micheal J 
  To: antlr-interest at antlr.org 
  Sent: Wednesday, July 11, 2007 10:07 PM
  Subject: Re: [antlr-interest] warning: The following token definitions areunreachable: PLUS


  Tokens defined in "tokens{...}" block take precedence.

  To fix, use:

  tokens
  {
      UNARY_PLUS;
  }

  Then assign UNARY_PLUS as appropriate in your parser (i.e. as an AST token type - your lexer only ever returns PLUS tokens). See sample grammars like KCSParse (for v2.7+) or perhaps Java (I haven't look at this in a while) to see how they handle this.

  Micheal
  -----------------------
  The best way to contact me is via the list/forum. My time is very limited. 

    -----Original Message-----
    From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Lloyd Dupont
    Sent: 11 July 2007 13:04
    To: antlr-interest at antlr.org
    Subject: [antlr-interest] warning: The following token definitions areunreachable: PLUS


    it all comes down to the fact I put this in the tokens declaration:

    tokens
    {
     UNARY_PLUS='+';
    }

    this made
    PLUS: '+' ;
    unreachable.

    I'm a bit puzzled with this imaganiry tokens.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070711/647f4d53/attachment.html 


More information about the antlr-interest mailing list