Esempio n. 1
0
        private void Boo(string input)
        {
            Debug.WriteLine("Boo");
            AntlrInputStream  antlrInput = new AntlrInputStream(input);
            TSqlLexer         lexer      = new TSqlLexer(antlrInput);
            CommonTokenStream tokens     = new CommonTokenStream(lexer);
            TSqlParser        parser     = new TSqlParser(tokens);

            TSqlParserListenerExtended listener = new TSqlParserListenerExtended();

            parser.search_condition().EnterRule(listener);
        }
Esempio n. 2
0
        private void Bar(string input)
        {
            Debug.WriteLine("Bar");
            AntlrInputStream  inputStream        = new AntlrInputStream(input);
            TSqlLexer         lexer              = new TSqlLexer(inputStream);
            CommonTokenStream tokens             = new CommonTokenStream(lexer);
            TSqlParser        parser             = new TSqlParser(tokens);
            var                        parseTree = parser.select_statement();
            ParseTreeWalker            walker    = new ParseTreeWalker();
            TSqlParserListenerExtended loader    = new TSqlParserListenerExtended();

            walker.Walk(loader, parseTree);
        }
Esempio n. 3
0
        private void ParseInput(string input)
        {
            AntlrInputStream           inputStream       = new AntlrInputStream(input);
            TSqlLexer                  sqlLexer          = new TSqlLexer(inputStream);
            CommonTokenStream          commonTokenStream = new CommonTokenStream(sqlLexer);
            TSqlParser                 sqlParser         = new TSqlParser(commonTokenStream);
            TSqlParserListenerExtended listener          = new TSqlParserListenerExtended();

            TSqlParser.ExpressionContext expressionContext = sqlParser.expression();

            //TSqlVisitor visitor = new TSqlVisitor();
            //visitor.Visit(expressionContext);

            MessageBox.Show("Done");
        }
Esempio n. 4
0
        private void ParseListener(string input)
        {
            TSqlLexer         lexer  = new TSqlLexer(new AntlrInputStream(input));
            CommonTokenStream tokens = new CommonTokenStream(lexer);
            TSqlParser        parser = new TSqlParser(tokens);

            TSqlParser.Select_statementContext selectStatement   = new TSqlParser.Select_statementContext(parser.Context, 0);
            TSqlParser.Select_list_elemContext selectElements    = new TSqlParser.Select_list_elemContext(parser.Context, 0);
            TSqlParser.Select_listContext      selectListContext = new TSqlParser.Select_listContext(parser.Context, 0);
            TSqlParser.Sql_clauseContext       sqlClauseContext  = new TSqlParser.Sql_clauseContext(parser.Context, 0);
            TSqlParser.Sql_clausesContext      clasesContext     = new TSqlParser.Sql_clausesContext(parser.Context, 0);
            ParseTreeWalker            walker   = new ParseTreeWalker();
            TSqlParserListenerExtended listener = new TSqlParserListenerExtended();

            walker.Walk(listener, selectStatement);
            walker.Walk(listener, selectListContext);
            walker.Walk(listener, selectElements);
            walker.Walk(listener, sqlClauseContext);
            walker.Walk(listener, clasesContext);
        }
Esempio n. 5
0
        private void Boom(string input)
        {
            Debug.WriteLine("Boom");
            AntlrInputStream  inputStream = new AntlrInputStream(input);
            TSqlLexer         lexer       = new TSqlLexer(inputStream);
            CommonTokenStream tokens      = new CommonTokenStream(lexer);
            TSqlParser        parser      = new TSqlParser(tokens);
            // these all appear to work in some way
            var parseTree = parser.dml_clause();
            //var parseTree = parser.query_specification();
            //var parseTree = parser.query_expression();
            ParseTreeWalker            walker = new ParseTreeWalker();
            TSqlParserListenerExtended loader = new TSqlParserListenerExtended();

            walker.Walk(loader, parseTree);
            Debug.WriteLine("---");
            Debug.WriteLine(parseTree.ToStringTree(parser));

            var item = lexer.Vocabulary;

            Debug.WriteLine("");
        }