[antlr-interest] Strange behaviour

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Wed Feb 25 05:39:03 PST 2009


And today, with absolutely no changes, it works. Weird.

In case the info is useful to someone, I uncommented the keywords one at 
a time, expecting it to suddenly break again at some point, and thus 
give me some clue as to what on earth is going on. However, it didn't 
break. I've started adding parser rules, and all is well.

Sam

Sam Barnett-Cormack wrote:
> 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
> 
> 
> ------------------------------------------------------------------------
> 
> 
> 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