[stringtemplate-interest] format option implemented?

Terence Parr parrt at cs.usfca.edu
Sun Dec 10 11:57:16 PST 2006


On Dec 9, 2006, at 10:10 PM, John Snyders wrote:
>> I think I have also decided that the format option would apply to the
>> object value, not the entire expression, thus, avoiding issues with
>> the separator.  It would apply to the null option, however, because
>> that replaces an expression value.
>
> This gets a little tricky. Options are allowed on and apply to
> templatesExpr.
> Most of the time you will do $attribute;format="fancy"$ but it seems
> incorrect
> to me that $list : {a $it$ b};format={toUpper}$ would only apply to  
> $it$ and
> not
> the whole annon template.

It would apply to entire {a $it$ b}, but not a separator.

> While perhaps not useful $\"literal\";format={toUpper}$ should also  
> work (it
> would result in "LITERAL")

yep.

> The discussion on this list went on about the order but that turns  
> out to be
> a non issue since all options apply to the template. They are  
> stored in a
> hash map and hence have no order.
>
> What naturally seemed to happen as I implemented this is that  
> format applied
> to the whole template and the null option value if used but not to the
> separator.


yep.

Ter


More information about the stringtemplate-interest mailing list