[antlr-interest] AntLR bug warning
Terence Parr
parrt at jguru.com
Sun Feb 3 21:16:52 PST 2002
On Sunday, February 3, 2002, at 03:58 AM, Michael Labhard wrote:
> As requested here is exactly what the warning is:
>
> 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>
Ok, it's a problem of lookahead.
protected GRAPHIC_TOKEN
:
( '.' (GRAPHIC_TOKEN_CHAR|'.')+ )
|
( GRAPHIC_TOKEN_CHAR (GRAPHIC_TOKEN_CHAR|'.')* )
;
can match '.' followed by something or a single char followed by
nothing...when these lookaheads are combined it appears that '.' <end>
is valid for this rule which it isn't.
Search the faq for info on linear approx lookahead.
Ter
PS You might consider merging the rules to fix this.
--
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