[stringtemplate-interest] another tweak
Terence Parr
parrt at cs.usfca.edu
Sat Jul 11 17:06:03 PDT 2009
On Jul 11, 2009, at 5:05 PM, Zenaan Harkness wrote:
> On Sat, Jul 11, 2009 at 01:13:10PM -0700, Terence Parr wrote:
>> changes for today:
>>
>> 07-11-2009
>>
>> o If default arg is a template with single expression wrapped in
>> parens, x={<(...)>},
>> then eval to string rather than setting x to the template for later
>> eval. Useful
>> in rare cases where the expression can change value when you read
>> it, such as
>> accessing time value or random number generator object.
>
> That's cool. The benefits of writing a book - you find real-world
> usage
> scenarios that require re-thinks/ features.
Yeah, it's too bad I'm rebuilding ST starting in a month or two
without a book concurrently ;)
>> o Added line break operator <\\>. It consumes remaining whitespace on
>> that line, the first and then any whitespace.
>> Added a number of unit tests. example:
>>
>> "foo <\\>
>> bar"
>>
>> emits "foo bar". All of the whitespace after the <\\> gets thrown
>> away like a comment.
>
> Ahh, so this is a white space consumption operator, not a "line break"
> operator.
yeah, wasn't sure what to call it. line break isn't perfect but it's a
line break and whitespace consumer. For example, it will only consume
a single newline not multiple.
Ter
More information about the stringtemplate-interest
mailing list