[antlr-interest] StringTemplate2

Joan Pujol joanpujol at gmail.com
Thu Sep 23 23:06:34 PDT 2004


On Thu, 23 Sep 2004 11:36:53 -0700, Terence Parr <parrt at cs.usfca.edu> wrote:

> > I have a template: vardef(type,name)::= << <type> <name>; >>
> > And code like:
> >    vardef.setAttribute("type","int");
> >    vardef.setAttribute("name","i");
> >    vardef.setAttribute("type","char");
> >    vardef.setAttribute("name","c");
> >
> Hmm...you need to use the separator="\n" which would require that you
> apply vardef to a bean.  instead, just do this:
> 
> vardef(type,name)::= <<
> <type> <name>;
>  >>
> newline before >> is the key. :)
> 
> Ter

A lot of thanks Ter, but it doesn't work.
If I appy this code to your template:

vardef.setAttribute("type","int");
vardef.setAttribute("name","i");
vardef.setAttribute("type","char");
vardef.setAttribute("type","c");

I get:
intchar ic;
(newline)

And what I want is 
int i;(newline)
char c;(newline)
(and without using beans)


A lot of thanks in advance for your time Ter,

 
-- 
Joan Jesús Pujol Espinar


 
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