[stringtemplate-interest] nesting templates and getting the loop count of the outer loop

Terence Parr parrt at cs.usfca.edu
Mon Oct 27 11:27:04 PDT 2008


Hi Roel,

  you are saying that group_nr = i0 in the template application; how  
could the values be different?
Ter
On Oct 27, 2008, at 9:49 AM, Roel Vanhout wrote:

> Hi,
>
>
> I have situation similar to what was asked here: http://markmail.org/message/izumze7jxytlwsds#query 
> :stringtemplate%20i0+page:1+mid:izumze7jxytlwsds+state:results but  
> the results that the poster there gets are not the same for me. A  
> regression maybe, or differences in the Java/C# version? Or more  
> probable, me missing something.
>
> My problem is as follows: I have templates like this:
>
> initialize_dlg(group_nr) ::= <<
> m_DialogIndexes["<group_nr>,<i0>"] = newdlg<it.ViewName>; }
> >>
>
> initialize_dlgs() ::= <<
> <it.Pages:initialize_dlg(group_nr=i0);separator="\n">
> >>
>
> The expexted output is for <group_nr> (in initialize_dlg) to be 0 a  
> couple of times, then 1 a couple of times etc. However, <group_nr>  
> and <i0> are always the same in initialize_dlg, which leads me to  
> believe that <group_nr> is somehow passed not as the value of i0 in  
> initialize_dlgs() but as a string literal 'i0' which is then re- 
> evaluated in initialize_dlg.
>
> I'm using StringTemplate 3.0.1 for C#. Thanks.
>
>
> cheers,
>
> roel
> _______________________________________________
> 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