[antlr-interest] can't find template when using gunit with tree walking
Marc Bischof
atlan at gmx.li
Fri Jun 13 01:44:19 PDT 2008
Hej,
I've a problem using gunit with tree walking.
Here is the tree walker rule which calls a template. (Grammar and TreeWalker
are working fine, I'am trying to use gunit with it)
program
: ^(ROOT decls+=declaration+)
-> list(content_st={$decls}) //template call
;
When I try to test this with the following gunit testsuite I get an error
which can't find the template. But I don't understand why. Do you know
anything about that? Is there a possibility to pass the .stg file to gunit?
gunit Walker walks Grammar;
program walks program:
"namespace lns = \"blub\";" -> "" //test1
And here is the Error:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.antlr.gunit.gUnitExecuter.runTreeParser(gUnitExecuter.java:392)
at
org.antlr.gunit.gUnitExecuter.runCorrectParser(gUnitExecuter.java:133)
at org.antlr.gunit.gUnitExecuter.executeTests(gUnitExecuter.java:149)
at org.antlr.gunit.gUnitExecuter.execTest(gUnitExecuter.java:92)
at org.antlr.gunit.Interp.main(Interp.java:62)
Caused by: java.lang.IllegalArgumentException: Can't find template list.st
at
org.antlr.stringtemplate.StringTemplateGroup.lookupTemplate(StringTemplateGroup.java:485)
at
org.antlr.stringtemplate.StringTemplateGroup.getInstanceOf(StringTemplateGroup.java:372)
at
org.antlr.stringtemplate.StringTemplateGroup.getInstanceOf(StringTemplateGroup.java:384)
at
org.antlr.stringtemplate.StringTemplateGroup.getInstanceOf(StringTemplateGroup.java:392)
at
org.apache.ode.simpel.antlr.SimPELWalker.program(SimPELWalker.java:259)
Cheers
Marc Bischof
More information about the antlr-interest
mailing list