[antlr-interest] Re: lexical nondeterminism
howardk at fatdog.com
howardk at fatdog.com
Wed Nov 21 10:17:21 PST 2001
Matthew, that's brilliant. Thanks. It's obvious when you see it!
Howard
--- "Matthew Ford" <Matthew.Ford at f...> wrote:
> I think it is
> > QName: (NCName COLON)? NCName;
> Antlr does not know which NCName to choose
>
> try
> QName: NCName (COLON NCName)?;
>
> now COLON tell antlr to continue looking
>
> matthew
> ----- Original Message -----
> From: <howardk at f...>
>
> > Sigh, I hate to bother people with this one. I thought I'd gotten
> > reasonably ok at working out nondeterminism problems, but I can't
see
> > why the following (slightly simplified) lexical grammar isn't
> > working. antlr is complaining about the production QName.
Lookahead
> > is k=2.
> >
> > QName: (NCName COLON)? NCName;
> >
> > protected
> > NCName: ( Letter | '_' ) (NCNameChar)*;
> >
> > protected
> > NCNameChar: Letter | Digit | DOT | '-' | '_';
> >
> > protected
> > Letter: 'A' .. 'Z';
> >
> > Here's the message I get:
> >
> > warning: lexical nondeterminism upon
> > k==1: 'A' .. 'Z', '_'
> > k==2: '-','.','0'..'9','A'..'Z','_'
> > between alts 1 and 2 of block
> >
> > I know this isn't hard, but I'm going blind (and I'm not even
doing
> > THAT!) Any help much appreciated,
> >
> > Howard
> >
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list