[stringtemplate-interest] leading/trailing whitespace trimmed
Terence Parr
parrt at cs.usfca.edu
Wed Apr 16 10:24:59 PDT 2008
My intention was that it consume all newlines before / after
templates; anything else is a bug. Might not be what you want, but
that was my intention...i can entertain an optin for 3.2.
Ter
On Apr 16, 2008, at 9:16 AM, Zenaan Harkness wrote:
> On Wed, Apr 16, 2008 at 10:07:43PM +0800, brian wrote:
>> On Wed, Apr 9, 2008 at 2:01 AM, Terence Parr <parrt at cs.usfca.edu>
>> wrote:
>>>
>>> On Apr 8, 2008, at 2:58 AM, brian wrote:
>>>
>>>> I think org.antlr.stringtemplate.StringTemplate(java.lang.String
>>>> template) is trimming leading and trailing whitespace. Is it?
>>>> Should
>>>> it? I see a note about ST doing that for file input, but why to
>>>> Strings?
>>>>
>>>
>>> Hi. It does it for all templates even those specified with "...".
>>> Easier
>>> to add whitespace later than to get rid of whitespace.
>>
>> OK. But it'd be nice if there were a "I really mean for you to use
>> this exact template, don't mess with it" flag. In fact, I really
>> think
>> producing what I told it to produce should be the default, and
>> automatic whitespace removal should be an option. Thanks.
>
> I've been using StringTemplate weekly for the past 6 months, and just
> yesterday I got bitten by this trimming issue once again.
>
> What I find frustrating is that it seems as though it can trim one OR
> two newlines.
>
> The first newline eaten, at least for <<, >> style templates (in group
> files I'm using here), is forgivable - so that the layout makes sense.
> But to consume the second blank line is unforgiveable. The
> 'solution' is
> to insert <\n>, but then the problem is that sometimes (may be every
> time), when at the start (or may be end, or may be both) of a
> template,
> I get TWO empty lines where I only want one!!
>
> At the least, there should be a specification for how to get NO lines,
> how to get ONE (blank) line, and how to get more than one, blank line.
> It seems horribly loose at the moment.
>
> I might just not be understanding it properly, but it has frustrated
> me
> on a few occasions now.
>
> So, here's my vote for clarification, and precision. With templates it
> must be possible to get precise output, per specification.
>
> Zen
>
> --
> Homepage: www.SoulSound.net -- Free Australia: www.UPMART.org
> Please respect the confidentiality of this email as sensibly
> warranted.
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list