[stringtemplate-interest] Fwd: How best to do recursive hetero template calls?

Terence Parr parrt at cs.usfca.edu
Fri Feb 19 13:41:28 PST 2010


Hiya. Can you be more specific? ST converts <list:{...}> to a list of STs, not a string.
T
On Feb 18, 2010, at 9:09 AM, Gerald Rosenberg wrote:

> Hi Ter,
> 
> Recursive hetero template calls (given node.type is the literal name of a template):
> 
> TypeA(node) ::= <<
>     // Prefix code for <node.type>
>     ...
>     <node.children:{ node | <(node.type)(node)> }>
>     // Suffix code for  <node.type>
>     ...
> >>
> 
> While it works well, turns out practical use is somewhat limited in that it renders as just one big blob of code|text.  
> 
> Wonder if any thought has been given to allowing ST to render to a string array, maybe using some template level flag to mark when to switch to generating to a new array slot?  Would add flexibility in the subsequent stitching together of the content.
> 
> Best,
> Gerald
> 
> 
> 
> 
> On 2/16/2010 2:49 PM, Gerald Rosenberg wrote:
>> Hi Ter,
>> 
>> Yes, slippery slope and all that.  Quite agree with the argument against 
>> model view entanglement -- actually the argument is mostly against 
>> putting combinatorial logic in the view to evaluate model aspects.
>>   
>> 
> 
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest



More information about the stringtemplate-interest mailing list