HyriseSQLParser/src/parser/bison_parser.cpp

2887 lines
96 KiB
C++
Raw Normal View History

/* A Bison parser, made by GNU Bison 3.0.2. */
/* Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "3.0.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */
#define YYPURE 2
/* Push parsers. */
#define YYPUSH 0
/* Pull parsers. */
#define YYPULL 1
/* Substitute the type names. */
#define YYSTYPE HSQL_STYPE
#define YYLTYPE HSQL_LTYPE
/* Substitute the variable and function names. */
#define yyparse hsql_parse
#define yylex hsql_lex
#define yyerror hsql_error
#define yydebug hsql_debug
#define yynerrs hsql_nerrs
/* Copy the first part of user declarations. */
#line 1 "bison_parser.y" /* yacc.c:339 */
/**
* bison_parser.y
* defines bison_parser.h
* outputs bison_parser.c
*
* Grammar File Spec: http://dinosaur.compilertools.net/bison/bison_6.html
*
*/
/*********************************
** Section 1: C Declarations
*********************************/
#include "bison_parser.h"
#include "flex_lexer.h"
#include <stdio.h>
using namespace hsql;
int yyerror(YYLTYPE* llocp, SQLParserResult** result, yyscan_t scanner, const char *msg) {
SQLParserResult* list = new SQLParserResult();
list->isValid = false;
2016-02-27 14:45:59 +01:00
list->errorMsg = strdup(msg);
list->errorLine = llocp->first_line;
list->errorColumn = llocp->first_column;
*result = list;
return 0;
}
#line 110 "bison_parser.cpp" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# else
# define YY_NULLPTR 0
# endif
# endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 1
#endif
/* In a future release of Bison, this section will be replaced
by #include "bison_parser.h". */
#ifndef YY_HSQL_BISON_PARSER_H_INCLUDED
# define YY_HSQL_BISON_PARSER_H_INCLUDED
/* Debug traces. */
#ifndef HSQL_DEBUG
# if defined YYDEBUG
#if YYDEBUG
# define HSQL_DEBUG 1
# else
# define HSQL_DEBUG 0
# endif
# else /* ! defined YYDEBUG */
# define HSQL_DEBUG 0
# endif /* ! defined YYDEBUG */
#endif /* ! defined HSQL_DEBUG */
#if HSQL_DEBUG
extern int hsql_debug;
#endif
/* "%code requires" blocks. */
#line 42 "bison_parser.y" /* yacc.c:355 */
// %code requires block
#include "../sql/statements.h"
#include "../SQLParserResult.h"
#include "parser_typedef.h"
// Auto update column and line number
#define YY_USER_ACTION \
yylloc->first_line = yylloc->last_line; \
yylloc->first_column = yylloc->last_column; \
for(int i = 0; yytext[i] != '\0'; i++) { \
yylloc->total_column++; \
if(yytext[i] == '\n') { \
yylloc->last_line++; \
yylloc->last_column = 0; \
} \
else { \
yylloc->last_column++; \
} \
}
#line 171 "bison_parser.cpp" /* yacc.c:355 */
/* Token type. */
#ifndef HSQL_TOKENTYPE
# define HSQL_TOKENTYPE
enum hsql_tokentype
{
SQL_IDENTIFIER = 258,
SQL_STRING = 259,
SQL_FLOATVAL = 260,
SQL_INTVAL = 261,
SQL_NOTEQUALS = 262,
SQL_LESSEQ = 263,
SQL_GREATEREQ = 264,
SQL_DEALLOCATE = 265,
SQL_PARAMETERS = 266,
SQL_INTERSECT = 267,
SQL_TEMPORARY = 268,
SQL_TIMESTAMP = 269,
SQL_DISTINCT = 270,
SQL_NVARCHAR = 271,
SQL_RESTRICT = 272,
SQL_TRUNCATE = 273,
SQL_ANALYZE = 274,
SQL_BETWEEN = 275,
SQL_CASCADE = 276,
SQL_COLUMNS = 277,
SQL_CONTROL = 278,
SQL_DEFAULT = 279,
SQL_EXECUTE = 280,
SQL_EXPLAIN = 281,
SQL_HISTORY = 282,
SQL_INTEGER = 283,
SQL_NATURAL = 284,
SQL_PREPARE = 285,
SQL_PRIMARY = 286,
SQL_SCHEMAS = 287,
SQL_SPATIAL = 288,
SQL_VIRTUAL = 289,
SQL_BEFORE = 290,
SQL_COLUMN = 291,
SQL_CREATE = 292,
SQL_DELETE = 293,
SQL_DIRECT = 294,
SQL_DOUBLE = 295,
SQL_ESCAPE = 296,
SQL_EXCEPT = 297,
SQL_EXISTS = 298,
SQL_GLOBAL = 299,
SQL_HAVING = 300,
SQL_IMPORT = 301,
SQL_INSERT = 302,
SQL_ISNULL = 303,
SQL_OFFSET = 304,
SQL_RENAME = 305,
SQL_SCHEMA = 306,
SQL_SELECT = 307,
SQL_SORTED = 308,
SQL_TABLES = 309,
SQL_UNIQUE = 310,
SQL_UNLOAD = 311,
SQL_UPDATE = 312,
SQL_VALUES = 313,
SQL_AFTER = 314,
SQL_ALTER = 315,
SQL_CROSS = 316,
SQL_DELTA = 317,
SQL_GROUP = 318,
SQL_INDEX = 319,
SQL_INNER = 320,
SQL_LIMIT = 321,
SQL_LOCAL = 322,
SQL_MERGE = 323,
SQL_MINUS = 324,
SQL_ORDER = 325,
SQL_OUTER = 326,
SQL_RIGHT = 327,
SQL_TABLE = 328,
SQL_UNION = 329,
SQL_USING = 330,
SQL_WHERE = 331,
SQL_CALL = 332,
SQL_DATE = 333,
SQL_DESC = 334,
SQL_DROP = 335,
SQL_FILE = 336,
SQL_FROM = 337,
SQL_FULL = 338,
SQL_HASH = 339,
SQL_HINT = 340,
SQL_INTO = 341,
SQL_JOIN = 342,
SQL_LEFT = 343,
SQL_LIKE = 344,
SQL_LOAD = 345,
SQL_NULL = 346,
SQL_PART = 347,
SQL_PLAN = 348,
SQL_SHOW = 349,
SQL_TEXT = 350,
SQL_TIME = 351,
SQL_VIEW = 352,
SQL_WITH = 353,
SQL_ADD = 354,
SQL_ALL = 355,
SQL_AND = 356,
SQL_ASC = 357,
SQL_CSV = 358,
SQL_FOR = 359,
SQL_INT = 360,
SQL_KEY = 361,
SQL_NOT = 362,
SQL_OFF = 363,
SQL_SET = 364,
SQL_TBL = 365,
SQL_TOP = 366,
SQL_AS = 367,
SQL_BY = 368,
SQL_IF = 369,
SQL_IN = 370,
SQL_IS = 371,
SQL_OF = 372,
SQL_ON = 373,
SQL_OR = 374,
SQL_TO = 375,
SQL_EQUALS = 376,
SQL_LESS = 377,
SQL_GREATER = 378,
SQL_NOTNULL = 379,
SQL_UMINUS = 380
};
#endif
/* Value type. */
#if ! defined HSQL_STYPE && ! defined HSQL_STYPE_IS_DECLARED
typedef union HSQL_STYPE HSQL_STYPE;
union HSQL_STYPE
{
#line 101 "bison_parser.y" /* yacc.c:355 */
double fval;
int64_t ival;
char* sval;
uint uval;
bool bval;
hsql::SQLStatement* statement;
hsql::SelectStatement* select_stmt;
hsql::ImportStatement* import_stmt;
hsql::CreateStatement* create_stmt;
hsql::InsertStatement* insert_stmt;
hsql::DeleteStatement* delete_stmt;
hsql::UpdateStatement* update_stmt;
hsql::DropStatement* drop_stmt;
hsql::PrepareStatement* prep_stmt;
hsql::ExecuteStatement* exec_stmt;
hsql::TableRef* table;
hsql::Expr* expr;
hsql::OrderDescription* order;
hsql::OrderType order_type;
hsql::LimitDescription* limit;
hsql::ColumnDefinition* column_t;
hsql::GroupByDescription* group_t;
hsql::UpdateClause* update_t;
hsql::SQLParserResult* stmt_list;
std::vector<char*>* str_vec;
std::vector<hsql::TableRef*>* table_vec;
std::vector<hsql::ColumnDefinition*>* column_vec;
std::vector<hsql::UpdateClause*>* update_vec;
std::vector<hsql::Expr*>* expr_vec;
#line 345 "bison_parser.cpp" /* yacc.c:355 */
};
# define HSQL_STYPE_IS_TRIVIAL 1
# define HSQL_STYPE_IS_DECLARED 1
#endif
/* Location type. */
#if ! defined HSQL_LTYPE && ! defined HSQL_LTYPE_IS_DECLARED
typedef struct HSQL_LTYPE HSQL_LTYPE;
struct HSQL_LTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
};
# define HSQL_LTYPE_IS_DECLARED 1
# define HSQL_LTYPE_IS_TRIVIAL 1
#endif
int hsql_parse (hsql::SQLParserResult** result, yyscan_t scanner);
#endif /* !YY_HSQL_BISON_PARSER_H_INCLUDED */
/* Copy the second part of user declarations. */
#line 373 "bison_parser.cpp" /* yacc.c:358 */
#ifdef short
# undef short
#endif
#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
typedef unsigned char yytype_uint8;
#endif
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#else
typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
typedef unsigned short int yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
typedef short int yytype_int16;
#endif
#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
# elif ! defined YYSIZE_T
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
# define YYSIZE_T unsigned int
# endif
#endif
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
# define YY_(Msgid) Msgid
# endif
#endif
#ifndef YY_ATTRIBUTE
# if (defined __GNUC__ \
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else
# define YY_ATTRIBUTE(Spec) /* empty */
# endif
#endif
#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
#if !defined _Noreturn \
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
# if defined _MSC_VER && 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(E) /* empty */
#endif
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# elif defined __BUILTIN_VA_ARG_INCR
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
# elif defined _AIX
# define YYSTACK_ALLOC __alloca
# elif defined _MSC_VER
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
/* Pacify GCC's 'empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
to allow for a few compiler-allocated temporary stack slots. */
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
# endif
# else
# define YYSTACK_ALLOC YYMALLOC
# define YYSTACK_FREE YYFREE
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (defined HSQL_LTYPE_IS_TRIVIAL && HSQL_LTYPE_IS_TRIVIAL \
&& defined HSQL_STYPE_IS_TRIVIAL && HSQL_STYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
yytype_int16 yyss_alloc;
YYSTYPE yyvs_alloc;
YYLTYPE yyls_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else
# define YYCOPY(Dst, Src, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 46
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 449
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 146
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 67
/* YYNRULES -- Number of rules. */
#define YYNRULES 145
/* YYNSTATES -- Number of states. */
#define YYNSTATES 257
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 380
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, without out-of-bounds checking. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 132, 2, 2,
137, 138, 130, 128, 144, 129, 139, 131, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 141, 140,
123, 121, 124, 145, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 135, 2, 136, 133, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 142, 2, 143, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 122, 125, 126, 127,
134
};
#if HSQL_DEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 229, 229, 236, 237, 241, 246, 251, 252, 253,
254, 255, 256, 257, 258, 259, 267, 272, 280, 284,
296, 304, 308, 318, 324, 333, 334, 338, 339, 343,
350, 351, 352, 353, 363, 367, 379, 387, 399, 405,
415, 416, 426, 435, 436, 440, 452, 453, 457, 458,
462, 467, 479, 480, 481, 485, 496, 497, 501, 506,
511, 512, 516, 521, 525, 526, 529, 530, 534, 535,
536, 541, 542, 543, 550, 551, 555, 556, 560, 567,
568, 569, 570, 571, 575, 576, 577, 581, 582, 586,
587, 588, 589, 590, 591, 592, 593, 594, 595, 596,
601, 602, 603, 604, 605, 606, 610, 614, 615, 619,
620, 621, 625, 630, 631, 635, 639, 644, 655, 656,
666, 667, 673, 678, 679, 684, 694, 702, 703, 708,
709, 713, 714, 722, 734, 735, 736, 737, 738, 744,
750, 754, 763, 764, 769, 770
};
#endif
#if HSQL_DEBUG || YYERROR_VERBOSE || 1
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
"$end", "error", "$undefined", "IDENTIFIER", "STRING", "FLOATVAL",
"INTVAL", "NOTEQUALS", "LESSEQ", "GREATEREQ", "DEALLOCATE", "PARAMETERS",
"INTERSECT", "TEMPORARY", "TIMESTAMP", "DISTINCT", "NVARCHAR",
"RESTRICT", "TRUNCATE", "ANALYZE", "BETWEEN", "CASCADE", "COLUMNS",
"CONTROL", "DEFAULT", "EXECUTE", "EXPLAIN", "HISTORY", "INTEGER",
"NATURAL", "PREPARE", "PRIMARY", "SCHEMAS", "SPATIAL", "VIRTUAL",
"BEFORE", "COLUMN", "CREATE", "DELETE", "DIRECT", "DOUBLE", "ESCAPE",
"EXCEPT", "EXISTS", "GLOBAL", "HAVING", "IMPORT", "INSERT", "ISNULL",
"OFFSET", "RENAME", "SCHEMA", "SELECT", "SORTED", "TABLES", "UNIQUE",
"UNLOAD", "UPDATE", "VALUES", "AFTER", "ALTER", "CROSS", "DELTA",
"GROUP", "INDEX", "INNER", "LIMIT", "LOCAL", "MERGE", "MINUS", "ORDER",
"OUTER", "RIGHT", "TABLE", "UNION", "USING", "WHERE", "CALL", "DATE",
"DESC", "DROP", "FILE", "FROM", "FULL", "HASH", "HINT", "INTO", "JOIN",
"LEFT", "LIKE", "LOAD", "NULL", "PART", "PLAN", "SHOW", "TEXT", "TIME",
"VIEW", "WITH", "ADD", "ALL", "AND", "ASC", "CSV", "FOR", "INT", "KEY",
"NOT", "OFF", "SET", "TBL", "TOP", "AS", "BY", "IF", "IN", "IS", "OF",
"ON", "OR", "TO", "'='", "EQUALS", "'<'", "'>'", "LESS", "GREATER",
"NOTNULL", "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "UMINUS", "'['",
"']'", "'('", "')'", "'.'", "';'", "':'", "'{'", "'}'", "','", "'?'",
"$accept", "input", "statement_list", "statement",
"preparable_statement", "prepare_statement", "execute_statement",
"import_statement", "import_file_type", "file_path", "create_statement",
"opt_not_exists", "column_def_commalist", "column_def", "column_type",
"drop_statement", "delete_statement", "truncate_statement",
"insert_statement", "opt_column_list", "update_statement",
"update_clause_commalist", "update_clause", "select_statement",
"select_with_paren", "select_no_paren", "set_operator", "select_clause",
"opt_distinct", "select_list", "from_clause", "opt_where", "opt_group",
"opt_having", "opt_order", "opt_order_type", "opt_limit", "expr_list",
"literal_list", "expr_alias", "expr", "scalar_expr", "unary_expr",
"binary_expr", "comp_expr", "function_expr", "column_name", "literal",
"string_literal", "num_literal", "int_literal", "star_expr",
"placeholder_expr", "table_ref", "table_ref_atomic",
"table_ref_commalist", "table_ref_name", "table_ref_name_no_alias",
"table_name", "alias", "opt_alias", "join_clause", "opt_join_type",
"join_table", "join_condition", "opt_semicolon", "ident_commalist", YY_NULLPTR
};
#endif
# ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
(internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
375, 61, 376, 60, 62, 377, 378, 379, 43, 45,
42, 47, 37, 94, 380, 91, 93, 40, 41, 46,
59, 58, 123, 125, 44, 63
};
# endif
#define YYPACT_NINF -209
#define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-209)))
#define YYTABLE_NINF -141
#define yytable_value_is_error(Yytable_value) \
(!!((Yytable_value) == (-141)))
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
static const yytype_int16 yypact[] =
{
212, 0, 32, 35, 72, -26, -3, -1, -6, 68,
32, 25, -34, 99, -36, -209, -209, -209, -209, -209,
-209, -209, -209, -209, -209, -209, -209, -209, -209, 80,
102, -33, -209, -30, -99, 10, 32, 16, 32, -209,
8, 14, -209, 32, -24, -13, -209, 212, -209, -209,
-209, 13, -209, 60, 62, -209, 126, 11, 64, 212,
27, 32, 67, -209, 55, 18, -66, -209, -209, -209,
8, 8, -209, 8, -209, 65, 2, -209, 124, -209,
-209, -209, -209, -209, -209, -209, -209, -209, -209, -209,
-209, 148, -209, -209, -209, -209, 8, 87, 152, -209,
-209, -112, -209, -209, -36, 116, -59, 8, -209, 159,
163, -25, 68, 172, 280, -45, 41, 3, 67, 8,
-209, 8, 8, 8, 8, 8, 89, 173, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, -209, -209,
73, -54, -209, 183, 62, 136, -209, 11, 45, -209,
83, 193, 231, 111, -209, -209, -107, 61, -209, 8,
-209, -209, -34, -209, 66, 96, 6, -209, 5, 141,
-209, 316, 252, 252, 316, 280, 8, -209, 267, 316,
252, 252, -45, -45, 75, 75, 75, -209, 11, 148,
-209, -209, -209, -209, -209, 152, -209, -209, 118, 44,
-98, -209, 32, -209, 202, 11, 88, 76, 3, -209,
-209, -209, -209, -209, 119, 110, -209, 316, -209, -209,
-209, 159, -209, -209, -209, -209, -209, -209, 193, -209,
-209, -93, -209, 6, -209, 71, 4, 8, -209, -209,
-209, 115, 3, -34, -209, 106, -35, -209, 90, 8,
8, -209, 6, 231, -209, 231, -209
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
Performed when YYTABLE does not specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 57,
0, 0, 0, 0, 143, 3, 6, 5, 15, 8,
9, 14, 11, 12, 10, 13, 7, 46, 47, 67,
0, 127, 37, 18, 0, 26, 0, 0, 0, 56,
0, 0, 126, 0, 0, 0, 1, 142, 2, 53,
54, 0, 52, 0, 73, 35, 0, 0, 0, 0,
0, 0, 61, 21, 0, 41, 107, 112, 113, 115,
0, 0, 116, 0, 117, 0, 58, 74, 132, 80,
81, 82, 89, 83, 84, 86, 109, 110, 114, 85,
111, 0, 34, 49, 48, 4, 0, 67, 0, 50,
128, 0, 76, 16, 143, 0, 0, 0, 36, 0,
0, 0, 57, 0, 88, 87, 0, 0, 61, 0,
130, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 131, 78,
0, 61, 43, 70, 73, 71, 19, 0, 0, 25,
0, 0, 60, 0, 22, 144, 0, 0, 39, 0,
108, 79, 0, 59, 118, 120, 132, 122, 138, 63,
75, 101, 104, 105, 98, 96, 0, 129, 97, 100,
102, 103, 91, 90, 93, 92, 94, 95, 0, 0,
42, 69, 68, 66, 51, 0, 77, 17, 0, 0,
0, 27, 0, 40, 0, 0, 0, 0, 0, 125,
134, 135, 137, 136, 0, 0, 55, 99, 45, 44,
72, 0, 31, 32, 33, 30, 29, 24, 0, 20,
145, 0, 106, 0, 123, 119, 0, 0, 23, 28,
38, 121, 0, 0, 140, 0, 65, 124, 0, 0,
0, 62, 0, 141, 133, 64, 139
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-209, -209, 168, 182, 174, -209, -209, -209, -209, 12,
-209, -209, -209, 7, -209, -209, -209, -209, -209, -209,
-209, -209, 52, -143, 222, 9, -209, 191, 134, -209,
-209, -89, -209, -209, 154, -209, 121, 26, 63, 147,
-68, -209, -209, -209, -209, -209, -209, -53, -108, -209,
-78, -209, -209, -209, -184, -209, 31, -209, -2, -208,
104, -209, -209, 37, -209, 167, -209
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
-1, 13, 14, 15, 16, 17, 18, 19, 64, 153,
20, 61, 200, 201, 226, 21, 22, 23, 24, 111,
25, 141, 142, 26, 27, 28, 53, 29, 40, 75,
118, 108, 216, 251, 54, 193, 99, 76, 101, 77,
78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 163, 164, 235, 165, 41, 166, 138,
139, 167, 214, 168, 254, 48, 156
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule whose
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int16 yytable[] =
{
32, 154, 114, 115, 102, 116, 31, 31, 42, 120,
250, 66, 67, 68, 69, 67, 68, 69, 9, 207,
145, 45, 107, 150, 234, 241, 146, 9, 143, 169,
30, 203, 147, 157, 62, 31, 65, 204, 33, 152,
227, 92, 58, 59, 256, 240, 228, 35, 121, 122,
123, 147, 190, 171, 172, 173, 174, 175, 247, 106,
178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
210, 112, 222, 113, 1, 34, 211, 212, 151, 36,
38, 37, 2, 39, 223, 134, 135, 136, 137, 3,
189, 206, 49, 213, 196, 121, 122, 123, 43, 46,
248, 5, 6, 12, 47, 55, 56, 57, 217, 119,
7, 8, 9, 154, 93, 70, 9, 220, 127, 63,
158, 10, 50, 91, 60, 94, 96, 120, 98, 100,
124, 121, 122, 123, 105, 218, 109, 71, 72, 224,
162, 243, 125, 107, 11, 73, 119, 117, 126, 225,
51, 140, 102, 74, 52, 110, 74, 51, 69, 149,
128, -140, 129, 67, 130, 131, 155, -140, -140, 132,
133, 134, 135, 136, 137, 160, 177, 124, 176, 161,
-139, 253, 255, -140, -140, 195, -139, -139, 197, 125,
121, 122, 123, 198, 188, 126, 199, 202, 205, 221,
229, 12, -139, -139, 215, 230, 236, 128, 137, 129,
208, 130, 131, 124, 233, 242, 132, 133, 134, 135,
136, 137, 1, 237, 249, 125, 232, 104, 252, 95,
2, 126, 103, 238, 44, 239, 127, 3, 121, 122,
123, 219, 4, 128, 97, 129, 159, 130, 131, 5,
6, 144, 132, 133, 134, 135, 136, 137, 7, 8,
-141, -141, 191, 246, 9, 194, 170, 244, 231, 10,
209, 148, 124, 245, 121, 122, 123, 0, 0, 0,
0, 0, 0, 0, 125, 192, 0, 121, 122, 123,
126, 0, 11, 0, 0, 0, 0, 0, 0, 0,
0, 0, 128, 0, 129, 0, 130, 131, 0, 0,
0, 132, 133, 134, 135, 136, 137, 0, 0, 0,
124, 0, 0, 121, 122, 123, 0, 0, 0, 0,
0, 0, 125, 0, 0, 0, 0, 0, 126, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 12,
128, 0, 129, 0, 130, 131, 124, 0, 0, 132,
133, 134, 135, 136, 137, 0, 0, 0, 125, 124,
0, 0, 0, 0, 126, -141, -141, 0, 0, 0,
132, 133, 134, 135, 136, 137, 0, 126, 129, 0,
130, 131, 0, 0, 0, 132, 133, 134, 135, 136,
137, 129, 0, 130, 131, 124, 0, 0, 132, 133,
134, 135, 136, 137, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 129, 0, 130,
131, 0, 0, 0, 132, 133, 134, 135, 136, 137
};
static const yytype_int16 yycheck[] =
{
2, 109, 70, 71, 57, 73, 3, 3, 10, 3,
45, 3, 4, 5, 6, 4, 5, 6, 52, 162,
98, 12, 76, 82, 208, 233, 138, 52, 96, 118,
30, 138, 144, 58, 36, 3, 38, 144, 3, 107,
138, 43, 141, 142, 252, 138, 144, 73, 7, 8,
9, 144, 141, 121, 122, 123, 124, 125, 242, 61,
128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
65, 137, 28, 139, 10, 3, 71, 72, 137, 82,
86, 82, 18, 15, 40, 130, 131, 132, 133, 25,
144, 159, 12, 88, 147, 7, 8, 9, 73, 0,
243, 37, 38, 137, 140, 3, 139, 137, 176, 144,
46, 47, 52, 221, 138, 107, 52, 195, 112, 103,
111, 57, 42, 109, 114, 138, 113, 3, 66, 3,
89, 7, 8, 9, 107, 188, 81, 129, 130, 95,
137, 137, 101, 76, 80, 137, 144, 82, 107, 105,
70, 3, 205, 145, 74, 137, 145, 70, 6, 43,
119, 65, 121, 4, 123, 124, 3, 71, 72, 128,
129, 130, 131, 132, 133, 3, 3, 89, 89, 138,
65, 249, 250, 87, 88, 49, 71, 72, 143, 101,
7, 8, 9, 110, 121, 107, 3, 86, 137, 81,
202, 137, 87, 88, 63, 3, 87, 119, 133, 121,
144, 123, 124, 89, 138, 144, 128, 129, 130, 131,
132, 133, 10, 113, 118, 101, 138, 59, 138, 47,
18, 107, 58, 221, 12, 228, 112, 25, 7, 8,
9, 189, 30, 119, 53, 121, 112, 123, 124, 37,
38, 97, 128, 129, 130, 131, 132, 133, 46, 47,
8, 9, 79, 237, 52, 144, 119, 236, 205, 57,
166, 104, 89, 236, 7, 8, 9, -1, -1, -1,
-1, -1, -1, -1, 101, 102, -1, 7, 8, 9,
107, -1, 80, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 119, -1, 121, -1, 123, 124, -1, -1,
-1, 128, 129, 130, 131, 132, 133, -1, -1, -1,
89, -1, -1, 7, 8, 9, -1, -1, -1, -1,
-1, -1, 101, -1, -1, -1, -1, -1, 107, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 137,
119, -1, 121, -1, 123, 124, 89, -1, -1, 128,
129, 130, 131, 132, 133, -1, -1, -1, 101, 89,
-1, -1, -1, -1, 107, 123, 124, -1, -1, -1,
128, 129, 130, 131, 132, 133, -1, 107, 121, -1,
123, 124, -1, -1, -1, 128, 129, 130, 131, 132,
133, 121, -1, 123, 124, 89, -1, -1, 128, 129,
130, 131, 132, 133, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 121, -1, 123,
124, -1, -1, -1, 128, 129, 130, 131, 132, 133
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 10, 18, 25, 30, 37, 38, 46, 47, 52,
57, 80, 137, 147, 148, 149, 150, 151, 152, 153,
156, 161, 162, 163, 164, 166, 169, 170, 171, 173,
30, 3, 204, 3, 3, 73, 82, 82, 86, 15,
174, 203, 204, 73, 170, 171, 0, 140, 211, 12,
42, 70, 74, 172, 180, 3, 139, 137, 141, 142,
114, 157, 204, 103, 154, 204, 3, 4, 5, 6,
107, 129, 130, 137, 145, 175, 183, 185, 186, 187,
188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
198, 109, 204, 138, 138, 149, 113, 173, 66, 182,
3, 184, 193, 150, 148, 107, 204, 76, 177, 81,
137, 165, 137, 139, 186, 186, 186, 82, 176, 144,
3, 7, 8, 9, 89, 101, 107, 112, 119, 121,
123, 124, 128, 129, 130, 131, 132, 133, 205, 206,
3, 167, 168, 186, 180, 196, 138, 144, 211, 43,
82, 137, 186, 155, 194, 3, 212, 58, 171, 174,
3, 138, 137, 199, 200, 202, 204, 207, 209, 177,
185, 186, 186, 186, 186, 186, 89, 3, 186, 186,
186, 186, 186, 186, 186, 186, 186, 186, 121, 144,
177, 79, 102, 181, 182, 49, 193, 143, 110, 3,
158, 159, 86, 138, 144, 137, 186, 169, 144, 206,
65, 71, 72, 88, 208, 63, 178, 186, 193, 168,
196, 81, 28, 40, 95, 105, 160, 138, 144, 204,
3, 184, 138, 138, 200, 201, 87, 113, 155, 159,
138, 205, 144, 137, 202, 209, 183, 200, 169, 118,
45, 179, 138, 186, 210, 186, 205
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
0, 146, 147, 148, 148, 149, 149, 150, 150, 150,
150, 150, 150, 150, 150, 150, 151, 151, 152, 152,
153, 154, 155, 156, 156, 157, 157, 158, 158, 159,
160, 160, 160, 160, 161, 161, 162, 163, 164, 164,
165, 165, 166, 167, 167, 168, 169, 169, 170, 170,
171, 171, 172, 172, 172, 173, 174, 174, 175, 176,
177, 177, 178, 178, 179, 179, 180, 180, 181, 181,
181, 182, 182, 182, 183, 183, 184, 184, 185, 186,
186, 186, 186, 186, 187, 187, 187, 188, 188, 189,
189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
190, 190, 190, 190, 190, 190, 191, 192, 192, 193,
193, 193, 194, 195, 195, 196, 197, 198, 199, 199,
200, 200, 200, 201, 201, 202, 203, 204, 204, 205,
205, 206, 206, 207, 208, 208, 208, 208, 208, 209,
209, 210, 211, 211, 212, 212
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 2, 1, 3, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 4, 6, 2, 5,
7, 1, 1, 8, 7, 3, 0, 1, 3, 2,
1, 1, 1, 1, 3, 3, 4, 2, 8, 5,
3, 0, 5, 1, 3, 3, 1, 1, 3, 3,
3, 5, 1, 1, 1, 6, 1, 0, 1, 2,
2, 0, 4, 0, 2, 0, 4, 0, 1, 1,
0, 2, 4, 0, 1, 3, 1, 3, 2, 3,
1, 1, 1, 1, 1, 1, 1, 2, 2, 1,
3, 3, 3, 3, 3, 3, 3, 3, 3, 4,
3, 3, 3, 3, 3, 3, 5, 1, 3, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1, 4, 1, 1, 3, 2, 1, 1, 3, 2,
1, 1, 0, 6, 1, 1, 1, 1, 0, 4,
1, 1, 1, 0, 1, 3
};
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
{ \
yyerror (&yylloc, result, scanner, YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (0)
/* Error token number */
#define YYTERROR 1
#define YYERRCODE 256
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (N) \
{ \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
} \
else \
{ \
(Current).first_line = (Current).last_line = \
YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
while (0)
#endif
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
/* Enable debugging if requested. */
#if HSQL_DEBUG
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
/* YY_LOCATION_PRINT -- Print the location on the stream.
This macro was not mandated originally: define only if we know
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
# if defined HSQL_LTYPE_IS_TRIVIAL && HSQL_LTYPE_IS_TRIVIAL
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
YY_ATTRIBUTE_UNUSED
static unsigned
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
{
unsigned res = 0;
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
if (0 <= yylocp->first_line)
{
res += YYFPRINTF (yyo, "%d", yylocp->first_line);
if (0 <= yylocp->first_column)
res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
}
if (0 <= yylocp->last_line)
{
if (yylocp->first_line < yylocp->last_line)
{
res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
if (0 <= end_col)
res += YYFPRINTF (yyo, ".%d", end_col);
}
else if (0 <= end_col && yylocp->first_column < end_col)
res += YYFPRINTF (yyo, "-%d", end_col);
}
return res;
}
# define YY_LOCATION_PRINT(File, Loc) \
yy_location_print_ (File, &(Loc))
# else
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
#endif
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
Type, Value, Location, result, scanner); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
/*----------------------------------------.
| Print this symbol's value on YYOUTPUT. |
`----------------------------------------*/
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, hsql::SQLParserResult** result, yyscan_t scanner)
{
FILE *yyo = yyoutput;
YYUSE (yyo);
YYUSE (yylocationp);
YYUSE (result);
YYUSE (scanner);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
YYUSE (yytype);
}
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, hsql::SQLParserResult** result, yyscan_t scanner)
{
YYFPRINTF (yyoutput, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
YY_LOCATION_PRINT (yyoutput, *yylocationp);
YYFPRINTF (yyoutput, ": ");
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, result, scanner);
YYFPRINTF (yyoutput, ")");
}
/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included). |
`------------------------------------------------------------------*/
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
{
int yybot = *yybottom;
YYFPRINTF (stderr, " %d", yybot);
}
YYFPRINTF (stderr, "\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
static void
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, hsql::SQLParserResult** result, yyscan_t scanner)
{
unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]],
&(yyvsp[(yyi + 1) - (yynrhs)])
, &(yylsp[(yyi + 1) - (yynrhs)]) , result, scanner);
YYFPRINTF (stderr, "\n");
}
}
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (yyssp, yyvsp, yylsp, Rule, result, scanner); \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !HSQL_DEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !HSQL_DEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
#if YYERROR_VERBOSE
# ifndef yystrlen
# if defined __GLIBC__ && defined _STRING_H
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
static YYSIZE_T
yystrlen (const char *yystr)
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
continue;
return yylen;
}
# endif
# endif
# ifndef yystpcpy
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
static char *
yystpcpy (char *yydest, const char *yysrc)
{
char *yyd = yydest;
const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
return yyd - 1;
}
# endif
# endif
# ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
quotes and backslashes, so that it's suitable for yyerror. The
heuristic is that double-quoting is unnecessary unless the string
contains an apostrophe, a comma, or backslash (other than
backslash-backslash). YYSTR is taken from yytname. If YYRES is
null, do not copy; instead, return the length of what the result
would have been. */
static YYSIZE_T
yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
YYSIZE_T yyn = 0;
char const *yyp = yystr;
for (;;)
switch (*++yyp)
{
case '\'':
case ',':
goto do_not_strip_quotes;
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
/* Fall through. */
default:
if (yyres)
yyres[yyn] = *yyp;
yyn++;
break;
case '"':
if (yyres)
yyres[yyn] = '\0';
return yyn;
}
do_not_strip_quotes: ;
}
if (! yyres)
return yystrlen (yystr);
return yystpcpy (yyres, yystr) - yyres;
}
# endif
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
about the unexpected token YYTOKEN for the state stack whose top is
YYSSP.
Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
not large enough to hold the message. In that case, also set
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
required number of bytes is too large to store. */
static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
break;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
}
#endif /* YYERROR_VERBOSE */
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, hsql::SQLParserResult** result, yyscan_t scanner)
{
YYUSE (yyvaluep);
YYUSE (yylocationp);
YYUSE (result);
YYUSE (scanner);
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YYUSE (yytype);
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
/*----------.
| yyparse. |
`----------*/
int
yyparse (hsql::SQLParserResult** result, yyscan_t scanner)
{
/* The lookahead symbol. */
int yychar;
/* The semantic value of the lookahead symbol. */
/* Default value used for initialization, for pacifying older GCCs
or non-GCC compilers. */
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
/* Location data for the lookahead symbol. */
static YYLTYPE yyloc_default
# if defined HSQL_LTYPE_IS_TRIVIAL && HSQL_LTYPE_IS_TRIVIAL
= { 1, 1, 1, 1 }
# endif
;
YYLTYPE yylloc = yyloc_default;
/* Number of syntax errors so far. */
int yynerrs;
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* The stacks and their tools:
'yyss': related to states.
'yyvs': related to semantic values.
'yyls': related to locations.
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
yytype_int16 yyssa[YYINITDEPTH];
yytype_int16 *yyss;
yytype_int16 *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
/* The location stack. */
YYLTYPE yylsa[YYINITDEPTH];
YYLTYPE *yyls;
YYLTYPE *yylsp;
/* The locations where the error started and ended. */
YYLTYPE yyerror_range[3];
YYSIZE_T yystacksize;
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
int yytoken = 0;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
YYLTYPE yyloc;
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
yyssp = yyss = yyssa;
yyvsp = yyvs = yyvsa;
yylsp = yyls = yylsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
/* User initialization code. */
#line 79 "bison_parser.y" /* yacc.c:1429 */
{
// Initialize
yylloc.first_column = 0;
yylloc.last_column = 0;
yylloc.first_line = 0;
yylloc.last_line = 0;
yylloc.total_column = 0;
yylloc.placeholder_id = 0;
}
#line 1646 "bison_parser.cpp" /* yacc.c:1429 */
yylsp[0] = yylloc;
goto yysetstate;
/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate. |
`------------------------------------------------------------*/
yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
yysetstate:
*yyssp = yystate;
if (yyss + yystacksize - 1 <= yyssp)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
YYLTYPE *yyls1 = yyls;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yyls1, yysize * sizeof (*yylsp),
&yystacksize);
yyls = yyls1;
yyss = yyss1;
yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
goto yyexhaustedlab;
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
{
yytype_int16 *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
YYSTACK_RELOCATE (yyls_alloc, yyls);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
yylsp = yyls + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
if (yystate == YYFINAL)
YYACCEPT;
goto yybackup;
/*-----------.
| yybackup. |
`-----------*/
yybackup:
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = yylex (&yylval, &yylloc, scanner);
}
if (yychar <= YYEOF)
{
yychar = yytoken = YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
yytoken = YYTRANSLATE (yychar);
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
}
/* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
yyn += yytoken;
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0)
{
if (yytable_value_is_error (yyn))
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
/* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
/* Discard the shifted token. */
yychar = YYEMPTY;
yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
*++yylsp = yylloc;
goto yynewstate;
/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
/*-----------------------------.
| yyreduce -- Do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
'$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
/* Default location. */
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 2:
#line 229 "bison_parser.y" /* yacc.c:1646 */
{
*result = (yyvsp[-1].stmt_list);
}
#line 1837 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 3:
#line 236 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.stmt_list) = new SQLParserResult((yyvsp[0].statement)); }
#line 1843 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 4:
#line 237 "bison_parser.y" /* yacc.c:1646 */
{ (yyvsp[-2].stmt_list)->addStatement((yyvsp[0].statement)); (yyval.stmt_list) = (yyvsp[-2].stmt_list); }
#line 1849 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 5:
#line 241 "bison_parser.y" /* yacc.c:1646 */
{
(yyvsp[0].prep_stmt)->setPlaceholders(yyloc.placeholder_list);
yyloc.placeholder_list.clear();
(yyval.statement) = (yyvsp[0].prep_stmt);
}
#line 1859 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 7:
#line 251 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.statement) = (yyvsp[0].select_stmt); }
#line 1865 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 8:
#line 252 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.statement) = (yyvsp[0].import_stmt); }
#line 1871 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 9:
#line 253 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.statement) = (yyvsp[0].create_stmt); }
#line 1877 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 10:
#line 254 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.statement) = (yyvsp[0].insert_stmt); }
#line 1883 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 11:
#line 255 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.statement) = (yyvsp[0].delete_stmt); }
#line 1889 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 12:
#line 256 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.statement) = (yyvsp[0].delete_stmt); }
#line 1895 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 13:
#line 257 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.statement) = (yyvsp[0].update_stmt); }
#line 1901 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 14:
#line 258 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.statement) = (yyvsp[0].drop_stmt); }
#line 1907 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 15:
#line 259 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.statement) = (yyvsp[0].exec_stmt); }
#line 1913 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 16:
#line 267 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.prep_stmt) = new PrepareStatement();
(yyval.prep_stmt)->name = (yyvsp[-2].sval);
(yyval.prep_stmt)->query = new SQLParserResult((yyvsp[0].statement));
}
#line 1923 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 17:
#line 272 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.prep_stmt) = new PrepareStatement();
(yyval.prep_stmt)->name = (yyvsp[-4].sval);
(yyval.prep_stmt)->query = (yyvsp[-2].stmt_list);
}
#line 1933 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 18:
#line 280 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.exec_stmt) = new ExecuteStatement();
(yyval.exec_stmt)->name = (yyvsp[0].sval);
}
#line 1942 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 19:
#line 284 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.exec_stmt) = new ExecuteStatement();
(yyval.exec_stmt)->name = (yyvsp[-3].sval);
(yyval.exec_stmt)->parameters = (yyvsp[-1].expr_vec);
}
#line 1952 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 20:
#line 296 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.import_stmt) = new ImportStatement((ImportStatement::ImportType) (yyvsp[-4].uval));
(yyval.import_stmt)->file_path = (yyvsp[-2].sval);
(yyval.import_stmt)->table_name = (yyvsp[0].sval);
}
#line 1962 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 21:
#line 304 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.uval) = ImportStatement::kImportCSV; }
#line 1968 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 22:
#line 308 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.sval) = (yyvsp[0].expr)->name; }
#line 1974 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 23:
#line 318 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.create_stmt) = new CreateStatement(CreateStatement::kTableFromTbl);
(yyval.create_stmt)->if_not_exists = (yyvsp[-5].bval);
(yyval.create_stmt)->table_name = (yyvsp[-4].sval);
(yyval.create_stmt)->file_path = (yyvsp[0].sval);
}
#line 1985 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 24:
#line 324 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.create_stmt) = new CreateStatement(CreateStatement::kTable);
(yyval.create_stmt)->if_not_exists = (yyvsp[-4].bval);
(yyval.create_stmt)->table_name = (yyvsp[-3].sval);
(yyval.create_stmt)->columns = (yyvsp[-1].column_vec);
}
#line 1996 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 25:
#line 333 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.bval) = true; }
#line 2002 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 26:
#line 334 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.bval) = false; }
#line 2008 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 27:
#line 338 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.column_vec) = new std::vector<ColumnDefinition*>(); (yyval.column_vec)->push_back((yyvsp[0].column_t)); }
#line 2014 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 28:
#line 339 "bison_parser.y" /* yacc.c:1646 */
{ (yyvsp[-2].column_vec)->push_back((yyvsp[0].column_t)); (yyval.column_vec) = (yyvsp[-2].column_vec); }
#line 2020 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 29:
#line 343 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.column_t) = new ColumnDefinition((yyvsp[-1].sval), (ColumnDefinition::DataType) (yyvsp[0].uval));
}
#line 2028 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 30:
#line 350 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.uval) = ColumnDefinition::INT; }
#line 2034 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 31:
#line 351 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.uval) = ColumnDefinition::INT; }
#line 2040 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 32:
#line 352 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.uval) = ColumnDefinition::DOUBLE; }
#line 2046 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 33:
#line 353 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.uval) = ColumnDefinition::TEXT; }
#line 2052 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 34:
#line 363 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.drop_stmt) = new DropStatement(DropStatement::kTable);
(yyval.drop_stmt)->name = (yyvsp[0].sval);
}
#line 2061 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 35:
#line 367 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.drop_stmt) = new DropStatement(DropStatement::kPreparedStatement);
(yyval.drop_stmt)->name = (yyvsp[0].sval);
}
#line 2070 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 36:
#line 379 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.delete_stmt) = new DeleteStatement();
(yyval.delete_stmt)->table_name = (yyvsp[-1].sval);
(yyval.delete_stmt)->expr = (yyvsp[0].expr);
}
#line 2080 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 37:
#line 387 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.delete_stmt) = new DeleteStatement();
(yyval.delete_stmt)->table_name = (yyvsp[0].sval);
}
#line 2089 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 38:
#line 399 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.insert_stmt) = new InsertStatement(InsertStatement::kInsertValues);
(yyval.insert_stmt)->table_name = (yyvsp[-5].sval);
(yyval.insert_stmt)->columns = (yyvsp[-4].str_vec);
(yyval.insert_stmt)->values = (yyvsp[-1].expr_vec);
}
#line 2100 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 39:
#line 405 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.insert_stmt) = new InsertStatement(InsertStatement::kInsertSelect);
(yyval.insert_stmt)->table_name = (yyvsp[-2].sval);
(yyval.insert_stmt)->columns = (yyvsp[-1].str_vec);
(yyval.insert_stmt)->select = (yyvsp[0].select_stmt);
}
#line 2111 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 40:
#line 415 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.str_vec) = (yyvsp[-1].str_vec); }
#line 2117 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 41:
#line 416 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.str_vec) = NULL; }
#line 2123 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 42:
#line 426 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.update_stmt) = new UpdateStatement();
(yyval.update_stmt)->table = (yyvsp[-3].table);
(yyval.update_stmt)->updates = (yyvsp[-1].update_vec);
(yyval.update_stmt)->where = (yyvsp[0].expr);
}
#line 2134 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 43:
#line 435 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.update_vec) = new std::vector<UpdateClause*>(); (yyval.update_vec)->push_back((yyvsp[0].update_t)); }
#line 2140 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 44:
#line 436 "bison_parser.y" /* yacc.c:1646 */
{ (yyvsp[-2].update_vec)->push_back((yyvsp[0].update_t)); (yyval.update_vec) = (yyvsp[-2].update_vec); }
#line 2146 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 45:
#line 440 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.update_t) = new UpdateClause();
(yyval.update_t)->column = (yyvsp[-2].sval);
(yyval.update_t)->value = (yyvsp[0].expr);
}
#line 2156 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 48:
#line 457 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.select_stmt) = (yyvsp[-1].select_stmt); }
#line 2162 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 49:
#line 458 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.select_stmt) = (yyvsp[-1].select_stmt); }
#line 2168 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 50:
#line 462 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.select_stmt) = (yyvsp[-2].select_stmt);
(yyval.select_stmt)->order = (yyvsp[-1].order);
(yyval.select_stmt)->limit = (yyvsp[0].limit);
}
#line 2178 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 51:
#line 467 "bison_parser.y" /* yacc.c:1646 */
{
// TODO: allow multiple unions (through linked list)
// TODO: capture type of set_operator
// TODO: might overwrite order and limit of first select here
(yyval.select_stmt) = (yyvsp[-4].select_stmt);
(yyval.select_stmt)->union_select = (yyvsp[-2].select_stmt);
(yyval.select_stmt)->order = (yyvsp[-1].order);
(yyval.select_stmt)->limit = (yyvsp[0].limit);
}
#line 2192 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 55:
#line 485 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.select_stmt) = new SelectStatement();
(yyval.select_stmt)->select_distinct = (yyvsp[-4].bval);
(yyval.select_stmt)->select_list = (yyvsp[-3].expr_vec);
(yyval.select_stmt)->from_table = (yyvsp[-2].table);
(yyval.select_stmt)->where_clause = (yyvsp[-1].expr);
(yyval.select_stmt)->group_by = (yyvsp[0].group_t);
}
#line 2205 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 56:
#line 496 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.bval) = true; }
#line 2211 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 57:
#line 497 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.bval) = false; }
#line 2217 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 59:
#line 506 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.table) = (yyvsp[0].table); }
#line 2223 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 60:
#line 511 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = (yyvsp[0].expr); }
#line 2229 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 61:
#line 512 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = NULL; }
#line 2235 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 62:
#line 516 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.group_t) = new GroupByDescription();
(yyval.group_t)->columns = (yyvsp[-1].expr_vec);
(yyval.group_t)->having = (yyvsp[0].expr);
}
#line 2245 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 63:
#line 521 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.group_t) = NULL; }
#line 2251 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 64:
#line 525 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = (yyvsp[0].expr); }
#line 2257 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 65:
#line 526 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = NULL; }
#line 2263 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 66:
#line 529 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.order) = new OrderDescription((yyvsp[0].order_type), (yyvsp[-1].expr)); }
#line 2269 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 67:
#line 530 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.order) = NULL; }
#line 2275 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 68:
#line 534 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.order_type) = kOrderAsc; }
#line 2281 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 69:
#line 535 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.order_type) = kOrderDesc; }
#line 2287 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 70:
#line 536 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.order_type) = kOrderAsc; }
#line 2293 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 71:
#line 541 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.limit) = new LimitDescription((yyvsp[0].expr)->ival, kNoOffset); delete (yyvsp[0].expr); }
#line 2299 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 72:
#line 542 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.limit) = new LimitDescription((yyvsp[-2].expr)->ival, (yyvsp[0].expr)->ival); delete (yyvsp[-2].expr); delete (yyvsp[0].expr); }
#line 2305 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 73:
#line 543 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.limit) = NULL; }
#line 2311 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 74:
#line 550 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr_vec) = new std::vector<Expr*>(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); }
#line 2317 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 75:
#line 551 "bison_parser.y" /* yacc.c:1646 */
{ (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); }
#line 2323 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 76:
#line 555 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr_vec) = new std::vector<Expr*>(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); }
#line 2329 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 77:
#line 556 "bison_parser.y" /* yacc.c:1646 */
{ (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); }
#line 2335 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 78:
#line 560 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.expr) = (yyvsp[-1].expr);
(yyval.expr)->alias = (yyvsp[0].sval);
}
#line 2344 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 79:
#line 567 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = (yyvsp[-1].expr); }
#line 2350 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 87:
#line 581 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpUnary(Expr::UMINUS, (yyvsp[0].expr)); }
#line 2356 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 88:
#line 582 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpUnary(Expr::NOT, (yyvsp[0].expr)); }
#line 2362 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 90:
#line 587 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), '-', (yyvsp[0].expr)); }
#line 2368 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 91:
#line 588 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), '+', (yyvsp[0].expr)); }
#line 2374 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 92:
#line 589 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), '/', (yyvsp[0].expr)); }
#line 2380 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 93:
#line 590 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), '*', (yyvsp[0].expr)); }
#line 2386 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 94:
#line 591 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), '%', (yyvsp[0].expr)); }
#line 2392 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 95:
#line 592 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), '^', (yyvsp[0].expr)); }
#line 2398 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 96:
#line 593 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), Expr::AND, (yyvsp[0].expr)); }
#line 2404 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 97:
#line 594 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), Expr::OR, (yyvsp[0].expr)); }
#line 2410 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 98:
#line 595 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), Expr::LIKE, (yyvsp[0].expr)); }
#line 2416 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 99:
#line 596 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-3].expr), Expr::NOT_LIKE, (yyvsp[0].expr)); }
#line 2422 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 100:
#line 601 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), '=', (yyvsp[0].expr)); }
#line 2428 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 101:
#line 602 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), Expr::NOT_EQUALS, (yyvsp[0].expr)); }
#line 2434 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 102:
#line 603 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), '<', (yyvsp[0].expr)); }
#line 2440 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 103:
#line 604 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), '>', (yyvsp[0].expr)); }
#line 2446 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 104:
#line 605 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), Expr::LESS_EQ, (yyvsp[0].expr)); }
#line 2452 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 105:
#line 606 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), Expr::GREATER_EQ, (yyvsp[0].expr)); }
#line 2458 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 106:
#line 610 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeFunctionRef((yyvsp[-4].sval), (yyvsp[-1].expr), (yyvsp[-2].bval)); }
#line 2464 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 107:
#line 614 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeColumnRef((yyvsp[0].sval)); }
#line 2470 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 108:
#line 615 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeColumnRef((yyvsp[-2].sval), (yyvsp[0].sval)); }
#line 2476 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 112:
#line 625 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeLiteral((yyvsp[0].sval)); }
#line 2482 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 113:
#line 630 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeLiteral((yyvsp[0].fval)); }
#line 2488 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 115:
#line 635 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = Expr::makeLiteral((yyvsp[0].ival)); }
#line 2494 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 116:
#line 639 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.expr) = new Expr(kExprStar); }
#line 2500 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 117:
#line 644 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.expr) = Expr::makePlaceholder(yylloc.total_column);
yyloc.placeholder_list.push_back((yyval.expr));
}
#line 2509 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 119:
#line 656 "bison_parser.y" /* yacc.c:1646 */
{
(yyvsp[0].table_vec)->push_back((yyvsp[-2].table));
auto tbl = new TableRef(kTableCrossProduct);
tbl->list = (yyvsp[0].table_vec);
(yyval.table) = tbl;
}
#line 2520 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 121:
#line 667 "bison_parser.y" /* yacc.c:1646 */
{
auto tbl = new TableRef(kTableSelect);
tbl->select = (yyvsp[-2].select_stmt);
tbl->alias = (yyvsp[0].sval);
(yyval.table) = tbl;
}
#line 2531 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 123:
#line 678 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.table_vec) = new std::vector<TableRef*>(); (yyval.table_vec)->push_back((yyvsp[0].table)); }
#line 2537 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 124:
#line 679 "bison_parser.y" /* yacc.c:1646 */
{ (yyvsp[-2].table_vec)->push_back((yyvsp[0].table)); (yyval.table_vec) = (yyvsp[-2].table_vec); }
#line 2543 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 125:
#line 684 "bison_parser.y" /* yacc.c:1646 */
{
auto tbl = new TableRef(kTableName);
tbl->name = (yyvsp[-1].sval);
tbl->alias = (yyvsp[0].sval);
(yyval.table) = tbl;
}
#line 2554 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 126:
#line 694 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.table) = new TableRef(kTableName);
(yyval.table)->name = (yyvsp[0].sval);
}
#line 2563 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 129:
#line 708 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.sval) = (yyvsp[0].sval); }
#line 2569 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 132:
#line 714 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.sval) = NULL; }
#line 2575 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 133:
#line 723 "bison_parser.y" /* yacc.c:1646 */
{
(yyval.table) = new TableRef(kTableJoin);
(yyval.table)->join = new JoinDefinition();
(yyval.table)->join->type = (JoinType) (yyvsp[-4].uval);
(yyval.table)->join->left = (yyvsp[-5].table);
(yyval.table)->join->right = (yyvsp[-2].table);
(yyval.table)->join->condition = (yyvsp[0].expr);
}
#line 2588 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 134:
#line 734 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.uval) = kJoinInner; }
#line 2594 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 135:
#line 735 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.uval) = kJoinOuter; }
#line 2600 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 136:
#line 736 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.uval) = kJoinLeft; }
#line 2606 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 137:
#line 737 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.uval) = kJoinRight; }
#line 2612 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 138:
#line 738 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.uval) = kJoinInner; }
#line 2618 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 139:
#line 744 "bison_parser.y" /* yacc.c:1646 */
{
auto tbl = new TableRef(kTableSelect);
tbl->select = (yyvsp[-2].select_stmt);
tbl->alias = (yyvsp[0].sval);
(yyval.table) = tbl;
}
#line 2629 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 144:
#line 769 "bison_parser.y" /* yacc.c:1646 */
{ (yyval.str_vec) = new std::vector<char*>(); (yyval.str_vec)->push_back((yyvsp[0].sval)); }
#line 2635 "bison_parser.cpp" /* yacc.c:1646 */
break;
case 145:
#line 770 "bison_parser.y" /* yacc.c:1646 */
{ (yyvsp[-2].str_vec)->push_back((yyvsp[0].sval)); (yyval.str_vec) = (yyvsp[-2].str_vec); }
#line 2641 "bison_parser.cpp" /* yacc.c:1646 */
break;
#line 2645 "bison_parser.cpp" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
that yytoken be updated with the new translation. We take the
approach of translating immediately before every use of yytoken.
One alternative is translating here after every semantic action,
but that translation would be missed if the semantic action invokes
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
incorrect destructor might then be invoked immediately. In the
case of YYERROR or YYBACKUP, subsequent parser actions might lead
to an incorrect destructor call or verbose syntax error message
before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
*++yylsp = yyloc;
/* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTOKENS];
goto yynewstate;
/*--------------------------------------.
| yyerrlab -- here on detecting error. |
`--------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
#if ! YYERROR_VERBOSE
yyerror (&yylloc, result, scanner, YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)
{
char const *yymsgp = YY_("syntax error");
int yysyntax_error_status;
yysyntax_error_status = YYSYNTAX_ERROR;
if (yysyntax_error_status == 0)
yymsgp = yymsg;
else if (yysyntax_error_status == 1)
{
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
if (!yymsg)
{
yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf;
yysyntax_error_status = 2;
}
else
{
yysyntax_error_status = YYSYNTAX_ERROR;
yymsgp = yymsg;
}
}
yyerror (&yylloc, result, scanner, yymsgp);
if (yysyntax_error_status == 2)
goto yyexhaustedlab;
}
# undef YYSYNTAX_ERROR
#endif
}
yyerror_range[1] = yylloc;
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
{
/* Return failure if at end of input. */
if (yychar == YYEOF)
YYABORT;
}
else
{
yydestruct ("Error: discarding",
yytoken, &yylval, &yylloc, result, scanner);
yychar = YYEMPTY;
}
}
/* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
/* Pacify compilers like GCC when the user code never invokes
YYERROR and the label yyerrorlab therefore never appears in user
code. */
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
yyerror_range[1] = yylsp[1-yylen];
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
yystate = *yyssp;
goto yyerrlab1;
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
YYABORT;
yyerror_range[1] = *yylsp;
yydestruct ("Error: popping",
yystos[yystate], yyvsp, yylsp, result, scanner);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
yyerror_range[2] = yylloc;
/* Using YYLLOC is tempting, but would change the location of
the lookahead. YYLOC is available though. */
YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
*++yylsp = yyloc;
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
goto yyreturn;
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
yyexhaustedlab:
yyerror (&yylloc, result, scanner, YY_("memory exhausted"));
yyresult = 2;
/* Fall through. */
#endif
yyreturn:
if (yychar != YYEMPTY)
{
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = YYTRANSLATE (yychar);
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, &yylloc, result, scanner);
}
/* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp, yylsp, result, scanner);
YYPOPSTACK (1);
}
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
return yyresult;
}
#line 773 "bison_parser.y" /* yacc.c:1906 */
/*********************************
** Section 4: Additional C code
*********************************/
/* empty */