[antlr-interest] Crash on rewrite

Mark Bednarczyk voytechs at yahoo.com
Sat Mar 10 04:57:01 PST 2007


Anyone know why this throws an exception everytime:

[antlr:antlr3] ANTLR Parser Generator  Version 3.0b6 (Jan 31, 2007)
1989-2007
[antlr:antlr3] error(10):  internal error:
C:\jnetstream\NplLanguage\src\antlr\Npl.g :
java.lang.IllegalArgumentException: Can't find template matchSetTrack.st
[antlr:antlr3]
org.antlr.stringtemplate.StringTemplateGroup.lookupTemplate(StringTemplateGr
oup.java:485)
[antlr:antlr3]
org.antlr.stringtemplate.StringTemplateGroup.getInstanceOf(StringTemplateGro
up.java:372)
[antlr:antlr3]
org.antlr.stringtemplate.StringTemplateGroup.getInstanceOf(StringTemplateGro
up.java:384)
...

On the following PARSER rule::

number
	:	h=Hex ('l'|'L') -> ^(INT64)
	;


When its broken out, it works fine::

number
	:	h=Hex 'l' -> ^(INT64)
	|	h=Hex 'L' -> ^(INT64)
	;

Without the rewrite part '->' the combined rule matches as expected. Only
throws exception when the rewrite is present.

I've tried everything I know and started breaking all the rules out in to
sperate lines, but that produces a lot of redundancy in the generated code.

Cheers,
mark...




More information about the antlr-interest mailing list