private Statement[] GetStatements(TSqlParser.Sql_clausesContext context)
 {
     Statement[] result;
     if (context != null)
     {
         result = context.sql_clause().Select(clause => (Statement)Visit(clause)).ToArray();
     }
     else
     {
         result = ArrayUtils <Statement> .EmptyArray;
     }
     return(result);
 }
Example #2
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);
        }
Example #3
0
 public override void ExitSql_clauses([NotNull] TSqlParser.Sql_clausesContext context)
 {
     base.ExitSql_clauses(context);
     Debug.WriteLine("ExitSql_clause");
     Debug.WriteLine(context.GetText());
 }