[antlr-interest] Lexical nondeterminism
Sohail Somani
sohail at taggedtype.net
Sat Oct 1 22:52:34 PDT 2005
Given this simple lexer:
class L extends Lexer;
options
{
testLiterals = true;
k=2;
caseSensitive=true;
caseSensitiveLiterals=true;
}
SOME_KEYWORD
: "if"
;
protected
LETTER
: 'a'..'z' | 'A'..'Z'
;
protected
DIGIT
: '0'..'9'
;
IDENTIFIER
: LETTER (LETTER | DIGIT)*
;
antlr 2.7.6 tells me:
test.g: warning:lexical nondeterminism between rules SOME_KEYWORD and
IDENTIFIER upon
test.g: k==1:'i'
test.g: k==2:'f'
Why is this? I thought testLiterals is supposed to get antlr to compare
matched tokens to my literals?
Thanks
Sohail
More information about the antlr-interest
mailing list