Hi!
Can somebody please help me finding out why antlr complains about this
grammar?
list : key (WHITESPACE)+ value ((WHITESPACE)+ key (WHITESPACE)+
value)* ;
value : integer | LEFTBRACKET (WHITESPACE)* list (WHITESPACE)*
RIGHTBRACKET;
key : LETTER (LETTER|DIGIT)*;
integer : (DIGIT)+;
The lexer-specification is straightforward:
WHITESPACE : (' ' | '\t' | '\r' '\n' | '\n');
LETTER : ('a'..'z'|'A'..'Z');
DIGIT : '0'..'9';
LEFTBRACKET : '[';
RIGHTBRACKET : ']';
And this is the error message:
gml2.g:4: warning:nondeterminism upon
gml2.g:4: k==1:WHITESPACE
gml2.g:4: k==2:WHITESPACE
gml2.g:4: k==3:WHITESPACE,LETTER
gml2.g:4: k==4:WHITESPACE,LETTER,DIGIT
gml2.g:4: k==5:WHITESPACE,LEFTBRACKET,RIGHTBRACKET,LETTER,DIGIT
gml2.g:4: between alt 1 and exit branch of block
It disappears when I delete the second (WHITESPACE)* in the value
rule. But that is not an option because the files which should be
parsed may be formatted with whitespace chars.
I am really stuck with this.
Thank you very much in advance
Olaf