[stringtemplate-interest] Functional List Formatting

Terence Parr parrt at cs.usfca.edu
Wed Mar 12 10:53:01 PDT 2008


On Mar 3, 2008, at 6:51 AM, Fred wrote:

>
>
> On Sun, Mar 2, 2008 at 3:43 PM, Terence Parr <parrt at cs.usfca.edu>  
> wrote:
> > Hi Fred, There is no reason that front in reverse can't be  
> provided in
> >  that they do not violate any of the rules.  You can probably fake  
> it
> >  with a format option for a moment and a renderer.
>
> If I could do that it would be perfect.
> I was under the impression that creating a custom renderer and using  
> format could only effect a change on the elements of list.

oh, right.  Hm.... what to do, what to do...

Ok, well here is a solution, but not the best one perhaps.  What you  
need to do is wrap lists in an object that adds an attribute called  
reverse. You can do this automatically by overriding ST.setAttribute.  
It will then auto wrap these objects as they come in.  You can then  
say $mylist.reverse$ in ST. :) Will this work for you?

Ter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20080312/28535b07/attachment.html 


More information about the stringtemplate-interest mailing list