[antlr-interest] AntLR bug?

Michael Labhard ince at pacifier.com
Sat Feb 2 19:18:55 PST 2002


All:
	This is a follow up on my last message.

	In the following lexer AntLR (2.7.1) complains that there is a 
nondeterminism between a NAME_TOKEN and an END_TOKEN.  

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

NAME_TOKEN
  : GRAPHIC_TOKEN
  ;

protected GRAPHIC_TOKEN
  : 
    ( '.' (GRAPHIC_TOKEN_CHAR|'.')+ )
    | 
    ( GRAPHIC_TOKEN_CHAR (GRAPHIC_TOKEN_CHAR|'.')* )
  ;

protected GRAPHIC_TOKEN_CHAR
  : GRAPHIC_CHAR | BACKSLASH_CHAR;

protected GRAPHIC_CHAR
  : ('#'|'$'|'&'|'*'|'+'|'/'
    |':'|'<'|'='|'>'|'?'|'@'|'^'|'~');

END_TOKEN: END_CHAR;

protected END_CHAR: '.';
protected BACKSLASH_CHAR:'\\';



	Modifying the GRAPHIC_TOKEN in either of the two following ways eliminatees 
the complaint:

protected GRAPHIC_TOKEN
  : 
    ( GRAPHIC_TOKEN_CHAR (GRAPHIC_TOKEN_CHAR|'.')* )
  ;

protected GRAPHIC_TOKEN
  : 
    ( '.' (GRAPHIC_TOKEN_CHAR|'.')+ )
  ;

	This looks like a bug since these are "ored" alternatives and each is 
individually acceptable.  Any advice?

-- Michael

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list