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

Terence Parr parrt at cs.usfca.edu
Wed Oct 29 10:56:59 PDT 2008


On Oct 29, 2008, at 2:19 AM, Roel Vanhout wrote:

>
> Here's how I see it; the engine 'executes' outer() for the first time.
> <i0>, in outer, is 0. Then, for every element, inner() is called with
> the argument argument '0'. In my example, inner() would be called 2
> times. So group_nr in inside inner could only be 0 for the first  
> element
> and then 1 for the second element if it is set to the value of <i0>
> _inside inner_, i.e. if it is evaluated as 'the value of <i0> inside
> inner'.
>
> I may be looking at this in a too code-like way, I don't know - but is
> there a way to do what I want?

Sure.  don't do group_nr = i0

group_nr is visible anyway.

Ter


More information about the stringtemplate-interest mailing list