[antlr-interest] Weird StringTemplate error on building grammar

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Sun Mar 22 15:46:27 PDT 2009


Terence Parr wrote:
> 
> On Mar 22, 2009, at 7:49 AM, Sam Barnett-Cormack wrote:
> 
>> Hi all,
>>
>> Trying to build my grammar, I get the following (including my command 
>> line):
>>
>> sdb at canth:~$ java -cp javalib/antlr-3.1.2/lib/antlr-3.1.2.jar
>> org.antlr.Tool -o tmp/junk workspace/asn.1-parse/grammars/ASN_1.g
>> error(10):  internal error: workspace/asn.1-parse/grammars/ASN_1.g :
>> java.lang.IllegalArgumentException: Can't find template
>> matchSetTrack.st; group hierarchy is [Java]
> 
> term+=(~(RSQR|LSQR)))*
> 
> is your problem. known bug :)  can't add sets to a list yet.

The full rule is:

encodingInstruction : (term+=(~(RSQR|LSQR)))* -> ^(ENCINS $term*);

I read that as

(
   term+=(
     ~(RSQR|LSQR)
   )
)*

So the term+= is applying to the *single* (~(RSQR|LSQR)), and the whole 
lot has cardinality zero-to-N. So each iteration adds one thing that is 
anything-but-rsqr-or-lsqr to term, and this happens zero or more times.

Is this not what it says?


-- 
Sam Barnett-Cormack


More information about the antlr-interest mailing list