[stringtemplate-interest] Line continuation escape

Paul Giblock pgiblock at voicesheardmedia.com
Mon Nov 15 07:35:23 PST 2010


Terrance -

Thanks for the hint.  I am using the DefaultTemplateLexer class. I tried:

Line one <\\>
More line one 

and the resulting output was:

Line one <\>
More line one

The '\\' was simply reduced to '\'.  Alternatively, if I use $\\$ instead, I 
get:

Line one 

That is, the string templating ends at the first occurance of $\\$.

I suppose I can write my own InputStream wrapper that replaces "\\\n[ \t]*" 
with " ", but I'd think StringTemplate could handle this out of the box.

-Paul

On Saturday 13 November 2010 16:17:12 Terence Parr wrote:
> Yeah,Dealing with and template formatting that does not affect the output
> is a very difficult problem. I think I implemented <\\>. can you try that?
> Ter
> 
> On Nov 11, 2010, at 8:22 AM, Paul Giblock wrote:
> > Terrance,
> > 
> > I'm wondering if there is a standard way to do a line-continuation (like
> > \ in C)  In my situation, we have a template we want auto-wrapped at 65
> > characters. This is great for splitting long lines, but it does not work
> > for joining lines that "shrink" after performing substitutions.
> > 
> > In the meantime, I need to write each "paragraph" as a single long line
> > in the template file.
> > 
> > Thanks for the great work!
> > 
> > Paul
> > _______________________________________________
> > 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