[stringtemplate-interest] Accessing outer iterator in nested templates

Sriram msg.sriram at gmail.com
Wed Feb 13 11:40:39 PST 2008


I am trying to use the iterator attribute <i> in the following example:

templateMain(semanticIndices) ::=<<
<semanticIndices:templateM1(); separator="\n">
>>

templateM1(semanticIndices) ::= <<
<semanticIndices:templateM2(); separator="\n">
>>

templateM2(semanticIndices) ::= <<
newArgs[<semanticIndices>] = args<###>[<i0>];
>>

templateMain is invoked with an (ArrayList of Int Arrays) as its parameter.

Main{
  ...
  M1{
     ...
     M2{
         ...
     }
  }
}

It tries to perform the function of a nested loop. At the placeholder
<###>, I need to access the iterator of templateM1. Please let me know
if someone has come across such a problem.

- Sriram


More information about the stringtemplate-interest mailing list