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

Micheal J open.zone at virgin.net
Wed Jul 11 05:07:32 PDT 2007


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/48679e43/attachment.html 


More information about the antlr-interest mailing list