[antlr-interest] Error I can't get my head around at all...

Andreas Meyer andreas.meyer at smartshift.de
Tue Mar 3 03:25:24 PST 2009


Just a guess: did you use ANTLRworks? If not, it is indeed quite hard to 
see the cause.

Andreas

Sam Barnett-Cormack schrieb:
> Hi all,
>
> I've wracked my brains on this one, and really can't see what's going on.
>
> I've got one error in my grammar, and I just can't see how it's come 
> about. I've been listening to everything people have said, I've been 
> trying to apply what I've learned, most notably drilling into rules 
> and expanding out to see why it says a choice is unreachable, but it 
> doesn't make sense.
>
> The rule with the error is on line 300:
>
> globalModuleReference : modulereference (objectIdentifierValue | 
> definedValue)? ;
>
> With the error:
>
> (201): The following alternatives can never be matched: 3
>
> Accompanying warnings:
>
> (200): Decision can match input such as "CAPID" using multiple 
> alternatives: 2, 3
> As a result, alternative(s) 3 were disabled for that input
>
> (200): Decision can match input such as "LCID" using multiple 
> alternatives: 2, 3
> As a result, alternative(s) 3 were disabled for that input
>
> The problem is, neither objectIdentifierValue is nillable, 
> objectIdentifierValue must start with '{', and defined value can start 
> with CAPID or LCID. So where's the ambiguity? It's got a choice of 
> matching '{', CAPID, LCID, or stopping for this rule.
>
> Hoping someone can shed some light on this before I get too much of a 
> headache...
>
> Sam
> ------------------------------------------------------------------------
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list