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

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Tue Mar 3 03:19:53 PST 2009


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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ASN_1.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20090303/396e45af/attachment.pl 


More information about the antlr-interest mailing list