[stringtemplate-interest] outputting current template file and line number?
Barrie Treloar
baerrach at gmail.com
Wed Jul 22 21:12:25 PDT 2009
On Thu, Jul 23, 2009 at 11:09 AM, Terence Parr<parrt at cs.usfca.edu> wrote:
> take a look at the emit start stop tag thing. Is very useful for figuring
> out where some output came from.
Ahh http://www.stringtemplate.org/api/org/antlr/stringtemplate/StringTemplateGroup.html#emitDebugStartStopStrings(boolean)
thanks.
But how do you set what the debug start/stop strings should be?
... looking at the code, I can't.
StringTemplateGroup.emitTemplateStartDebugString() - Line 1031
out.write("<"+groupPrefix +st.getName()+">");
This is probably another edge case for me.
The generated template is used in another engine and will print out
the rules that it matches, including any comments on that rule.
So I really want the Template:LineNumber as part of that comment so I
can see which rule fired.
I dont think I want the file:line to be output for every template that
gets invoked... that's probably going to clutter the output and I'd
need the emitter to have a configurable start/end debug string.
Maybe I could push the current template as an attribute so I could do
<template.name>, <template.line> but I would need to expose the
current chunk to pull out the AST since that is what has the line
information.
These all sound like crazy thoughts. Back to the manual way.
Thanks.
More information about the stringtemplate-interest
mailing list