Repository navigation
Expand file tree
/
Copy pathbison_parser.cpp
More file actions
5595 lines (4929 loc) · 187 KB
/
Copy pathbison_parser.cpp
File metadata and controls
5595 lines (4929 loc) · 187 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison implementation 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. */
/* 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.4"
/* 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 2 "bison_parser.y" /* yacc.c:339 */
// clang-format on
/**
* 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>
#include <string.h>
using namespace hsql;
int yyerror(YYLTYPE * llocp, SQLParserResult * result, yyscan_t scanner, const char* msg) {
result->setIsValid(false);
result->setErrorDetails(strdup(msg), llocp->first_line, llocp->first_column);
return 0;
}
// clang-format off
#line 104 "bison_parser.tab.c" /* 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.tab.h". */
#ifndef YY_HSQL_BISON_PARSER_TAB_H_INCLUDED
# define YY_HSQL_BISON_PARSER_TAB_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 1
# endif /* ! defined YYDEBUG */
#endif /* ! defined HSQL_DEBUG */
#if HSQL_DEBUG
extern int hsql_debug;
#endif
/* "%code requires" blocks. */
#line 38 "bison_parser.y" /* yacc.c:355 */
// clang-format on
// %code requires block
#include "../SQLParserResult.h"
#include "../sql/statements.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 166 "bison_parser.tab.c" /* 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_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_INTEGER = 279,
SQL_NATURAL = 280,
SQL_PREPARE = 281,
SQL_PRIMARY = 282,
SQL_SCHEMAS = 283,
SQL_CHARACTER_VARYING = 284,
SQL_REAL = 285,
SQL_DECIMAL = 286,
SQL_SMALLINT = 287,
SQL_BIGINT = 288,
SQL_SPATIAL = 289,
SQL_VARCHAR = 290,
SQL_VIRTUAL = 291,
SQL_DESCRIBE = 292,
SQL_BEFORE = 293,
SQL_COLUMN = 294,
SQL_CREATE = 295,
SQL_DELETE = 296,
SQL_DIRECT = 297,
SQL_DOUBLE = 298,
SQL_ESCAPE = 299,
SQL_EXCEPT = 300,
SQL_EXISTS = 301,
SQL_EXTRACT = 302,
SQL_CAST = 303,
SQL_FORMAT = 304,
SQL_GLOBAL = 305,
SQL_HAVING = 306,
SQL_IMPORT = 307,
SQL_INSERT = 308,
SQL_ISNULL = 309,
SQL_OFFSET = 310,
SQL_RENAME = 311,
SQL_SCHEMA = 312,
SQL_SELECT = 313,
SQL_SORTED = 314,
SQL_TABLES = 315,
SQL_UNIQUE = 316,
SQL_UNLOAD = 317,
SQL_UPDATE = 318,
SQL_VALUES = 319,
SQL_AFTER = 320,
SQL_ALTER = 321,
SQL_CROSS = 322,
SQL_DATABASES = 323,
SQL_DATABASE = 324,
SQL_DELTA = 325,
SQL_FLOAT = 326,
SQL_GROUP = 327,
SQL_INDEX = 328,
SQL_INNER = 329,
SQL_LIMIT = 330,
SQL_LOCAL = 331,
SQL_MERGE = 332,
SQL_MINUS = 333,
SQL_ORDER = 334,
SQL_OUTER = 335,
SQL_RIGHT = 336,
SQL_TABLE = 337,
SQL_UNION = 338,
SQL_USING = 339,
SQL_WHERE = 340,
SQL_CALL = 341,
SQL_CASE = 342,
SQL_CHAR = 343,
SQL_COPY = 344,
SQL_DATE = 345,
SQL_DATETIME = 346,
SQL_DESC = 347,
SQL_DROP = 348,
SQL_ELSE = 349,
SQL_FILE = 350,
SQL_FROM = 351,
SQL_FULL = 352,
SQL_HASH = 353,
SQL_HINT = 354,
SQL_INTO = 355,
SQL_JOIN = 356,
SQL_LEFT = 357,
SQL_LIKE = 358,
SQL_LOAD = 359,
SQL_LONG = 360,
SQL_NULL = 361,
SQL_PLAN = 362,
SQL_SHOW = 363,
SQL_TEXT = 364,
SQL_THEN = 365,
SQL_TIME = 366,
SQL_VIEW = 367,
SQL_WHEN = 368,
SQL_WITH = 369,
SQL_ADD = 370,
SQL_ALL = 371,
SQL_AND = 372,
SQL_ASC = 373,
SQL_END = 374,
SQL_FOR = 375,
SQL_INT = 376,
SQL_KEY = 377,
SQL_NOT = 378,
SQL_OFF = 379,
SQL_SET = 380,
SQL_TOP = 381,
SQL_AS = 382,
SQL_BY = 383,
SQL_IF = 384,
SQL_IN = 385,
SQL_IS = 386,
SQL_OF = 387,
SQL_ON = 388,
SQL_OR = 389,
SQL_TO = 390,
SQL_NO = 391,
SQL_ARRAY = 392,
SQL_CONCAT = 393,
SQL_ILIKE = 394,
SQL_SECOND = 395,
SQL_MINUTE = 396,
SQL_HOUR = 397,
SQL_DAY = 398,
SQL_MONTH = 399,
SQL_YEAR = 400,
SQL_SECONDS = 401,
SQL_MINUTES = 402,
SQL_HOURS = 403,
SQL_DAYS = 404,
SQL_MONTHS = 405,
SQL_YEARS = 406,
SQL_INTERVAL = 407,
SQL_TRUE = 408,
SQL_FALSE = 409,
SQL_BOOLEAN = 410,
SQL_TRANSACTION = 411,
SQL_BEGIN = 412,
SQL_COMMIT = 413,
SQL_ROLLBACK = 414,
SQL_NOWAIT = 415,
SQL_SKIP = 416,
SQL_LOCKED = 417,
SQL_SHARE = 418,
SQL_EQUALS = 419,
SQL_NOTEQUALS = 420,
SQL_LESS = 421,
SQL_GREATER = 422,
SQL_LESSEQ = 423,
SQL_GREATEREQ = 424,
SQL_NOTNULL = 425,
SQL_UMINUS = 426
};
#endif
/* Tokens. */
#define SQL_IDENTIFIER 258
#define SQL_STRING 259
#define SQL_FLOATVAL 260
#define SQL_INTVAL 261
#define SQL_DEALLOCATE 262
#define SQL_PARAMETERS 263
#define SQL_INTERSECT 264
#define SQL_TEMPORARY 265
#define SQL_TIMESTAMP 266
#define SQL_DISTINCT 267
#define SQL_NVARCHAR 268
#define SQL_RESTRICT 269
#define SQL_TRUNCATE 270
#define SQL_ANALYZE 271
#define SQL_BETWEEN 272
#define SQL_CASCADE 273
#define SQL_COLUMNS 274
#define SQL_CONTROL 275
#define SQL_DEFAULT 276
#define SQL_EXECUTE 277
#define SQL_EXPLAIN 278
#define SQL_INTEGER 279
#define SQL_NATURAL 280
#define SQL_PREPARE 281
#define SQL_PRIMARY 282
#define SQL_SCHEMAS 283
#define SQL_CHARACTER_VARYING 284
#define SQL_REAL 285
#define SQL_DECIMAL 286
#define SQL_SMALLINT 287
#define SQL_BIGINT 288
#define SQL_SPATIAL 289
#define SQL_VARCHAR 290
#define SQL_VIRTUAL 291
#define SQL_DESCRIBE 292
#define SQL_BEFORE 293
#define SQL_COLUMN 294
#define SQL_CREATE 295
#define SQL_DELETE 296
#define SQL_DIRECT 297
#define SQL_DOUBLE 298
#define SQL_ESCAPE 299
#define SQL_EXCEPT 300
#define SQL_EXISTS 301
#define SQL_EXTRACT 302
#define SQL_CAST 303
#define SQL_FORMAT 304
#define SQL_GLOBAL 305
#define SQL_HAVING 306
#define SQL_IMPORT 307
#define SQL_INSERT 308
#define SQL_ISNULL 309
#define SQL_OFFSET 310
#define SQL_RENAME 311
#define SQL_SCHEMA 312
#define SQL_SELECT 313
#define SQL_SORTED 314
#define SQL_TABLES 315
#define SQL_UNIQUE 316
#define SQL_UNLOAD 317
#define SQL_UPDATE 318
#define SQL_VALUES 319
#define SQL_AFTER 320
#define SQL_ALTER 321
#define SQL_CROSS 322
#define SQL_DATABASES 323
#define SQL_DATABASE 324
#define SQL_DELTA 325
#define SQL_FLOAT 326
#define SQL_GROUP 327
#define SQL_INDEX 328
#define SQL_INNER 329
#define SQL_LIMIT 330
#define SQL_LOCAL 331
#define SQL_MERGE 332
#define SQL_MINUS 333
#define SQL_ORDER 334
#define SQL_OUTER 335
#define SQL_RIGHT 336
#define SQL_TABLE 337
#define SQL_UNION 338
#define SQL_USING 339
#define SQL_WHERE 340
#define SQL_CALL 341
#define SQL_CASE 342
#define SQL_CHAR 343
#define SQL_COPY 344
#define SQL_DATE 345
#define SQL_DATETIME 346
#define SQL_DESC 347
#define SQL_DROP 348
#define SQL_ELSE 349
#define SQL_FILE 350
#define SQL_FROM 351
#define SQL_FULL 352
#define SQL_HASH 353
#define SQL_HINT 354
#define SQL_INTO 355
#define SQL_JOIN 356
#define SQL_LEFT 357
#define SQL_LIKE 358
#define SQL_LOAD 359
#define SQL_LONG 360
#define SQL_NULL 361
#define SQL_PLAN 362
#define SQL_SHOW 363
#define SQL_TEXT 364
#define SQL_THEN 365
#define SQL_TIME 366
#define SQL_VIEW 367
#define SQL_WHEN 368
#define SQL_WITH 369
#define SQL_ADD 370
#define SQL_ALL 371
#define SQL_AND 372
#define SQL_ASC 373
#define SQL_END 374
#define SQL_FOR 375
#define SQL_INT 376
#define SQL_KEY 377
#define SQL_NOT 378
#define SQL_OFF 379
#define SQL_SET 380
#define SQL_TOP 381
#define SQL_AS 382
#define SQL_BY 383
#define SQL_IF 384
#define SQL_IN 385
#define SQL_IS 386
#define SQL_OF 387
#define SQL_ON 388
#define SQL_OR 389
#define SQL_TO 390
#define SQL_NO 391
#define SQL_ARRAY 392
#define SQL_CONCAT 393
#define SQL_ILIKE 394
#define SQL_SECOND 395
#define SQL_MINUTE 396
#define SQL_HOUR 397
#define SQL_DAY 398
#define SQL_MONTH 399
#define SQL_YEAR 400
#define SQL_SECONDS 401
#define SQL_MINUTES 402
#define SQL_HOURS 403
#define SQL_DAYS 404
#define SQL_MONTHS 405
#define SQL_YEARS 406
#define SQL_INTERVAL 407
#define SQL_TRUE 408
#define SQL_FALSE 409
#define SQL_BOOLEAN 410
#define SQL_TRANSACTION 411
#define SQL_BEGIN 412
#define SQL_COMMIT 413
#define SQL_ROLLBACK 414
#define SQL_NOWAIT 415
#define SQL_SKIP 416
#define SQL_LOCKED 417
#define SQL_SHARE 418
#define SQL_EQUALS 419
#define SQL_NOTEQUALS 420
#define SQL_LESS 421
#define SQL_GREATER 422
#define SQL_LESSEQ 423
#define SQL_GREATEREQ 424
#define SQL_NOTNULL 425
#define SQL_UMINUS 426
/* Value type. */
#if ! defined HSQL_STYPE && ! defined HSQL_STYPE_IS_DECLARED
union HSQL_STYPE
{
#line 98 "bison_parser.y" /* yacc.c:355 */
// clang-format on
bool bval;
char* sval;
double fval;
int64_t ival;
uintmax_t uval;
// statements
hsql::AlterStatement* alter_stmt;
hsql::CreateStatement* create_stmt;
hsql::DeleteStatement* delete_stmt;
hsql::DropStatement* drop_stmt;
hsql::ExecuteStatement* exec_stmt;
hsql::ExportStatement* export_stmt;
hsql::ImportStatement* import_stmt;
hsql::InsertStatement* insert_stmt;
hsql::PrepareStatement* prep_stmt;
hsql::SelectStatement* select_stmt;
hsql::ShowStatement* show_stmt;
hsql::SQLStatement* statement;
hsql::TransactionStatement* transaction_stmt;
hsql::UpdateStatement* update_stmt;
hsql::Alias* alias_t;
hsql::AlterAction* alter_action_t;
hsql::ColumnDefinition* column_t;
hsql::ColumnType column_type_t;
hsql::ConstraintType column_constraint_t;
hsql::DatetimeField datetime_field;
hsql::DropColumnAction* drop_action_t;
hsql::Expr* expr;
hsql::GroupByDescription* group_t;
hsql::ImportType import_type_t;
hsql::JoinType join_type;
hsql::LimitDescription* limit;
hsql::OrderDescription* order;
hsql::OrderType order_type;
hsql::SetOperation* set_operator_t;
hsql::TableConstraint* table_constraint_t;
hsql::TableElement* table_element_t;
hsql::TableName table_name;
hsql::TableRef* table;
hsql::UpdateClause* update_t;
hsql::WithDescription* with_description_t;
hsql::LockingClause* locking_t;
std::vector<char*>* str_vec;
std::set<hsql::ConstraintType>* column_constraint_set;
std::vector<hsql::Expr*>* expr_vec;
std::vector<hsql::OrderDescription*>* order_vec;
std::vector<hsql::SQLStatement*>* stmt_vec;
std::vector<hsql::TableElement*>* table_element_vec;
std::vector<hsql::TableRef*>* table_vec;
std::vector<hsql::UpdateClause*>* update_vec;
std::vector<hsql::WithDescription*>* with_description_vec;
std::vector<hsql::LockingClause*>* locking_clause_vec;
std::pair<int64_t, int64_t>* ival_pair;
hsql::RowLockMode lock_mode_t;
hsql::RowLockWaitPolicy lock_wait_policy_t;
#line 584 "bison_parser.tab.c" /* yacc.c:355 */
};
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_TAB_H_INCLUDED */
/* Copy the second part of user declarations. */
#line 614 "bison_parser.tab.c" /* 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 69
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 858
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 189
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 126
/* YYNRULES -- Number of rules. */
#define YYNRULES 325
/* YYNSTATES -- Number of states. */
#define YYNSTATES 584
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 426
#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, 178, 2, 2,
183, 184, 176, 174, 187, 175, 185, 177, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 186,
167, 164, 168, 188, 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, 181, 2, 182, 179, 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, 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, 121, 122, 123, 124,
125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
155, 156, 157, 158, 159, 160, 161, 162, 163, 165,
166, 169, 170, 171, 172, 173, 180
};
#if HSQL_DEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 304, 304, 323, 329, 336, 340, 344, 345, 346,
348, 349, 350, 351, 352, 353, 354, 355, 356, 357,
363, 364, 366, 370, 375, 379, 389, 390, 391, 393,
393, 399, 405, 407, 411, 422, 428, 435, 450, 455,
456, 462, 474, 475, 476, 480, 485, 496, 509, 521,
528, 535, 544, 545, 547, 551, 556, 557, 559, 566,
567, 568, 569, 570, 571, 572, 576, 577, 578, 579,
580, 581, 582, 583, 584, 585, 586, 588, 589, 591,
592, 593, 595, 596, 598, 602, 607, 608, 609, 610,
612, 613, 621, 627, 633, 639, 645, 646, 653, 659,
661, 671, 678, 689, 696, 704, 705, 712, 719, 723,
728, 738, 742, 746, 758, 758, 760, 761, 770, 771,
773, 787, 799, 804, 808, 812, 817, 818, 820, 830,
835, 836, 838, 840, 841, 843, 845, 846, 848, 853,
855, 856, 858, 859, 861, 865, 870, 872, 873, 874,
878, 879, 881, 882, 883, 884, 885, 886, 887, 892,
896, 901, 902, 904, 908, 913, 921, 921, 921, 921,
921, 923, 924, 924, 924, 924, 924, 924, 924, 924,
925, 925, 929, 929, 931, 932, 933, 934, 935, 937,
937, 938, 939, 940, 941, 942, 943, 944, 945, 946,
948, 949, 951, 952, 953, 954, 958, 959, 960, 961,
963, 964, 966, 967, 969, 970, 971, 972, 973, 974,
975, 977, 978, 980, 982, 984, 985, 986, 987, 988,
989, 991, 992, 993, 994, 995, 996, 998, 998, 1000,
1002, 1004, 1006, 1007, 1008, 1009, 1011, 1011, 1011, 1011,
1011, 1011, 1011, 1011, 1013, 1015, 1017, 1018, 1020, 1021,
1023, 1025, 1027, 1038, 1042, 1053, 1085, 1094, 1094, 1101,
1101, 1103, 1103, 1110, 1114, 1119, 1127, 1133, 1137, 1142,
1143, 1145, 1145, 1147, 1147, 1149, 1150, 1152, 1152, 1158,
1159, 1161, 1165, 1170, 1176, 1183, 1184, 1185, 1186, 1188,
1189, 1190, 1196, 1196, 1198, 1200, 1204, 1209, 1219, 1226,
1234, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258,
1259, 1261, 1267, 1267, 1270, 1274
};
#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", "DEALLOCATE", "PARAMETERS", "INTERSECT", "TEMPORARY",
"TIMESTAMP", "DISTINCT", "NVARCHAR", "RESTRICT", "TRUNCATE", "ANALYZE",
"BETWEEN", "CASCADE", "COLUMNS", "CONTROL", "DEFAULT", "EXECUTE",
"EXPLAIN", "INTEGER", "NATURAL", "PREPARE", "PRIMARY", "SCHEMAS",
"CHARACTER_VARYING", "REAL", "DECIMAL", "SMALLINT", "BIGINT", "SPATIAL",
"VARCHAR", "VIRTUAL", "DESCRIBE", "BEFORE", "COLUMN", "CREATE", "DELETE",
"DIRECT", "DOUBLE", "ESCAPE", "EXCEPT", "EXISTS", "EXTRACT", "CAST",
"FORMAT", "GLOBAL", "HAVING", "IMPORT", "INSERT", "ISNULL", "OFFSET",
"RENAME", "SCHEMA", "SELECT", "SORTED", "TABLES", "UNIQUE", "UNLOAD",
"UPDATE", "VALUES", "AFTER", "ALTER", "CROSS", "DATABASES", "DATABASE",
"DELTA", "FLOAT", "GROUP", "INDEX", "INNER", "LIMIT", "LOCAL", "MERGE",
"MINUS", "ORDER", "OUTER", "RIGHT", "TABLE", "UNION", "USING", "WHERE",
"CALL", "CASE", "CHAR", "COPY", "DATE", "DATETIME", "DESC", "DROP",
"ELSE", "FILE", "FROM", "FULL", "HASH", "HINT", "INTO", "JOIN", "LEFT",
"LIKE", "LOAD", "LONG", "NULL", "PLAN", "SHOW", "TEXT", "THEN", "TIME",
"VIEW", "WHEN", "WITH", "ADD", "ALL", "AND", "ASC", "END", "FOR", "INT",
"KEY", "NOT", "OFF", "SET", "TOP", "AS", "BY", "IF", "IN", "IS", "OF",
"ON", "OR", "TO", "NO", "ARRAY", "CONCAT", "ILIKE", "SECOND", "MINUTE",
"HOUR", "DAY", "MONTH", "YEAR", "SECONDS", "MINUTES", "HOURS", "DAYS",
"MONTHS", "YEARS", "INTERVAL", "TRUE", "FALSE", "BOOLEAN", "TRANSACTION",
"BEGIN", "COMMIT", "ROLLBACK", "NOWAIT", "SKIP", "LOCKED", "SHARE",
"'='", "EQUALS", "NOTEQUALS", "'<'", "'>'", "LESS", "GREATER", "LESSEQ",
"GREATEREQ", "NOTNULL", "'+'", "'-'", "'*'", "'/'", "'%'", "'^'",
"UMINUS", "'['", "']'", "'('", "')'", "'.'", "';'", "','", "'?'",
"$accept", "input", "statement_list", "statement",
"preparable_statement", "opt_hints", "hint_list", "hint",
"transaction_statement", "opt_transaction_keyword", "prepare_statement",
"prepare_target_query", "execute_statement", "import_statement",
"file_type", "file_path", "opt_file_type", "export_statement",
"show_statement", "create_statement", "opt_not_exists",