[antlr-interest] AntLR bug?

Terence Parr parrt at jguru.com
Sun Feb 3 10:07:25 PST 2002


Can you post the warning?

Thanks,
Ter
PS	I suspect it might be a linear approximate lookahead issue.

On Saturday, February 2, 2002, at 07:18  PM, Michael Labhard wrote:

> 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/
>
>
--
Chief Scientist & Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org


 

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



More information about the antlr-interest mailing list