[antlr-interest] Imaginary tokens warning
G R
relationalalgebra at gmail.com
Fri Oct 19 02:23:54 PDT 2007
Hi,
Creating my grammar, I'm using some imaginary tokens to create nodes for my
AST.
The problem is that i got some warning with my imaginary tokens.
Here's a part of my grammar :
grammar RAGrammar;
...
divide : r1=relation Divide r2=relation
->^(Divide $r1 $r2);
AttributeList:;
RenameList:;
RenameAttribute:;
Project : '\\u03c0';
Select : '\\u03c3';
...
And the warning messages :
warning(208): RAGrammar.g:126:1: The following token definitions are
unreachable: RenameList,RenameAttribute
line 126 is the line defining RenameAttribute.
Trying to have a warning free program, I'v try to define a token section
giving the next grammar :
grammar RAGrammar;
...
divide : r1=relation Divide r2=relation
->^(Divide $r1 $r2);
tokens {
AttributeList;
RenameList;
RenameAttribute;
}
Project : '\\u03c0';
Select : '\\u03c3';
...
This time i got the following errors :
error(100): RAGrammar.g:123:1: syntax error: antlr: RAGrammar.g:123:1:
unexpected token: tokens {
error(100): RAGrammar.g:124:15: syntax error: antlr: RAGrammar.g:124:15:
unexpected token: ;
error(100): RAGrammar.g:125:12: syntax error: antlr: RAGrammar.g:125:12:
unexpected token: ;
error(100): RAGrammar.g:126:17: syntax error: antlr: RAGrammar.g:126:17:
unexpected token: ;
error(106): RAGrammar.g:42:4: reference to undefined rule: divide
error(10): internal error: org.antlr.tool.Message.toString(Message.java:124):
Assertion failed! Message ID 100 created but is not present in errorMsgIDs
or warningMsgIDs.
I'm a bit lost on this one. Could anyone give a hand ?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071019/831cdd79/attachment.html
More information about the antlr-interest
mailing list