281 lines
6.9 KiB
C++
281 lines
6.9 KiB
C++
/* A Bison parser, made by GNU Bison 3.0.4. */
|
|
|
|
/* Bison interface for Yacc-like parsers in C
|
|
|
|
Copyright (C) 1984, 1989-1990, 2000-2015 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. */
|
|
|
|
#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 36 "bison_parser.y" /* yacc.c:1909 */
|
|
|
|
// %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 75 "bison_parser.h" /* yacc.c:1909 */
|
|
|
|
/* 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_CASE = 333,
|
|
SQL_DATE = 334,
|
|
SQL_DESC = 335,
|
|
SQL_DROP = 336,
|
|
SQL_ELSE = 337,
|
|
SQL_FILE = 338,
|
|
SQL_FROM = 339,
|
|
SQL_FULL = 340,
|
|
SQL_HASH = 341,
|
|
SQL_HINT = 342,
|
|
SQL_INTO = 343,
|
|
SQL_JOIN = 344,
|
|
SQL_LEFT = 345,
|
|
SQL_LIKE = 346,
|
|
SQL_LOAD = 347,
|
|
SQL_NULL = 348,
|
|
SQL_PART = 349,
|
|
SQL_PLAN = 350,
|
|
SQL_SHOW = 351,
|
|
SQL_TEXT = 352,
|
|
SQL_THEN = 353,
|
|
SQL_TIME = 354,
|
|
SQL_VIEW = 355,
|
|
SQL_WHEN = 356,
|
|
SQL_WITH = 357,
|
|
SQL_ADD = 358,
|
|
SQL_ALL = 359,
|
|
SQL_AND = 360,
|
|
SQL_ASC = 361,
|
|
SQL_CSV = 362,
|
|
SQL_END = 363,
|
|
SQL_FOR = 364,
|
|
SQL_INT = 365,
|
|
SQL_KEY = 366,
|
|
SQL_NOT = 367,
|
|
SQL_OFF = 368,
|
|
SQL_SET = 369,
|
|
SQL_TBL = 370,
|
|
SQL_TOP = 371,
|
|
SQL_AS = 372,
|
|
SQL_BY = 373,
|
|
SQL_IF = 374,
|
|
SQL_IN = 375,
|
|
SQL_IS = 376,
|
|
SQL_OF = 377,
|
|
SQL_ON = 378,
|
|
SQL_OR = 379,
|
|
SQL_TO = 380,
|
|
SQL_EQUALS = 381,
|
|
SQL_LESS = 382,
|
|
SQL_GREATER = 383,
|
|
SQL_NOTNULL = 384,
|
|
SQL_UMINUS = 385
|
|
};
|
|
#endif
|
|
|
|
/* Value type. */
|
|
#if ! defined HSQL_STYPE && ! defined HSQL_STYPE_IS_DECLARED
|
|
|
|
union HSQL_STYPE
|
|
{
|
|
#line 95 "bison_parser.y" /* yacc.c:1909 */
|
|
|
|
double fval;
|
|
int64_t ival;
|
|
char* sval;
|
|
uintmax_t 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;
|
|
|
|
std::vector<hsql::SQLStatement*>* stmt_vec;
|
|
|
|
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;
|
|
std::vector<hsql::OrderDescription*>* order_vec;
|
|
|
|
#line 255 "bison_parser.h" /* yacc.c:1909 */
|
|
};
|
|
|
|
typedef union HSQL_STYPE HSQL_STYPE;
|
|
# 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 */
|