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


C# Antlr3.Tool.Grammar.ToString方法代码示例

本文整理汇总了C#中Antlr3.Tool.Grammar.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Antlr3.Tool.Grammar.ToString方法的具体用法?C# Antlr3.Tool.Grammar.ToString怎么用?C# Antlr3.Tool.Grammar.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Antlr3.Tool.Grammar的用法示例。


在下文中一共展示了Antlr3.Tool.Grammar.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestLabeledNotSet

        public void TestLabeledNotSet()
        {
            Grammar g = new Grammar(
                "parser grammar P;\n" +
                "tokens { A; B; C; }\n" +
                "a : t=~A ;\n" );
            string expecting =
                ".s0->.s1" + NewLine +
                ".s1->.s2" + NewLine +
                ".s2-B..C->.s3" + NewLine +
                ".s3->:s4" + NewLine +
                ":s4-EOF->.s5" + NewLine;
            checkRule( g, "a", expecting );

            string expectingGrammarStr =
                "1:8: parser grammar P;\n" +
                "a : t=~ A ;";
            Assert.AreEqual( expectingGrammarStr, g.ToString() );
        }
开发者ID:JSchofield,项目名称:antlrcs,代码行数:19,代码来源:TestNFAConstruction.cs

示例2: TestLabeledNotCharSet

        public void TestLabeledNotCharSet()
        {
            Grammar g = new Grammar(
                "lexer grammar P;\n" +
                "A : t=~'3' ;\n" );
            string expecting =
                ".s0->.s1" + NewLine +
                ".s1->.s2" + NewLine +
                ".s2-{'\\u0000'..'2', '4'..'\\uFFFF'}->.s3" + NewLine +
                ".s3->:s4" + NewLine +
                ":s4-<EOT>->.s5" + NewLine;
            checkRule( g, "A", expecting );

            string expectingGrammarStr =
                "1:7: lexer grammar P;\n" +
                "A : t=~ '3' ;\n" +
                "Tokens : A ;";
            Assert.AreEqual( expectingGrammarStr, g.ToString() );
        }
开发者ID:JSchofield,项目名称:antlrcs,代码行数:19,代码来源:TestNFAConstruction.cs

示例3: TestNotSetLoop

        public void TestNotSetLoop()
        {
            Grammar g = new Grammar(
                "lexer grammar P;\n" +
                "A : ~('3')* ;\n" );
            string expecting =
                ".s0->.s1" + NewLine +
                ".s1->.s2" + NewLine +
                ".s2->.s3" + NewLine +
                ".s2->.s9" + NewLine +
                ".s3->.s4" + NewLine +
                ".s4-{'\\u0000'..'2', '4'..'\\uFFFF'}->.s5" + NewLine +
                ".s5->.s3" + NewLine +
                ".s5->.s6" + NewLine +
                ".s6->:s7" + NewLine +
                ".s9->.s6" + NewLine +
                ":s7-<EOT>->.s8" + NewLine;
            checkRule( g, "A", expecting );

            string expectingGrammarStr =
                "1:7: lexer grammar P;\n" +
                "A : (~ ( '3' ) )* ;\n" +
                "Tokens : A ;";
            Assert.AreEqual( expectingGrammarStr, g.ToString() );
        }
开发者ID:JSchofield,项目名称:antlrcs,代码行数:25,代码来源:TestNFAConstruction.cs

示例4: TestLabeledNotSet

        public void TestLabeledNotSet()
        {
            Grammar g = new Grammar(
                "parser grammar P;\n" +
                "tokens { A; B; C; }\n" +
                "a : t=~A ;\n" );
            string expecting =
                ".s0->.s1\n" +
                ".s1->.s2\n" +
                ".s2-B..C->.s3\n" +
                ".s3->:s4\n" +
                ":s4-EOF->.s5\n";
            checkRule( g, "a", expecting );

            string expectingGrammarStr =
                "1:8: parser grammar P;\n" +
                "a : t=~ A ;";
            assertEquals( expectingGrammarStr, g.ToString() );
        }
开发者ID:bszafko,项目名称:antlrcs,代码行数:19,代码来源:TestNFAConstruction.cs

示例5: TestLabeledNotBlockSet

        public void TestLabeledNotBlockSet()
        {
            Grammar g = new Grammar(
                "lexer grammar P;\n" +
                "A : t=~('3'|'b') ;\n" );
            string expecting =
                ".s0->.s1\n" +
                ".s1->.s2\n" +
                ".s2-{'\\u0000'..'2', '4'..'a', 'c'..'\\uFFFF'}->.s3\n" +
                ".s3->:s4\n" +
                ":s4-<EOT>->.s5\n";
            checkRule( g, "A", expecting );

            string expectingGrammarStr =
                "1:7: lexer grammar P;\n" +
                "A : t=~ ( '3' | 'b' ) ;\n" +
                "Tokens : A ;";
            assertEquals( expectingGrammarStr, g.ToString() );
        }
开发者ID:bszafko,项目名称:antlrcs,代码行数:19,代码来源:TestNFAConstruction.cs

示例6: TestNotSetLoop

        public void TestNotSetLoop()
        {
            Grammar g = new Grammar(
                "lexer grammar P;\n" +
                "A : ~('3')* ;\n" );
            string expecting =
                ".s0->.s1\n" +
                ".s1->.s2\n" +
                ".s2->.s3\n" +
                ".s2->.s9\n" +
                ".s3->.s4\n" +
                ".s4-{'\\u0000'..'2', '4'..'\\uFFFF'}->.s5\n" +
                ".s5->.s3\n" +
                ".s5->.s6\n" +
                ".s6->:s7\n" +
                ".s9->.s6\n" +
                ":s7-<EOT>->.s8\n";
            checkRule( g, "A", expecting );

            string expectingGrammarStr =
                "1:7: lexer grammar P;\n" +
                "A : (~ ( '3' ) )* ;\n" +
                "Tokens : A ;";
            assertEquals( expectingGrammarStr, g.ToString() );
        }
开发者ID:bszafko,项目名称:antlrcs,代码行数:25,代码来源:TestNFAConstruction.cs


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