[stringtemplate-interest] elseif bug

Zenaan Harkness zen at freedbms.net
Thu Apr 17 01:00:28 PDT 2008


On Thu, Apr 17, 2008 at 05:47:58PM +1000, Zenaan Harkness wrote:
> Can someone confirm whether in fact elseif in the latest version of ST
> is not being recognized, or am I doing something wrong?
> 
> java.lang.IllegalArgumentException: Can't find template elseif.st
> at
> org.antlr.stringtemplate.StringTemplateGroup.lookupTemplate(StringTemplateGroup.java:485)
> ...

Here's my ST code snippet:

<if(!isInterface)>
<if(!model.poly)> final
<elseif(model.isAbstract)> abstract
<endif>
<endif>

Is there something obviously wrong that I'm doing here?

Perhaps ST is mixing up the elseif and assuming that goes with the first
if, rather than the second? Ie, perhaps ST is not nesting properly here?

If I change the code to this:

<if(!isInterface)>
<if(!model.poly)> final
<if(model.isAbstract)> abstract
<endif>
<endif>

It works ... ?? (leaving aside the logic bug in my generated code logic :)

-- 
Homepage: www.SoulSound.net -- Free Australia: www.UPMART.org
Please respect the confidentiality of this email as sensibly warranted.


More information about the stringtemplate-interest mailing list