[antlr-interest] Re: lexical nondeterminism Or rule contain rule
idontwantanidwith2000init
idontwantanidwith2000init at yahoo.com
Fri Apr 9 01:36:57 PDT 2004
--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...>
wrote:
>
> On Apr 8, 2004, at 4:30 AM, idontwantanidwith2000init wrote:
>
> > Hi,
> > I have one lexical rule that contains another.
> > STRING: ( 'a'..'z'|'A'..'Z' )+
> > ;
> >
> > STRING_LITERAL
> > : '"'!
> > ( '\\' .
> > | ~('"'|'\n'|'\r')
> > )*
> > ( '"'!
> > | // nothing -- write error message
> > )
> > ;
> >
> > I'm using eclipse.
> > It's warning me that I have nondeterminism but I'm not using
> > STRING_LITERAL and STRING in the same parser rule.
> > What can I do to avoid this nondeterminism?
>
> Hi. Both are considered valid tokens and hence nextToken has them
as
> alternatives. Use protected keyword on one of the rules.
>
> Terence
> --
> Professor Comp. Sci., University of San Francisco
> Creator, ANTLR Parser Generator, http://www.antlr.org
> Cofounder, http://www.jguru.com
> Cofounder, http://www.knowspam.net enjoy email again!
> Cofounder, http://www.peerscope.com pure link sharing
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list