Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Action <string> writeLine;

#if LEGACY_PCL
            var writeLineMethod = typeof(int).Assembly.GetType("Console").GetMethod("WriteLine", new[] { typeof(string) });
            writeLine = (Action <string>)Delegate.CreateDelegate(typeof(Action <string>), writeLineMethod);
#else
            writeLine = Console.WriteLine;
#endif

            var lexer1  = new global::DotnetValidation.GrammarLexer(new AntlrInputStream("keys"));
            var parser1 = new GrammarParser(new CommonTokenStream(lexer1));
            var tree1   = parser1.keys();
            writeLine(tree1.ToStringTree(parser1));

            var lexer2  = new global::DotnetValidation.GrammarLexer(new AntlrInputStream("values"));
            var parser2 = new GrammarParser(new CommonTokenStream(lexer2));
            var tree2   = parser2.values();
            writeLine(tree2.ToStringTree(parser2));

            var lexer  = new global::DotnetValidation.GrammarLexer(new AntlrInputStream("text"));
            var parser = new GrammarParser(new CommonTokenStream(lexer));
            var tree   = parser.compilationUnit();
            writeLine(tree.ToStringTree(parser));

            var subLexer  = new global::DotnetValidation.SubFolder.SubGrammarLexer(new AntlrInputStream("text"));
            var subParser = new SubFolder.SubGrammarParser(new CommonTokenStream(subLexer));
            var subTree   = subParser.compilationUnit();
            writeLine(subTree.ToStringTree(subParser));
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var lexer1  = new global::DotnetValidation.GrammarLexer(new AntlrInputStream("keys"));
            var parser1 = new GrammarParser(new CommonTokenStream(lexer1));
            var tree1   = parser1.keys();

            Console.WriteLine(tree1.ToStringTree(parser1));

            var lexer2  = new global::DotnetValidation.GrammarLexer(new AntlrInputStream("values"));
            var parser2 = new GrammarParser(new CommonTokenStream(lexer2));
            var tree2   = parser2.values();

            Console.WriteLine(tree2.ToStringTree(parser2));

            var lexer  = new global::DotnetValidation.GrammarLexer(new AntlrInputStream("text"));
            var parser = new GrammarParser(new CommonTokenStream(lexer));
            var tree   = parser.compilationUnit();

            Console.WriteLine(tree.ToStringTree(parser));

            var subLexer  = new global::DotnetValidation.SubFolder.SubGrammarLexer(new AntlrInputStream("text"));
            var subParser = new SubFolder.SubGrammarParser(new CommonTokenStream(subLexer));
            var subTree   = subParser.compilationUnit();

            Console.WriteLine(subTree.ToStringTree(subParser));
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var lexer  = new GrammarLexer(new ANTLRStringStream("text"));
            var parser = new GrammarParser(new CommonTokenStream(lexer));
            var tree   = parser.compilationUnit();

            Console.WriteLine(new DotTreeGenerator().ToDot((ITree)tree.Tree));
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            var lexer  = new GrammarLexer(new ANTLRStringStream("text"));
            var parser = new GrammarParser(new CommonTokenStream(lexer));
            var tree   = parser.compilationUnit();

            Action <string> writeLine;

#if LEGACY_PCL
            var writeLineMethod = typeof(int).Assembly.GetType("Console").GetMethod("WriteLine", new[] { typeof(string) });
            writeLine = (Action <string>)Delegate.CreateDelegate(typeof(Action <string>), writeLineMethod);
#else
            writeLine = Console.WriteLine;
#endif

            writeLine(new DotTreeGenerator().ToDot((ITree)tree.Tree));
        }