[antlr-interest] if..else in StringTemplate

Terence Parr parrt at cs.usfca.edu
Wed Feb 25 13:29:23 PST 2009


On Feb 24, 2009, at 6:48 PM, YingAnnie wrote:

>
>
>
> Hi everyone,
>
> I want to use if else in the StringTemplateGroup,if (x ="org") print  
> 1234 else print 5678, but <if(x=="org")> doesnot work.

Correct. ST does not allow you to do any logic computations in the  
view. You must do the computation in the model and pass the result to  
the template.

  this philosophy is explained in a number of places on the website  
and the wiki.

Ter


More information about the antlr-interest mailing list