当前位置: 首页>>代码示例>>C#>>正文


C# TemplateGroupFile.Show方法代码示例

本文整理汇总了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);
        }
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:14,代码来源:TestGroupSyntax.cs

示例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);
        }
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:14,代码来源:TestGroupSyntax.cs

示例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);
        }
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:14,代码来源:TestGroupSyntax.cs

示例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);
        }
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:14,代码来源:TestGroupSyntax.cs

示例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);
        }
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:22,代码来源:TestGroupSyntax.cs

示例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);
        }
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:16,代码来源:TestGroupSyntax.cs

示例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);
        }
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:14,代码来源:TestGroupSyntax.cs


注:本文中的Antlr4.StringTemplate.TemplateGroupFile.Show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。