[stringtemplate-interest] summarizing white space and indentation
Terence Parr
parrt at cs.usfca.edu
Sun Nov 8 10:48:47 PST 2009
On Nov 7, 2009, at 9:58 PM, Zenaan Harkness wrote:
> What about:
>
> t() ::= << foo
> bar
> blah
>>>
>
> ??
>
> In this case, the template probably wants to emit a single space
> character at the start. How would a multi-line template be written to
> emit a single space character?
t() ::= <<
foo
bar
blah
>>
:)
>
> Here we are already breaking backward compatibility.
>
> I'd prefer strict default templates (no messing with ANY whitespace!),
> and syntax pre- or in-fix operator to get "nice pretty layout"
> behaviour.
>
> Q.1:
> Can we say that the advantages of strict, deterministic, non-
> whitespace-
> consuming, low-cognitive-overhad templates take a back seat to "the
> prettiest template layout we can achieve"?
maybe. it's a simple rule ;) one ws char.
> Q.2:
> Ter, since your the primary implementer, can you please comment on the
> possibility of an in-fix or pre-fix template operator syntax for
> "please
> remove some or all of {first, leading, last} whitespace in this
> template"?
I'm resisting at moment.
T
More information about the stringtemplate-interest
mailing list