[stringtemplate-interest] Problem with upgrading to ST4 in c#
Jakub Šturc
jakub.sturc at gmail.com
Thu May 12 14:45:34 PDT 2011
Hi,
attached file attached file contains VS2010 project with demo of this
problem. Just copy ST4# binaries to the lib folder and watch console
for error message.
The body of the template is trivial 4 characters "ABCD".
Thanks
Jakub
On Thu, May 12, 2011 at 11:12 PM, Sam Harwell
<sharwell at pixelminegames.com> wrote:
> 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
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: st4test.7z
Type: application/octet-stream
Size: 9289 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20110512/3bc69b60/attachment.obj
More information about the stringtemplate-interest
mailing list