[stringtemplate-interest] Problem with upgrading to ST4 in c#
Jakub Šturc
jakub.sturc at gmail.com
Thu May 12 22:35:39 PDT 2011
Hi Sam,
I didn't see this one coming. Thank you very much.
Maybe I should read this
http://www.antlr.org/wiki/display/ST4/Differences+between+v3+and+v4
article before complaining.
Regards
Jakub
On Fri, May 13, 2011 at 6:08 AM, Sam Harwell
<sharwell at pixelminegames.com> wrote:
> Hi Jakub,
>
> ST4 requires template files to include a template declaration. I modified the test template you sent me to be compatible with ST4 (see attached).
>
> The new syntax allows you to specify formal arguments for templates where it wasn't possible before.
>
> Thanks,
> Sam
>
> -----Original Message-----
> From: Jakub Šturc [mailto:jakub.sturc at gmail.com]
> Sent: Thursday, May 12, 2011 4:46 PM
> To: Sam Harwell
> Cc: stringtemplate-interest at antlr.org
> Subject: Re: [stringtemplate-interest] Problem with upgrading to ST4 in c#
>
> 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
>>
>>
>
More information about the stringtemplate-interest
mailing list