[stringtemplate-interest] Anonymous template inside another anonymous template

Morten Olav Hansen mortenoh at gmail.com
Thu Dec 2 14:52:49 PST 2010


After more digging around, it seems that the problem is that i have
recursive templates with the same arguments.

Something like this fails:
a(prefix) ::= <<
<b(prefix={added_<prefix>}>
>>

b(prefix) ::= <<
<prefix> ...
>>

but using b_prefix instead works fine.

The problem I'm facing is that I have recursion, and I can't create a
template for every possible level.

Any suggestions on how to fix this?

Regards,
Morten

On Thu, Nov 25, 2010 at 9:44 PM, Morten Olav Hansen <mortenoh at gmail.com> wrote:
> Hi
>
> Is it possible to have an anonymous template inside another template
> somehow? I'm trying to generate an argument to a template (which is
> called from an anonymous template).
>
> I have something like this:
>
> <r.states: {s|<state_builder(state=s, region_ns={r<region_n>})>}>
>
> But i get an exception:
> Exception in thread "main" java.lang.IllegalArgumentException: cannot
> embed template <anonymous template argument> in itself
>
> I'm just passing region_ns=region_n now and adding the r on the
> template side (and this works), but this argument will potentially
> have several arguments concatenated together.
>
> Regards,
> Morten
>


More information about the stringtemplate-interest mailing list