本文整理汇总了C#中Antlr4.StringTemplate.TemplateGroup.Load方法的典型用法代码示例。如果您正苦于以下问题:C# TemplateGroup.Load方法的具体用法?C# TemplateGroup.Load怎么用?C# TemplateGroup.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Antlr4.StringTemplate.TemplateGroup
的用法示例。
在下文中一共展示了TemplateGroup.Load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetFormat
/** The format gets reset either from the Tool if the user supplied a command line option to that effect
* Otherwise we just use the default "antlr".
*/
public virtual void SetFormat(string formatName)
{
this.formatName = formatName;
string fileName = Path.Combine(FORMATS_DIR, formatName + TemplateGroup.GroupFileExtension);
if (!File.Exists(fileName) && formatName != "antlr")
{
SetFormat("antlr");
return;
}
//format.EnableCache = AntlrTool.EnableTemplateCache;
if (!File.Exists(fileName))
{
RawError("ANTLR installation corrupted; cannot find ANTLR messages format file " + fileName);
Panic();
}
//else if (url == null)
//{
// RawError("no such message format file " + fileName + " retrying with default ANTLR format");
// SetFormat("antlr"); // recurse on this rule, trying the default message format
// return;
//}
format = new TemplateGroupFile(
Path.Combine(
Path.GetDirectoryName(typeof(AntlrTool).GetTypeInfo().Assembly.Location),
fileName),
Encoding.UTF8);
format.Load();
if (initSTListener.Errors.Count > 0)
{
RawError("ANTLR installation corrupted; can't load messages format file:\n" +
initSTListener.ToString());
Panic();
}
bool formatOK = VerifyFormat();
if (!formatOK && formatName.Equals("antlr"))
{
RawError("ANTLR installation corrupted; ANTLR messages format file " + formatName + ".stg incomplete");
Panic();
}
else if (!formatOK)
{
SetFormat("antlr"); // recurse on this rule, trying the default message format
}
}