[stringtemplate-interest] i0 access in <attribute:template(argument-list)> in ST4
Udo Borkowski
ub at abego-software.de
Thu May 12 02:32:27 PDT 2011
Hi,
you may wrap the call into an anonymous template.
Here a complete example:
========
main(p) ::= "<p:{a|<f(a,i0)>}>"
f(s,index) ::= "<index>. <s><\n>"
========
Calling main with a list ["X","Y","Z"] will render
========
0. X
1. Y
2. Z
========
I assume in your case this should work:
<attr.attr2:{p|<mytempl(position=i0)>}>
BTW: if mytempl only has one parameter ("position") you may omit the parameter name and just pass i0:
<attr.attr2:{p|<mytempl(i0)>}>
Udo
On 12.05.2011, at 10:22, Damien Urruty wrote:
> Hello,
>
> I want to access the i0 value in my argument-list like this :
>
> <attr.attr2:mytempl(position=i0)>
>
> But this raises me an error : implicitly-defined attribute i0 not visible.
>
> Is this normal or is it a bug ?
>
> I am trying to migrate from v3 to v4, and I have found problems in auto-indentation too, but for the moment I can't give an example of what fails.
>
> Thanks for the response !
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20110512/3b0eeb87/attachment.html
More information about the stringtemplate-interest
mailing list