[stringtemplate-interest] Template validation
Ilya Sterin
sterini at gmail.com
Thu Mar 25 21:42:03 PDT 2010
Is there a way to validate a template synchronously. I see there is
a StringTemplateErrorListener which allows to listen to an error
event, but it doesn't fit very well into my current model. We
basically have a factory which generates templates by retrieving them
from storage (these templates are user defined) and then we construct
a StringTemplate using the text. Currently, no exception is thrown
and StringTemplate logs parsing errors
action parse error; template context is [anonymous
if(isIntervalFull)_subtemplate]
line 1:1: unexpected token: Congrats
at org.antlr.stringtemplate.language.ActionParser.primaryExpr(ActionParser.java:813)
at org.antlr.stringtemplate.language.ActionParser.expr(ActionParser.java:539)
...
Is there a way to either force the parser to throw an exception and/or
is there a way to validate the template text synchronously?
Thanks.
--Ilya
More information about the stringtemplate-interest
mailing list