[stringtemplate-interest] ST output start/stop tags
Terence Parr
parrt at cs.usfca.edu
Tue Jun 13 10:48:24 PDT 2006
Hi,
Per a previous discussion, when trying to answer "which template
generated that text" it would be nice to have each template spit out
a start/stop tag (user-defined). It works great...built it
yesterday...you get:
<method><type>void</type> foo(<args>...</args>) { <body>...</body> }</
method>
or close...
I decided that each group would have
public void emitTemplateStartDebugString(StringTemplate st,
StringTemplateWriter out)
throws IOException
{
out.write("<"+st.getName()+">");
}
public void emitTemplateStopDebugString(StringTemplate st,
StringTemplateWriter out)
throws IOException
{
out.write("</"+st.getName()+">");
}
and each group would have a boolean
public boolean debugTemplateOutput = false;
or sometihng that you could set per group. For example, errors in
antlr I don't want wrapped but the codegen i do want wrapped.
Does this make sense? Only problem I have is that I ask for the file
extension such as .java or .cpp from the code gen templates and it
gives t.<fileExt>java</fileExt> when it tries to build a filename,
but that is my special case.
Any comments on desired functionality?
Ter
More information about the stringtemplate-interest
mailing list