[antlr-interest] Another question......

stefan stefan at amiq.ro
Thu Jun 9 02:01:50 PDT 2005


On Thursday 09 June 2005 11:12, Hill, Robert wrote:
> Hi all,,
> 	<gasp> another question... :)
>
> Im using the stringtemplate as the final code formatting phase of my tool
> trying to follow the separation of model/view etc, and was wondering if
> there was anyway of formating the strings in the template, kind of like you
> would  with sprintf?.. What I'd like to do would be something along the
> lines of
>
> $name; separator = "\n"; format = "%.10s"$

At this moment you must format before stick values into the above template.
Something similar with this is on the requests list; please see 
"StringTemplate Bugs, Requests, Changes" section on 
www.stringtemplate.org/bugs.html.

> At the moment I have a switch {} that checks which destination style im
> outputting in, and then formats the string before the
>
> xxx.setAttribute("name",myformattedstring);
>
> If there isn't already a way of doing this (I don't see it in the string
> template docs) then is there any reason why this wouldn't be a good idea
> since it makes the view deal with any formatting, taking more output
> specifics away from the model?
>
> If so I might have a bash at modding (read: messing up) stringtemplate :)
>
> Cheers,
> /2ob
>
> Ps..If this isn't the list for stringtemplate discussion, could someone
> point me in the right direction?

yes, you can subscribe to stringtemplate-interest at antlr.org.

>
>
> Rob Hill
> EDS UKNMSC				+44 (0) 114 291 1928
> Innovation Centre			+44 (0) 114 291 2000
> 217 Portobello			+44 (0) 791 732 1227
> Sheffield				rhill03 at eds.com
> S1 4DP
>
>
>
>
>
> Rob Hill
> F UKNMSC
> Innovation Centre
> 217 Portobello
> Sheffield
> S1 4DP
> *	+44 (0) 114 291 1928
> 6	+44 (0) 114 291 2000
> * +44 (0) 791 732 1227
> *	rhill03 at eds.com


More information about the antlr-interest mailing list