[stringtemplate-interest] Re: [antlr-dev] ST output start/stop tags

Jim Idle jimi at intersystems.com
Wed Jun 14 00:25:49 PDT 2006


That would pretty much do it for me as I found that once I knew which
template had spat out which piece of code, the rest was easy from there.

On another note, there will be a need to spit out more than one header file
and perhaps extra C code (or other targets) for additionally features I
would like to add (such as perhaps auto generating a COM interface or .Net
or indeed anything at all really.

Do you have any strong preferences for the way to do this. My thought is
that the codegen target .java file could just call any additional templates
it wants when it is called to generate the header file and the target file.
However, what method do you wish to adopt (as it should be orthogonal across
all codegens if possible) for signifying that 'extras' are requested from
codegen. I think that it should be some construct in the grammar, and it
probably isn't options. There could be new @ sections etc.

Before just making something up though, how about you suggest something and
unless I can find something wrong with it, I will just use it. So, let's say
that the C codegen has an option to produce an additional .c and .h file for
some option, such as foobar. What do you think?

Jim


On 6/13/06 7:48 PM, "Terence Parr" <parrt at cs.usfca.edu> wrote:

> 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
> _______________________________________________
> antlr-dev mailing list
> antlr-dev at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/antlr-dev
> 




More information about the stringtemplate-interest mailing list