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

Sam Harwell sharwell at pixelminegames.com
Thu May 12 14:12:52 PDT 2011


Is there any way you can send the contents of your template file as well?

Thanks,
Sam

-----Original Message-----
From: stringtemplate-interest-bounces at antlr.org [mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of Jakub Šturc
Sent: Thursday, May 12, 2011 9:32 AM
To: stringtemplate-interest at antlr.org
Subject: [stringtemplate-interest] Problem with upgrading to ST4 in c#

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
_______________________________________________
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