當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。