[antlr-interest] AntLR Bug

Michael Labhard ince at pacifier.com
Mon Feb 4 16:33:44 PST 2002


This is the simplified example that fails to work with AntLR.  I don't see 
any additional opportunity for left-factoring here.

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

NAME_TOKEN
  : GRAPHIC_TOKEN
  ;

END_TOKEN
    : 
    END_CHAR 
    ( options {greedy=true;} :
     GRAPHIC_TOKEN_CHAR {setType(GRAPHIC_TOKEN);}
    )+
    ;

protected GRAPHIC_TOKEN
  : 
    ( options {greedy=true;} :
    END_CHAR ( GRAPHIC_TOKEN_CHAR )+
    )
  ;

protected GRAPHIC_TOKEN_CHAR
  : GRAPHIC_CHAR
  ;

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

protected END_CHAR: 
    '.' 
    ;

RESULTS:

ANTLR Parser Generator   Version 2.7.1   1989-2000 jGuru.com
warning: lexical nondeterminism between rules NAME_TOKEN and END_TOKEN upon
TermParser2.g:0: 	k==1:'.'
TermParser2.g:0: 	
k==2:<end-of-token>,'#','$','&','*','+','/',':','<'..'@','^','~'
TermParser2.g:19: warning: lexical nondeterminism upon
TermParser2.g:19: 	k==1:<end-of-token>
TermParser2.g:19: 	k==2:<end-of-token>
TermParser2.g:19: 	between alt 1 and exit branch of block



 

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



More information about the antlr-interest mailing list