Exemple #1
0
        public override object VisitParse([NotNull] SqlParser.ParseContext context)
        {
            if (context.exception != null)
            {
                throw new SQLParseException($"Incorrect syntax near '{context.exception.OffendingToken.Text}'");
            }

            if (context.ChildCount > 2)
            {
                throw new SQLParseException($"Incorrect syntax near '{context.GetChild(1)}'");
            }

            object result = null;

            if (context.sql_stmt_list() != null)
            {
                result = VisitSql_stmt_list(context.sql_stmt_list());
            }
            else
            {
                throw new SQLParseException($"Incorrect syntax near '{context.GetChild(0)}'");
            }

            return(result);
        }
 /// <summary>
 /// Visit a parse tree produced by <see cref="SqlParser.parse"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitParse([NotNull] SqlParser.ParseContext context)
 {
     return(VisitChildren(context));
 }