[antlr-interest] StringTemplate2
Terence Parr
parrt at cs.usfca.edu
Thu Sep 23 11:36:53 PDT 2004
On Sep 23, 2004, at 11:14 AM, Joan Pujol wrote:
> Hi,
>
> Some days ago I made a question but nobody has answered it. Possibly
> because it was too much long and complex. Because it's a lot important
> for me I reformulate it again in a more simpler way.
Sorry...had it up in a window, but didn't have time to answer...
> 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");
>
> I understand that my template doesn't work as expected
> int i;char c;
> And I understand the why. But after reading all the stringtemplate
> docs twice I don't find any way to do it without using beans. It is
> posible to do it without beans?
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
>
> I don't want to use beans because, I find it unproductive, because I
> have to create a lot of beans from the AST.
>
> A lot of thanks in advance, and excuse me for posting the same
> question again. But I think that possible with this simpler question
> will be more easy that someone be able to answer me.
>
>
> Cheers,
> --
> Joan Jesús Pujol Espinar
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
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