[stringtemplate-interest] A few notes on StringTemplate v4 beta

Matthieu Wipliez mwipliez at yahoo.fr
Tue Jan 18 01:23:04 PST 2011


Hi Terence,

it's great to see this beta released!
I have been using the early adopter version for 9 months now, and tried the beta 
version yesterday.
With my templates this version is definitely faster!

However, I believe I have found a bug in this release with "elseif" 
conditionally-included templates.
The test case below fails with "fail2" but I would expect it to work:

@Test public void testElseIf2() throws Exception {
        String template = 
"<if(x)>fail1<elseif(y)>fail2<elseif(z)>works<else>fail3<endif>";
        ST st = new ST(template);
        st.add("z", "2DF3DF");
        String expected = "works";
        String result = st.render();
        assertEquals(expected, result);
    }


Other differences I have noticed with the early adopter version is that it seems 
that $it$ is not propagated *at all* anymore.
For instance I needed to replace
  $value : {[$it$]}$ 
with
  $value : {v | [$v$]}$

Is this intended?
You mention in the differences between v3 and v4 both "no "it" iteration value" 
and "default attr 'it' only set if no arg in {...}.".
So... which one is it? Is "it" allowed?

Also, I have tried the TestCoreBasics unit test, and on Windows a couple of 
tests fail (namely testInclude and testFalseCondWithFormalArgs) because of the 
difference between the Unix and Windows EOL convention: expected is "x\ny" and 
result is "x\r\ny".

Cheers
Matthieu



________________________________
De : Collin Fagan <collin.fagan at gmail.com>
À : Terence Parr <parrt at cs.usfca.edu>
Cc : stringtemplate-interest List <stringtemplate-interest at antlr.org>
Envoyé le : Sam 15 janvier 2011, 2h 10min 51s
Objet : Re: [stringtemplate-interest] StringTemplate v4 beta released

YAY!!! I can't believe I missed that. Very cool :)

Thank you


On Fri, Jan 14, 2011 at 7:08 PM, Terence Parr <parrt at cs.usfca.edu> wrote:

You could use $..$ if you want.
>
>new STGroup('$', '$')
>
>or any other single chars.
>
>Ter
>
>On Jan 14, 2011, at 3:49 PM, Collin Fagan wrote:
>
>> Great News! Just one question I noticed that <> are the default now. I do a lot 
>>of Java code generations and <> are used for generics, is there a good way of 
>>dealing with <> besides just escaping them?
>>
>> Thanks,
>>
>> Collin
>>
>>
>> On Fri, Jan 14, 2011 at 3:37 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
>> finally! http://bit.ly/gfHOaz
>> A complete reimplementation that is BSD license clean. next stop, antlr v4.
>>
>> ter
>> _______________________________________________
>> stringtemplate-interest mailing list
>> stringtemplate-interest at antlr.org
>> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>>
>
>


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20110118/1c986db9/attachment.html 


More information about the stringtemplate-interest mailing list