[stringtemplate-interest] Looking for the 'right' way to split lines

Terence Parr parrt at cs.usfca.edu
Wed Jan 18 10:39:19 PST 2006


On Jan 18, 2006, at 2:39 AM, VAUCHER Laurent wrote:
>   Hi.

Salut Laurent. :)

>   I'm using stringtemplate to generate Java source code, and, as  
> far as
> possible, I'd like the generated code to conform to our current coding
> standards. The question I have is about splitting lines. I think it
> should be the responsibility of the view part (templates) to split
> lines, but how could I do it?
>
>   The simple example is when having a collection of values that should
> be output as an array litteral. Is it possible to express conditionnal
> line splitting like: "insert a newline if we've reached column 80"?

I've been thinking about this for a while.  For now, can you try  
using an output filter?  ST has for example the autoindent writer or  
whatever the class.  You could do one that extends it and breaks  
lines at or near 80 but not in a string or whatever.

Ter


More information about the stringtemplate-interest mailing list