[antlr-interest] literals in 2.7.6

Omry Yadan omry at yadan.net
Thu Feb 8 06:57:17 PST 2007


Here is a simple example that demonstrate my problem:

class TestLexter extends Lexer;
protected CHAR : ('a'..'z' | 'A'..'Z');
RESERVED     : "foo";
SYMBOL  : CHAR (CHAR)* ;



Lets say foo is a reserved keywork and that SYMBOL can be any sequence 
of chars.
obviously SYMBOL also matches "foo", so I get the following warning:

lexical nondeterminism between rules RESERVED and SYMBOL upon k==1:'f'

Increasing the k value (even to 4) does not help here.

any suggestion how to work around this warning?
I believe it has something to do with the 
http://www.antlr.org/doc/lexer.html#Keywords_and_literals section in the 
doc, but I didn't understand how to solve it from what's written there.


More information about the antlr-interest mailing list