[antlr-interest] ANTLR 3: relax this error for the java taget: 'label conflicts with rule with same name'
Francis ANDRE
francis.andre.kampbell at orange.fr
Thu Aug 14 09:19:03 PDT 2008
Hi
One gets this error message Cobol.g:4:44 label subscript conflicts with
rule with same name
on the following snippet
grammar Cobol;
tokens { DOT='DOT'; SECTION='SECTION'; IDENT='I'; }
debut : subscripts ;
subscripts returns[Object[\] indexes] : LP subscript = subscript (COMMA
subscript = subscript)* RP ;
subscript returns [Object index] : IDENT | NUMBER ;
NUMBER : '0'..'9'+;
LP : '(';
RP : ')';
COMMA : ',';
Since one can write this valid Java code
class Foo {
static Foo foo = foo();
static Foo foo() {
return new Foo();
}
}
I am proposing to relax this error message for Java and keep it for all
languages that do not allow this construct as C, C++...
Cheers
FA
More information about the antlr-interest
mailing list