[stringtemplate-interest] i0 access in <attribute:template(argument-list)> in ST4

Terence Parr parrt at cs.usfca.edu
Thu May 19 08:42:32 PDT 2011


I decided that i, i0 implicit parameters only work within {...} for simplicity. it could be made to work as you say.
T
On May 19, 2011, at 7:18 AM, Damien Urruty wrote:

> Hi
> 
> Why is the i0 not accessible in the case I mentionned ? Is there a special reason for this ? I think it would be logical, and practical to have it. 
> 
> Subject: Re: [stringtemplate-interest] i0 access in <attribute:template(argument-list)> in ST4
> From: ub at abego-software.de
> Date: Thu, 12 May 2011 11:32:27 +0200
> CC: stringtemplate-interest at antlr.org
> To: lepilache at hotmail.com
> 
> 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
> 
> _______________________________________________
> 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/20110519/6e47dd2f/attachment.html 


More information about the stringtemplate-interest mailing list