[stringtemplate-interest] How can I test if an attribute exists?
Terence Parr
parrt at cs.usfca.edu
Mon Nov 16 10:32:35 PST 2009
Well, it works but does throw that exception to the error listener.
ST v4 has an error tolerance concept where you say what you care about
hearing about.
Ter
On Nov 16, 2009, at 10:12 AM, Samuel Lee wrote:
> This is what I want to do:
>
> $if(it.foo)$
> do something with $it.foo$
> $endif$
>
> Obviously, it throws an exception: java.lang.NoSuchFieldException.
>
> I also tried:
>
> $if(!it.foo)$
>
> and
>
> $if(!(it.foo))$
>
> but I can't eliminate the exception.
>
> Is it possible to conditionally do something if an object has
> specific attribute?
>
> Thanks
> Sam
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list