[stringtemplate-interest] Creating new attributes?
Morten Olav Hansen
mortenoh at gmail.com
Wed Nov 17 17:11:27 PST 2010
Yes, thats what I'm already doing.
statemachine(regions) ::= <<
<regions: region_n(); separator="\n\n">
>>
region_n() ::= <<
Region region<i0>;
<it.states: state_n(i0); separator="\n">
>>
state_n(rid) ::= <<
State state_<it.id>_<rid>;
>>
region(id, states, transitions) ::= << >>
state(id) ::= << >>
transition(from, to) ::= << >>
For the first region i0 is 0, and the state_n also receives 0 (rid =
0). If there is another region, i0 is 1, and state_n should now get
rid = 1, but it still evaluates to 0.
So it seems to be taking the value of i0 inside state_n (which is of
course 0 if there there is only one state). Thats why I was hoping to
somehow force evaluation of i0 in region_n.
Regards,
Morten
On Thu, Nov 18, 2010 at 1:52 AM, Terence Parr <parrt at cs.usfca.edu> wrote:
> Hi. Try passing i/i0/it as a parameter with different name to new template to rename them.
> Ter
> On Nov 17, 2010, at 4:10 PM, Morten Olav Hansen wrote:
>
>> Hi
>>
>> I'm having a problem with my iterators (related to my problem in the
>> mail before). It seems that I can't use it/i/i0 as a parameter when I
>> have two levels of iterators, and I want to use information from the
>> outer iteration in the inner iteration (it and i0 in my case). They
>> seem to be evaluated by name, rather than value, and the value of
>> it/i/i0 has of course changed in the inner iterator.
>>
>> Is it possible in StringTemplate to assign these attributes to a new
>> attribute? So I send send this one instead.
>>
>> Regards,
>> Morten
>> _______________________________________________
>> stringtemplate-interest mailing list
>> stringtemplate-interest at antlr.org
>> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>
>
More information about the stringtemplate-interest
mailing list