These are chat archives for antlr/antlrcs

22nd
Jun 2017
Jericho
@Jericho
Jun 22 2017 18:27
I'm new to StringTemplate and trying to configure a simple template but I get an exception which I believe is due to the delimeters
The exception I get, unfortunately, is not very helpful:
Exception of type 'Antlr4.StringTemplate.Compiler.TemplateException' was thrown.
My code is:
var st = new Template("Dear [firstname]", '[', ']');
st.Add("firstname", "Bob");
var result = st.Render();
In case it can be useful, the stack trace is:
   at Antlr4.StringTemplate.Compiler.TemplateCompiler.ReportMessageAndThrowTemplateException(ITokenStream tokens, IToken templateToken, Parser parser, RecognitionException re)
   at Antlr4.StringTemplate.Compiler.TemplateCompiler.Compile(String srcName, String name, List`1 args, String template, IToken templateToken)
   at Antlr4.StringTemplate.Template..ctor(TemplateGroup group, String template)
Sam Harwell
@sharwell
Jun 22 2017 22:05
I believe the problem is an inability to use ] as the closing delimiter
You could test this by using $ instead of ], but leaving the start delimiter as [