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.
精彩评论