[stringtemplate-interest] How to call a template from another when using formal args
Marziou, Gael
gael.marziou at hp.com
Fri Apr 3 10:16:54 PDT 2009
Hello,
I have looked at the simple_group_example tutorial in the wiki and the test cases but I haven't found an example that could show me how to
Define a template that calls another one with formal arguments.
The code below does not even parse.
It tries to define a "zero" template that takes one single arg and that calls "equals" which takes 2 args by setting the second one to a fixed value 0.
String templates = "group test; "
+ "equals(a, b) ::= <<$a$ = $b$>>"
+ "zero(a) ::= <<$equals($a$,0)$>>";
StringTemplateGroup group = new StringTemplateGroup(new StringReader(templates), DefaultTemplateLexer.class);
action parse error in group test line 1; template context is [zero]
line 1:1: unexpected token: equals
I am using ST 3.2 if it does matter.
Thanks,
Gael
More information about the stringtemplate-interest
mailing list