[stringtemplate-interest] Indirect template references
Terence Parr
parrt at cs.usfca.edu
Thu Nov 17 16:45:54 PST 2005
On Nov 17, 2005, at 1:23 PM, Christophe PARIS wrote:
> Hi,
>
> I was wondering if it's possible to call a template which name is
> composed of a prefix and a variable part ?
>
> For example :
>
> -----
>
> group simple;
>
> main(objects) ::= <<
> $objects:print(); separator="\n"$
>>>
>
print() ::= "$(print$it.type$)()$"
Hi. Sure, the following should work:
print() ::= "$(print+it.type)()$"
Well, now that I think about it, I'm not sure the + will work in that
case, but i know it works in args:
$foo(tname="print"+it.type)$
then call $(tname)()$
:)
Ter
More information about the stringtemplate-interest
mailing list