[stringtemplate-interest] Problem with upgrading to ST4 in c#

Jakub Šturc jakub.sturc at gmail.com
Thu May 12 07:31:51 PDT 2011


Hello,

a while ago I've been using following c# code to load templates from disk:

var group = new StringTemplateGroup(name, dir, typeof(DefaultTemplateLexer));
var template = group.GetInstanceOf(fileName);
// where dir + fileName + ".st" is name of template file on disk

In ST4 I suppose former code should look as following:

var group = new TemplateGroupDirectory(dir, UTF8, '$', '$');
var template = group.GetInstanceOf(fileName);

Now however template is null. When I attached ErrorListener I found
that  "A recognition
error occurred." with following message "Test.st 1:0: no viable
alternative at input 'ABCD'".

This errors are quite cryptic for me but I guess that problem might be
that GroupParser is
used over template file (.st not .gst).

Is this a bug or am I doing something fundamentally wrong?

Thanks,
Jakub Šturc


More information about the stringtemplate-interest mailing list