HyriseSQLParser/src/parser/bison_parser.h
alkim0 a59deb43c3 Added boolean literal support (#103)
* Added boolean support

* Made bool literals int vals

With a flag indicating if they came from boolean literals.

* Add makeLiteral(bool val);
2018-11-02 11:42:23 +01:00

302 lines
7.4 KiB
C++

/* A Bison parser, made by GNU Bison 3.1. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018 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 35 "bison_parser.y" /* yacc.c:1919 */
// %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++; \
yylloc->string_length++; \
if(yytext[i] == '\n') { \
yylloc->last_line++; \
yylloc->last_column = 0; \
} \
else { \
yylloc->last_column++; \
} \
}
#line 76 "bison_parser.h" /* yacc.c:1919 */
/* Token type. */
#ifndef HSQL_TOKENTYPE
# define HSQL_TOKENTYPE
enum hsql_tokentype
{
SQL_IDENTIFIER = 258,
SQL_STRING = 259,
SQL_FLOATVAL = 260,
SQL_INTVAL = 261,
SQL_DEALLOCATE = 262,
SQL_PARAMETERS = 263,
SQL_INTERSECT = 264,
SQL_TEMPORARY = 265,
SQL_TIMESTAMP = 266,
SQL_DISTINCT = 267,
SQL_NVARCHAR = 268,
SQL_RESTRICT = 269,
SQL_TRUNCATE = 270,
SQL_ANALYZE = 271,
SQL_BETWEEN = 272,
SQL_CASCADE = 273,
SQL_COLUMNS = 274,
SQL_CONTROL = 275,
SQL_DEFAULT = 276,
SQL_EXECUTE = 277,
SQL_EXPLAIN = 278,
SQL_HISTORY = 279,
SQL_INTEGER = 280,
SQL_NATURAL = 281,
SQL_PREPARE = 282,
SQL_PRIMARY = 283,
SQL_SCHEMAS = 284,
SQL_SPATIAL = 285,
SQL_VARCHAR = 286,
SQL_VIRTUAL = 287,
SQL_BEFORE = 288,
SQL_COLUMN = 289,
SQL_CREATE = 290,
SQL_DELETE = 291,
SQL_DIRECT = 292,
SQL_DOUBLE = 293,
SQL_ESCAPE = 294,
SQL_EXCEPT = 295,
SQL_EXISTS = 296,
SQL_EXTRACT = 297,
SQL_GLOBAL = 298,
SQL_HAVING = 299,
SQL_IMPORT = 300,
SQL_INSERT = 301,
SQL_ISNULL = 302,
SQL_OFFSET = 303,
SQL_RENAME = 304,
SQL_SCHEMA = 305,
SQL_SELECT = 306,
SQL_SORTED = 307,
SQL_TABLES = 308,
SQL_UNIQUE = 309,
SQL_UNLOAD = 310,
SQL_UPDATE = 311,
SQL_VALUES = 312,
SQL_AFTER = 313,
SQL_ALTER = 314,
SQL_CROSS = 315,
SQL_DELTA = 316,
SQL_FLOAT = 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_CHAR = 334,
SQL_DATE = 335,
SQL_DESC = 336,
SQL_DROP = 337,
SQL_ELSE = 338,
SQL_FILE = 339,
SQL_FROM = 340,
SQL_FULL = 341,
SQL_HASH = 342,
SQL_HINT = 343,
SQL_INTO = 344,
SQL_JOIN = 345,
SQL_LEFT = 346,
SQL_LIKE = 347,
SQL_LOAD = 348,
SQL_LONG = 349,
SQL_NULL = 350,
SQL_PLAN = 351,
SQL_SHOW = 352,
SQL_TEXT = 353,
SQL_THEN = 354,
SQL_TIME = 355,
SQL_VIEW = 356,
SQL_WHEN = 357,
SQL_WITH = 358,
SQL_ADD = 359,
SQL_ALL = 360,
SQL_AND = 361,
SQL_ASC = 362,
SQL_CSV = 363,
SQL_END = 364,
SQL_FOR = 365,
SQL_INT = 366,
SQL_KEY = 367,
SQL_NOT = 368,
SQL_OFF = 369,
SQL_SET = 370,
SQL_TBL = 371,
SQL_TOP = 372,
SQL_AS = 373,
SQL_BY = 374,
SQL_IF = 375,
SQL_IN = 376,
SQL_IS = 377,
SQL_OF = 378,
SQL_ON = 379,
SQL_OR = 380,
SQL_TO = 381,
SQL_ARRAY = 382,
SQL_CONCAT = 383,
SQL_ILIKE = 384,
SQL_SECOND = 385,
SQL_MINUTE = 386,
SQL_HOUR = 387,
SQL_DAY = 388,
SQL_MONTH = 389,
SQL_YEAR = 390,
SQL_TRUE = 391,
SQL_FALSE = 392,
SQL_EQUALS = 393,
SQL_NOTEQUALS = 394,
SQL_LESS = 395,
SQL_GREATER = 396,
SQL_LESSEQ = 397,
SQL_GREATEREQ = 398,
SQL_NOTNULL = 399,
SQL_UMINUS = 400
};
#endif
/* Value type. */
#if ! defined HSQL_STYPE && ! defined HSQL_STYPE_IS_DECLARED
union HSQL_STYPE
{
#line 95 "bison_parser.y" /* yacc.c:1919 */
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::ShowStatement* show_stmt;
hsql::TableName table_name;
hsql::TableRef* table;
hsql::Expr* expr;
hsql::OrderDescription* order;
hsql::OrderType order_type;
hsql::DatetimeField datetime_field;
hsql::LimitDescription* limit;
hsql::ColumnDefinition* column_t;
hsql::ColumnType column_type_t;
hsql::GroupByDescription* group_t;
hsql::UpdateClause* update_t;
hsql::Alias* alias_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 276 "bison_parser.h" /* yacc.c:1919 */
};
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 */