[antlr-interest] Token class in lexer - lexical nondeterminism error

Jiho Han jhan at InfinityInfo.com
Tue Jul 25 06:15:56 PDT 2006


I am new to ANTLR.
I have the following defined in my lexer.

OP_EQ		: '=' ;
OP_NEQ	: "<>" ;
OP_GT		: '>' ;
OP_LT		: '<' ;
OP_GE		: ">=" ;
OP_LE		: "<=" ;
LPAREN	: '(' ;
RPAREN	: ')' ;
OPERATOR	: (OP_EQ | OP_NEQ | OP_GT | OP_LT | OP_GE | OP_LE) ;

When I run it through antlr I get:

FilterExpression.g: warning:lexical nondeterminism between rules OP_EQ
and OPERATOR upon
FilterExpression.g:     k==1:'='
FilterExpression.g:     k==2:<end-of-token>

And bunch of others like it.

I tried to create OPERATOR as a token class as mentioned in the antlr
documentation in the section titled, Meta Language.

So that I can do this in the parser:

expr: ID OPERATOR^ VALUELITERAL ;

Instead of,

expr: ID (OP_EQ | OP_NEQ | OP_GT | OP_LT | OP_GE | OP_LE) VALUELITERAL ;

What am I missing?
Thanks

Jiho Han
Senior Software Engineer
Infinity Info Systems
The Sales Technology Experts
Tel: 212.563.4400 x216
Fax: 212.760.0540
jhan at infinityinfo.com
www.infinityinfo.com <http://www.infinityinfo.com/> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060725/19e01a82/attachment-0001.html


More information about the antlr-interest mailing list