[antlr-interest] Stringtemplate: passing args to templates passed as args

Bill Andersen bill.andersen at mac.com
Mon May 17 11:47:59 PDT 2010


Folks

I have the following template def

emitMatchListReluctant(in,v1,v2,c2,v3,fail) ::= <<
<v1> = new LinkedList\<Form\>();
<v3> = new LinkedList\<Form\>();
matched = false;
for (Form <v2> : <in>) {
  <c2>
  if (!matched) {
    <v1>.add(<v2>);
  } else {
    <v3>.add(<v2>);
  }
}
if (!matched) {
  <if (fail)><fail><else>return false;<endif>
}
>>

c2 is a template argument passed into this template.  What I'd like to do is, where <c2> appears above, to pass an extra parameter to the template that is the actual parameter for c2.  Something like

	<c2 param=value>

to influence the expansion of <c2>

Is this possible?  If so, how?  I can't find it.

Thanks

	Bill


More information about the antlr-interest mailing list