[antlr-interest] Strange behaviour

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Tue Feb 24 11:18:40 PST 2009


Hi all,

I'm back to using ANTLR after a long time away, and in principle I have
to say I'm liking ANTLR3. However, I'm seeing something very strange.

Based on advice in various places, I'm using tokens{} to define keywords
in my combined grammar. However, if I define them all, I get lots of
warnings:

"warning(209): workspace/asn.1-parse/grammars/ASN_1.g:131:1: Multiple
token rules can match input such as "'V'": VideotexString,
VisibleString, CAPID

As a result, token(s) VisibleString,CAPID were disabled for that input"

These are topped off by:

"error(208): workspace/asn.1-parse/grammars/ASN_1.g:159:1: The following
token definitions can never be matched because prior tokens match the
same input:
ABSTRACT_SYNTAX,ALL,APPLICATION,AUTOMATIC,BIT,BMPString,BOOLEAN,BY,CHOICE,
CLASS,COMPONENT,COMPONENTS,CONSTRAINED,CONTAINING,DEFINITIONS,ENCODED,END,
ENUMERATED,EXCEPT,EXPLICIT,EXPORTS,EXTENSIBILITY,EXTERNAL,FROM,
GeneralString,GraphicString,IDENTIFIER,IMPLICIT,IMPLIED,IMPORTS,INCLUDES,
INSTANCE,INTEGER,INTERSECTION,ISO646String,MIN,MINUS_INFINITY,NumericString,
ObjectDescriptor,OCTET,OF,OPTIONAL,PDV,PLUS_INFITIY,PRESENT,PrintableString,
PRIVATE,RELATIVE_OID,SET,SIZE,STRING,SYNTAX,TAGS,TeletexString,TRUE,
TYPE_IDENTIFIER,UNIQUE,UNIVERSAL,UniversalString,UTCTime,UTF8String,
VisibleString,HSTRING"


Obviously, this result is bad. My grammar is attached, with sufficiently
few on the keywords uncommented to allow it to build. If I uncomment
them all, it gives me one of the above warnings for each letter of the
alphabet that a keyword starts with, pretty much.

Anyone have any idea what's going on?

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


More information about the antlr-interest mailing list