[prev in list] [next in list] [prev in thread] [next in thread] 

List:       stringtemplate-interest
Subject:    [stringtemplate-interest] Accessing outer iterator in nested
From:       parrt () cs ! usfca ! edu (Terence Parr)
Date:       2008-02-14 1:21:04
Message-ID: 2C46205E-0957-43A2-8AB3-67FB2C4663F0 () cs ! usfca ! edu
[Download RAW message or body]

oh! sorry.  try templateM1(outer=i, semanticIndices=it)
On Feb 13, 2008, at 4:38 PM, Sriram wrote:

> OK. This is what I tried to do. Please let me know what I am doing  
> wrong.
>
> templateMain(semanticIndices) ::= <<
> <semanticIndices:templateM1(outer=i); separator="\n">
>>>
>
> templateM1(semanticIndices, outer) ::= <<
> <outer><semanticIndices>
>>>
>
> Attribute <outer> holds the correct iteration value. However, the
> attribute <semanticIndices> is not set.
>
> -Sriram
>
> On Feb 13, 2008 6:53 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
>> 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
>>
>>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic