[stringtemplate-interest] Force single-valued template
sohail at taggedtype.net
sohail at taggedtype.net
Sun Nov 20 10:26:35 PST 2005
> [forgot to send to list]
>
> On Nov 20, 2005, at 10:01 AM, Terence Parr wrote:
>> On Nov 20, 2005, at 9:47 AM, sohail at taggedtype.net wrote:
>>> The primary motivation is implementation of right and left
>>> associative
>>> operators:
>>>
>>> power(lhs,rhs)::=<<std::power(<lhs>,<rhs>)>>
>>>
>>> for 2**3**5, this should give:
>>>
>>> std::power(2,std::power(3,5))
>>>
>>> I don't think there is a way to do it without forcing lhs and rhs
>>> to be
>>> single valued.
>>
>> How about using first(lhs) to get the first element?
I don't particularly like this solution as it will cause a silent failure.
I'd really like an exception to be thrown while the template is being
constructed.
Sohail
More information about the stringtemplate-interest
mailing list