[antlr-interest] Confusing, hopefully-final, problems

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Mon Mar 2 01:48:47 PST 2009


Hey all,

With Gavin's generous help, I'm down to one error and a couple of 
warnings, which is nice.

In the attached grammar, I haven't fixed the lexer issues Gavin 
identified yet, as I'm focused on the parser for the moment.

The error is on line 473, as are two of the warnings. I can't say as I 
can figure out what it's getting at all, but I'm probably just being dumb.

The rule is

extensionAndException : '...' exceptionSpec? ;

and exceptionSpec is:

exceptionSpec : ('!' exceptionIdentification)? ;

exceptionIdentification : signedNumber | definedValue | type ':' value ;

The error and warnings are:

warning(200): workspace/asn.1-parse/grammars/ASN_1.g:346:82: Decision 
can match input such as "'('" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
warning(200): workspace/asn.1-parse/grammars/ASN_1.g:473:31: Decision 
can match input such as "'}'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
warning(200): workspace/asn.1-parse/grammars/ASN_1.g:473:31: Decision 
can match input such as "','" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
error(201): workspace/asn.1-parse/grammars/ASN_1.g:473:31: The following 
alternatives can never be matched: 2

My best guess is that the problem comes from "type" in the 
exceptionIdentification rule, but then I'd expect the error to be there, 
and not in extensionAndException.

The remaining warning, about rule 'type', I'm similarly at a loss about. 
The warning seems to refer to the reference to 'constraint'.

Thanks for any help anyone can give,

Sam
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ASN_1.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20090302/e7150c61/attachment.pl 


More information about the antlr-interest mailing list