开发者

The type or namespace name 'DefaultTemplateLexer' could not be found

The official tutorial from http://www.antlr.org/wiki/display/ST/Five+minute+Introduction doesn't work because of DefaultTemplateLexer, how to fix ?

using Sy开发者_运维百科stem;
using Antlr.StringTemplate;

class Script
{
    static public void Main(string[] args)
    {


StringTemplateGroup group =  new StringTemplateGroup("myGroup", @"C:\Tutorials\stringtemplate", typeof(DefaultTemplateLexer));
StringTemplate helloAgain = group.GetInstanceOf("homepage");

helloAgain.SetAttribute("title", "Welcome To StringTemplate");
helloAgain.SetAttribute("name", "World");
helloAgain.SetAttribute("friends", "Terence");
helloAgain.SetAttribute("friends", "Kunle");
helloAgain.SetAttribute("friends", "Micheal");
helloAgain.SetAttribute("friends", "Marq");

Console.Out.WriteLine(helloAgain.ToString());
    }
}


From the tutorial, you didn't include the using line:

using Antlr.StringTemplate.Language;

Which imports the namespace that DefaultTemplateLexer resides in. So either include that line or fully qualify the type.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜