The += implies a List of what you gather from the rule call but p=  
refers to the return type of the rule. In the template youbwill  
iterate the list but not the return from the rule. ST will take any  
Object and expect you to reference it correctly on the template. So  
you can use += on a single rule call and end up with a list of one  
object. The usage tends to fall out from the natural form if the rule  
calls. Best is to experiment and look at the generated code :)

Jim

On Nov 3, 2009, at 20:30, Nauman <[email protected]> wrote:

> Thanks but I'm still confused. Couldn't I have just said p 
> +=policyType and then, in the call policyType={$p} ? Are they equiv.?
>
>
>
> 2009/11/4 Jim Idle <[email protected]>
> Because u+= means you are passing in a collection, not a  
> StringTemplate reference.
>
> Jim
>
>
> On Nov 3, 2009, at 20:10, Nauman <[email protected]> wrote:
>
>> Dear all,
>>
>> I am having trouble understanding the difference between two  
>> methods for setting template attributes. Consider the following:
>>
>> policy: ^(POLICY policyType u+=updateStat*)
>>      ->
>>  policyStat(policyType={$policyType.st} ,upd={$u})
>>
>>
>> Why do I have $u without the .st and $policyType with a .st? Both  
>> have defined templates and appear similar to me. I tried searching  
>> in the references but couldn't find an explanation. Can anyone  
>> guide me towards an answer?
>>
>> Regards,
>>
>> -- 
>> Nauman
>>
>> Research Associate
>> Security Engineering Research Group
>> Institute of Management Sciences
>> Peshawar, Pakistan
>>
>> Blog: http://recluze.wordpress.com
>> Group: http://serg.imsciences.edu.pk
>> Wiki: http://serg.imsciences.edu.pk/wiki
>> Art gallery: http://flickr.com/recluze
>>
>> Contact number: Use email.
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe: 
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
>
> -- 
> Nauman
>
> Research Associate
> Security Engineering Research Group
> Institute of Management Sciences
> Peshawar, Pakistan
>
> Blog: http://recluze.wordpress.com
> Group: http://serg.imsciences.edu.pk
> Wiki: http://serg.imsciences.edu.pk/wiki
> Art gallery: http://flickr.com/recluze
>
> Contact number: Use email.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to