[antlr-interest] string template v4 list of object iteration
Terence Parr
parrt at cs.usfca.edu
Thu May 3 10:45:59 PDT 2012
when you load the v4 .stg file the you specify $? is not the default.
Also, why are you posting this to the ANTLR's list instead of the string template list?
Ter
On May 3, 2012, at 10:14 AM, Pradeep Vasudevan wrote:
> Hi All
>
> (finally my interest list confirmation mail turned up :) )
>
> I have used stringtemplatev3 in one of my .net project
>
> in v3, if I have arraylist of objects I can iterate thru the list by
> in my html page ,
>
> <table>
> $arrayListOfPersons :{ p |
> <tr><td>p.name</td></tr>
> <tr><td>p.age</td></tr>
> }$
> </table>
>
> where person class is declared in java
>
> class persons{
> public String getName();
> public int getAge();
> ...
> }
>
> List<persons> ps = new ArrayList<persons>();
> add persons to ps
>
> but now I am using a string template group file(.stg) with stringtempate V4
> I am getting exception on above html table iteration code
> some of the stack trace says
> can't load group file
> Caused by: java.lang.ClassCastException: java.util.ArrayList
> at org.antlr.runtime.tree.BaseTreeAdaptor.addChild(BaseTreeAdaptor.java:107)
> at org.stringtemplate.v4.compiler.STParser.mapExpr(STParser.java:3508)
>
> at the same time I can list an array of string like this $contents; separator="<br/>"$
>
>
> (we use $ for delimiters in v3 and v4)
>
> how do I iterate a list of object in a list in ST version 4 using string template group file?
> is my syntax is wrong ? I can provide more info about java classes/more stack trace etcetc (someoneelse in my team wrote it)
> if required
>
> any help/tips would be greatful
> thanks in advance
>
> pvee
>
>
> 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