[stringtemplate-interest] Applying templates with more than one parameter to multi-valued attributes
Terence Parr
parrt at cs.usfca.edu
Tue Oct 31 09:35:06 PST 2006
On Oct 31, 2006, at 1:03 AM, Varghese wrote:
> Hi Terence,
>
> There is an example template (scopedListingTest.st), test code
> (ScopedListingTest.java), output as a part of the first post.
> http://www.antlr.org:8080/pipermail/stringtemplate-interest/2006-
> October/000769.html
> Or do you want a simpler test case?
>
> Also, if the template is such 'bFormatter(b, aDisplay, bIndex,
> arg) ::= <<...>>'
> and it is invoked like this '<a.bList:bFormatter(aDisplay=
> {<a.display>}, bIndex={<i>}), arg={ABC}>'
> Isn't 'b' a formal parameter(and hence don't have to be set
> explicitly) because 'a.bList' is a array list of bs' and the
> template is iterating through the list?
See section "Allowing enclosing attributes to pass through":
When template x calls template y, the formal arguments of y hide any
x arguments of the same because the formal parameters force you to
define values. This prevents surprises and makes it easy to ensure
any parameter value is empty unless you specifically set it for that
template. ...
Ter
More information about the stringtemplate-interest
mailing list