[stringtemplate-interest] Template validation

Ilya Sterin sterini at gmail.com
Fri Mar 26 21:36:25 PDT 2010


Yes, that's what I ended up doing.

Thanks.

On Fri, Mar 26, 2010 at 2:26 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
> Can you have the listener throw an exception?
> Ter
> On Mar 25, 2010, at 9:42 PM, Ilya Sterin wrote:
>
>> 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
>> _______________________________________________
>> stringtemplate-interest mailing list
>> stringtemplate-interest at antlr.org
>> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>
>


More information about the stringtemplate-interest mailing list