[antlr-interest] end-of-token

=?gb2312?q?=CB=EF=BC=CD=B8=D5=20Jigang=20(Robert)=20Sun?= sunjigang1965 at yahoo.com.cn
Fri Jun 9 14:52:09 PDT 2006


lookahead set to k=2,

IntDenot: ('+'|'-')? (Digit)+;
Sign:'+'|'-';

warning generated:

ANTLR Parser Generator   Version 2.7.6 (2005-12-22)   1989-2005
lex.g: warning:lexical nondeterminism between rules IntDenot and Sign upon
lex.g:     k==1:'+','-'
lex.g:     k==2:<end-of-token>

IntDenot: ('+'|'-')? (Digit)+; should equals to
 
IntDenot: (('+'|'-') (Digit)+) | (Digit)+;

so

IntDenot: (('+'|'-') (Digit)+) | (Digit)+;
Sign:'+'|'-';

should not has any confusion.
if inupt is '+', the second rule should match;  if input "+45" or "45", the first rule should be
invoked.
 
I am not sure what the <end-of-token> char is.

Thank you for your help.

Jigang


__________________________________________________
¸Ï¿ì×¢²áÑÅ»¢³¬´óÈÝÁ¿Ãâ·ÑÓÊÏä?
http://cn.mail.yahoo.com


More information about the antlr-interest mailing list