[stringtemplate-interest] Can't parse chunk exception.

Terence Parr parrt at cs.usfca.edu
Fri Apr 13 10:39:22 PDT 2007


Hi. It is using <...> as the expression delimiters.  That is the  
default with STG(reader).  You can tell it to use the $..$ though  
with an argument.
Ter

On Apr 13, 2007, at 6:55 AM, Andrew Melnichuk wrote:

> Hi, i'm newbie to ST.
>
> I have exception, when trying to load template group and can't  
> understand whats wrong. Here is my code:
>
> Template group file
>
> --------------------------------
> group master;
>
> main() ::= "<p>Hello</p>"
> ---------------------------------
>
> My C# code is
>
>     class Program
>     {
>         static void Main(string[] args)
>         {
>             string viewPath = "../../views/master.stg";
>
>             TextReader reader = new StreamReader(viewPath);
>
>             StringTemplateGroup stgMaster = new StringTemplateGroup 
> (reader); // EXCEPTION here
>         }
>     }
>
> The stack trace is
>
> Can't parse chunk: /p
>    at Antlr.StringTemplate.Language.ActionLexer.nextToken() in D: 
> \Downloads\www.stringtemplate.org\StringTemplate 
> \Antlr.StringTemplate.Language\ActionLexer.cs:line 278
>    at antlr.TokenBuffer.fill (Int32 amount)
>    at antlr.TokenBuffer.LA(Int32 i)
>    at antlr.LLkParser.LA(Int32 i)
>    at Antlr.StringTemplate.Language.ActionParser.action() in D: 
> \Downloads\www.stringtemplate.org\StringTemplate 
> \Antlr.StringTemplate.Language\ActionParser.cs:line 192
>    at Antlr.StringTemplate.StringTemplate.ParseAction(String  
> action) in D:\Downloads\www.stringtemplate.org\StringTemplate 
> \Antlr.StringTemplate\StringTemplate.cs:line 1195
> problem parsing template 'main'
>    at Antlr.StringTemplate.Language.TemplateParser.action 
> (StringTemplate self) in D:\Downloads\www.stringtemplate.org 
> \StringTemplate\Antlr.StringTemplate.Language 
> \TemplateParser.cs:line 199
>    at Antlr.StringTemplate.Language.TemplateParser.template  
> (StringTemplate self) in D:\Downloads\www.stringtemplate.org\
> StringTemplate\Antlr.StringTemplate.Language\TemplateParser.cs:line  
> 160
>    at Antlr.StringTemplate.StringTemplate.BreakTemplateIntoChunks()  
> in D:\Downloads\www.stringtemplate.org\StringTemplate 
> \Antlr.StringTemplate\StringTemplate.cs:line 1168
>
> -- 
> Best regards,
> Andrew Melnichuk
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest



More information about the stringtemplate-interest mailing list