[antlr-interest] why <if(y==2 )> in Stringtemplate does not work?

Terence Parr parrt at cs.usfca.edu
Fri Mar 6 13:20:32 PST 2009


Hi. you cannot test the value of attributes within ST; it violates  
model view separation. please read the following paper to catch the  
philosophical approach of ST:

http://www.cs.usfca.edu/~parrt/papers/mvc.templates.pdf

Ter
On Mar 6, 2009, at 1:13 PM, YingAnnie wrote:

>
>
> Hi,
>
> I used the following stg, the aim is when y is equal to 2 ,print out  
> <x><z><y>, but <if(y==2 )> does not work.
> group T;
> assgin(x,y,z)::= <<
> <if(y==2)><x><z><y><else><"fsdfsdfsdf"><endif>
>
> >>
>
> How can I use if...else in Stringtemplate?
>
>
> Thanks in advance.
>
>
> Annie
>
>
> 微软地图实时路况,为您节省的不仅仅是时间! 立即查看!
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list