[stringtemplate-interest] Problems with counting using i/i0
Morten Olav Hansen
mortenoh at gmail.com
Tue Nov 9 08:35:00 PST 2010
Hi
I'm having a problem with using a counter in my stringtemplate (also
using ANTLR3).
In my StringTemplate I have:
datavalues(datas) ::= <<
<datas: data_n()>
>>
data_n() ::= <<
Data <i0>;
<it.values: value_n(i0)>
>>
value_n() ::= <<
Value <n>_<i0>;
>>
data(values) ::= << >>
value() ::= << >>
data and value has corresponding -> data/value template rewrites in
the antlr-grammar.
This does not work, since it seems the i0 parameter to value_n is
evaluated in value_n, so <i0> == <n>, I'm looking for something like:
Data 0;
Value 0_0;
Value 0_1;
Data 1;
Value 1_0;
Value 1_1;
Is there something I can do about this behavior ? or are there any
other ways of accomplishing this? any ideas would be appreciated.
Regards,
Morten
More information about the stringtemplate-interest
mailing list