[antlr-interest] lexical nondeterminism

Matthew Ford Matthew.Ford at forward.com.au
Tue Nov 20 20:23:59 PST 2001


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 fatdog.com>
To: <antlr-interest at yahoogroups.com>
Sent: Wednesday, November 21, 2001 2:52 PM
Subject: [antlr-interest] lexical nondeterminism


> 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