本文整理汇总了C#中Antlr4.StringTemplate.TemplateGroupFile.Show方法的典型用法代码示例。如果您正苦于以下问题:C# TemplateGroupFile.Show方法的具体用法?C# TemplateGroupFile.Show怎么用?C# TemplateGroupFile.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Antlr4.StringTemplate.TemplateGroupFile
的用法示例。
在下文中一共展示了TemplateGroupFile.Show方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSimpleGroup
public void TestSimpleGroup()
{
string templates =
"t() ::= <<foo>>" + Environment.NewLine;
writeFile(tmpdir, "t.stg", templates);
TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
string expected =
"t() ::= <<" + Environment.NewLine +
"foo" + Environment.NewLine +
">>" + Environment.NewLine;
string result = group.Show();
Assert.AreEqual(expected, result);
}
示例2: TestSingleTemplateWithArgs
public void TestSingleTemplateWithArgs()
{
string templates =
"t(a,b) ::= \"[<a>]\"" + Environment.NewLine;
writeFile(tmpdir, "t.stg", templates);
TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
string expected =
"t(a,b) ::= <<" + Environment.NewLine +
"[<a>]" + Environment.NewLine +
">>" + Environment.NewLine;
string result = group.Show();
Assert.AreEqual(expected, result);
}
示例3: TestNestedTemplateInGroupFile
public void TestNestedTemplateInGroupFile()
{
string templates =
"t(a) ::= \"<a:{x | <x:{y | <y>}>}>\"" + Environment.NewLine;
writeFile(tmpdir, "t.stg", templates);
TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
string expected =
"t(a) ::= <<" + Environment.NewLine +
"<a:{x | <x:{y | <y>}>}>" + Environment.NewLine +
">>" + Environment.NewLine;
string result = group.Show();
Assert.AreEqual(expected, result);
}
示例4: TestNestedDefaultValueTemplateWithEscapes
public void TestNestedDefaultValueTemplateWithEscapes()
{
string templates =
"t(a={x | \\< <x:{y|<y>\\}}>}) ::= \"[<a>]\"" + Environment.NewLine;
writeFile(tmpdir, "t.stg", templates);
TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
string expected =
"t(a={x | \\< <x:{y|<y>\\}}>}) ::= <<" + Environment.NewLine +
"[<a>]" + Environment.NewLine +
">>" + Environment.NewLine;
string result = group.Show();
Assert.AreEqual(expected, result);
}
示例5: TestMultiTemplates
public void TestMultiTemplates()
{
string templates =
"ta(x) ::= \"[<x>]\"" + Environment.NewLine +
"duh() ::= <<hi there>>" + Environment.NewLine +
"wow() ::= <<last>>" + Environment.NewLine;
writeFile(tmpdir, "t.stg", templates);
TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
string expected =
"ta(x) ::= <<" + Environment.NewLine +
"[<x>]" + Environment.NewLine +
">>" + Environment.NewLine +
"duh() ::= <<" + Environment.NewLine +
"hi there" + Environment.NewLine +
">>" + Environment.NewLine +
"wow() ::= <<" + Environment.NewLine +
"last" + Environment.NewLine +
">>" + Environment.NewLine;
string result = group.Show();
Assert.AreEqual(expected, result);
}
示例6: TestEscapedQuote
public void TestEscapedQuote()
{
// setTest(ranges) ::= "<ranges; separator=\"||\">"
// has to unescape the strings.
string templates =
"setTest(ranges) ::= \"<ranges; separator=\\\"||\\\">\"" + Environment.NewLine;
writeFile(tmpdir, "t.stg", templates);
TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
string expected =
"setTest(ranges) ::= <<" + Environment.NewLine +
"<ranges; separator=\"||\">" + Environment.NewLine +
">>" + Environment.NewLine;
string result = group.Show();
Assert.AreEqual(expected, result);
}
示例7: TestDefaultValues2
public void TestDefaultValues2()
{
string templates =
"t(x, y, a={def1}, b=\"def2\") ::= \"[<a>]\"" + Environment.NewLine;
writeFile(tmpdir, "t.stg", templates);
TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
string expected =
"t(x,y,a={def1},b=\"def2\") ::= <<" + Environment.NewLine +
"[<a>]" + Environment.NewLine +
">>" + Environment.NewLine;
string result = group.Show();
Assert.AreEqual(expected, result);
}