[antlr-interest] StringTemplare v 1.03 and suggestions for UberStringTemplate

agoebel5232 ag at j2b.de
Sun Apr 18 14:30:03 PDT 2004


I am currently evaluating StringTemplate and I think I found some 
problems with the otherwise nicely performing library:

- The code in StringTemplate.java (and maybe others?) has some 
unreferenced local variables.

- The examples given in the documentation under the heading "Applying 
Templates To Multi-Valued Attributes" do not work as advertised 
because StringTemplate does a trim() while reading templates and thus 
deleting leading and trailing white space. The output of the first 
example is:

<ul>
<li>Terence</li><li>Tom</li><li>Jim</li>
</ul>

and not:

<ul>
<li>Terence</li>
<li>Tom</li>
<li>Jim</li>
</ul>

Either change the example (easy enough) or remove the trim() while 
reading the code (might be better...).

- In the same example, when I use the following form to set the 
attributes, the result is not what I would expect.

    Vector names = new Vector();
    names.add( "Mary Ellen" );
    names.add( "Jim Bob" );
    names.add( "John-Boy" );
    list.setAttribute( "names", names );
    list.setAttribute("names", "Elizabeth" );
    System.out.println( list );

Will give me:

<ul>
<li>Mary EllenJim BobJohn-Boy</li>
<li>Elizabeth</li>
</ul>

and NOT: 

<ul>
<li>Mary Ellen</li>
<li>Jim Bob</li>
<li>John-Boy</li>
<li>Elizabeth</li>
</ul>

I have also read your suggestions for UberStringTemplate and in 
addition to $else$ I would like to see $elseif$ (like in Velocity) 
because it would clean the templates up a little bit and the 
possibility to call arbitrary no args methods (not only getters) on 
attributes would be nice.

If you set up a project with CVS access for StringTemplate I would  
contribute some code changes...

Andreas. 




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list