atom feed4 messages in org.antlr.stringtemplate-interest[stringtemplate-interest] Accessing o...
FromSent OnAttachments
SriramFeb 13, 2008 11:40 am 
Terence ParrFeb 13, 2008 3:53 pm 
SriramFeb 13, 2008 4:38 pm 
Terence ParrFeb 13, 2008 5:20 pm 
Subject:[stringtemplate-interest] Accessing outer iterator in nested templates
From:Terence Parr (par@cs.usfca.edu)
Date:Feb 13, 2008 5:20:41 pm
List:org.antlr.stringtemplate-interest

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