[prev in list] [next in list] [prev in thread] [next in thread] 

List:       stringtemplate-interest
Subject:    Re: [stringtemplate-interest] Functional List Formatting
From:       Terence Parr <parrt () cs ! usfca ! edu>
Date:       2008-03-12 17:53:01
Message-ID: 3E377545-BF87-4F27-A449-D7CCCE2B0AE2 () cs ! usfca ! edu
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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

>
>
> On Sun, Mar 2, 2008 at 3:43 PM, Terence Parr <parrt@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
[Attachment #5 (text/html)]

<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; "><br><div><div>On Mar 3, 2008, at 6:51 AM, \
Fred wrote:</div><br class="Apple-interchange-newline"><blockquote \
type="cite"><br><br>On Sun, Mar 2, 2008 at 3:43 PM, Terence Parr &lt;<a \
href="mailto:parrt@cs.usfca.edu">parrt@cs.usfca.edu</a>&gt; wrote:<br>&gt; Hi Fred, \
There is no reason that front in reverse can't be provided in<br>&gt; &nbsp;that they \
do not violate any of the rules. &nbsp;You can probably fake it<br> &gt; &nbsp;with a \
format option for a moment and a renderer.<br><br>If I could do that it would be \
perfect.<br>I was under the impression that creating a custom renderer and using \
format could only effect a change on the elements of list.</blockquote><div><br \
class="webkit-block-placeholder"></div>oh, right. &nbsp;Hm.... what to do, what to \
do...</div><div><br class="webkit-block-placeholder"></div><div>Ok, well here is a \
solution, but not the best one perhaps. &nbsp;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. \
&nbsp;You can then say $mylist.reverse$ in ST. :) Will this work for \
you?</div><div><br class="webkit-block-placeholder"></div><div>Ter</div></body></html>




_______________________________________________
stringtemplate-interest mailing list
stringtemplate-interest@antlr.org
http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic