[stringtemplate-interest] Accessing outer iterator in nested templates

Terence Parr parrt at cs.usfca.edu
Wed Feb 13 15:53:56 PST 2008


Hi.I think that the most recent i0 will hide the version above... try  
using a parameter set to i.

templateMain(semanticIndices) ::= <<
<semanticIndices:templateM1(outer=i); separator="\n">
 >>
then ref <outer> below.
Ter


On Feb 13, 2008, at 11:40 AM, Sriram wrote:

> 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
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest



More information about the stringtemplate-interest mailing list