[antlr-interest] Should the lex warning be ignored?

=?gb2312?q?=CB=EF=BC=CD=B8=D5=20Jigang=20(Robert)=20Sun?= sunjigang1965 at yahoo.com.cn
Tue Jul 11 16:26:22 PDT 2006


The following lexer rules IntDenot and FunnyId are obviously distinguishable, but warning still be
given:

options {
    language  = "CSharp";
    namespace = "Clean"; 
}

class Lex extends Lexer;
options { 
            k=2;            
        }                

IntDenot: (Sign)? (Digit)+;
FunnyId: ('@'|Sign)+;

protected Digit: '0'..'9';
protected Sign: '+'|'-'|'~';


lex.g: warning:lexical nondeterminism between rules IntDenot and FunnyId upon
lex.g:     k==1:'+','-','~'
lex.g:     k==2:<end-of-token>

I know there are maybe input like "9", of which the length is less than 2, but it is still could
be distinguished with FunnyIds like "@", "+" and "+-". Should I ignore the warning?

Thanks.

Jigang




		
___________________________________________________________ 
ÇÀ×¢ÑÅ»¢Ãâ·ÑÓÊÏä-3.5GÈÝÁ¿£¬20M¸½¼þ£¡ 
http://cn.mail.yahoo.com


More information about the antlr-interest mailing list