diff --git a/.gitignore b/.gitignore index 59c419d..d47c92e 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,6 @@ cmake-build-debug/ *.swp *.csv + +# macOS compilation dirs +*.dSYM diff --git a/.travis.yml b/.travis.yml index b6fd166..4bbbb59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,10 @@ language: cpp install: - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo apt-get -qq update - - sudo apt-get install -y g++-4.8 libstdc++-4.8-dev - - sudo apt-get install -y flex valgrind - - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90 - - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90 + - sudo apt-get install -y g++-6 libstdc++-6-dev + - sudo apt-get install -y valgrind + - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 90 + - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 90 # Install bison 3.0.4. - wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz @@ -16,21 +16,34 @@ install: - ./configure && make && sudo make install - cd .. + # Install flex 2.6.4 + - wget https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz + - tar -xvzf flex-2.6.4.tar.gz + - cd flex-2.6.4 + - ./configure && make && sudo make install + - cd .. + # Show installed versions. - which g++ - g++ -v - bison --version - flex --version - valgrind --version + - if [ "$CXX" = "clang++" ]; then export CXXFLAGS="-stdlib=libc++"; fi compiler: - gcc - clang script: + # bi build with flex/bison files checked into repo + - make -j4 + - make test + - make test_example + + # build flex/bison files in CI - make cleanall - make -j4 - - make test - make test_example diff --git a/Makefile b/Makefile index ca23eeb..2f3d90e 100644 --- a/Makefile +++ b/Makefile @@ -36,17 +36,17 @@ GMAKE = make mode=$(mode) NAME := sqlparser PARSER_CPP = $(SRCPARSER)/bison_parser.cpp $(SRCPARSER)/flex_lexer.cpp PARSER_H = $(SRCPARSER)/bison_parser.h $(SRCPARSER)/flex_lexer.h +LIB_CFLAGS = -std=c++1z -Wall -Werror $(OPT_FLAG) static ?= no ifeq ($(static), yes) LIB_BUILD = lib$(NAME).a LIBLINKER = $(AR) - LIB_CFLAGS = -std=c++11 -Wall -Werror $(OPT_FLAG) LIB_LFLAGS = rs else LIB_BUILD = lib$(NAME).so LIBLINKER = $(CXX) - LIB_CFLAGS = -std=c++11 -Wall -Werror -fPIC $(OPT_FLAG) + LIB_CFLAGS += -fPIC LIB_LFLAGS = -shared -o endif LIB_CPP = $(shell find $(SRC) -name '*.cpp' -not -path "$(SRCPARSER)/*") $(PARSER_CPP) @@ -60,7 +60,7 @@ $(LIB_BUILD): $(LIB_OBJ) $(LIBLINKER) $(LIB_LFLAGS) $(LIB_BUILD) $(LIB_OBJ) $(SRCPARSER)/flex_lexer.o: $(SRCPARSER)/flex_lexer.cpp $(SRCPARSER)/bison_parser.cpp - $(CXX) $(LIB_CFLAGS) -c -o $@ $< -Wno-sign-compare -Wno-unneeded-internal-declaration -Wno-deprecated-register + $(CXX) $(LIB_CFLAGS) -c -o $@ $< -Wno-sign-compare -Wno-unneeded-internal-declaration %.o: %.cpp $(PARSER_CPP) $(LIB_H) $(CXX) $(LIB_CFLAGS) -c -o $@ $< @@ -120,7 +120,7 @@ $(BM_BUILD): $(BM_ALL) $(LIB_BUILD) ############ Test & Example ############ ######################################## TEST_BUILD = $(BIN)/tests -TEST_CFLAGS = -std=c++11 -Wall -Werror -Isrc/ -Itest/ -L./ $(OPT_FLAG) +TEST_CFLAGS = -std=c++1z -Wall -Werror -Isrc/ -Itest/ -L./ $(OPT_FLAG) TEST_CPP = $(shell find test/ -name '*.cpp') TEST_ALL = $(shell find test/ -name '*.cpp') $(shell find test/ -name '*.h') EXAMPLE_SRC = $(shell find example/ -name '*.cpp') $(shell find example/ -name '*.h') diff --git a/docs/README.md b/docs/README.md index f519412..f80ee5a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,7 +4,8 @@ Documentation Internal Links: * [Developer Documentation](dev-docs.md) - * [Working SQL Syntax Examples](syntax-examples.md) + * [Supported SQL Queries](syntax-support.md) + * [Known Limitations & Missing Features](known-limitations.md) External Resources: diff --git a/docs/known-limitations.md b/docs/known-limitations.md new file mode 100644 index 0000000..0c91b04 --- /dev/null +++ b/docs/known-limitations.md @@ -0,0 +1,18 @@ +Known Limitations & Missing Features +==================================== + +This page contains an overview of known missing limitations and missing features in our SQL parser project. In general, we would like to see all of these features being supported at some point. If you are particularly interested in a specific feature, feel free to contribute to this project through a pull request. + +### Completely Missing Statement Types + + * EXPLAIN + * EXPORT + * RENAME + * ALTER + +Additionally, there are a lot of statement types that are specific to certain database systems. Supporting all of these is not on our roadmap, but if someone implements support for such a statement, we can also integrate it. + +### Other SQL Limitations + + * Tables names ignore the schema name (see grammar rule `table_name`). This affects, for example, `INSERT, IMPORT, DROP, DELETE`. + * Column data types only support `INT, DOUBLE, TEXT`. diff --git a/docs/syntax-examples.md b/docs/syntax-examples.md deleted file mode 100644 index be1d4d0..0000000 --- a/docs/syntax-examples.md +++ /dev/null @@ -1,44 +0,0 @@ -Syntax Examples -=============== - -This page contains some samples of SQL statements that can be executed in Hyrise. - - -**Create Tables** -```sql -CREATE TABLE IF NOT EXISTS students FROM TBL FILE 'test/students.tbl'; -CREATE TABLE test (v1 INTEGER, v2 INTEGER, v3 INTEGER); -``` - - -**Select with Join** -```sql -SELECT name, city, * FROM students AS t1 JOIN students AS t2 ON t1.city = t2.city WHERE t1.grade < 2.0 AND t2.grade > 2.0 AND t1.city = 'Frohnau' ORDER BY t1.grade DESC; -``` - - -**Group By** -```sql -SELECT city, AVG(grade) AS average, MIN(grade) AS best, MAX(grade) AS worst FROM students GROUP BY city; -``` - - -**Update and Delete** -```sql -UPDATE students SET name='Max Mustermann' WHERE name = 'Ralf Stiebitz'; -DELETE FROM students WHERE name = 'Max Mustermann'; -``` - - -**Prepare and Execute** -```sql -PREPARE batch_insert { - INSERT INTO test VALUES (?, 0, 0); - INSERT INTO test VALUES (?, 0, 0); - INSERT INTO test VALUES (?, 0, 0); - INSERT INTO test VALUES (?, 0, 0); - INSERT INTO test VALUES (?, 0, 0); -}; - -EXECUTE insert_test(1, 2, 3, 4 ,5); -``` diff --git a/docs/syntax-support.md b/docs/syntax-support.md new file mode 100644 index 0000000..59d08b9 --- /dev/null +++ b/docs/syntax-support.md @@ -0,0 +1,53 @@ +Supported SQL Queries +===================== + +This page contains a short list of queries that can be correctly parsed with our parser. If you are interested in finding out if a certain feature is supported, it is probably the easiest to checkout the repository and try the example project or check our [list of known limitations](known-limitations.md). Also the file [queries-good.sql](../test/queries/queries-good.sql) shows a list of queries which are parsable with the current version. + + +## Select Statements + +We implement a broad support for the most common elements for `SELECT` statements. Following are a few examples of basic constructs that are supported. + +```sql +SELECT name, city, * + FROM students AS t1 JOIN students AS t2 ON t1.city = t2.city + WHERE t1.grade < 2.0 AND + t2.grade > 2.0 AND + t1.city = 'Frohnau' + ORDER BY t1.grade DESC; + +SELECT city, AVG(grade) AS average, + MIN(grade) AS best, MAX(grade) AS worst + FROM students + GROUP BY city; +``` + +## Data Definition & Modification + +**Create Tables** +```sql +CREATE TABLE students ( + name TEXT, + student_number INTEGER, + city TEXT, + grade DOUBLE +); +``` + +**Update and Delete** +```sql +UPDATE students SET name='Max Mustermann' WHERE name = 'Ralf Mustermann'; + +DELETE FROM students WHERE name = 'Max Mustermann'; +``` + + +## Prepared Statements + +The definition and execution of prepared statements is supported using the following syntax. + +```sql +PREPARE select_test FROM 'SELECT * FROM customer WHERE c_name = ?;'; + +EXECUTE select_test('Max Mustermann'); +``` diff --git a/example/Makefile b/example/Makefile index 8e241c1..387b553 100644 --- a/example/Makefile +++ b/example/Makefile @@ -1,5 +1,5 @@ -CFLAGS = -std=c++11 -lstdc++ -Wall -Werror -I../src/ -L../ +CFLAGS = -std=c++1z -lstdc++ -Wall -Werror -I../src/ -L../ all: $(CXX) $(CFLAGS) example.cpp -o example -lsqlparser diff --git a/src/parser/bison_parser.cpp b/src/parser/bison_parser.cpp index 63fc7a9..8aafc9b 100644 --- a/src/parser/bison_parser.cpp +++ b/src/parser/bison_parser.cpp @@ -324,7 +324,9 @@ union HSQL_STYPE 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; @@ -343,7 +345,7 @@ union HSQL_STYPE std::vector* expr_vec; std::vector* order_vec; -#line 347 "bison_parser.cpp" /* yacc.c:355 */ +#line 349 "bison_parser.cpp" /* yacc.c:355 */ }; typedef union HSQL_STYPE HSQL_STYPE; @@ -373,7 +375,7 @@ int hsql_parse (hsql::SQLParserResult* result, yyscan_t scanner); /* Copy the second part of user declarations. */ -#line 377 "bison_parser.cpp" /* yacc.c:358 */ +#line 379 "bison_parser.cpp" /* yacc.c:358 */ #ifdef short # undef short @@ -615,18 +617,18 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 48 +#define YYFINAL 52 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 559 +#define YYLAST 552 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 151 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 85 +#define YYNNTS 87 /* YYNRULES -- Number of rules. */ -#define YYNRULES 196 +#define YYNRULES 201 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 362 +#define YYNSTATES 371 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ @@ -685,26 +687,27 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 240, 240, 261, 262, 266, 270, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 295, 296, 301, 302, - 306, 310, 322, 329, 332, 336, 348, 356, 360, 370, - 376, 382, 392, 393, 397, 398, 402, 409, 410, 411, - 412, 422, 426, 430, 442, 450, 462, 468, 478, 479, - 489, 498, 499, 503, 515, 516, 517, 534, 535, 539, - 540, 544, 554, 571, 575, 576, 577, 581, 582, 586, - 598, 599, 603, 607, 612, 613, 617, 622, 626, 627, - 630, 631, 635, 636, 640, 644, 645, 646, 652, 653, - 657, 658, 659, 666, 667, 671, 672, 676, 683, 684, - 685, 686, 687, 691, 692, 693, 694, 695, 696, 697, - 698, 699, 703, 704, 708, 709, 710, 711, 712, 716, - 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, - 730, 731, 735, 736, 737, 738, 743, 745, 749, 750, - 754, 755, 756, 757, 758, 759, 763, 764, 768, 772, - 776, 780, 781, 782, 783, 787, 788, 789, 790, 794, - 799, 800, 804, 808, 812, 824, 825, 835, 836, 840, - 841, 850, 851, 856, 866, 874, 875, 880, 881, 885, - 886, 894, 902, 912, 931, 932, 933, 934, 935, 936, - 937, 938, 943, 952, 953, 958, 959 + 0, 245, 245, 266, 267, 271, 275, 279, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 303, 304, 309, + 310, 314, 318, 330, 337, 340, 344, 356, 365, 369, + 379, 382, 396, 403, 410, 421, 422, 426, 427, 431, + 438, 439, 440, 441, 451, 457, 463, 471, 472, 481, + 490, 503, 510, 521, 522, 532, 541, 542, 546, 558, + 559, 560, 577, 578, 582, 583, 587, 597, 614, 618, + 619, 620, 624, 625, 629, 641, 642, 646, 650, 655, + 656, 660, 665, 669, 670, 673, 674, 678, 679, 683, + 687, 688, 689, 695, 696, 700, 701, 702, 709, 710, + 714, 715, 719, 726, 727, 728, 729, 730, 734, 735, + 736, 737, 738, 739, 740, 741, 742, 746, 747, 751, + 752, 753, 754, 755, 759, 760, 761, 762, 763, 764, + 765, 766, 767, 768, 769, 773, 774, 778, 779, 780, + 781, 786, 788, 792, 793, 797, 798, 799, 800, 801, + 802, 806, 807, 811, 815, 819, 823, 824, 825, 826, + 830, 831, 832, 833, 837, 842, 843, 847, 851, 855, + 867, 868, 878, 879, 883, 884, 893, 894, 899, 910, + 919, 920, 925, 926, 930, 931, 939, 947, 957, 976, + 977, 978, 979, 980, 981, 982, 983, 988, 997, 998, + 1003, 1004 }; #endif @@ -735,25 +738,25 @@ static const char *const yytname[] = "'.'", "';'", "','", "'?'", "$accept", "input", "statement_list", "statement", "preparable_statement", "opt_hints", "hint_list", "hint", "prepare_statement", "prepare_target_query", "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_paren_or_clause", "select_no_paren", - "set_operator", "set_type", "opt_all", "select_clause", "opt_distinct", - "select_list", "from_clause", "opt_where", "opt_group", "opt_having", - "opt_order", "order_list", "order_desc", "opt_order_type", "opt_top", - "opt_limit", "expr_list", "literal_list", "expr_alias", "expr", - "operand", "scalar_expr", "unary_expr", "binary_expr", "logic_expr", - "in_expr", "case_expr", "exists_expr", "comp_expr", "function_expr", - "array_expr", "array_index", "between_expr", "column_name", "literal", - "string_literal", "num_literal", "int_literal", "null_literal", - "param_expr", "table_ref", "table_ref_atomic", - "nonjoin_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_condition", "opt_semicolon", - "ident_commalist", YY_NULLPTR + "import_statement", "import_file_type", "file_path", "show_statement", + "create_statement", "opt_not_exists", "column_def_commalist", + "column_def", "column_type", "drop_statement", "opt_exists", + "delete_statement", "truncate_statement", "insert_statement", + "opt_column_list", "update_statement", "update_clause_commalist", + "update_clause", "select_statement", "select_with_paren", + "select_paren_or_clause", "select_no_paren", "set_operator", "set_type", + "opt_all", "select_clause", "opt_distinct", "select_list", "from_clause", + "opt_where", "opt_group", "opt_having", "opt_order", "order_list", + "order_desc", "opt_order_type", "opt_top", "opt_limit", "expr_list", + "literal_list", "expr_alias", "expr", "operand", "scalar_expr", + "unary_expr", "binary_expr", "logic_expr", "in_expr", "case_expr", + "exists_expr", "comp_expr", "function_expr", "array_expr", "array_index", + "between_expr", "column_name", "literal", "string_literal", + "num_literal", "int_literal", "null_literal", "param_expr", "table_ref", + "table_ref_atomic", "nonjoin_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_condition", + "opt_semicolon", "ident_commalist", YY_NULLPTR }; #endif @@ -781,57 +784,58 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -259 +#define YYPACT_NINF -232 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-259))) + (!!((Yystate) == (-232))) -#define YYTABLE_NINF -192 +#define YYTABLE_NINF -197 #define yytable_value_is_error(Yytable_value) \ - (!!((Yytable_value) == (-192))) + (!!((Yytable_value) == (-197))) /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { - 8, 44, 76, 85, 86, 68, 19, 28, 14, 26, - 76, 90, -8, 140, 33, -259, 63, 63, -259, -259, - -259, -259, -259, -259, -259, -259, -259, 37, -259, 132, - 186, 43, -259, 51, 120, 92, 92, 76, 98, 76, - 212, 210, 113, -259, 76, 76, 87, 89, -259, 8, - -259, 150, -259, -259, -259, -259, -259, -8, 148, 126, - -8, 187, -259, 248, 7, 252, 161, 76, 76, 202, - -259, 196, 135, -259, -259, -259, 123, 274, -259, -259, - -259, -259, -259, 136, -259, 215, -259, -259, -259, 123, - 215, 212, -259, -259, -259, -259, -259, -259, 31, -259, - -259, -259, -259, -259, -259, -259, -259, 245, -64, 135, - 123, -259, 284, 286, 127, 50, 145, 206, 129, 168, - 146, -259, 55, 232, 166, -259, 52, 169, -259, -259, - -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, - -259, -259, 190, -48, -259, 314, 187, 170, -259, -49, - 187, 275, -259, 7, -259, 208, 321, 211, -39, 241, - -259, -259, 39, 182, -259, 12, 5, 279, 123, 184, - 146, 328, 123, 88, 189, -71, 3, 202, 123, -259, - 123, 327, 123, -259, -259, 146, -259, 146, -69, 188, - -3, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 212, 7, 274, -259, 191, - 45, -259, -259, 123, -259, -259, -259, -259, 212, -259, - 264, -11, 60, -259, -8, 76, -259, 329, 7, -259, - 123, -259, -259, 199, -18, 279, 260, -117, -259, -259, - -8, -259, 185, -259, -259, 17, -259, 298, -259, -259, - -259, 258, 269, 356, 146, 216, 55, -259, 272, 220, - 356, 356, 356, 382, 382, 382, 382, 88, 88, 18, - 18, 18, 32, 223, -259, -259, 7, -259, 314, -259, - -259, 284, -259, -259, -259, -259, -259, -259, 321, -259, - -259, -259, 61, 71, -259, 146, 218, -259, 222, 288, - -259, -259, -259, 302, 304, 3, 289, -259, 261, -259, - 146, 356, 55, 231, 91, -259, -259, 93, -259, -259, - -259, -259, -259, 213, -259, 17, 3, -259, -259, 472, - 230, 3, 123, 328, 234, 99, -259, -259, -259, 146, - -259, -259, -259, 3, 297, -13, -259, -259, 295, 472, - 236, 123, 123, -259, -259, 6, -39, -259, -39, 235, - 239, -259 + 268, 42, 35, 73, 110, -43, -30, 39, 41, 32, + 35, 30, 11, -39, 147, 3, -232, 82, 82, -232, + -232, -232, -232, -232, -232, -232, -232, -232, -232, 28, + -232, 27, 169, 49, -232, 56, 126, 100, 100, 35, + 117, 35, 226, 205, 123, -232, 128, 128, 35, -232, + 101, 103, -232, 268, -232, 170, -232, -232, -232, -232, + -232, -39, 152, 144, -39, 194, -232, 258, 14, 261, + 159, 35, 35, 196, -232, 190, 127, -232, -232, -232, + 151, 270, 231, 35, 35, -232, -232, -232, -232, 131, + -232, 212, -232, -232, -232, 151, 212, 226, -232, -232, + -232, -232, -232, -232, -44, -232, -232, -232, -232, -232, + -232, -232, -232, 241, -56, 127, 151, -232, 280, 279, + -16, -84, 140, 188, 155, 161, 75, -232, 113, 213, + 157, -232, 65, 211, -232, -232, -232, -232, -232, -232, + -232, -232, -232, -232, -232, -232, -232, -232, 181, -61, + -232, -232, -232, -232, 306, 194, 164, -232, -46, 194, + 264, -232, 14, -232, 202, 315, 207, -78, 234, -232, + -232, -37, 179, -232, 2, 5, 276, 151, 185, 75, + 381, 151, 99, 180, -86, 4, 196, 151, -232, 151, + 324, 151, -232, -232, 75, -232, 75, -47, 186, -62, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 226, 151, 270, -232, 187, 34, + -232, -232, 151, -232, -232, -232, -232, 226, -232, 253, + 7, 48, -232, -39, 35, -232, 331, 14, -232, 151, + -232, -232, 192, -50, 276, 254, 26, -232, -232, -39, + -232, 24, -232, -232, 10, -232, 283, -232, -232, -232, + 256, 322, 409, 75, 210, 113, -232, 266, 217, 409, + 409, 409, 235, 235, 235, 235, 99, 99, -95, -95, + -95, 50, 218, -78, -232, 14, -232, 306, -232, -232, + 280, -232, -232, -232, -232, -232, -232, 315, -232, -232, + -232, 53, 59, -232, 75, 224, -232, 233, 277, -232, + -232, -232, 309, 312, 4, 295, -232, 267, -232, 75, + 409, 113, 238, 60, -232, -232, 69, -232, -232, -232, + -232, -232, 278, -232, 10, 4, -232, -232, 229, 236, + 4, 151, 381, 240, 78, -232, -232, -232, 75, -232, + -232, -232, 4, 142, -27, -232, -232, 348, 229, 243, + 151, 151, -232, -232, 6, -78, -232, -78, 242, 244, + -232 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -839,71 +843,72 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, - 0, 0, 0, 0, 194, 3, 17, 17, 15, 8, - 9, 14, 11, 12, 10, 13, 7, 54, 55, 81, - 0, 175, 45, 24, 0, 33, 33, 0, 0, 0, - 0, 71, 0, 174, 0, 0, 0, 0, 1, 193, - 2, 0, 6, 5, 65, 66, 64, 0, 68, 0, - 0, 92, 43, 0, 0, 0, 0, 0, 0, 75, - 27, 0, 49, 162, 88, 70, 0, 0, 41, 42, - 58, 57, 4, 0, 59, 81, 60, 67, 63, 0, - 81, 0, 61, 176, 159, 160, 163, 164, 0, 95, - 155, 156, 161, 157, 158, 23, 22, 0, 0, 49, - 0, 44, 0, 0, 0, 151, 0, 0, 0, 0, - 0, 153, 0, 0, 72, 93, 180, 98, 105, 106, - 107, 100, 102, 108, 101, 119, 109, 110, 104, 99, - 112, 113, 0, 75, 51, 0, 92, 80, 82, 87, - 92, 90, 25, 0, 32, 0, 0, 0, 74, 0, - 28, 195, 0, 0, 47, 71, 0, 0, 0, 0, - 0, 115, 0, 114, 0, 0, 0, 75, 0, 178, - 0, 0, 0, 179, 97, 0, 116, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, + 0, 0, 0, 0, 0, 199, 3, 18, 18, 16, + 9, 7, 10, 15, 12, 13, 11, 14, 8, 59, + 60, 86, 0, 180, 50, 25, 0, 36, 36, 0, + 0, 0, 0, 76, 0, 179, 48, 48, 0, 30, + 0, 0, 1, 198, 2, 0, 6, 5, 70, 71, + 69, 0, 73, 0, 0, 97, 46, 0, 0, 0, + 0, 0, 0, 80, 28, 0, 54, 167, 93, 75, + 0, 0, 0, 0, 0, 31, 63, 62, 4, 0, + 64, 86, 65, 72, 68, 0, 86, 0, 66, 181, + 164, 165, 168, 169, 0, 100, 160, 161, 166, 162, + 163, 24, 23, 0, 0, 54, 0, 49, 0, 0, + 0, 156, 0, 0, 0, 0, 0, 158, 0, 0, + 77, 98, 185, 103, 110, 111, 112, 105, 107, 113, + 106, 124, 114, 115, 109, 104, 117, 118, 0, 80, + 56, 47, 44, 45, 0, 97, 85, 87, 92, 97, + 95, 26, 0, 35, 0, 0, 0, 79, 0, 29, + 200, 0, 0, 52, 76, 0, 0, 0, 0, 0, + 120, 0, 119, 0, 0, 0, 80, 0, 183, 0, + 0, 0, 184, 102, 0, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 50, 20, - 0, 18, 56, 0, 86, 85, 84, 62, 0, 96, - 0, 0, 0, 34, 0, 0, 48, 0, 0, 146, - 0, 152, 154, 0, 0, 0, 0, 0, 111, 103, - 0, 73, 165, 167, 169, 180, 168, 77, 94, 130, - 177, 131, 0, 126, 0, 0, 0, 117, 0, 129, - 128, 140, 141, 142, 143, 144, 145, 121, 120, 123, - 122, 124, 125, 0, 53, 52, 0, 16, 0, 83, - 91, 0, 38, 39, 40, 37, 36, 30, 0, 31, - 26, 196, 0, 0, 138, 0, 0, 148, 0, 0, - 190, 184, 185, 189, 188, 0, 0, 173, 0, 69, - 0, 127, 0, 0, 0, 118, 149, 0, 19, 29, - 35, 46, 147, 0, 139, 180, 0, 187, 186, 171, - 166, 0, 0, 150, 0, 0, 134, 132, 21, 0, - 136, 170, 181, 0, 191, 79, 135, 133, 0, 172, - 0, 0, 0, 76, 137, 0, 192, 182, 78, 151, - 0, 183 + 0, 0, 0, 0, 0, 0, 0, 55, 21, 0, + 19, 61, 0, 91, 90, 89, 67, 0, 101, 0, + 0, 0, 37, 0, 0, 53, 0, 0, 151, 0, + 157, 159, 0, 0, 0, 0, 0, 116, 108, 0, + 78, 170, 172, 174, 185, 173, 82, 99, 135, 182, + 136, 0, 131, 0, 0, 0, 122, 0, 134, 133, + 145, 146, 147, 148, 149, 150, 126, 125, 128, 127, + 129, 130, 0, 58, 57, 0, 17, 0, 88, 96, + 0, 41, 42, 43, 40, 39, 33, 0, 34, 27, + 201, 0, 0, 143, 0, 0, 153, 0, 0, 195, + 189, 190, 194, 193, 0, 0, 178, 0, 74, 0, + 132, 0, 0, 0, 123, 154, 0, 20, 32, 38, + 51, 152, 0, 144, 185, 0, 192, 191, 176, 171, + 0, 0, 155, 0, 0, 139, 137, 22, 0, 141, + 175, 186, 0, 196, 84, 140, 138, 0, 177, 0, + 0, 0, 81, 142, 0, 197, 187, 83, 156, 0, + 188 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -259, -259, -259, 337, -259, 371, -259, 111, -259, -259, - -259, -259, -259, 109, -259, 355, -259, 104, -259, -259, - -259, -259, -259, 287, -259, -259, 204, -191, 9, 354, - -12, 386, -259, -259, 205, 253, -259, -259, -107, -259, - -259, 94, -259, 209, -259, -259, -72, -165, -212, 262, - -88, -80, -259, -259, -259, -259, -259, -259, -259, -259, - -259, -259, -259, -259, 75, -60, -109, -259, -35, -259, - -259, -259, -258, 100, -259, -259, -259, 0, -259, -227, - -259, -259, -259, -259, -259 + -232, -232, -232, 338, -232, 374, -232, 107, -232, -232, + -232, -232, -232, 105, -232, -232, 359, -232, 102, -232, + -232, 351, -232, -232, -232, 285, -232, -232, 189, -64, + 13, 337, -13, 378, -232, -232, 182, 246, -232, -232, + -128, -232, -232, 91, -232, 200, -232, -232, -68, -175, + -220, 245, -94, -71, -232, -232, -232, -232, -232, -232, + -232, -232, -232, -232, -232, -232, 61, -66, -113, -232, + -38, -232, -232, -232, -162, 88, -232, -232, -232, 1, + -232, -231, -232, -232, -232, -232, -232 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 13, 14, 15, 16, 52, 210, 211, 17, 106, - 18, 19, 71, 159, 20, 67, 222, 223, 286, 21, - 22, 23, 24, 114, 25, 143, 144, 26, 27, 85, - 28, 57, 58, 88, 29, 76, 123, 177, 111, 309, - 353, 61, 147, 148, 216, 41, 92, 124, 98, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 100, 101, 102, 103, - 104, 241, 242, 243, 330, 244, 42, 245, 183, 184, - 246, 306, 357, 50, 162 + -1, 14, 15, 16, 17, 56, 219, 220, 18, 112, + 19, 20, 75, 168, 21, 22, 71, 231, 232, 295, + 23, 83, 24, 25, 26, 120, 27, 149, 150, 28, + 29, 91, 30, 61, 62, 94, 31, 80, 129, 186, + 117, 318, 362, 65, 156, 157, 225, 43, 98, 130, + 104, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 106, 107, + 108, 109, 110, 250, 251, 252, 339, 253, 44, 254, + 192, 193, 255, 315, 366, 54, 171 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -911,122 +916,122 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 47, 149, 32, 160, 99, 74, 31, 237, 231, 359, - 43, 94, 95, 73, 282, 1, 292, 155, 307, 254, - 179, 46, 158, 2, 75, 110, 283, 297, 214, 352, - 3, 180, 178, 289, 175, 4, 208, 69, 171, 72, - 173, 9, 5, 6, 78, 79, 54, 329, 255, 298, - 182, 7, 8, 180, 215, 179, 151, 9, 115, 94, - 95, 73, 10, 180, 317, 293, 84, 108, 109, 84, - 247, 30, 182, 344, 212, 239, 55, 295, 217, 31, - 234, 156, 182, 284, 180, 349, 11, 257, 33, 34, - 171, 314, 249, 219, 251, 116, 285, 96, 341, 39, - 37, 207, 164, 182, 9, 252, 258, 253, 56, 38, - 174, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 149, 115, 94, 95, 73, - 117, 181, 115, 94, 95, 73, 178, 12, 35, 40, - 48, 54, 191, 232, 121, 96, 274, 335, 240, 115, - 94, 95, 73, 12, 180, 233, 191, 97, 229, 204, - 44, 205, 51, 116, 118, 36, 181, 345, 99, 169, - 273, 55, 160, 182, 311, 205, 9, 152, 119, 146, - 153, 49, 163, 280, 150, 226, 185, 45, 227, 62, - 63, 277, 120, 121, 278, 165, 64, 166, 117, 59, - 122, 65, 70, 56, 117, 97, 287, 321, 66, 288, - 153, 299, 191, 96, 186, 323, 99, 322, 73, 96, - 178, 117, 75, 296, 77, 290, 201, 202, 203, 204, - 333, 205, 118, 80, 83, 81, 96, 337, 170, 338, - 178, 89, 153, 300, 313, 347, 119, 301, 178, 87, - 91, 93, 119, 302, 303, 170, 105, 187, 186, 348, - 120, 121, 86, 356, 358, 86, 120, 121, 122, 119, - 107, -191, 304, 97, 122, 110, 112, 142, 188, 97, - 113, 145, 59, 120, 121, 154, 189, 190, 94, 161, - 167, 122, 339, 191, 192, 193, 97, 194, 195, 196, - 334, 187, 197, 198, 168, 199, 200, 201, 202, 203, - 204, 172, 205, 176, 186, 178, 206, 209, 340, 213, - 220, 218, 236, 299, 221, 224, 225, 228, 9, 235, - 250, 190, 291, 256, 305, 238, 276, 191, 192, 193, - 186, 194, 195, 196, 281, 294, 197, 198, 254, 199, - 200, 201, 202, 203, 204, 300, 205, 187, 308, 301, - 180, 312, 315, 205, 324, 302, 303, 316, 325, 350, - 327, 310, 328, 186, 326, 331, 332, 336, 236, 343, - 346, 355, 166, 187, 304, 361, 82, 190, 53, 318, - 319, 68, 320, 191, 192, 193, 157, 194, 195, 196, - 354, 186, 197, 198, 236, 199, 200, 201, 202, 203, - 204, 275, 205, 190, 90, 60, 187, 351, 230, 191, - 192, 193, 279, 194, 195, 196, 342, 186, 197, 198, - 360, 199, 200, 201, 202, 203, 204, 236, 205, 0, - 248, 0, 0, 0, -192, 0, 190, 0, 0, 0, - 0, 0, 191, 192, 193, 0, 194, 195, 196, 0, - 0, 197, 198, 0, 199, 200, 201, 202, 203, 204, - 0, 205, 0, 0, 190, 0, 0, 0, 0, 0, - 191, -192, -192, 0, -192, 195, 196, 0, 0, 197, - 198, 0, 199, 200, 201, 202, 203, 204, 299, 205, - 190, 0, 0, 0, 0, 0, 191, 0, 0, 0, - 0, -192, -192, 0, 0, -192, -192, 0, 199, 200, - 201, 202, 203, 204, 0, 205, 0, 0, 0, 0, - 300, 0, 0, 0, 301, 0, 0, 0, 0, 0, - 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -191, 304 + 51, 158, 105, 34, 78, 169, 246, 33, 240, 368, + 9, 45, 116, 188, 79, 361, 189, 301, 100, 101, + 77, 217, 167, 316, 189, 164, 50, 37, 266, 200, + 48, 223, 291, 9, 184, 191, 58, 58, 33, 172, + 73, 263, 76, 191, 292, 304, 213, 267, 214, 85, + 308, 39, 189, 180, 38, 182, 189, 224, 256, 160, + 248, 174, 49, 175, 302, 326, 59, 59, 188, 32, + 264, 191, 114, 115, 90, 191, 35, 90, 121, 100, + 101, 77, 309, 243, 152, 153, 310, 221, 216, 165, + 323, 226, 311, 312, 63, 258, 228, 260, 60, 60, + 46, 293, 161, 350, 102, 162, 13, 173, 180, 235, + -196, 313, 236, 36, 294, 183, 121, 100, 101, 77, + 40, 283, 187, 261, 190, 262, 41, 47, 158, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 241, 127, 42, 344, 52, 238, 249, + 123, 53, 338, 122, 121, 100, 101, 77, 121, 100, + 101, 77, 9, 242, 103, 102, 354, 189, 308, 298, + 306, 105, 66, 314, 200, 187, 282, 169, 353, 190, + 286, 55, 155, 287, 179, 307, 191, 159, 123, 289, + 358, 122, 320, 214, 296, 178, 67, 297, 125, 330, + 309, 68, 162, 102, 310, 331, 346, 69, 187, 187, + 311, 312, 126, 127, 359, 347, 70, 79, 162, 105, + 128, 74, 124, 200, 356, 103, 123, 187, 194, 313, + 123, 305, 77, 332, 81, 299, 125, 210, 211, 212, + 213, 102, 214, 92, 82, 102, 92, 86, 342, 87, + 126, 127, 322, 93, 89, 308, 195, 97, 128, 95, + 124, 99, 360, 103, 179, 111, 365, 367, 113, 116, + 118, 151, 119, 148, 125, 1, 154, 357, 125, 63, + 195, 163, 170, 2, 100, 176, 177, 309, 126, 127, + 3, 310, 126, 127, 185, 4, 128, 311, 312, 196, + 128, 103, 5, 6, 181, 103, 187, 215, 343, 218, + 227, 7, 8, 222, 229, -196, 313, 9, 230, 234, + 197, 233, 10, 195, 237, 9, 247, 259, 198, 199, + 244, 265, 285, 290, 300, 200, 201, 202, 303, 203, + 204, 205, 263, 317, 206, 207, 11, 208, 209, 210, + 211, 212, 213, 199, 214, 321, 324, 348, 189, 200, + 214, 12, 325, 335, -197, -197, 196, 195, -197, -197, + 333, 208, 209, 210, 211, 212, 213, 336, 214, 334, + 337, 340, 341, 349, 345, 352, 355, 245, 364, 175, + 370, 88, 57, 195, 327, 328, 199, 72, 84, 329, + 166, 96, 200, 201, 202, 284, 203, 204, 205, 64, + 196, 206, 207, 13, 208, 209, 210, 211, 212, 213, + 239, 214, 288, 351, 319, 369, 195, 0, 0, 0, + 0, 245, 257, 0, 0, 0, 196, 0, 0, 0, + 199, 0, 0, 0, 0, 0, 200, 201, 202, 0, + 203, 204, 205, 363, 195, 206, 207, 245, 208, 209, + 210, 211, 212, 213, 0, 214, 199, 0, 0, 196, + 0, 0, 200, 201, 202, 0, 203, 204, 205, 0, + 0, 206, 207, 0, 208, 209, 210, 211, 212, 213, + 245, 214, 0, 0, 0, 0, 0, -197, 0, 199, + 0, 0, 0, 0, 0, 200, 201, 202, 0, 203, + 204, 205, 0, 0, 206, 207, 0, 208, 209, 210, + 211, 212, 213, 0, 214, 0, 0, 199, 0, 0, + 0, 0, 0, 200, -197, -197, 0, -197, 204, 205, + 0, 0, 206, 207, 0, 208, 209, 210, 211, 212, + 213, 0, 214 }; static const yytype_int16 yycheck[] = { - 12, 89, 2, 112, 64, 40, 3, 172, 3, 3, - 10, 4, 5, 6, 25, 7, 228, 81, 245, 88, - 3, 12, 110, 15, 12, 73, 37, 144, 77, 42, - 22, 102, 149, 224, 122, 27, 143, 37, 118, 39, - 120, 49, 34, 35, 44, 45, 9, 305, 117, 240, - 121, 43, 44, 102, 103, 3, 91, 49, 3, 4, - 5, 6, 54, 102, 276, 230, 57, 67, 68, 60, - 177, 27, 121, 331, 146, 146, 39, 95, 150, 3, - 168, 145, 121, 94, 102, 343, 78, 90, 3, 3, - 170, 256, 180, 153, 182, 40, 107, 90, 325, 85, - 81, 149, 114, 121, 49, 185, 109, 187, 71, 81, - 122, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 213, 3, 4, 5, 6, - 75, 114, 3, 4, 5, 6, 149, 145, 70, 113, - 0, 9, 124, 138, 138, 90, 206, 312, 145, 3, - 4, 5, 6, 145, 102, 167, 124, 150, 146, 141, - 70, 143, 99, 40, 109, 97, 114, 332, 228, 40, - 205, 39, 281, 121, 254, 143, 49, 146, 123, 85, - 149, 148, 55, 218, 90, 146, 17, 97, 149, 3, - 147, 146, 137, 138, 149, 145, 145, 147, 75, 67, - 145, 81, 104, 71, 75, 150, 146, 146, 116, 149, - 149, 26, 124, 90, 45, 295, 276, 146, 6, 90, - 149, 75, 12, 235, 111, 225, 138, 139, 140, 141, - 310, 143, 109, 146, 84, 146, 90, 146, 109, 146, - 149, 115, 149, 58, 256, 146, 123, 62, 149, 101, - 63, 3, 123, 68, 69, 109, 4, 88, 45, 339, - 137, 138, 57, 351, 352, 60, 137, 138, 145, 123, - 109, 86, 87, 150, 145, 73, 80, 3, 109, 150, - 145, 145, 67, 137, 138, 40, 117, 118, 4, 3, - 145, 145, 79, 124, 125, 126, 150, 128, 129, 130, - 312, 88, 133, 134, 98, 136, 137, 138, 139, 140, - 141, 143, 143, 81, 45, 149, 126, 3, 105, 149, - 112, 46, 109, 26, 3, 114, 85, 145, 49, 145, - 3, 118, 3, 145, 149, 146, 145, 124, 125, 126, - 45, 128, 129, 130, 80, 146, 133, 134, 88, 136, - 137, 138, 139, 140, 141, 58, 143, 88, 60, 62, - 102, 145, 90, 143, 146, 68, 69, 144, 146, 72, - 68, 102, 68, 45, 86, 86, 115, 146, 109, 149, - 146, 145, 147, 88, 87, 146, 49, 118, 17, 278, - 281, 36, 288, 124, 125, 126, 109, 128, 129, 130, - 105, 45, 133, 134, 109, 136, 137, 138, 139, 140, - 141, 207, 143, 118, 60, 29, 88, 120, 165, 124, - 125, 126, 213, 128, 129, 130, 326, 45, 133, 134, - 355, 136, 137, 138, 139, 140, 141, 109, 143, -1, - 178, -1, -1, -1, 88, -1, 118, -1, -1, -1, + 13, 95, 68, 2, 42, 118, 181, 3, 3, 3, + 49, 10, 73, 3, 12, 42, 102, 237, 4, 5, + 6, 149, 116, 254, 102, 81, 13, 70, 90, 124, + 19, 77, 25, 49, 128, 121, 9, 9, 3, 55, + 39, 88, 41, 121, 37, 95, 141, 109, 143, 48, + 26, 81, 102, 124, 97, 126, 102, 103, 186, 97, + 146, 145, 51, 147, 239, 285, 39, 39, 3, 27, + 117, 121, 71, 72, 61, 121, 3, 64, 3, 4, + 5, 6, 58, 177, 83, 84, 62, 155, 149, 145, + 265, 159, 68, 69, 67, 189, 162, 191, 71, 71, + 70, 94, 146, 334, 90, 149, 145, 120, 179, 146, + 86, 87, 149, 3, 107, 128, 3, 4, 5, 6, + 81, 215, 149, 194, 114, 196, 85, 97, 222, 200, + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, + 211, 212, 213, 138, 138, 113, 321, 0, 146, 145, + 75, 148, 314, 40, 3, 4, 5, 6, 3, 4, + 5, 6, 49, 176, 150, 90, 341, 102, 26, 233, + 144, 237, 3, 149, 124, 149, 214, 290, 340, 114, + 146, 99, 91, 149, 109, 249, 121, 96, 75, 227, + 352, 40, 263, 143, 146, 40, 147, 149, 123, 146, + 58, 145, 149, 90, 62, 146, 146, 81, 149, 149, + 68, 69, 137, 138, 72, 146, 116, 12, 149, 285, + 145, 104, 109, 124, 146, 150, 75, 149, 17, 87, + 75, 244, 6, 304, 111, 234, 123, 138, 139, 140, + 141, 90, 143, 61, 116, 90, 64, 146, 319, 146, + 137, 138, 265, 101, 84, 26, 45, 63, 145, 115, + 109, 3, 120, 150, 109, 4, 360, 361, 109, 73, + 80, 40, 145, 3, 123, 7, 145, 348, 123, 67, + 45, 40, 3, 15, 4, 145, 98, 58, 137, 138, + 22, 62, 137, 138, 81, 27, 145, 68, 69, 88, + 145, 150, 34, 35, 143, 150, 149, 126, 321, 3, + 46, 43, 44, 149, 112, 86, 87, 49, 3, 85, + 109, 114, 54, 45, 145, 49, 146, 3, 117, 118, + 145, 145, 145, 80, 3, 124, 125, 126, 146, 128, + 129, 130, 88, 60, 133, 134, 78, 136, 137, 138, + 139, 140, 141, 118, 143, 145, 90, 79, 102, 124, + 143, 93, 144, 86, 129, 130, 88, 45, 133, 134, + 146, 136, 137, 138, 139, 140, 141, 68, 143, 146, + 68, 86, 115, 105, 146, 149, 146, 109, 145, 147, + 146, 53, 18, 45, 287, 290, 118, 38, 47, 297, + 115, 64, 124, 125, 126, 216, 128, 129, 130, 31, + 88, 133, 134, 145, 136, 137, 138, 139, 140, 141, + 174, 143, 222, 335, 102, 364, 45, -1, -1, -1, + -1, 109, 187, -1, -1, -1, 88, -1, -1, -1, + 118, -1, -1, -1, -1, -1, 124, 125, 126, -1, + 128, 129, 130, 105, 45, 133, 134, 109, 136, 137, + 138, 139, 140, 141, -1, 143, 118, -1, -1, 88, -1, -1, 124, 125, 126, -1, 128, 129, 130, -1, -1, 133, 134, -1, 136, 137, 138, 139, 140, 141, - -1, 143, -1, -1, 118, -1, -1, -1, -1, -1, - 124, 125, 126, -1, 128, 129, 130, -1, -1, 133, - 134, -1, 136, 137, 138, 139, 140, 141, 26, 143, - 118, -1, -1, -1, -1, -1, 124, -1, -1, -1, - -1, 129, 130, -1, -1, 133, 134, -1, 136, 137, - 138, 139, 140, 141, -1, 143, -1, -1, -1, -1, - 58, -1, -1, -1, 62, -1, -1, -1, -1, -1, - 68, 69, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 86, 87 + 109, 143, -1, -1, -1, -1, -1, 88, -1, 118, + -1, -1, -1, -1, -1, 124, 125, 126, -1, 128, + 129, 130, -1, -1, 133, 134, -1, 136, 137, 138, + 139, 140, 141, -1, 143, -1, -1, 118, -1, -1, + -1, -1, -1, 124, 125, 126, -1, 128, 129, 130, + -1, -1, 133, 134, -1, 136, 137, 138, 139, 140, + 141, -1, 143 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1034,92 +1039,95 @@ static const yytype_int16 yycheck[] = static const yytype_uint8 yystos[] = { 0, 7, 15, 22, 27, 34, 35, 43, 44, 49, - 54, 78, 145, 152, 153, 154, 155, 159, 161, 162, - 165, 170, 171, 172, 173, 175, 178, 179, 181, 185, - 27, 3, 228, 3, 3, 70, 97, 81, 81, 85, - 113, 196, 227, 228, 70, 97, 179, 181, 0, 148, - 234, 99, 156, 156, 9, 39, 71, 182, 183, 67, - 182, 192, 3, 147, 145, 81, 116, 166, 166, 228, - 104, 163, 228, 6, 219, 12, 186, 111, 228, 228, - 146, 146, 154, 84, 179, 180, 185, 101, 184, 115, - 180, 63, 197, 3, 4, 5, 90, 150, 199, 216, - 217, 218, 219, 220, 221, 4, 160, 109, 228, 228, - 73, 189, 80, 145, 174, 3, 40, 75, 109, 123, - 137, 138, 145, 187, 198, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 3, 176, 177, 145, 192, 193, 194, 201, - 192, 219, 146, 149, 40, 81, 145, 174, 201, 164, - 217, 3, 235, 55, 181, 145, 147, 145, 98, 40, - 109, 202, 143, 202, 181, 201, 81, 188, 149, 3, - 102, 114, 121, 229, 230, 17, 45, 88, 109, 117, - 118, 124, 125, 126, 128, 129, 130, 133, 134, 136, - 137, 138, 139, 140, 141, 143, 126, 149, 189, 3, - 157, 158, 197, 149, 77, 103, 195, 197, 46, 216, - 112, 3, 167, 168, 114, 85, 146, 149, 145, 146, - 186, 3, 138, 181, 201, 145, 109, 198, 146, 146, - 145, 222, 223, 224, 226, 228, 231, 189, 200, 201, - 3, 201, 202, 202, 88, 117, 145, 90, 109, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 219, 216, 177, 145, 146, 149, 194, - 219, 80, 25, 37, 94, 107, 169, 146, 149, 178, - 228, 3, 199, 198, 146, 95, 181, 144, 178, 26, - 58, 62, 68, 69, 87, 149, 232, 230, 60, 190, - 102, 202, 145, 181, 198, 90, 144, 199, 158, 164, - 168, 146, 146, 202, 146, 146, 86, 68, 68, 223, - 225, 86, 115, 202, 181, 198, 146, 146, 146, 79, - 105, 230, 224, 149, 223, 198, 146, 146, 202, 223, - 72, 120, 42, 191, 105, 145, 201, 233, 201, 3, - 215, 146 + 54, 78, 93, 145, 152, 153, 154, 155, 159, 161, + 162, 165, 166, 171, 173, 174, 175, 177, 180, 181, + 183, 187, 27, 3, 230, 3, 3, 70, 97, 81, + 81, 85, 113, 198, 229, 230, 70, 97, 19, 51, + 181, 183, 0, 148, 236, 99, 156, 156, 9, 39, + 71, 184, 185, 67, 184, 194, 3, 147, 145, 81, + 116, 167, 167, 230, 104, 163, 230, 6, 221, 12, + 188, 111, 116, 172, 172, 230, 146, 146, 154, 84, + 181, 182, 187, 101, 186, 115, 182, 63, 199, 3, + 4, 5, 90, 150, 201, 218, 219, 220, 221, 222, + 223, 4, 160, 109, 230, 230, 73, 191, 80, 145, + 176, 3, 40, 75, 109, 123, 137, 138, 145, 189, + 200, 202, 203, 204, 205, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 216, 217, 218, 3, 178, + 179, 40, 230, 230, 145, 194, 195, 196, 203, 194, + 221, 146, 149, 40, 81, 145, 176, 203, 164, 219, + 3, 237, 55, 183, 145, 147, 145, 98, 40, 109, + 204, 143, 204, 183, 203, 81, 190, 149, 3, 102, + 114, 121, 231, 232, 17, 45, 88, 109, 117, 118, + 124, 125, 126, 128, 129, 130, 133, 134, 136, 137, + 138, 139, 140, 141, 143, 126, 149, 191, 3, 157, + 158, 199, 149, 77, 103, 197, 199, 46, 218, 112, + 3, 168, 169, 114, 85, 146, 149, 145, 146, 188, + 3, 138, 183, 203, 145, 109, 200, 146, 146, 145, + 224, 225, 226, 228, 230, 233, 191, 202, 203, 3, + 203, 204, 204, 88, 117, 145, 90, 109, 204, 204, + 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, + 204, 204, 221, 203, 179, 145, 146, 149, 196, 221, + 80, 25, 37, 94, 107, 170, 146, 149, 180, 230, + 3, 201, 200, 146, 95, 183, 144, 180, 26, 58, + 62, 68, 69, 87, 149, 234, 232, 60, 192, 102, + 204, 145, 183, 200, 90, 144, 201, 158, 164, 169, + 146, 146, 204, 146, 146, 86, 68, 68, 225, 227, + 86, 115, 204, 183, 200, 146, 146, 146, 79, 105, + 232, 226, 149, 225, 200, 146, 146, 204, 225, 72, + 120, 42, 193, 105, 145, 203, 235, 203, 3, 217, + 146 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 151, 152, 153, 153, 154, 154, 155, 155, 155, - 155, 155, 155, 155, 155, 155, 156, 156, 157, 157, - 158, 158, 159, 160, 161, 161, 162, 163, 164, 165, - 165, 165, 166, 166, 167, 167, 168, 169, 169, 169, - 169, 170, 170, 170, 171, 172, 173, 173, 174, 174, - 175, 176, 176, 177, 178, 178, 178, 179, 179, 180, - 180, 181, 181, 182, 183, 183, 183, 184, 184, 185, - 186, 186, 187, 188, 189, 189, 190, 190, 191, 191, - 192, 192, 193, 193, 194, 195, 195, 195, 196, 196, - 197, 197, 197, 198, 198, 199, 199, 200, 201, 201, - 201, 201, 201, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 203, 203, 204, 204, 204, 204, 204, 205, - 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, - 206, 206, 207, 207, 207, 207, 208, 208, 209, 209, - 210, 210, 210, 210, 210, 210, 211, 211, 212, 213, - 214, 215, 215, 215, 215, 216, 216, 216, 216, 217, - 218, 218, 219, 220, 221, 222, 222, 223, 223, 224, - 224, 225, 225, 226, 227, 228, 228, 229, 229, 230, - 230, 231, 231, 231, 232, 232, 232, 232, 232, 232, - 232, 232, 233, 234, 234, 235, 235 + 0, 151, 152, 153, 153, 154, 154, 154, 155, 155, + 155, 155, 155, 155, 155, 155, 155, 156, 156, 157, + 157, 158, 158, 159, 160, 161, 161, 162, 163, 164, + 165, 165, 166, 166, 166, 167, 167, 168, 168, 169, + 170, 170, 170, 170, 171, 171, 171, 172, 172, 173, + 174, 175, 175, 176, 176, 177, 178, 178, 179, 180, + 180, 180, 181, 181, 182, 182, 183, 183, 184, 185, + 185, 185, 186, 186, 187, 188, 188, 189, 190, 191, + 191, 192, 192, 193, 193, 194, 194, 195, 195, 196, + 197, 197, 197, 198, 198, 199, 199, 199, 200, 200, + 201, 201, 202, 203, 203, 203, 203, 203, 204, 204, + 204, 204, 204, 204, 204, 204, 204, 205, 205, 206, + 206, 206, 206, 206, 207, 207, 207, 207, 207, 207, + 207, 207, 207, 207, 207, 208, 208, 209, 209, 209, + 209, 210, 210, 211, 211, 212, 212, 212, 212, 212, + 212, 213, 213, 214, 215, 216, 217, 217, 217, 217, + 218, 218, 218, 218, 219, 220, 220, 221, 222, 223, + 224, 224, 225, 225, 226, 226, 227, 227, 228, 229, + 230, 230, 231, 231, 232, 232, 233, 233, 233, 234, + 234, 234, 234, 234, 234, 234, 234, 235, 236, 236, + 237, 237 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 2, 1, 3, 2, 2, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 5, 0, 1, 3, - 1, 4, 4, 1, 2, 5, 7, 1, 1, 8, - 7, 7, 3, 0, 1, 3, 2, 1, 1, 1, - 1, 3, 3, 3, 4, 2, 8, 5, 3, 0, - 5, 1, 3, 3, 1, 1, 5, 3, 3, 1, - 1, 3, 5, 2, 1, 1, 1, 1, 0, 7, - 1, 0, 1, 2, 2, 0, 4, 0, 2, 0, - 3, 0, 1, 3, 2, 1, 1, 0, 2, 0, - 2, 4, 0, 1, 3, 1, 3, 2, 1, 1, - 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, - 1, 3, 1, 1, 2, 2, 2, 3, 4, 1, - 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, - 3, 3, 5, 6, 5, 6, 6, 8, 4, 5, - 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, - 5, 1, 3, 1, 3, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, - 4, 1, 3, 2, 1, 1, 3, 2, 1, 1, - 0, 4, 6, 8, 1, 1, 2, 2, 1, 1, - 1, 0, 1, 1, 0, 1, 3 + 1, 1, 1, 1, 1, 1, 1, 5, 0, 1, + 3, 1, 4, 4, 1, 2, 5, 7, 1, 1, + 2, 3, 8, 7, 7, 3, 0, 1, 3, 2, + 1, 1, 1, 1, 4, 4, 3, 2, 0, 4, + 2, 8, 5, 3, 0, 5, 1, 3, 3, 1, + 1, 5, 3, 3, 1, 1, 3, 5, 2, 1, + 1, 1, 1, 0, 7, 1, 0, 1, 2, 2, + 0, 4, 0, 2, 0, 3, 0, 1, 3, 2, + 1, 1, 0, 2, 0, 2, 4, 0, 1, 3, + 1, 3, 2, 1, 1, 1, 1, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 3, 1, 1, 2, + 2, 2, 3, 4, 1, 3, 3, 3, 3, 3, + 3, 3, 4, 3, 3, 3, 3, 5, 6, 5, + 6, 6, 8, 4, 5, 3, 3, 3, 3, 3, + 3, 3, 5, 4, 4, 5, 1, 3, 1, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 1, 1, 1, 4, 1, 3, 2, 1, + 1, 3, 2, 1, 1, 0, 4, 6, 8, 1, + 1, 2, 2, 1, 1, 1, 0, 1, 1, 0, + 1, 3 }; @@ -1616,31 +1624,31 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio switch (yytype) { case 3: /* IDENTIFIER */ -#line 135 "bison_parser.y" /* yacc.c:1257 */ +#line 138 "bison_parser.y" /* yacc.c:1257 */ { free( (((*yyvaluep).sval)) ); } -#line 1622 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1630 "bison_parser.cpp" /* yacc.c:1257 */ break; case 4: /* STRING */ -#line 135 "bison_parser.y" /* yacc.c:1257 */ +#line 138 "bison_parser.y" /* yacc.c:1257 */ { free( (((*yyvaluep).sval)) ); } -#line 1628 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1636 "bison_parser.cpp" /* yacc.c:1257 */ break; case 5: /* FLOATVAL */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ +#line 136 "bison_parser.y" /* yacc.c:1257 */ { } -#line 1634 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1642 "bison_parser.cpp" /* yacc.c:1257 */ break; case 6: /* INTVAL */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ +#line 136 "bison_parser.y" /* yacc.c:1257 */ { } -#line 1640 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1648 "bison_parser.cpp" /* yacc.c:1257 */ break; case 153: /* statement_list */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).stmt_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).stmt_vec))) { @@ -1649,23 +1657,23 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).stmt_vec)); } -#line 1653 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1661 "bison_parser.cpp" /* yacc.c:1257 */ break; case 154: /* statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).statement)); } -#line 1659 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1667 "bison_parser.cpp" /* yacc.c:1257 */ break; case 155: /* preparable_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).statement)); } -#line 1665 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1673 "bison_parser.cpp" /* yacc.c:1257 */ break; case 156: /* opt_hints */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).expr_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).expr_vec))) { @@ -1674,11 +1682,11 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).expr_vec)); } -#line 1678 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1686 "bison_parser.cpp" /* yacc.c:1257 */ break; case 157: /* hint_list */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).expr_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).expr_vec))) { @@ -1687,65 +1695,71 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).expr_vec)); } -#line 1691 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1699 "bison_parser.cpp" /* yacc.c:1257 */ break; case 158: /* hint */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 1697 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1705 "bison_parser.cpp" /* yacc.c:1257 */ break; case 159: /* prepare_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).prep_stmt)); } -#line 1703 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1711 "bison_parser.cpp" /* yacc.c:1257 */ break; case 160: /* prepare_target_query */ -#line 135 "bison_parser.y" /* yacc.c:1257 */ +#line 138 "bison_parser.y" /* yacc.c:1257 */ { free( (((*yyvaluep).sval)) ); } -#line 1709 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1717 "bison_parser.cpp" /* yacc.c:1257 */ break; case 161: /* execute_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).exec_stmt)); } -#line 1715 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1723 "bison_parser.cpp" /* yacc.c:1257 */ break; case 162: /* import_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).import_stmt)); } -#line 1721 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1729 "bison_parser.cpp" /* yacc.c:1257 */ break; case 163: /* import_file_type */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ +#line 136 "bison_parser.y" /* yacc.c:1257 */ { } -#line 1727 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1735 "bison_parser.cpp" /* yacc.c:1257 */ break; case 164: /* file_path */ -#line 135 "bison_parser.y" /* yacc.c:1257 */ +#line 138 "bison_parser.y" /* yacc.c:1257 */ { free( (((*yyvaluep).sval)) ); } -#line 1733 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1741 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 165: /* create_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 165: /* show_statement */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ + { delete (((*yyvaluep).show_stmt)); } +#line 1747 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 166: /* create_statement */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).create_stmt)); } -#line 1739 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1753 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 166: /* opt_not_exists */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ - { } -#line 1745 "bison_parser.cpp" /* yacc.c:1257 */ - break; - - case 167: /* column_def_commalist */ + case 167: /* opt_not_exists */ #line 136 "bison_parser.y" /* yacc.c:1257 */ + { } +#line 1759 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 168: /* column_def_commalist */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).column_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).column_vec))) { @@ -1754,47 +1768,53 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).column_vec)); } -#line 1758 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1772 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 168: /* column_def */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 169: /* column_def */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).column_t)); } -#line 1764 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1778 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 169: /* column_type */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ - { } -#line 1770 "bison_parser.cpp" /* yacc.c:1257 */ - break; - - case 170: /* drop_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ - { delete (((*yyvaluep).drop_stmt)); } -#line 1776 "bison_parser.cpp" /* yacc.c:1257 */ - break; - - case 171: /* delete_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ - { delete (((*yyvaluep).delete_stmt)); } -#line 1782 "bison_parser.cpp" /* yacc.c:1257 */ - break; - - case 172: /* truncate_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ - { delete (((*yyvaluep).delete_stmt)); } -#line 1788 "bison_parser.cpp" /* yacc.c:1257 */ - break; - - case 173: /* insert_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ - { delete (((*yyvaluep).insert_stmt)); } -#line 1794 "bison_parser.cpp" /* yacc.c:1257 */ - break; - - case 174: /* opt_column_list */ + case 170: /* column_type */ #line 136 "bison_parser.y" /* yacc.c:1257 */ + { } +#line 1784 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 171: /* drop_statement */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ + { delete (((*yyvaluep).drop_stmt)); } +#line 1790 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 172: /* opt_exists */ +#line 136 "bison_parser.y" /* yacc.c:1257 */ + { } +#line 1796 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 173: /* delete_statement */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ + { delete (((*yyvaluep).delete_stmt)); } +#line 1802 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 174: /* truncate_statement */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ + { delete (((*yyvaluep).delete_stmt)); } +#line 1808 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 175: /* insert_statement */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ + { delete (((*yyvaluep).insert_stmt)); } +#line 1814 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 176: /* opt_column_list */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).str_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).str_vec))) { @@ -1803,17 +1823,17 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).str_vec)); } -#line 1807 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1827 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 175: /* update_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 177: /* update_statement */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).update_stmt)); } -#line 1813 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1833 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 176: /* update_clause_commalist */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 178: /* update_clause_commalist */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).update_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).update_vec))) { @@ -1822,53 +1842,53 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).update_vec)); } -#line 1826 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1846 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 177: /* update_clause */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 179: /* update_clause */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).update_t)); } -#line 1832 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1852 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 178: /* select_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 180: /* select_statement */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).select_stmt)); } -#line 1838 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1858 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 179: /* select_with_paren */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 181: /* select_with_paren */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).select_stmt)); } -#line 1844 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1864 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 180: /* select_paren_or_clause */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 182: /* select_paren_or_clause */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).select_stmt)); } -#line 1850 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1870 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 181: /* select_no_paren */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 183: /* select_no_paren */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).select_stmt)); } -#line 1856 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1876 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 185: /* select_clause */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 187: /* select_clause */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).select_stmt)); } -#line 1862 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1882 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 186: /* opt_distinct */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ - { } -#line 1868 "bison_parser.cpp" /* yacc.c:1257 */ - break; - - case 187: /* select_list */ + case 188: /* opt_distinct */ #line 136 "bison_parser.y" /* yacc.c:1257 */ + { } +#line 1888 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 189: /* select_list */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).expr_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).expr_vec))) { @@ -1877,35 +1897,35 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).expr_vec)); } -#line 1881 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1901 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 188: /* from_clause */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 190: /* from_clause */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 1887 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1907 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 189: /* opt_where */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 191: /* opt_where */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 1893 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1913 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 190: /* opt_group */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 192: /* opt_group */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).group_t)); } -#line 1899 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1919 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 191: /* opt_having */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 193: /* opt_having */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 1905 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1925 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 192: /* opt_order */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 194: /* opt_order */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).order_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).order_vec))) { @@ -1914,11 +1934,11 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).order_vec)); } -#line 1918 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1938 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 193: /* order_list */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 195: /* order_list */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).order_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).order_vec))) { @@ -1927,35 +1947,35 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).order_vec)); } -#line 1931 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1951 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 194: /* order_desc */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 196: /* order_desc */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).order)); } -#line 1937 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1957 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 195: /* opt_order_type */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ + case 197: /* opt_order_type */ +#line 136 "bison_parser.y" /* yacc.c:1257 */ { } -#line 1943 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1963 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 196: /* opt_top */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 198: /* opt_top */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).limit)); } -#line 1949 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1969 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 197: /* opt_limit */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 199: /* opt_limit */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).limit)); } -#line 1955 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1975 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 198: /* expr_list */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 200: /* expr_list */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).expr_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).expr_vec))) { @@ -1964,11 +1984,11 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).expr_vec)); } -#line 1968 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1988 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 199: /* literal_list */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 201: /* literal_list */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).expr_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).expr_vec))) { @@ -1977,161 +1997,161 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).expr_vec)); } -#line 1981 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2001 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 200: /* expr_alias */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 202: /* expr_alias */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 1987 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2007 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 201: /* expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 203: /* expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 1993 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2013 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 202: /* operand */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 204: /* operand */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 1999 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2019 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 203: /* scalar_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 205: /* scalar_expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2005 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2025 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 204: /* unary_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 206: /* unary_expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2011 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2031 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 205: /* binary_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 207: /* binary_expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2017 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2037 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 206: /* logic_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 208: /* logic_expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2023 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2043 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 207: /* in_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 209: /* in_expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2029 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2049 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 208: /* case_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 210: /* case_expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2035 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2055 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 209: /* exists_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 211: /* exists_expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2041 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2061 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 210: /* comp_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 212: /* comp_expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2047 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2067 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 211: /* function_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 213: /* function_expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2053 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2073 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 212: /* array_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 214: /* array_expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2059 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2079 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 213: /* array_index */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 215: /* array_index */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2065 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2085 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 214: /* between_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 216: /* between_expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2071 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2091 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 215: /* column_name */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 217: /* column_name */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2077 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2097 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 216: /* literal */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 218: /* literal */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2083 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2103 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 217: /* string_literal */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 219: /* string_literal */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2089 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2109 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 218: /* num_literal */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 220: /* num_literal */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2095 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2115 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 219: /* int_literal */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 221: /* int_literal */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2101 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2121 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 220: /* null_literal */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 222: /* null_literal */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2107 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2127 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 221: /* param_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 223: /* param_expr */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2113 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2133 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 222: /* table_ref */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 224: /* table_ref */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 2119 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2139 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 223: /* table_ref_atomic */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 225: /* table_ref_atomic */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 2125 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2145 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 224: /* nonjoin_table_ref_atomic */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 226: /* nonjoin_table_ref_atomic */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 2131 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2151 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 225: /* table_ref_commalist */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 227: /* table_ref_commalist */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).table_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).table_vec))) { @@ -2140,59 +2160,59 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).table_vec)); } -#line 2144 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2164 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 226: /* table_ref_name */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 228: /* table_ref_name */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 2150 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2170 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 227: /* table_ref_name_no_alias */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 229: /* table_ref_name_no_alias */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 2156 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2176 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 228: /* table_name */ -#line 135 "bison_parser.y" /* yacc.c:1257 */ + case 230: /* table_name */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ + { free( (((*yyvaluep).table_name).name) ); free( (((*yyvaluep).table_name).schema) ); } +#line 2182 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 231: /* alias */ +#line 138 "bison_parser.y" /* yacc.c:1257 */ { free( (((*yyvaluep).sval)) ); } -#line 2162 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2188 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 229: /* alias */ -#line 135 "bison_parser.y" /* yacc.c:1257 */ + case 232: /* opt_alias */ +#line 138 "bison_parser.y" /* yacc.c:1257 */ { free( (((*yyvaluep).sval)) ); } -#line 2168 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2194 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 230: /* opt_alias */ -#line 135 "bison_parser.y" /* yacc.c:1257 */ - { free( (((*yyvaluep).sval)) ); } -#line 2174 "bison_parser.cpp" /* yacc.c:1257 */ - break; - - case 231: /* join_clause */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 233: /* join_clause */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 2180 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2200 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 232: /* opt_join_type */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ - { } -#line 2186 "bison_parser.cpp" /* yacc.c:1257 */ - break; - - case 233: /* join_condition */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ - { delete (((*yyvaluep).expr)); } -#line 2192 "bison_parser.cpp" /* yacc.c:1257 */ - break; - - case 235: /* ident_commalist */ + case 234: /* opt_join_type */ #line 136 "bison_parser.y" /* yacc.c:1257 */ + { } +#line 2206 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 235: /* join_condition */ +#line 147 "bison_parser.y" /* yacc.c:1257 */ + { delete (((*yyvaluep).expr)); } +#line 2212 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 237: /* ident_commalist */ +#line 139 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).str_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).str_vec))) { @@ -2201,7 +2221,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).str_vec)); } -#line 2205 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2225 "bison_parser.cpp" /* yacc.c:1257 */ break; @@ -2319,7 +2339,7 @@ YYLTYPE yylloc = yyloc_default; yylloc.total_column = 0; } -#line 2323 "bison_parser.cpp" /* yacc.c:1429 */ +#line 2343 "bison_parser.cpp" /* yacc.c:1429 */ yylsp[0] = yylloc; goto yysetstate; @@ -2506,7 +2526,7 @@ yyreduce: switch (yyn) { case 2: -#line 240 "bison_parser.y" /* yacc.c:1646 */ +#line 245 "bison_parser.y" /* yacc.c:1646 */ { for (SQLStatement* stmt : *(yyvsp[-1].stmt_vec)) { // Transfers ownership of the statement. @@ -2524,392 +2544,443 @@ yyreduce: } delete (yyvsp[-1].stmt_vec); } -#line 2528 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2548 "bison_parser.cpp" /* yacc.c:1646 */ break; case 3: -#line 261 "bison_parser.y" /* yacc.c:1646 */ +#line 266 "bison_parser.y" /* yacc.c:1646 */ { (yyval.stmt_vec) = new std::vector(); (yyval.stmt_vec)->push_back((yyvsp[0].statement)); } -#line 2534 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2554 "bison_parser.cpp" /* yacc.c:1646 */ break; case 4: -#line 262 "bison_parser.y" /* yacc.c:1646 */ +#line 267 "bison_parser.y" /* yacc.c:1646 */ { (yyvsp[-2].stmt_vec)->push_back((yyvsp[0].statement)); (yyval.stmt_vec) = (yyvsp[-2].stmt_vec); } -#line 2540 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2560 "bison_parser.cpp" /* yacc.c:1646 */ break; case 5: -#line 266 "bison_parser.y" /* yacc.c:1646 */ +#line 271 "bison_parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[-1].prep_stmt); (yyval.statement)->hints = (yyvsp[0].expr_vec); } -#line 2549 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2569 "bison_parser.cpp" /* yacc.c:1646 */ break; case 6: -#line 270 "bison_parser.y" /* yacc.c:1646 */ +#line 275 "bison_parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[-1].statement); (yyval.statement)->hints = (yyvsp[0].expr_vec); } -#line 2558 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2578 "bison_parser.cpp" /* yacc.c:1646 */ break; case 7: -#line 278 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].select_stmt); } -#line 2564 "bison_parser.cpp" /* yacc.c:1646 */ +#line 279 "bison_parser.y" /* yacc.c:1646 */ + { + (yyval.statement) = (yyvsp[0].show_stmt); + } +#line 2586 "bison_parser.cpp" /* yacc.c:1646 */ break; case 8: -#line 279 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].import_stmt); } -#line 2570 "bison_parser.cpp" /* yacc.c:1646 */ +#line 286 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].select_stmt); } +#line 2592 "bison_parser.cpp" /* yacc.c:1646 */ break; case 9: -#line 280 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].create_stmt); } -#line 2576 "bison_parser.cpp" /* yacc.c:1646 */ +#line 287 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].import_stmt); } +#line 2598 "bison_parser.cpp" /* yacc.c:1646 */ break; case 10: -#line 281 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].insert_stmt); } -#line 2582 "bison_parser.cpp" /* yacc.c:1646 */ +#line 288 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].create_stmt); } +#line 2604 "bison_parser.cpp" /* yacc.c:1646 */ break; case 11: -#line 282 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].delete_stmt); } -#line 2588 "bison_parser.cpp" /* yacc.c:1646 */ +#line 289 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].insert_stmt); } +#line 2610 "bison_parser.cpp" /* yacc.c:1646 */ break; case 12: -#line 283 "bison_parser.y" /* yacc.c:1646 */ +#line 290 "bison_parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].delete_stmt); } -#line 2594 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2616 "bison_parser.cpp" /* yacc.c:1646 */ break; case 13: -#line 284 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].update_stmt); } -#line 2600 "bison_parser.cpp" /* yacc.c:1646 */ +#line 291 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].delete_stmt); } +#line 2622 "bison_parser.cpp" /* yacc.c:1646 */ break; case 14: -#line 285 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].drop_stmt); } -#line 2606 "bison_parser.cpp" /* yacc.c:1646 */ +#line 292 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].update_stmt); } +#line 2628 "bison_parser.cpp" /* yacc.c:1646 */ break; case 15: -#line 286 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].exec_stmt); } -#line 2612 "bison_parser.cpp" /* yacc.c:1646 */ +#line 293 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].drop_stmt); } +#line 2634 "bison_parser.cpp" /* yacc.c:1646 */ break; case 16: -#line 295 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr_vec) = (yyvsp[-1].expr_vec); } -#line 2618 "bison_parser.cpp" /* yacc.c:1646 */ +#line 294 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].exec_stmt); } +#line 2640 "bison_parser.cpp" /* yacc.c:1646 */ break; case 17: -#line 296 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr_vec) = nullptr; } -#line 2624 "bison_parser.cpp" /* yacc.c:1646 */ +#line 303 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr_vec) = (yyvsp[-1].expr_vec); } +#line 2646 "bison_parser.cpp" /* yacc.c:1646 */ break; case 18: -#line 301 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr_vec) = new std::vector(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); } -#line 2630 "bison_parser.cpp" /* yacc.c:1646 */ +#line 304 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr_vec) = nullptr; } +#line 2652 "bison_parser.cpp" /* yacc.c:1646 */ break; case 19: -#line 302 "bison_parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); } -#line 2636 "bison_parser.cpp" /* yacc.c:1646 */ +#line 309 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr_vec) = new std::vector(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); } +#line 2658 "bison_parser.cpp" /* yacc.c:1646 */ break; case 20: -#line 306 "bison_parser.y" /* yacc.c:1646 */ +#line 310 "bison_parser.y" /* yacc.c:1646 */ + { (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); } +#line 2664 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 21: +#line 314 "bison_parser.y" /* yacc.c:1646 */ { (yyval.expr) = Expr::make(kExprHint); (yyval.expr)->name = (yyvsp[0].sval); } -#line 2645 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2673 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 21: -#line 310 "bison_parser.y" /* yacc.c:1646 */ + case 22: +#line 318 "bison_parser.y" /* yacc.c:1646 */ { (yyval.expr) = Expr::make(kExprHint); (yyval.expr)->name = (yyvsp[-3].sval); (yyval.expr)->exprList = (yyvsp[-1].expr_vec); } -#line 2655 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2683 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 22: -#line 322 "bison_parser.y" /* yacc.c:1646 */ + case 23: +#line 330 "bison_parser.y" /* yacc.c:1646 */ { (yyval.prep_stmt) = new PrepareStatement(); (yyval.prep_stmt)->name = (yyvsp[-2].sval); (yyval.prep_stmt)->query = (yyvsp[0].sval); } -#line 2665 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2693 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 24: -#line 332 "bison_parser.y" /* yacc.c:1646 */ + case 25: +#line 340 "bison_parser.y" /* yacc.c:1646 */ { (yyval.exec_stmt) = new ExecuteStatement(); (yyval.exec_stmt)->name = (yyvsp[0].sval); } -#line 2674 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2702 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 25: -#line 336 "bison_parser.y" /* yacc.c:1646 */ + case 26: +#line 344 "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 2684 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 26: -#line 348 "bison_parser.y" /* yacc.c:1646 */ - { - (yyval.import_stmt) = new ImportStatement((ImportType) (yyvsp[-4].uval)); - (yyval.import_stmt)->filePath = (yyvsp[-2].sval); - (yyval.import_stmt)->tableName = (yyvsp[0].sval); - } -#line 2694 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2712 "bison_parser.cpp" /* yacc.c:1646 */ break; case 27: #line 356 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kImportCSV; } -#line 2700 "bison_parser.cpp" /* yacc.c:1646 */ + { + (yyval.import_stmt) = new ImportStatement((ImportType) (yyvsp[-4].uval)); + (yyval.import_stmt)->filePath = (yyvsp[-2].sval); + (yyval.import_stmt)->schema = (yyvsp[0].table_name).schema; + (yyval.import_stmt)->tableName = (yyvsp[0].table_name).name; + } +#line 2723 "bison_parser.cpp" /* yacc.c:1646 */ break; case 28: -#line 360 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.sval) = strdup((yyvsp[0].expr)->name); delete (yyvsp[0].expr); } -#line 2706 "bison_parser.cpp" /* yacc.c:1646 */ +#line 365 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kImportCSV; } +#line 2729 "bison_parser.cpp" /* yacc.c:1646 */ break; case 29: -#line 370 "bison_parser.y" /* yacc.c:1646 */ - { - (yyval.create_stmt) = new CreateStatement(kCreateTableFromTbl); - (yyval.create_stmt)->ifNotExists = (yyvsp[-5].bval); - (yyval.create_stmt)->tableName = (yyvsp[-4].sval); - (yyval.create_stmt)->filePath = (yyvsp[0].sval); - } -#line 2717 "bison_parser.cpp" /* yacc.c:1646 */ +#line 369 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.sval) = strdup((yyvsp[0].expr)->name); delete (yyvsp[0].expr); } +#line 2735 "bison_parser.cpp" /* yacc.c:1646 */ break; case 30: -#line 376 "bison_parser.y" /* yacc.c:1646 */ +#line 379 "bison_parser.y" /* yacc.c:1646 */ { - (yyval.create_stmt) = new CreateStatement(kCreateTable); - (yyval.create_stmt)->ifNotExists = (yyvsp[-4].bval); - (yyval.create_stmt)->tableName = (yyvsp[-3].sval); - (yyval.create_stmt)->columns = (yyvsp[-1].column_vec); + (yyval.show_stmt) = new ShowStatement(kShowTables); } -#line 2728 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2743 "bison_parser.cpp" /* yacc.c:1646 */ break; case 31: #line 382 "bison_parser.y" /* yacc.c:1646 */ { - (yyval.create_stmt) = new CreateStatement(kCreateView); - (yyval.create_stmt)->ifNotExists = (yyvsp[-4].bval); - (yyval.create_stmt)->tableName = (yyvsp[-3].sval); - (yyval.create_stmt)->viewColumns = (yyvsp[-2].str_vec); - (yyval.create_stmt)->select = (yyvsp[0].select_stmt); + (yyval.show_stmt) = new ShowStatement(kShowColumns); + (yyval.show_stmt)->schema = (yyvsp[0].table_name).schema; + (yyval.show_stmt)->name = (yyvsp[0].table_name).name; } -#line 2740 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2753 "bison_parser.cpp" /* yacc.c:1646 */ break; case 32: -#line 392 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.bval) = true; } -#line 2746 "bison_parser.cpp" /* yacc.c:1646 */ +#line 396 "bison_parser.y" /* yacc.c:1646 */ + { + (yyval.create_stmt) = new CreateStatement(kCreateTableFromTbl); + (yyval.create_stmt)->ifNotExists = (yyvsp[-5].bval); + (yyval.create_stmt)->schema = (yyvsp[-4].table_name).schema; + (yyval.create_stmt)->tableName = (yyvsp[-4].table_name).name; + (yyval.create_stmt)->filePath = (yyvsp[0].sval); + } +#line 2765 "bison_parser.cpp" /* yacc.c:1646 */ break; case 33: -#line 393 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.bval) = false; } -#line 2752 "bison_parser.cpp" /* yacc.c:1646 */ +#line 403 "bison_parser.y" /* yacc.c:1646 */ + { + (yyval.create_stmt) = new CreateStatement(kCreateTable); + (yyval.create_stmt)->ifNotExists = (yyvsp[-4].bval); + (yyval.create_stmt)->schema = (yyvsp[-3].table_name).schema; + (yyval.create_stmt)->tableName = (yyvsp[-3].table_name).name; + (yyval.create_stmt)->columns = (yyvsp[-1].column_vec); + } +#line 2777 "bison_parser.cpp" /* yacc.c:1646 */ break; case 34: -#line 397 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.column_vec) = new std::vector(); (yyval.column_vec)->push_back((yyvsp[0].column_t)); } -#line 2758 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 35: -#line 398 "bison_parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].column_vec)->push_back((yyvsp[0].column_t)); (yyval.column_vec) = (yyvsp[-2].column_vec); } -#line 2764 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 36: -#line 402 "bison_parser.y" /* yacc.c:1646 */ - { - (yyval.column_t) = new ColumnDefinition((yyvsp[-1].sval), (ColumnDefinition::DataType) (yyvsp[0].uval)); - } -#line 2772 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 37: -#line 409 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = ColumnDefinition::INT; } -#line 2778 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 38: #line 410 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = ColumnDefinition::INT; } -#line 2784 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 39: -#line 411 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = ColumnDefinition::DOUBLE; } + { + (yyval.create_stmt) = new CreateStatement(kCreateView); + (yyval.create_stmt)->ifNotExists = (yyvsp[-4].bval); + (yyval.create_stmt)->schema = (yyvsp[-3].table_name).schema; + (yyval.create_stmt)->tableName = (yyvsp[-3].table_name).name; + (yyval.create_stmt)->viewColumns = (yyvsp[-2].str_vec); + (yyval.create_stmt)->select = (yyvsp[0].select_stmt); + } #line 2790 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 40: -#line 412 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = ColumnDefinition::TEXT; } + case 35: +#line 421 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.bval) = true; } #line 2796 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 41: + case 36: #line 422 "bison_parser.y" /* yacc.c:1646 */ - { - (yyval.drop_stmt) = new DropStatement(kDropTable); - (yyval.drop_stmt)->name = (yyvsp[0].sval); - } -#line 2805 "bison_parser.cpp" /* yacc.c:1646 */ + { (yyval.bval) = false; } +#line 2802 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 42: + case 37: #line 426 "bison_parser.y" /* yacc.c:1646 */ - { - (yyval.drop_stmt) = new DropStatement(kDropView); - (yyval.drop_stmt)->name = (yyvsp[0].sval); - } + { (yyval.column_vec) = new std::vector(); (yyval.column_vec)->push_back((yyvsp[0].column_t)); } +#line 2808 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 38: +#line 427 "bison_parser.y" /* yacc.c:1646 */ + { (yyvsp[-2].column_vec)->push_back((yyvsp[0].column_t)); (yyval.column_vec) = (yyvsp[-2].column_vec); } #line 2814 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 43: -#line 430 "bison_parser.y" /* yacc.c:1646 */ + case 39: +#line 431 "bison_parser.y" /* yacc.c:1646 */ { - (yyval.drop_stmt) = new DropStatement(kDropPreparedStatement); - (yyval.drop_stmt)->name = (yyvsp[0].sval); + (yyval.column_t) = new ColumnDefinition((yyvsp[-1].sval), (ColumnDefinition::DataType) (yyvsp[0].uval)); } -#line 2823 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2822 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 40: +#line 438 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = ColumnDefinition::INT; } +#line 2828 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 41: +#line 439 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = ColumnDefinition::INT; } +#line 2834 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 42: +#line 440 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = ColumnDefinition::DOUBLE; } +#line 2840 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 43: +#line 441 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = ColumnDefinition::TEXT; } +#line 2846 "bison_parser.cpp" /* yacc.c:1646 */ break; case 44: -#line 442 "bison_parser.y" /* yacc.c:1646 */ +#line 451 "bison_parser.y" /* yacc.c:1646 */ { - (yyval.delete_stmt) = new DeleteStatement(); - (yyval.delete_stmt)->tableName = (yyvsp[-1].sval); - (yyval.delete_stmt)->expr = (yyvsp[0].expr); + (yyval.drop_stmt) = new DropStatement(kDropTable); + (yyval.drop_stmt)->ifExists = (yyvsp[-1].bval); + (yyval.drop_stmt)->schema = (yyvsp[0].table_name).schema; + (yyval.drop_stmt)->name = (yyvsp[0].table_name).name; } -#line 2833 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2857 "bison_parser.cpp" /* yacc.c:1646 */ break; case 45: -#line 450 "bison_parser.y" /* yacc.c:1646 */ +#line 457 "bison_parser.y" /* yacc.c:1646 */ { - (yyval.delete_stmt) = new DeleteStatement(); - (yyval.delete_stmt)->tableName = (yyvsp[0].sval); + (yyval.drop_stmt) = new DropStatement(kDropView); + (yyval.drop_stmt)->ifExists = (yyvsp[-1].bval); + (yyval.drop_stmt)->schema = (yyvsp[0].table_name).schema; + (yyval.drop_stmt)->name = (yyvsp[0].table_name).name; } -#line 2842 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2868 "bison_parser.cpp" /* yacc.c:1646 */ break; case 46: -#line 462 "bison_parser.y" /* yacc.c:1646 */ +#line 463 "bison_parser.y" /* yacc.c:1646 */ { - (yyval.insert_stmt) = new InsertStatement(kInsertValues); - (yyval.insert_stmt)->tableName = (yyvsp[-5].sval); - (yyval.insert_stmt)->columns = (yyvsp[-4].str_vec); - (yyval.insert_stmt)->values = (yyvsp[-1].expr_vec); + (yyval.drop_stmt) = new DropStatement(kDropPreparedStatement); + (yyval.drop_stmt)->ifExists = false; + (yyval.drop_stmt)->name = (yyvsp[0].sval); } -#line 2853 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2878 "bison_parser.cpp" /* yacc.c:1646 */ break; case 47: -#line 468 "bison_parser.y" /* yacc.c:1646 */ - { - (yyval.insert_stmt) = new InsertStatement(kInsertSelect); - (yyval.insert_stmt)->tableName = (yyvsp[-2].sval); - (yyval.insert_stmt)->columns = (yyvsp[-1].str_vec); - (yyval.insert_stmt)->select = (yyvsp[0].select_stmt); - } -#line 2864 "bison_parser.cpp" /* yacc.c:1646 */ +#line 471 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.bval) = true; } +#line 2884 "bison_parser.cpp" /* yacc.c:1646 */ break; case 48: -#line 478 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.str_vec) = (yyvsp[-1].str_vec); } -#line 2870 "bison_parser.cpp" /* yacc.c:1646 */ +#line 472 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.bval) = false; } +#line 2890 "bison_parser.cpp" /* yacc.c:1646 */ break; case 49: -#line 479 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.str_vec) = nullptr; } -#line 2876 "bison_parser.cpp" /* yacc.c:1646 */ +#line 481 "bison_parser.y" /* yacc.c:1646 */ + { + (yyval.delete_stmt) = new DeleteStatement(); + (yyval.delete_stmt)->schema = (yyvsp[-1].table_name).schema; + (yyval.delete_stmt)->tableName = (yyvsp[-1].table_name).name; + (yyval.delete_stmt)->expr = (yyvsp[0].expr); + } +#line 2901 "bison_parser.cpp" /* yacc.c:1646 */ break; case 50: -#line 489 "bison_parser.y" /* yacc.c:1646 */ +#line 490 "bison_parser.y" /* yacc.c:1646 */ + { + (yyval.delete_stmt) = new DeleteStatement(); + (yyval.delete_stmt)->schema = (yyvsp[0].table_name).schema; + (yyval.delete_stmt)->tableName = (yyvsp[0].table_name).name; + } +#line 2911 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 51: +#line 503 "bison_parser.y" /* yacc.c:1646 */ + { + (yyval.insert_stmt) = new InsertStatement(kInsertValues); + (yyval.insert_stmt)->schema = (yyvsp[-5].table_name).schema; + (yyval.insert_stmt)->tableName = (yyvsp[-5].table_name).name; + (yyval.insert_stmt)->columns = (yyvsp[-4].str_vec); + (yyval.insert_stmt)->values = (yyvsp[-1].expr_vec); + } +#line 2923 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 52: +#line 510 "bison_parser.y" /* yacc.c:1646 */ + { + (yyval.insert_stmt) = new InsertStatement(kInsertSelect); + (yyval.insert_stmt)->schema = (yyvsp[-2].table_name).schema; + (yyval.insert_stmt)->tableName = (yyvsp[-2].table_name).name; + (yyval.insert_stmt)->columns = (yyvsp[-1].str_vec); + (yyval.insert_stmt)->select = (yyvsp[0].select_stmt); + } +#line 2935 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 53: +#line 521 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.str_vec) = (yyvsp[-1].str_vec); } +#line 2941 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 54: +#line 522 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.str_vec) = nullptr; } +#line 2947 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 55: +#line 532 "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 2887 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2958 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 51: -#line 498 "bison_parser.y" /* yacc.c:1646 */ + case 56: +#line 541 "bison_parser.y" /* yacc.c:1646 */ { (yyval.update_vec) = new std::vector(); (yyval.update_vec)->push_back((yyvsp[0].update_t)); } -#line 2893 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2964 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 52: -#line 499 "bison_parser.y" /* yacc.c:1646 */ + case 57: +#line 542 "bison_parser.y" /* yacc.c:1646 */ { (yyvsp[-2].update_vec)->push_back((yyvsp[0].update_t)); (yyval.update_vec) = (yyvsp[-2].update_vec); } -#line 2899 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2970 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 53: -#line 503 "bison_parser.y" /* yacc.c:1646 */ + case 58: +#line 546 "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 2909 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2980 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 56: -#line 517 "bison_parser.y" /* yacc.c:1646 */ + case 61: +#line 560 "bison_parser.y" /* yacc.c:1646 */ { // TODO: allow multiple unions (through linked list) // TODO: capture type of set_operator @@ -2924,23 +2995,23 @@ yyreduce: (yyval.select_stmt)->limit = (yyvsp[0].limit); } } -#line 2928 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2999 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 57: -#line 534 "bison_parser.y" /* yacc.c:1646 */ + case 62: +#line 577 "bison_parser.y" /* yacc.c:1646 */ { (yyval.select_stmt) = (yyvsp[-1].select_stmt); } -#line 2934 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3005 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 58: -#line 535 "bison_parser.y" /* yacc.c:1646 */ + case 63: +#line 578 "bison_parser.y" /* yacc.c:1646 */ { (yyval.select_stmt) = (yyvsp[-1].select_stmt); } -#line 2940 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3011 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 61: -#line 544 "bison_parser.y" /* yacc.c:1646 */ + case 66: +#line 587 "bison_parser.y" /* yacc.c:1646 */ { (yyval.select_stmt) = (yyvsp[-2].select_stmt); (yyval.select_stmt)->order = (yyvsp[-1].order_vec); @@ -2951,11 +3022,11 @@ yyreduce: (yyval.select_stmt)->limit = (yyvsp[0].limit); } } -#line 2955 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3026 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 62: -#line 554 "bison_parser.y" /* yacc.c:1646 */ + case 67: +#line 597 "bison_parser.y" /* yacc.c:1646 */ { // TODO: allow multiple unions (through linked list) // TODO: capture type of set_operator @@ -2970,11 +3041,11 @@ yyreduce: (yyval.select_stmt)->limit = (yyvsp[0].limit); } } -#line 2974 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3045 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 69: -#line 586 "bison_parser.y" /* yacc.c:1646 */ + case 74: +#line 629 "bison_parser.y" /* yacc.c:1646 */ { (yyval.select_stmt) = new SelectStatement(); (yyval.select_stmt)->limit = (yyvsp[-5].limit); @@ -2984,538 +3055,546 @@ yyreduce: (yyval.select_stmt)->whereClause = (yyvsp[-1].expr); (yyval.select_stmt)->groupBy = (yyvsp[0].group_t); } -#line 2988 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 70: -#line 598 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.bval) = true; } -#line 2994 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 71: -#line 599 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.bval) = false; } -#line 3000 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 73: -#line 607 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.table) = (yyvsp[0].table); } -#line 3006 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 74: -#line 612 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = (yyvsp[0].expr); } -#line 3012 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3059 "bison_parser.cpp" /* yacc.c:1646 */ break; case 75: -#line 613 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = nullptr; } -#line 3018 "bison_parser.cpp" /* yacc.c:1646 */ +#line 641 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.bval) = true; } +#line 3065 "bison_parser.cpp" /* yacc.c:1646 */ break; case 76: -#line 617 "bison_parser.y" /* yacc.c:1646 */ +#line 642 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.bval) = false; } +#line 3071 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 78: +#line 650 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.table) = (yyvsp[0].table); } +#line 3077 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 79: +#line 655 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[0].expr); } +#line 3083 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 80: +#line 656 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = nullptr; } +#line 3089 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 81: +#line 660 "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 3028 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 77: -#line 622 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.group_t) = nullptr; } -#line 3034 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 78: -#line 626 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = (yyvsp[0].expr); } -#line 3040 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 79: -#line 627 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = nullptr; } -#line 3046 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 80: -#line 630 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.order_vec) = (yyvsp[0].order_vec); } -#line 3052 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 81: -#line 631 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.order_vec) = nullptr; } -#line 3058 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3099 "bison_parser.cpp" /* yacc.c:1646 */ break; case 82: -#line 635 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.order_vec) = new std::vector(); (yyval.order_vec)->push_back((yyvsp[0].order)); } -#line 3064 "bison_parser.cpp" /* yacc.c:1646 */ +#line 665 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.group_t) = nullptr; } +#line 3105 "bison_parser.cpp" /* yacc.c:1646 */ break; case 83: -#line 636 "bison_parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].order_vec)->push_back((yyvsp[0].order)); (yyval.order_vec) = (yyvsp[-2].order_vec); } -#line 3070 "bison_parser.cpp" /* yacc.c:1646 */ +#line 669 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[0].expr); } +#line 3111 "bison_parser.cpp" /* yacc.c:1646 */ break; case 84: -#line 640 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.order) = new OrderDescription((yyvsp[0].order_type), (yyvsp[-1].expr)); } -#line 3076 "bison_parser.cpp" /* yacc.c:1646 */ +#line 670 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = nullptr; } +#line 3117 "bison_parser.cpp" /* yacc.c:1646 */ break; case 85: -#line 644 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.order_type) = kOrderAsc; } -#line 3082 "bison_parser.cpp" /* yacc.c:1646 */ +#line 673 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order_vec) = (yyvsp[0].order_vec); } +#line 3123 "bison_parser.cpp" /* yacc.c:1646 */ break; case 86: -#line 645 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.order_type) = kOrderDesc; } -#line 3088 "bison_parser.cpp" /* yacc.c:1646 */ +#line 674 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order_vec) = nullptr; } +#line 3129 "bison_parser.cpp" /* yacc.c:1646 */ break; case 87: -#line 646 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.order_type) = kOrderAsc; } -#line 3094 "bison_parser.cpp" /* yacc.c:1646 */ +#line 678 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order_vec) = new std::vector(); (yyval.order_vec)->push_back((yyvsp[0].order)); } +#line 3135 "bison_parser.cpp" /* yacc.c:1646 */ break; case 88: -#line 652 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.limit) = new LimitDescription((yyvsp[0].expr)->ival, kNoOffset); delete (yyvsp[0].expr); } -#line 3100 "bison_parser.cpp" /* yacc.c:1646 */ +#line 679 "bison_parser.y" /* yacc.c:1646 */ + { (yyvsp[-2].order_vec)->push_back((yyvsp[0].order)); (yyval.order_vec) = (yyvsp[-2].order_vec); } +#line 3141 "bison_parser.cpp" /* yacc.c:1646 */ break; case 89: -#line 653 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.limit) = nullptr; } -#line 3106 "bison_parser.cpp" /* yacc.c:1646 */ +#line 683 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order) = new OrderDescription((yyvsp[0].order_type), (yyvsp[-1].expr)); } +#line 3147 "bison_parser.cpp" /* yacc.c:1646 */ break; case 90: -#line 657 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.limit) = new LimitDescription((yyvsp[0].expr)->ival, kNoOffset); delete (yyvsp[0].expr); } -#line 3112 "bison_parser.cpp" /* yacc.c:1646 */ +#line 687 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order_type) = kOrderAsc; } +#line 3153 "bison_parser.cpp" /* yacc.c:1646 */ break; case 91: -#line 658 "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 3118 "bison_parser.cpp" /* yacc.c:1646 */ +#line 688 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order_type) = kOrderDesc; } +#line 3159 "bison_parser.cpp" /* yacc.c:1646 */ break; case 92: -#line 659 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.limit) = nullptr; } -#line 3124 "bison_parser.cpp" /* yacc.c:1646 */ +#line 689 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order_type) = kOrderAsc; } +#line 3165 "bison_parser.cpp" /* yacc.c:1646 */ break; case 93: -#line 666 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr_vec) = new std::vector(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); } -#line 3130 "bison_parser.cpp" /* yacc.c:1646 */ +#line 695 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.limit) = new LimitDescription((yyvsp[0].expr)->ival, kNoOffset); delete (yyvsp[0].expr); } +#line 3171 "bison_parser.cpp" /* yacc.c:1646 */ break; case 94: -#line 667 "bison_parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); } -#line 3136 "bison_parser.cpp" /* yacc.c:1646 */ +#line 696 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.limit) = nullptr; } +#line 3177 "bison_parser.cpp" /* yacc.c:1646 */ break; case 95: -#line 671 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr_vec) = new std::vector(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); } -#line 3142 "bison_parser.cpp" /* yacc.c:1646 */ +#line 700 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.limit) = new LimitDescription((yyvsp[0].expr)->ival, kNoOffset); delete (yyvsp[0].expr); } +#line 3183 "bison_parser.cpp" /* yacc.c:1646 */ break; case 96: -#line 672 "bison_parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); } -#line 3148 "bison_parser.cpp" /* yacc.c:1646 */ +#line 701 "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 3189 "bison_parser.cpp" /* yacc.c:1646 */ break; case 97: -#line 676 "bison_parser.y" /* yacc.c:1646 */ +#line 702 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.limit) = nullptr; } +#line 3195 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 98: +#line 709 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr_vec) = new std::vector(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); } +#line 3201 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 99: +#line 710 "bison_parser.y" /* yacc.c:1646 */ + { (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); } +#line 3207 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 100: +#line 714 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr_vec) = new std::vector(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); } +#line 3213 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 101: +#line 715 "bison_parser.y" /* yacc.c:1646 */ + { (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); } +#line 3219 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 102: +#line 719 "bison_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[-1].expr); (yyval.expr)->alias = (yyvsp[0].sval); } -#line 3157 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3228 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 103: -#line 691 "bison_parser.y" /* yacc.c:1646 */ + case 108: +#line 734 "bison_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[-1].expr); } -#line 3163 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 111: -#line 699 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeSelect((yyvsp[-1].select_stmt)); } -#line 3169 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 114: -#line 708 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpUnary(kOpUnaryMinus, (yyvsp[0].expr)); } -#line 3175 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 115: -#line 709 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpUnary(kOpNot, (yyvsp[0].expr)); } -#line 3181 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3234 "bison_parser.cpp" /* yacc.c:1646 */ break; case 116: -#line 710 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpUnary(kOpIsNull, (yyvsp[-1].expr)); } -#line 3187 "bison_parser.cpp" /* yacc.c:1646 */ +#line 742 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeSelect((yyvsp[-1].select_stmt)); } +#line 3240 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 117: -#line 711 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpUnary(kOpIsNull, (yyvsp[-2].expr)); } -#line 3193 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 118: -#line 712 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeOpUnary(kOpIsNull, (yyvsp[-3].expr))); } -#line 3199 "bison_parser.cpp" /* yacc.c:1646 */ + case 119: +#line 751 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpUnaryMinus, (yyvsp[0].expr)); } +#line 3246 "bison_parser.cpp" /* yacc.c:1646 */ break; case 120: -#line 717 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpMinus, (yyvsp[0].expr)); } -#line 3205 "bison_parser.cpp" /* yacc.c:1646 */ +#line 752 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpNot, (yyvsp[0].expr)); } +#line 3252 "bison_parser.cpp" /* yacc.c:1646 */ break; case 121: -#line 718 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpPlus, (yyvsp[0].expr)); } -#line 3211 "bison_parser.cpp" /* yacc.c:1646 */ +#line 753 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpIsNull, (yyvsp[-1].expr)); } +#line 3258 "bison_parser.cpp" /* yacc.c:1646 */ break; case 122: -#line 719 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpSlash, (yyvsp[0].expr)); } -#line 3217 "bison_parser.cpp" /* yacc.c:1646 */ +#line 754 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpIsNull, (yyvsp[-2].expr)); } +#line 3264 "bison_parser.cpp" /* yacc.c:1646 */ break; case 123: -#line 720 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpAsterisk, (yyvsp[0].expr)); } -#line 3223 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 124: -#line 721 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpPercentage, (yyvsp[0].expr)); } -#line 3229 "bison_parser.cpp" /* yacc.c:1646 */ +#line 755 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeOpUnary(kOpIsNull, (yyvsp[-3].expr))); } +#line 3270 "bison_parser.cpp" /* yacc.c:1646 */ break; case 125: -#line 722 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpCaret, (yyvsp[0].expr)); } -#line 3235 "bison_parser.cpp" /* yacc.c:1646 */ +#line 760 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpMinus, (yyvsp[0].expr)); } +#line 3276 "bison_parser.cpp" /* yacc.c:1646 */ break; case 126: -#line 723 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLike, (yyvsp[0].expr)); } -#line 3241 "bison_parser.cpp" /* yacc.c:1646 */ +#line 761 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpPlus, (yyvsp[0].expr)); } +#line 3282 "bison_parser.cpp" /* yacc.c:1646 */ break; case 127: -#line 724 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-3].expr), kOpNotLike, (yyvsp[0].expr)); } -#line 3247 "bison_parser.cpp" /* yacc.c:1646 */ +#line 762 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpSlash, (yyvsp[0].expr)); } +#line 3288 "bison_parser.cpp" /* yacc.c:1646 */ break; case 128: -#line 725 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpILike, (yyvsp[0].expr)); } -#line 3253 "bison_parser.cpp" /* yacc.c:1646 */ +#line 763 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpAsterisk, (yyvsp[0].expr)); } +#line 3294 "bison_parser.cpp" /* yacc.c:1646 */ break; case 129: -#line 726 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpConcat, (yyvsp[0].expr)); } -#line 3259 "bison_parser.cpp" /* yacc.c:1646 */ +#line 764 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpPercentage, (yyvsp[0].expr)); } +#line 3300 "bison_parser.cpp" /* yacc.c:1646 */ break; case 130: -#line 730 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpAnd, (yyvsp[0].expr)); } -#line 3265 "bison_parser.cpp" /* yacc.c:1646 */ +#line 765 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpCaret, (yyvsp[0].expr)); } +#line 3306 "bison_parser.cpp" /* yacc.c:1646 */ break; case 131: -#line 731 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpOr, (yyvsp[0].expr)); } -#line 3271 "bison_parser.cpp" /* yacc.c:1646 */ +#line 766 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLike, (yyvsp[0].expr)); } +#line 3312 "bison_parser.cpp" /* yacc.c:1646 */ break; case 132: -#line 735 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeInOperator((yyvsp[-4].expr), (yyvsp[-1].expr_vec)); } -#line 3277 "bison_parser.cpp" /* yacc.c:1646 */ +#line 767 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-3].expr), kOpNotLike, (yyvsp[0].expr)); } +#line 3318 "bison_parser.cpp" /* yacc.c:1646 */ break; case 133: -#line 736 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeInOperator((yyvsp[-5].expr), (yyvsp[-1].expr_vec))); } -#line 3283 "bison_parser.cpp" /* yacc.c:1646 */ +#line 768 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpILike, (yyvsp[0].expr)); } +#line 3324 "bison_parser.cpp" /* yacc.c:1646 */ break; case 134: -#line 737 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeInOperator((yyvsp[-4].expr), (yyvsp[-1].select_stmt)); } -#line 3289 "bison_parser.cpp" /* yacc.c:1646 */ +#line 769 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpConcat, (yyvsp[0].expr)); } +#line 3330 "bison_parser.cpp" /* yacc.c:1646 */ break; case 135: -#line 738 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeInOperator((yyvsp[-5].expr), (yyvsp[-1].select_stmt))); } -#line 3295 "bison_parser.cpp" /* yacc.c:1646 */ +#line 773 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpAnd, (yyvsp[0].expr)); } +#line 3336 "bison_parser.cpp" /* yacc.c:1646 */ break; case 136: -#line 743 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeCase((yyvsp[-3].expr), (yyvsp[-1].expr)); } -#line 3301 "bison_parser.cpp" /* yacc.c:1646 */ +#line 774 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpOr, (yyvsp[0].expr)); } +#line 3342 "bison_parser.cpp" /* yacc.c:1646 */ break; case 137: -#line 745 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeCase((yyvsp[-5].expr), (yyvsp[-3].expr), (yyvsp[-1].expr)); } -#line 3307 "bison_parser.cpp" /* yacc.c:1646 */ +#line 778 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeInOperator((yyvsp[-4].expr), (yyvsp[-1].expr_vec)); } +#line 3348 "bison_parser.cpp" /* yacc.c:1646 */ break; case 138: -#line 749 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeExists((yyvsp[-1].select_stmt)); } -#line 3313 "bison_parser.cpp" /* yacc.c:1646 */ +#line 779 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeInOperator((yyvsp[-5].expr), (yyvsp[-1].expr_vec))); } +#line 3354 "bison_parser.cpp" /* yacc.c:1646 */ break; case 139: -#line 750 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeExists((yyvsp[-1].select_stmt))); } -#line 3319 "bison_parser.cpp" /* yacc.c:1646 */ +#line 780 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeInOperator((yyvsp[-4].expr), (yyvsp[-1].select_stmt)); } +#line 3360 "bison_parser.cpp" /* yacc.c:1646 */ break; case 140: -#line 754 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpEquals, (yyvsp[0].expr)); } -#line 3325 "bison_parser.cpp" /* yacc.c:1646 */ +#line 781 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeInOperator((yyvsp[-5].expr), (yyvsp[-1].select_stmt))); } +#line 3366 "bison_parser.cpp" /* yacc.c:1646 */ break; case 141: -#line 755 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpNotEquals, (yyvsp[0].expr)); } -#line 3331 "bison_parser.cpp" /* yacc.c:1646 */ +#line 786 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeCase((yyvsp[-3].expr), (yyvsp[-1].expr)); } +#line 3372 "bison_parser.cpp" /* yacc.c:1646 */ break; case 142: -#line 756 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLess, (yyvsp[0].expr)); } -#line 3337 "bison_parser.cpp" /* yacc.c:1646 */ +#line 788 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeCase((yyvsp[-5].expr), (yyvsp[-3].expr), (yyvsp[-1].expr)); } +#line 3378 "bison_parser.cpp" /* yacc.c:1646 */ break; case 143: -#line 757 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpGreater, (yyvsp[0].expr)); } -#line 3343 "bison_parser.cpp" /* yacc.c:1646 */ +#line 792 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeExists((yyvsp[-1].select_stmt)); } +#line 3384 "bison_parser.cpp" /* yacc.c:1646 */ break; case 144: -#line 758 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLessEq, (yyvsp[0].expr)); } -#line 3349 "bison_parser.cpp" /* yacc.c:1646 */ +#line 793 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeExists((yyvsp[-1].select_stmt))); } +#line 3390 "bison_parser.cpp" /* yacc.c:1646 */ break; case 145: -#line 759 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpGreaterEq, (yyvsp[0].expr)); } -#line 3355 "bison_parser.cpp" /* yacc.c:1646 */ +#line 797 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpEquals, (yyvsp[0].expr)); } +#line 3396 "bison_parser.cpp" /* yacc.c:1646 */ break; case 146: -#line 763 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeFunctionRef((yyvsp[-2].sval), new std::vector(), false); } -#line 3361 "bison_parser.cpp" /* yacc.c:1646 */ +#line 798 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpNotEquals, (yyvsp[0].expr)); } +#line 3402 "bison_parser.cpp" /* yacc.c:1646 */ break; case 147: -#line 764 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeFunctionRef((yyvsp[-4].sval), (yyvsp[-1].expr_vec), (yyvsp[-2].bval)); } -#line 3367 "bison_parser.cpp" /* yacc.c:1646 */ +#line 799 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLess, (yyvsp[0].expr)); } +#line 3408 "bison_parser.cpp" /* yacc.c:1646 */ break; case 148: -#line 768 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeArray((yyvsp[-1].expr_vec)); } -#line 3373 "bison_parser.cpp" /* yacc.c:1646 */ +#line 800 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpGreater, (yyvsp[0].expr)); } +#line 3414 "bison_parser.cpp" /* yacc.c:1646 */ break; case 149: -#line 772 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeArrayIndex((yyvsp[-3].expr), (yyvsp[-1].expr)->ival); } -#line 3379 "bison_parser.cpp" /* yacc.c:1646 */ +#line 801 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLessEq, (yyvsp[0].expr)); } +#line 3420 "bison_parser.cpp" /* yacc.c:1646 */ break; case 150: -#line 776 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeBetween((yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 3385 "bison_parser.cpp" /* yacc.c:1646 */ +#line 802 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpGreaterEq, (yyvsp[0].expr)); } +#line 3426 "bison_parser.cpp" /* yacc.c:1646 */ break; case 151: -#line 780 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeColumnRef((yyvsp[0].sval)); } -#line 3391 "bison_parser.cpp" /* yacc.c:1646 */ +#line 806 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeFunctionRef((yyvsp[-2].sval), new std::vector(), false); } +#line 3432 "bison_parser.cpp" /* yacc.c:1646 */ break; case 152: -#line 781 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeColumnRef((yyvsp[-2].sval), (yyvsp[0].sval)); } -#line 3397 "bison_parser.cpp" /* yacc.c:1646 */ +#line 807 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeFunctionRef((yyvsp[-4].sval), (yyvsp[-1].expr_vec), (yyvsp[-2].bval)); } +#line 3438 "bison_parser.cpp" /* yacc.c:1646 */ break; case 153: -#line 782 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeStar(); } -#line 3403 "bison_parser.cpp" /* yacc.c:1646 */ +#line 811 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeArray((yyvsp[-1].expr_vec)); } +#line 3444 "bison_parser.cpp" /* yacc.c:1646 */ break; case 154: -#line 783 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeStar((yyvsp[-2].sval)); } -#line 3409 "bison_parser.cpp" /* yacc.c:1646 */ +#line 815 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeArrayIndex((yyvsp[-3].expr), (yyvsp[-1].expr)->ival); } +#line 3450 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 155: +#line 819 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeBetween((yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); } +#line 3456 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 156: +#line 823 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeColumnRef((yyvsp[0].sval)); } +#line 3462 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 157: +#line 824 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeColumnRef((yyvsp[-2].sval), (yyvsp[0].sval)); } +#line 3468 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 158: +#line 825 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeStar(); } +#line 3474 "bison_parser.cpp" /* yacc.c:1646 */ break; case 159: -#line 794 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeLiteral((yyvsp[0].sval)); } -#line 3415 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 160: -#line 799 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeLiteral((yyvsp[0].fval)); } -#line 3421 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 162: -#line 804 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeLiteral((yyvsp[0].ival)); } -#line 3427 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 163: -#line 808 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeNullLiteral(); } -#line 3433 "bison_parser.cpp" /* yacc.c:1646 */ +#line 826 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeStar((yyvsp[-2].sval)); } +#line 3480 "bison_parser.cpp" /* yacc.c:1646 */ break; case 164: -#line 812 "bison_parser.y" /* yacc.c:1646 */ +#line 837 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeLiteral((yyvsp[0].sval)); } +#line 3486 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 165: +#line 842 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeLiteral((yyvsp[0].fval)); } +#line 3492 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 167: +#line 847 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeLiteral((yyvsp[0].ival)); } +#line 3498 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 168: +#line 851 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeNullLiteral(); } +#line 3504 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 169: +#line 855 "bison_parser.y" /* yacc.c:1646 */ { (yyval.expr) = Expr::makeParameter(yylloc.total_column); (yyval.expr)->ival2 = yyloc.param_list.size(); yyloc.param_list.push_back((yyval.expr)); } -#line 3443 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3514 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 166: -#line 825 "bison_parser.y" /* yacc.c:1646 */ + case 171: +#line 868 "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 3454 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3525 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 170: -#line 841 "bison_parser.y" /* yacc.c:1646 */ + case 175: +#line 884 "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 3465 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 171: -#line 850 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.table_vec) = new std::vector(); (yyval.table_vec)->push_back((yyvsp[0].table)); } -#line 3471 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 172: -#line 851 "bison_parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].table_vec)->push_back((yyvsp[0].table)); (yyval.table_vec) = (yyvsp[-2].table_vec); } -#line 3477 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 173: -#line 856 "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 3488 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 174: -#line 866 "bison_parser.y" /* yacc.c:1646 */ - { - (yyval.table) = new TableRef(kTableName); - (yyval.table)->name = (yyvsp[0].sval); - } -#line 3497 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3536 "bison_parser.cpp" /* yacc.c:1646 */ break; case 176: -#line 875 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.sval) = (yyvsp[0].sval); } -#line 3503 "bison_parser.cpp" /* yacc.c:1646 */ +#line 893 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.table_vec) = new std::vector(); (yyval.table_vec)->push_back((yyvsp[0].table)); } +#line 3542 "bison_parser.cpp" /* yacc.c:1646 */ break; case 177: -#line 880 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.sval) = (yyvsp[0].sval); } -#line 3509 "bison_parser.cpp" /* yacc.c:1646 */ +#line 894 "bison_parser.y" /* yacc.c:1646 */ + { (yyvsp[-2].table_vec)->push_back((yyvsp[0].table)); (yyval.table_vec) = (yyvsp[-2].table_vec); } +#line 3548 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 178: +#line 899 "bison_parser.y" /* yacc.c:1646 */ + { + auto tbl = new TableRef(kTableName); + tbl->schema = (yyvsp[-1].table_name).schema; + tbl->name = (yyvsp[-1].table_name).name; + tbl->alias = (yyvsp[0].sval); + (yyval.table) = tbl; + } +#line 3560 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 179: +#line 910 "bison_parser.y" /* yacc.c:1646 */ + { + (yyval.table) = new TableRef(kTableName); + (yyval.table)->schema = (yyvsp[0].table_name).schema; + (yyval.table)->name = (yyvsp[0].table_name).name; + } +#line 3570 "bison_parser.cpp" /* yacc.c:1646 */ break; case 180: -#line 886 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.sval) = nullptr; } -#line 3515 "bison_parser.cpp" /* yacc.c:1646 */ +#line 919 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.table_name).schema = nullptr; (yyval.table_name).name = (yyvsp[0].sval);} +#line 3576 "bison_parser.cpp" /* yacc.c:1646 */ break; case 181: -#line 895 "bison_parser.y" /* yacc.c:1646 */ +#line 920 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.table_name).schema = (yyvsp[-2].sval); (yyval.table_name).name = (yyvsp[0].sval); } +#line 3582 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 182: +#line 925 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].sval); } +#line 3588 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 185: +#line 931 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.sval) = nullptr; } +#line 3594 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 186: +#line 940 "bison_parser.y" /* yacc.c:1646 */ { (yyval.table) = new TableRef(kTableJoin); (yyval.table)->join = new JoinDefinition(); @@ -3523,12 +3602,12 @@ yyreduce: (yyval.table)->join->left = (yyvsp[-3].table); (yyval.table)->join->right = (yyvsp[0].table); } -#line 3527 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3606 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 182: -#line 903 "bison_parser.y" /* yacc.c:1646 */ - { + case 187: +#line 948 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.table) = new TableRef(kTableJoin); (yyval.table)->join = new JoinDefinition(); (yyval.table)->join->type = (JoinType) (yyvsp[-4].uval); @@ -3536,12 +3615,12 @@ yyreduce: (yyval.table)->join->right = (yyvsp[-2].table); (yyval.table)->join->condition = (yyvsp[0].expr); } -#line 3540 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3619 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 183: -#line 913 "bison_parser.y" /* yacc.c:1646 */ - { + case 188: +#line 958 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.table) = new TableRef(kTableJoin); (yyval.table)->join = new JoinDefinition(); (yyval.table)->join->type = (JoinType) (yyvsp[-6].uval); @@ -3556,71 +3635,71 @@ yyreduce: (yyval.table)->join->condition = Expr::makeOpBinary(left_col, kOpEquals, right_col); delete (yyvsp[-1].expr); } -#line 3560 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 184: -#line 931 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kJoinInner; } -#line 3566 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 185: -#line 932 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kJoinOuter; } -#line 3572 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 186: -#line 933 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kJoinLeftOuter; } -#line 3578 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 187: -#line 934 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kJoinRightOuter; } -#line 3584 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 188: -#line 935 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kJoinLeft; } -#line 3590 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3639 "bison_parser.cpp" /* yacc.c:1646 */ break; case 189: -#line 936 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kJoinRight; } -#line 3596 "bison_parser.cpp" /* yacc.c:1646 */ +#line 976 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinInner; } +#line 3645 "bison_parser.cpp" /* yacc.c:1646 */ break; case 190: -#line 937 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kJoinCross; } -#line 3602 "bison_parser.cpp" /* yacc.c:1646 */ +#line 977 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinOuter; } +#line 3651 "bison_parser.cpp" /* yacc.c:1646 */ break; case 191: -#line 938 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kJoinInner; } -#line 3608 "bison_parser.cpp" /* yacc.c:1646 */ +#line 978 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinLeftOuter; } +#line 3657 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 192: +#line 979 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinRightOuter; } +#line 3663 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 193: +#line 980 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinLeft; } +#line 3669 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 194: +#line 981 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinRight; } +#line 3675 "bison_parser.cpp" /* yacc.c:1646 */ break; case 195: -#line 958 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.str_vec) = new std::vector(); (yyval.str_vec)->push_back((yyvsp[0].sval)); } -#line 3614 "bison_parser.cpp" /* yacc.c:1646 */ +#line 982 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinCross; } +#line 3681 "bison_parser.cpp" /* yacc.c:1646 */ break; case 196: -#line 959 "bison_parser.y" /* yacc.c:1646 */ +#line 983 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinInner; } +#line 3687 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 200: +#line 1003 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.str_vec) = new std::vector(); (yyval.str_vec)->push_back((yyvsp[0].sval)); } +#line 3693 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 201: +#line 1004 "bison_parser.y" /* yacc.c:1646 */ { (yyvsp[-2].str_vec)->push_back((yyvsp[0].sval)); (yyval.str_vec) = (yyvsp[-2].str_vec); } -#line 3620 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3699 "bison_parser.cpp" /* yacc.c:1646 */ break; -#line 3624 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3703 "bison_parser.cpp" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -3855,7 +3934,7 @@ yyreturn: #endif return yyresult; } -#line 962 "bison_parser.y" /* yacc.c:1906 */ +#line 1007 "bison_parser.y" /* yacc.c:1906 */ /********************************* ** Section 4: Additional C code diff --git a/src/parser/bison_parser.h b/src/parser/bison_parser.h index e203b32..314283e 100644 --- a/src/parser/bison_parser.h +++ b/src/parser/bison_parser.h @@ -235,7 +235,9 @@ union HSQL_STYPE 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; @@ -254,7 +256,7 @@ union HSQL_STYPE std::vector* expr_vec; std::vector* order_vec; -#line 258 "bison_parser.h" /* yacc.c:1909 */ +#line 260 "bison_parser.h" /* yacc.c:1909 */ }; typedef union HSQL_STYPE HSQL_STYPE; diff --git a/src/parser/bison_parser.y b/src/parser/bison_parser.y old mode 100644 new mode 100755 index bb96826..7d280a9 --- a/src/parser/bison_parser.y +++ b/src/parser/bison_parser.y @@ -107,7 +107,9 @@ int yyerror(YYLTYPE* llocp, SQLParserResult* result, yyscan_t scanner, const cha 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; @@ -131,7 +133,8 @@ int yyerror(YYLTYPE* llocp, SQLParserResult* result, yyscan_t scanner, const cha /********************************* ** Descrutor symbols *********************************/ -%destructor { } +%destructor { } +%destructor { free( ($$.name) ); free( ($$.schema) ); } %destructor { free( ($$) ); } %destructor { if (($$) != nullptr) { @@ -182,8 +185,10 @@ int yyerror(YYLTYPE* llocp, SQLParserResult* result, yyscan_t scanner, const cha %type delete_statement truncate_statement %type update_statement %type drop_statement -%type table_name opt_alias alias file_path prepare_target_query -%type opt_not_exists opt_distinct +%type show_statement +%type table_name +%type opt_alias alias file_path prepare_target_query +%type opt_not_exists opt_exists opt_distinct %type import_file_type opt_join_type column_type %type from_clause table_ref table_ref_atomic table_ref_name nonjoin_table_ref_atomic %type
join_clause table_ref_name_no_alias @@ -271,6 +276,9 @@ statement: $$ = $1; $$->hints = $2; } + | show_statement { + $$ = $1; + } ; @@ -348,7 +356,8 @@ import_statement: IMPORT FROM import_file_type FILE file_path INTO table_name { $$ = new ImportStatement((ImportType) $3); $$->filePath = $5; - $$->tableName = $7; + $$->schema = $7.schema; + $$->tableName = $7.name; } ; @@ -361,6 +370,23 @@ file_path: ; +/****************************** + * Show Statement + * SHOW TABLES; + ******************************/ + +show_statement: + SHOW TABLES { + $$ = new ShowStatement(kShowTables); + } + | SHOW COLUMNS table_name { + $$ = new ShowStatement(kShowColumns); + $$->schema = $3.schema; + $$->name = $3.name; + } + ; + + /****************************** * Create Statement * CREATE TABLE students (name TEXT, student_number INTEGER, city TEXT, grade DOUBLE) @@ -370,19 +396,22 @@ create_statement: CREATE TABLE opt_not_exists table_name FROM TBL FILE file_path { $$ = new CreateStatement(kCreateTableFromTbl); $$->ifNotExists = $3; - $$->tableName = $4; + $$->schema = $4.schema; + $$->tableName = $4.name; $$->filePath = $8; } | CREATE TABLE opt_not_exists table_name '(' column_def_commalist ')' { $$ = new CreateStatement(kCreateTable); $$->ifNotExists = $3; - $$->tableName = $4; + $$->schema = $4.schema; + $$->tableName = $4.name; $$->columns = $6; } | CREATE VIEW opt_not_exists table_name opt_column_list AS select_statement { $$ = new CreateStatement(kCreateView); $$->ifNotExists = $3; - $$->tableName = $4; + $$->schema = $4.schema; + $$->tableName = $4.name; $$->viewColumns = $5; $$->select = $7; } @@ -419,20 +448,30 @@ column_type: ******************************/ drop_statement: - DROP TABLE table_name { + DROP TABLE opt_exists table_name { $$ = new DropStatement(kDropTable); - $$->name = $3; + $$->ifExists = $3; + $$->schema = $4.schema; + $$->name = $4.name; } - | DROP VIEW table_name { + | DROP VIEW opt_exists table_name { $$ = new DropStatement(kDropView); - $$->name = $3; + $$->ifExists = $3; + $$->schema = $4.schema; + $$->name = $4.name; } | DEALLOCATE PREPARE IDENTIFIER { $$ = new DropStatement(kDropPreparedStatement); + $$->ifExists = false; $$->name = $3; } ; +opt_exists: + IF EXISTS { $$ = true; } + | /* empty */ { $$ = false; } + ; + /****************************** * Delete Statement / Truncate statement * DELETE FROM students WHERE grade > 3.0 @@ -441,7 +480,8 @@ drop_statement: delete_statement: DELETE FROM table_name opt_where { $$ = new DeleteStatement(); - $$->tableName = $3; + $$->schema = $3.schema; + $$->tableName = $3.name; $$->expr = $4; } ; @@ -449,7 +489,8 @@ delete_statement: truncate_statement: TRUNCATE table_name { $$ = new DeleteStatement(); - $$->tableName = $2; + $$->schema = $2.schema; + $$->tableName = $2.name; } ; @@ -461,13 +502,15 @@ truncate_statement: insert_statement: INSERT INTO table_name opt_column_list VALUES '(' literal_list ')' { $$ = new InsertStatement(kInsertValues); - $$->tableName = $3; + $$->schema = $3.schema; + $$->tableName = $3.name; $$->columns = $4; $$->values = $7; } | INSERT INTO table_name opt_column_list select_no_paren { $$ = new InsertStatement(kInsertSelect); - $$->tableName = $3; + $$->schema = $3.schema; + $$->tableName = $3.name; $$->columns = $4; $$->select = $5; } @@ -500,7 +543,7 @@ update_clause_commalist: ; update_clause: - IDENTIFIER '=' literal { + IDENTIFIER '=' expr { $$ = new UpdateClause(); $$->column = $1; $$->value = $3; @@ -836,7 +879,7 @@ table_ref_atomic: | join_clause ; -nonjoin_table_ref_atomic: +nonjoin_table_ref_atomic: table_ref_name | '(' select_statement ')' opt_alias { auto tbl = new TableRef(kTableSelect); @@ -855,7 +898,8 @@ table_ref_commalist: table_ref_name: table_name opt_alias { auto tbl = new TableRef(kTableName); - tbl->name = $1; + tbl->schema = $1.schema; + tbl->name = $1.name; tbl->alias = $2; $$ = tbl; } @@ -865,14 +909,15 @@ table_ref_name: table_ref_name_no_alias: table_name { $$ = new TableRef(kTableName); - $$->name = $1; + $$->schema = $1.schema; + $$->name = $1.name; } ; table_name: - IDENTIFIER - | IDENTIFIER '.' IDENTIFIER { $$ = $3; } + IDENTIFIER { $$.schema = nullptr; $$.name = $1;} + | IDENTIFIER '.' IDENTIFIER { $$.schema = $1; $$.name = $3; } ; @@ -900,7 +945,7 @@ join_clause: $$->join->right = $4; } | table_ref_atomic opt_join_type JOIN table_ref_atomic ON join_condition - { + { $$ = new TableRef(kTableJoin); $$->join = new JoinDefinition(); $$->join->type = (JoinType) $2; @@ -910,7 +955,7 @@ join_clause: } | table_ref_atomic opt_join_type JOIN table_ref_atomic USING '(' column_name ')' - { + { $$ = new TableRef(kTableJoin); $$->join = new JoinDefinition(); $$->join->type = (JoinType) $2; diff --git a/src/parser/flex_lexer.cpp b/src/parser/flex_lexer.cpp index ceb87e2..094f831 100644 --- a/src/parser/flex_lexer.cpp +++ b/src/parser/flex_lexer.cpp @@ -1,6 +1,6 @@ -#line 1 "flex_lexer.cpp" +#line 2 "flex_lexer.cpp" -#line 3 "flex_lexer.cpp" +#line 4 "flex_lexer.cpp" #define YY_INT_ALIGNED short int @@ -9,245 +9,11 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 4 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif -#ifdef yy_create_buffer -#define hsql__create_buffer_ALREADY_DEFINED -#else -#define yy_create_buffer hsql__create_buffer -#endif - -#ifdef yy_delete_buffer -#define hsql__delete_buffer_ALREADY_DEFINED -#else -#define yy_delete_buffer hsql__delete_buffer -#endif - -#ifdef yy_scan_buffer -#define hsql__scan_buffer_ALREADY_DEFINED -#else -#define yy_scan_buffer hsql__scan_buffer -#endif - -#ifdef yy_scan_string -#define hsql__scan_string_ALREADY_DEFINED -#else -#define yy_scan_string hsql__scan_string -#endif - -#ifdef yy_scan_bytes -#define hsql__scan_bytes_ALREADY_DEFINED -#else -#define yy_scan_bytes hsql__scan_bytes -#endif - -#ifdef yy_init_buffer -#define hsql__init_buffer_ALREADY_DEFINED -#else -#define yy_init_buffer hsql__init_buffer -#endif - -#ifdef yy_flush_buffer -#define hsql__flush_buffer_ALREADY_DEFINED -#else -#define yy_flush_buffer hsql__flush_buffer -#endif - -#ifdef yy_load_buffer_state -#define hsql__load_buffer_state_ALREADY_DEFINED -#else -#define yy_load_buffer_state hsql__load_buffer_state -#endif - -#ifdef yy_switch_to_buffer -#define hsql__switch_to_buffer_ALREADY_DEFINED -#else -#define yy_switch_to_buffer hsql__switch_to_buffer -#endif - -#ifdef yypush_buffer_state -#define hsql_push_buffer_state_ALREADY_DEFINED -#else -#define yypush_buffer_state hsql_push_buffer_state -#endif - -#ifdef yypop_buffer_state -#define hsql_pop_buffer_state_ALREADY_DEFINED -#else -#define yypop_buffer_state hsql_pop_buffer_state -#endif - -#ifdef yyensure_buffer_stack -#define hsql_ensure_buffer_stack_ALREADY_DEFINED -#else -#define yyensure_buffer_stack hsql_ensure_buffer_stack -#endif - -#ifdef yylex -#define hsql_lex_ALREADY_DEFINED -#else -#define yylex hsql_lex -#endif - -#ifdef yyrestart -#define hsql_restart_ALREADY_DEFINED -#else -#define yyrestart hsql_restart -#endif - -#ifdef yylex_init -#define hsql_lex_init_ALREADY_DEFINED -#else -#define yylex_init hsql_lex_init -#endif - -#ifdef yylex_init_extra -#define hsql_lex_init_extra_ALREADY_DEFINED -#else -#define yylex_init_extra hsql_lex_init_extra -#endif - -#ifdef yylex_destroy -#define hsql_lex_destroy_ALREADY_DEFINED -#else -#define yylex_destroy hsql_lex_destroy -#endif - -#ifdef yyget_debug -#define hsql_get_debug_ALREADY_DEFINED -#else -#define yyget_debug hsql_get_debug -#endif - -#ifdef yyset_debug -#define hsql_set_debug_ALREADY_DEFINED -#else -#define yyset_debug hsql_set_debug -#endif - -#ifdef yyget_extra -#define hsql_get_extra_ALREADY_DEFINED -#else -#define yyget_extra hsql_get_extra -#endif - -#ifdef yyset_extra -#define hsql_set_extra_ALREADY_DEFINED -#else -#define yyset_extra hsql_set_extra -#endif - -#ifdef yyget_in -#define hsql_get_in_ALREADY_DEFINED -#else -#define yyget_in hsql_get_in -#endif - -#ifdef yyset_in -#define hsql_set_in_ALREADY_DEFINED -#else -#define yyset_in hsql_set_in -#endif - -#ifdef yyget_out -#define hsql_get_out_ALREADY_DEFINED -#else -#define yyget_out hsql_get_out -#endif - -#ifdef yyset_out -#define hsql_set_out_ALREADY_DEFINED -#else -#define yyset_out hsql_set_out -#endif - -#ifdef yyget_leng -#define hsql_get_leng_ALREADY_DEFINED -#else -#define yyget_leng hsql_get_leng -#endif - -#ifdef yyget_text -#define hsql_get_text_ALREADY_DEFINED -#else -#define yyget_text hsql_get_text -#endif - -#ifdef yyget_lineno -#define hsql_get_lineno_ALREADY_DEFINED -#else -#define yyget_lineno hsql_get_lineno -#endif - -#ifdef yyset_lineno -#define hsql_set_lineno_ALREADY_DEFINED -#else -#define yyset_lineno hsql_set_lineno -#endif - -#ifdef yyget_column -#define hsql_get_column_ALREADY_DEFINED -#else -#define yyget_column hsql_get_column -#endif - -#ifdef yyset_column -#define hsql_set_column_ALREADY_DEFINED -#else -#define yyset_column hsql_set_column -#endif - -#ifdef yywrap -#define hsql_wrap_ALREADY_DEFINED -#else -#define yywrap hsql_wrap -#endif - -#ifdef yyget_lval -#define hsql_get_lval_ALREADY_DEFINED -#else -#define yyget_lval hsql_get_lval -#endif - -#ifdef yyset_lval -#define hsql_set_lval_ALREADY_DEFINED -#else -#define yyset_lval hsql_set_lval -#endif - -#ifdef yyget_lloc -#define hsql_get_lloc_ALREADY_DEFINED -#else -#define yyget_lloc hsql_get_lloc -#endif - -#ifdef yyset_lloc -#define hsql_set_lloc_ALREADY_DEFINED -#else -#define yyset_lloc hsql_set_lloc -#endif - -#ifdef yyalloc -#define hsql_alloc_ALREADY_DEFINED -#else -#define yyalloc hsql_alloc -#endif - -#ifdef yyrealloc -#define hsql_realloc_ALREADY_DEFINED -#else -#define yyrealloc hsql_realloc -#endif - -#ifdef yyfree -#define hsql_free_ALREADY_DEFINED -#else -#define yyfree hsql_free -#endif - /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -318,16 +84,10 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif - #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -/* begin standard C++ headers. */ - /* TODO: this is always defined, so inline it */ #define yyconst const @@ -340,10 +100,12 @@ typedef unsigned int flex_uint32_t; /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an - * integer in range [0..255] for use as an array index. +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. */ -#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T @@ -367,16 +129,20 @@ typedef void* yyscan_t; * definition of BEGIN. */ #define BEGIN yyg->yy_start = 1 + 2 * + /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yyg->yy_start - 1) / 2) #define YYSTATE YY_START + /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin , yyscanner ) +#define YY_NEW_FILE hsql_restart(yyin ,yyscanner ) + #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ @@ -409,7 +175,7 @@ typedef size_t yy_size_t; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) #define YY_LINENO_REWIND_TO(ptr) @@ -426,6 +192,7 @@ typedef size_t yy_size_t; YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) + #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -485,7 +252,7 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by + * (via hsql_restart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -502,67 +269,73 @@ struct yy_buffer_state #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ : NULL) + /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] -void yyrestart ( FILE *input_file , yyscan_t yyscanner ); -void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); -void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); -void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); -void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); -void yypop_buffer_state ( yyscan_t yyscanner ); +void hsql_restart (FILE *input_file ,yyscan_t yyscanner ); +void hsql__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE hsql__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void hsql__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void hsql__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void hsql_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void hsql_pop_buffer_state (yyscan_t yyscanner ); -static void yyensure_buffer_stack ( yyscan_t yyscanner ); -static void yy_load_buffer_state ( yyscan_t yyscanner ); -static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); -#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) +static void hsql_ensure_buffer_stack (yyscan_t yyscanner ); +static void hsql__load_buffer_state (yyscan_t yyscanner ); +static void hsql__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); +#define YY_FLUSH_BUFFER hsql__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) -void *yyalloc ( yy_size_t , yyscan_t yyscanner ); -void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); -void yyfree ( void * , yyscan_t yyscanner ); +YY_BUFFER_STATE hsql__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE hsql__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE hsql__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *hsql_alloc (yy_size_t ,yyscan_t yyscanner ); +void *hsql_realloc (void *,yy_size_t ,yyscan_t yyscanner ); +void hsql_free (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer hsql__create_buffer -#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (yyscanner); \ + hsql_ensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ + hsql__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } + #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (yyscanner); \ + hsql_ensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ + hsql__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } + #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define hsql_wrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP -typedef flex_uint8_t YY_CHAR; + +typedef unsigned char YY_CHAR; typedef int yy_state_type; #define yytext_ptr yytext_r -static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); -static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); -static int yy_get_next_buffer ( yyscan_t yyscanner ); -static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. @@ -573,6 +346,7 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; + #define YY_NUM_RULES 136 #define YY_END_OF_BUFFER 137 /* This struct is not used in this scanner, @@ -582,7 +356,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[938] = +static yyconst flex_int16_t yy_accept[938] = { 0, 0, 0, 2, 2, 137, 135, 4, 4, 135, 135, 128, 135, 128, 128, 131, 128, 128, 133, 133, 133, @@ -689,7 +463,7 @@ static const flex_int16_t yy_accept[938] = 2, 2, 5, 6, 2, 2, 0 } ; -static const YY_CHAR yy_ec[256] = +static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -721,7 +495,7 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static const YY_CHAR yy_meta[68] = +static yyconst YY_CHAR yy_meta[68] = { 0, 1, 1, 2, 1, 3, 1, 1, 1, 1, 4, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, @@ -732,7 +506,7 @@ static const YY_CHAR yy_meta[68] = 4, 4, 4, 4, 4, 4, 1 } ; -static const flex_int16_t yy_base[945] = +static yyconst flex_uint16_t yy_base[945] = { 0, 0, 0, 67, 0, 433, 3713, 133, 135, 418, 0, 3713, 410, 131, 401, 133, 132, 384, 129, 129, 137, @@ -840,7 +614,7 @@ static const flex_int16_t yy_base[945] = 3696, 3700, 3704, 3708 } ; -static const flex_int16_t yy_def[945] = +static yyconst flex_int16_t yy_def[945] = { 0, 937, 1, 937, 3, 937, 937, 937, 937, 937, 938, 937, 939, 937, 937, 937, 937, 937, 940, 940, 940, @@ -948,7 +722,7 @@ static const flex_int16_t yy_def[945] = 937, 937, 937, 937 } ; -static const flex_int16_t yy_nxt[3781] = +static yyconst flex_uint16_t yy_nxt[3781] = { 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 11, 17, 18, 19, 20, 21, 22, 23, 24, @@ -1367,7 +1141,7 @@ static const flex_int16_t yy_nxt[3781] = 937, 937, 937, 937, 937, 937, 937, 937, 937, 937 } ; -static const flex_int16_t yy_chk[3781] = +static yyconst flex_int16_t yy_chk[3781] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -1810,7 +1584,6 @@ static const flex_int16_t yy_chk[3781] = #define TOKEN(name) { return SQL_##name; } -#line 1813 "flex_lexer.cpp" /*************************** ** Section 2: Rules ***************************/ @@ -1823,7 +1596,7 @@ static const flex_int16_t yy_chk[3781] = /*************************** ** Section 3: Rules ***************************/ -#line 1826 "flex_lexer.cpp" +#line 1600 "flex_lexer.cpp" #define INITIAL 0 #define COMMENT 1 @@ -1878,7 +1651,7 @@ struct yyguts_t }; /* end struct yyguts_t */ -static int yy_init_globals ( yyscan_t yyscanner ); +static int yy_init_globals (yyscan_t yyscanner ); /* This must go here because YYSTYPE and YYLTYPE are included * from bison output in section 1.*/ @@ -1886,50 +1659,50 @@ static int yy_init_globals ( yyscan_t yyscanner ); # define yylloc yyg->yylloc_r -int yylex_init (yyscan_t* scanner); +int hsql_lex_init (yyscan_t* scanner); -int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); +int hsql_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy ( yyscan_t yyscanner ); +int hsql_lex_destroy (yyscan_t yyscanner ); -int yyget_debug ( yyscan_t yyscanner ); +int hsql_get_debug (yyscan_t yyscanner ); -void yyset_debug ( int debug_flag , yyscan_t yyscanner ); +void hsql_set_debug (int debug_flag ,yyscan_t yyscanner ); -YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); +YY_EXTRA_TYPE hsql_get_extra (yyscan_t yyscanner ); -void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); +void hsql_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); -FILE *yyget_in ( yyscan_t yyscanner ); +FILE *hsql_get_in (yyscan_t yyscanner ); -void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); +void hsql_set_in (FILE * _in_str ,yyscan_t yyscanner ); -FILE *yyget_out ( yyscan_t yyscanner ); +FILE *hsql_get_out (yyscan_t yyscanner ); -void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); +void hsql_set_out (FILE * _out_str ,yyscan_t yyscanner ); - int yyget_leng ( yyscan_t yyscanner ); + int hsql_get_leng (yyscan_t yyscanner ); -char *yyget_text ( yyscan_t yyscanner ); +char *hsql_get_text (yyscan_t yyscanner ); -int yyget_lineno ( yyscan_t yyscanner ); +int hsql_get_lineno (yyscan_t yyscanner ); -void yyset_lineno ( int _line_number , yyscan_t yyscanner ); +void hsql_set_lineno (int _line_number ,yyscan_t yyscanner ); -int yyget_column ( yyscan_t yyscanner ); +int hsql_get_column (yyscan_t yyscanner ); -void yyset_column ( int _column_no , yyscan_t yyscanner ); +void hsql_set_column (int _column_no ,yyscan_t yyscanner ); -YYSTYPE * yyget_lval ( yyscan_t yyscanner ); +YYSTYPE * hsql_get_lval (yyscan_t yyscanner ); -void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); +void hsql_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); - YYLTYPE *yyget_lloc ( yyscan_t yyscanner ); + YYLTYPE *hsql_get_lloc (yyscan_t yyscanner ); - void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner ); + void hsql_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1937,9 +1710,9 @@ void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap ( yyscan_t yyscanner ); +extern "C" int hsql_wrap (yyscan_t yyscanner ); #else -extern int yywrap ( yyscan_t yyscanner ); +extern int hsql_wrap (yyscan_t yyscanner ); #endif #endif @@ -1948,18 +1721,19 @@ extern int yywrap ( yyscan_t yyscanner ); #endif #ifndef yytext_ptr -static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen ( const char * , yyscan_t yyscanner); +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int yyinput ( yyscan_t yyscanner ); +static int yyinput (yyscan_t yyscanner ); #else -static int input ( yyscan_t yyscanner ); +static int input (yyscan_t yyscanner ); #endif #endif @@ -1990,7 +1764,7 @@ static int input ( yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -2003,7 +1777,7 @@ static int input ( yyscan_t yyscanner ); else \ { \ errno=0; \ - while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -2044,10 +1818,10 @@ static int input ( yyscan_t yyscanner ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int yylex \ - (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner); +extern int hsql_lex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); -#define YY_DECL int yylex \ +#define YY_DECL int hsql_lex \ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) #endif /* !YY_DECL */ @@ -2097,19 +1871,19 @@ YY_DECL yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (yyscanner); + hsql_ensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); + hsql__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } - yy_load_buffer_state( yyscanner ); + hsql__load_buffer_state(yyscanner ); } { #line 51 "flex_lexer.l" -#line 2112 "flex_lexer.cpp" +#line 1887 "flex_lexer.cpp" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -2137,9 +1911,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 938 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; ++yy_cp; } while ( yy_current_state != 937 ); @@ -2858,7 +2632,7 @@ YY_RULE_SETUP #line 217 "flex_lexer.l" ECHO; YY_BREAK -#line 2861 "flex_lexer.cpp" +#line 2636 "flex_lexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMENT): yyterminate(); @@ -2877,7 +2651,7 @@ case YY_STATE_EOF(COMMENT): /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure + * hsql_lex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a @@ -2938,7 +2712,7 @@ case YY_STATE_EOF(COMMENT): { yyg->yy_did_buffer_switch_on_eof = 0; - if ( yywrap( yyscanner ) ) + if ( hsql_wrap(yyscanner ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -2992,7 +2766,7 @@ case YY_STATE_EOF(COMMENT): } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ -} /* end of yylex */ +} /* end of hsql_lex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -3071,8 +2845,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yyrealloc( (void *) b->yy_ch_buf, - (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); + hsql_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); } else /* Can't grow it, we don't own it. */ @@ -3104,7 +2877,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin , yyscanner); + hsql_restart(yyin ,yyscanner); } else @@ -3121,12 +2894,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( - (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) hsql_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - /* "- 2" to take care of EOB's */ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } yyg->yy_n_chars += number_to_move; @@ -3160,9 +2930,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 938 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; } return yy_current_state; @@ -3189,9 +2959,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 938 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; yy_is_jam = (yy_current_state == 937); (void)yyg; @@ -3227,7 +2997,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -3244,13 +3014,13 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ /* Reset buffer status. */ - yyrestart( yyin , yyscanner); + hsql_restart(yyin ,yyscanner); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap( yyscanner ) ) + if ( hsql_wrap(yyscanner ) ) return 0; if ( ! yyg->yy_did_buffer_switch_on_eof ) @@ -3282,34 +3052,34 @@ static int yy_get_next_buffer (yyscan_t yyscanner) * @param yyscanner The scanner object. * @note This function does not reset the start condition to @c INITIAL . */ - void yyrestart (FILE * input_file , yyscan_t yyscanner) + void hsql_restart (FILE * input_file , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (yyscanner); + hsql_ensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); + hsql__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } - yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); - yy_load_buffer_state( yyscanner ); + hsql__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + hsql__load_buffer_state(yyscanner ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * @param yyscanner The scanner object. */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) + void hsql__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* TODO. We should be able to replace this entire function body * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); + * hsql_pop_buffer_state(); + * hsql_push_buffer_state(new_buffer); */ - yyensure_buffer_stack (yyscanner); + hsql_ensure_buffer_stack (yyscanner); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -3322,17 +3092,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( yyscanner ); + hsql__load_buffer_state(yyscanner ); /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe + * EOF (hsql_wrap()) processing, but the only time this flag + * is looked at is after hsql_wrap() is called, so it's safe * to go ahead and always set it. */ yyg->yy_did_buffer_switch_on_eof = 1; } -static void yy_load_buffer_state (yyscan_t yyscanner) +static void hsql__load_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; @@ -3347,35 +3117,35 @@ static void yy_load_buffer_state (yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the allocated buffer state. */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) + YY_BUFFER_STATE hsql__create_buffer (FILE * file, int size , yyscan_t yyscanner) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); + b = (YY_BUFFER_STATE) hsql_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in hsql__create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = (yy_size_t)size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); + b->yy_ch_buf = (char *) hsql_alloc(b->yy_buf_size + 2 ,yyscanner ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in hsql__create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file , yyscanner); + hsql__init_buffer(b,file ,yyscanner); return b; } /** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() + * @param b a buffer created with hsql__create_buffer() * @param yyscanner The scanner object. */ - void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) + void hsql__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -3386,28 +3156,28 @@ static void yy_load_buffer_state (yyscan_t yyscanner) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yyfree( (void *) b->yy_ch_buf , yyscanner ); + hsql_free((void *) b->yy_ch_buf ,yyscanner ); - yyfree( (void *) b , yyscanner ); + hsql_free((void *) b ,yyscanner ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. + * such as during a hsql_restart() or at EOF. */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + static void hsql__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) { int oerrno = errno; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flush_buffer( b , yyscanner); + hsql__flush_buffer(b ,yyscanner); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. + /* If b is the current buffer, then hsql__init_buffer was _probably_ + * called from hsql_restart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -3424,7 +3194,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * @param yyscanner The scanner object. */ - void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) + void hsql__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! b ) @@ -3445,7 +3215,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( yyscanner ); + hsql__load_buffer_state(yyscanner ); } /** Pushes the new state onto the stack. The new state becomes @@ -3454,15 +3224,15 @@ static void yy_load_buffer_state (yyscan_t yyscanner) * @param new_buffer The new state. * @param yyscanner The scanner object. */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +void hsql_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (new_buffer == NULL) return; - yyensure_buffer_stack(yyscanner); + hsql_ensure_buffer_stack(yyscanner); - /* This block is copied from yy_switch_to_buffer. */ + /* This block is copied from hsql__switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -3476,8 +3246,8 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) yyg->yy_buffer_stack_top++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( yyscanner ); + /* copied from hsql__switch_to_buffer. */ + hsql__load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } @@ -3485,19 +3255,19 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) * The next element becomes the new top. * @param yyscanner The scanner object. */ -void yypop_buffer_state (yyscan_t yyscanner) +void hsql_pop_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!YY_CURRENT_BUFFER) return; - yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); + hsql__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); YY_CURRENT_BUFFER_LVALUE = NULL; if (yyg->yy_buffer_stack_top > 0) --yyg->yy_buffer_stack_top; if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( yyscanner ); + hsql__load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } } @@ -3505,9 +3275,9 @@ void yypop_buffer_state (yyscan_t yyscanner) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void yyensure_buffer_stack (yyscan_t yyscanner) +static void hsql_ensure_buffer_stack (yyscan_t yyscanner) { - yy_size_t num_to_alloc; + int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -3517,11 +3287,11 @@ static void yyensure_buffer_stack (yyscan_t yyscanner) * immediate realloc on the next call. */ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ - yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc + yyg->yy_buffer_stack = (struct yy_buffer_state**)hsql_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in hsql_ensure_buffer_stack()" ); memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); @@ -3536,12 +3306,12 @@ static void yyensure_buffer_stack (yyscan_t yyscanner) yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; - yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc + yyg->yy_buffer_stack = (struct yy_buffer_state**)hsql_realloc (yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in hsql_ensure_buffer_stack()" ); /* zero only the new slots.*/ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -3555,7 +3325,7 @@ static void yyensure_buffer_stack (yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +YY_BUFFER_STATE hsql__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { YY_BUFFER_STATE b; @@ -3565,11 +3335,11 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann /* They forgot to leave room for the EOB's. */ return NULL; - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); + b = (YY_BUFFER_STATE) hsql_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in hsql__scan_buffer()" ); - b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = NULL; @@ -3579,33 +3349,33 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b , yyscanner ); + hsql__switch_to_buffer(b ,yyscanner ); return b; } -/** Setup the input buffer state to scan a string. The next call to yylex() will +/** Setup the input buffer state to scan a string. The next call to hsql_lex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. + * hsql__scan_bytes() instead. */ -YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) +YY_BUFFER_STATE hsql__scan_string (yyconst char * yystr , yyscan_t yyscanner) { - return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); + return hsql__scan_bytes(yystr,(int) strlen(yystr) ,yyscanner); } -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will +/** Setup the input buffer state to scan the given bytes. The next call to hsql_lex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE hsql__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; @@ -3614,18 +3384,18 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan /* Get memory for full buffer, including space for trailing EOB's. */ n = (yy_size_t) (_yybytes_len + 2); - buf = (char *) yyalloc( n , yyscanner ); + buf = (char *) hsql_alloc(n ,yyscanner ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in hsql__scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n , yyscanner); + b = hsql__scan_buffer(buf,n ,yyscanner); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in hsql__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -3639,11 +3409,11 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan #define YY_EXIT_FAILURE 2 #endif -static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) +static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void)yyg; - fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -3669,7 +3439,7 @@ static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) /** Get the user-defined data for this scanner. * @param yyscanner The scanner object. */ -YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +YY_EXTRA_TYPE hsql_get_extra (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyextra; @@ -3678,7 +3448,7 @@ YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) /** Get the current line number. * @param yyscanner The scanner object. */ -int yyget_lineno (yyscan_t yyscanner) +int hsql_get_lineno (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -3691,7 +3461,7 @@ int yyget_lineno (yyscan_t yyscanner) /** Get the current column number. * @param yyscanner The scanner object. */ -int yyget_column (yyscan_t yyscanner) +int hsql_get_column (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -3704,7 +3474,7 @@ int yyget_column (yyscan_t yyscanner) /** Get the input stream. * @param yyscanner The scanner object. */ -FILE *yyget_in (yyscan_t yyscanner) +FILE *hsql_get_in (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyin; @@ -3713,7 +3483,7 @@ FILE *yyget_in (yyscan_t yyscanner) /** Get the output stream. * @param yyscanner The scanner object. */ -FILE *yyget_out (yyscan_t yyscanner) +FILE *hsql_get_out (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyout; @@ -3722,7 +3492,7 @@ FILE *yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -int yyget_leng (yyscan_t yyscanner) +int hsql_get_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -3732,7 +3502,7 @@ int yyget_leng (yyscan_t yyscanner) * @param yyscanner The scanner object. */ -char *yyget_text (yyscan_t yyscanner) +char *hsql_get_text (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yytext; @@ -3742,7 +3512,7 @@ char *yyget_text (yyscan_t yyscanner) * @param user_defined The data to be associated with this scanner. * @param yyscanner The scanner object. */ -void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +void hsql_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyextra = user_defined ; @@ -3752,13 +3522,13 @@ void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) * @param _line_number line number * @param yyscanner The scanner object. */ -void yyset_lineno (int _line_number , yyscan_t yyscanner) +void hsql_set_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); + YY_FATAL_ERROR( "hsql_set_lineno called with no buffer" ); yylineno = _line_number; } @@ -3767,13 +3537,13 @@ void yyset_lineno (int _line_number , yyscan_t yyscanner) * @param _column_no column number * @param yyscanner The scanner object. */ -void yyset_column (int _column_no , yyscan_t yyscanner) +void hsql_set_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - YY_FATAL_ERROR( "yyset_column called with no buffer" ); + YY_FATAL_ERROR( "hsql_set_column called with no buffer" ); yycolumn = _column_no; } @@ -3782,27 +3552,27 @@ void yyset_column (int _column_no , yyscan_t yyscanner) * input buffer. * @param _in_str A readable stream. * @param yyscanner The scanner object. - * @see yy_switch_to_buffer + * @see hsql__switch_to_buffer */ -void yyset_in (FILE * _in_str , yyscan_t yyscanner) +void hsql_set_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyin = _in_str ; } -void yyset_out (FILE * _out_str , yyscan_t yyscanner) +void hsql_set_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyout = _out_str ; } -int yyget_debug (yyscan_t yyscanner) +int hsql_get_debug (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yy_flex_debug; } -void yyset_debug (int _bdebug , yyscan_t yyscanner) +void hsql_set_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_flex_debug = _bdebug ; @@ -3810,25 +3580,25 @@ void yyset_debug (int _bdebug , yyscan_t yyscanner) /* Accessor methods for yylval and yylloc */ -YYSTYPE * yyget_lval (yyscan_t yyscanner) +YYSTYPE * hsql_get_lval (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yylval; } -void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +void hsql_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylval = yylval_param; } -YYLTYPE *yyget_lloc (yyscan_t yyscanner) +YYLTYPE *hsql_get_lloc (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yylloc; } -void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) +void hsql_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylloc = yylloc_param; @@ -3836,18 +3606,20 @@ void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) /* User-visible API */ -/* yylex_init is special because it creates the scanner itself, so it is +/* hsql_lex_init is special because it creates the scanner itself, so it is * the ONLY reentrant function that doesn't take the scanner as the last argument. * That's why we explicitly handle the declaration, instead of using our macros. */ -int yylex_init(yyscan_t* ptr_yy_globals) + +int hsql_lex_init(yyscan_t* ptr_yy_globals) + { if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } - *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); + *ptr_yy_globals = (yyscan_t) hsql_alloc ( sizeof( struct yyguts_t ), NULL ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; @@ -3860,25 +3632,27 @@ int yylex_init(yyscan_t* ptr_yy_globals) return yy_init_globals ( *ptr_yy_globals ); } -/* yylex_init_extra has the same functionality as yylex_init, but follows the +/* hsql_lex_init_extra has the same functionality as hsql_lex_init, but follows the * convention of taking the scanner as the last argument. Note however, that * this is a *pointer* to a scanner, as it will be allocated by this call (and * is the reason, too, why this function also must handle its own declaration). - * The user defined value in the first argument will be available to yyalloc in + * The user defined value in the first argument will be available to hsql_alloc in * the yyextra field. */ -int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) + +int hsql_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + { struct yyguts_t dummy_yyguts; - yyset_extra (yy_user_defined, &dummy_yyguts); + hsql_set_extra (yy_user_defined, &dummy_yyguts); if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } - *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + *ptr_yy_globals = (yyscan_t) hsql_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; @@ -3889,7 +3663,7 @@ int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) yy_init_globals. Leave at 0x00 for releases. */ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); - yyset_extra (yy_user_defined, *ptr_yy_globals); + hsql_set_extra (yy_user_defined, *ptr_yy_globals); return yy_init_globals ( *ptr_yy_globals ); } @@ -3898,7 +3672,7 @@ static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. + * This function is called from hsql_lex_destroy(), so don't allocate here. */ yyg->yy_buffer_stack = NULL; @@ -3922,37 +3696,37 @@ static int yy_init_globals (yyscan_t yyscanner) #endif /* For future reference: Set errno on error, since we are called by - * yylex_init() + * hsql_lex_init() */ return 0; } -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (yyscan_t yyscanner) +/* hsql_lex_destroy is for both reentrant and non-reentrant scanners. */ +int hsql_lex_destroy (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); + hsql__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(yyscanner); + hsql_pop_buffer_state(yyscanner); } /* Destroy the stack itself. */ - yyfree(yyg->yy_buffer_stack , yyscanner); + hsql_free(yyg->yy_buffer_stack ,yyscanner); yyg->yy_buffer_stack = NULL; /* Destroy the start condition stack. */ - yyfree( yyg->yy_start_stack , yyscanner ); + hsql_free(yyg->yy_start_stack ,yyscanner ); yyg->yy_start_stack = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ + * hsql_lex() is called, initialization will occur. */ yy_init_globals( yyscanner); /* Destroy the main struct (reentrant only). */ - yyfree ( yyscanner , yyscanner ); + hsql_free ( yyscanner , yyscanner ); yyscanner = NULL; return 0; } @@ -3962,7 +3736,7 @@ int yylex_destroy (yyscan_t yyscanner) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void)yyg; @@ -3974,7 +3748,7 @@ static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscann #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (const char * s , yyscan_t yyscanner) +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) { int n; for ( n = 0; s[n]; ++n ) @@ -3984,14 +3758,14 @@ static int yy_flex_strlen (const char * s , yyscan_t yyscanner) } #endif -void *yyalloc (yy_size_t size , yyscan_t yyscanner) +void *hsql_alloc (yy_size_t size , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void)yyg; return malloc(size); } -void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +void *hsql_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void)yyg; @@ -4006,17 +3780,18 @@ void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) return realloc(ptr, size); } -void yyfree (void * ptr , yyscan_t yyscanner) +void hsql_free (void * ptr , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void)yyg; - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see hsql_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 217 "flex_lexer.l" + /*************************** ** Section 3: User code ***************************/ diff --git a/src/parser/flex_lexer.h b/src/parser/flex_lexer.h index f500b82..cedea38 100644 --- a/src/parser/flex_lexer.h +++ b/src/parser/flex_lexer.h @@ -2,9 +2,9 @@ #define hsql_HEADER_H 1 #define hsql_IN_HEADER 1 -#line 5 "flex_lexer.h" +#line 6 "flex_lexer.h" -#line 7 "flex_lexer.h" +#line 8 "flex_lexer.h" #define YY_INT_ALIGNED short int @@ -13,245 +13,11 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 4 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif -#ifdef yy_create_buffer -#define hsql__create_buffer_ALREADY_DEFINED -#else -#define yy_create_buffer hsql__create_buffer -#endif - -#ifdef yy_delete_buffer -#define hsql__delete_buffer_ALREADY_DEFINED -#else -#define yy_delete_buffer hsql__delete_buffer -#endif - -#ifdef yy_scan_buffer -#define hsql__scan_buffer_ALREADY_DEFINED -#else -#define yy_scan_buffer hsql__scan_buffer -#endif - -#ifdef yy_scan_string -#define hsql__scan_string_ALREADY_DEFINED -#else -#define yy_scan_string hsql__scan_string -#endif - -#ifdef yy_scan_bytes -#define hsql__scan_bytes_ALREADY_DEFINED -#else -#define yy_scan_bytes hsql__scan_bytes -#endif - -#ifdef yy_init_buffer -#define hsql__init_buffer_ALREADY_DEFINED -#else -#define yy_init_buffer hsql__init_buffer -#endif - -#ifdef yy_flush_buffer -#define hsql__flush_buffer_ALREADY_DEFINED -#else -#define yy_flush_buffer hsql__flush_buffer -#endif - -#ifdef yy_load_buffer_state -#define hsql__load_buffer_state_ALREADY_DEFINED -#else -#define yy_load_buffer_state hsql__load_buffer_state -#endif - -#ifdef yy_switch_to_buffer -#define hsql__switch_to_buffer_ALREADY_DEFINED -#else -#define yy_switch_to_buffer hsql__switch_to_buffer -#endif - -#ifdef yypush_buffer_state -#define hsql_push_buffer_state_ALREADY_DEFINED -#else -#define yypush_buffer_state hsql_push_buffer_state -#endif - -#ifdef yypop_buffer_state -#define hsql_pop_buffer_state_ALREADY_DEFINED -#else -#define yypop_buffer_state hsql_pop_buffer_state -#endif - -#ifdef yyensure_buffer_stack -#define hsql_ensure_buffer_stack_ALREADY_DEFINED -#else -#define yyensure_buffer_stack hsql_ensure_buffer_stack -#endif - -#ifdef yylex -#define hsql_lex_ALREADY_DEFINED -#else -#define yylex hsql_lex -#endif - -#ifdef yyrestart -#define hsql_restart_ALREADY_DEFINED -#else -#define yyrestart hsql_restart -#endif - -#ifdef yylex_init -#define hsql_lex_init_ALREADY_DEFINED -#else -#define yylex_init hsql_lex_init -#endif - -#ifdef yylex_init_extra -#define hsql_lex_init_extra_ALREADY_DEFINED -#else -#define yylex_init_extra hsql_lex_init_extra -#endif - -#ifdef yylex_destroy -#define hsql_lex_destroy_ALREADY_DEFINED -#else -#define yylex_destroy hsql_lex_destroy -#endif - -#ifdef yyget_debug -#define hsql_get_debug_ALREADY_DEFINED -#else -#define yyget_debug hsql_get_debug -#endif - -#ifdef yyset_debug -#define hsql_set_debug_ALREADY_DEFINED -#else -#define yyset_debug hsql_set_debug -#endif - -#ifdef yyget_extra -#define hsql_get_extra_ALREADY_DEFINED -#else -#define yyget_extra hsql_get_extra -#endif - -#ifdef yyset_extra -#define hsql_set_extra_ALREADY_DEFINED -#else -#define yyset_extra hsql_set_extra -#endif - -#ifdef yyget_in -#define hsql_get_in_ALREADY_DEFINED -#else -#define yyget_in hsql_get_in -#endif - -#ifdef yyset_in -#define hsql_set_in_ALREADY_DEFINED -#else -#define yyset_in hsql_set_in -#endif - -#ifdef yyget_out -#define hsql_get_out_ALREADY_DEFINED -#else -#define yyget_out hsql_get_out -#endif - -#ifdef yyset_out -#define hsql_set_out_ALREADY_DEFINED -#else -#define yyset_out hsql_set_out -#endif - -#ifdef yyget_leng -#define hsql_get_leng_ALREADY_DEFINED -#else -#define yyget_leng hsql_get_leng -#endif - -#ifdef yyget_text -#define hsql_get_text_ALREADY_DEFINED -#else -#define yyget_text hsql_get_text -#endif - -#ifdef yyget_lineno -#define hsql_get_lineno_ALREADY_DEFINED -#else -#define yyget_lineno hsql_get_lineno -#endif - -#ifdef yyset_lineno -#define hsql_set_lineno_ALREADY_DEFINED -#else -#define yyset_lineno hsql_set_lineno -#endif - -#ifdef yyget_column -#define hsql_get_column_ALREADY_DEFINED -#else -#define yyget_column hsql_get_column -#endif - -#ifdef yyset_column -#define hsql_set_column_ALREADY_DEFINED -#else -#define yyset_column hsql_set_column -#endif - -#ifdef yywrap -#define hsql_wrap_ALREADY_DEFINED -#else -#define yywrap hsql_wrap -#endif - -#ifdef yyget_lval -#define hsql_get_lval_ALREADY_DEFINED -#else -#define yyget_lval hsql_get_lval -#endif - -#ifdef yyset_lval -#define hsql_set_lval_ALREADY_DEFINED -#else -#define yyset_lval hsql_set_lval -#endif - -#ifdef yyget_lloc -#define hsql_get_lloc_ALREADY_DEFINED -#else -#define yyget_lloc hsql_get_lloc -#endif - -#ifdef yyset_lloc -#define hsql_set_lloc_ALREADY_DEFINED -#else -#define yyset_lloc hsql_set_lloc -#endif - -#ifdef yyalloc -#define hsql_alloc_ALREADY_DEFINED -#else -#define yyalloc hsql_alloc -#endif - -#ifdef yyrealloc -#define hsql_realloc_ALREADY_DEFINED -#else -#define yyrealloc hsql_realloc -#endif - -#ifdef yyfree -#define hsql_free_ALREADY_DEFINED -#else -#define yyfree hsql_free -#endif - /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -322,16 +88,10 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif - #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -/* begin standard C++ headers. */ - /* TODO: this is always defined, so inline it */ #define yyconst const @@ -432,21 +192,21 @@ struct yy_buffer_state }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ -void yyrestart ( FILE *input_file , yyscan_t yyscanner ); -void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); -void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); -void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); -void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); -void yypop_buffer_state ( yyscan_t yyscanner ); +void hsql_restart (FILE *input_file ,yyscan_t yyscanner ); +void hsql__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE hsql__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void hsql__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void hsql__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void hsql_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void hsql_pop_buffer_state (yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); +YY_BUFFER_STATE hsql__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE hsql__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE hsql__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); -void *yyalloc ( yy_size_t , yyscan_t yyscanner ); -void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); -void yyfree ( void * , yyscan_t yyscanner ); +void *hsql_alloc (yy_size_t ,yyscan_t yyscanner ); +void *hsql_realloc (void *,yy_size_t ,yyscan_t yyscanner ); +void hsql_free (void * ,yyscan_t yyscanner ); /* Begin user sect3 */ @@ -473,50 +233,50 @@ void yyfree ( void * , yyscan_t yyscanner ); #define YY_EXTRA_TYPE void * #endif -int yylex_init (yyscan_t* scanner); +int hsql_lex_init (yyscan_t* scanner); -int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); +int hsql_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy ( yyscan_t yyscanner ); +int hsql_lex_destroy (yyscan_t yyscanner ); -int yyget_debug ( yyscan_t yyscanner ); +int hsql_get_debug (yyscan_t yyscanner ); -void yyset_debug ( int debug_flag , yyscan_t yyscanner ); +void hsql_set_debug (int debug_flag ,yyscan_t yyscanner ); -YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); +YY_EXTRA_TYPE hsql_get_extra (yyscan_t yyscanner ); -void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); +void hsql_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); -FILE *yyget_in ( yyscan_t yyscanner ); +FILE *hsql_get_in (yyscan_t yyscanner ); -void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); +void hsql_set_in (FILE * _in_str ,yyscan_t yyscanner ); -FILE *yyget_out ( yyscan_t yyscanner ); +FILE *hsql_get_out (yyscan_t yyscanner ); -void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); +void hsql_set_out (FILE * _out_str ,yyscan_t yyscanner ); - int yyget_leng ( yyscan_t yyscanner ); + int hsql_get_leng (yyscan_t yyscanner ); -char *yyget_text ( yyscan_t yyscanner ); +char *hsql_get_text (yyscan_t yyscanner ); -int yyget_lineno ( yyscan_t yyscanner ); +int hsql_get_lineno (yyscan_t yyscanner ); -void yyset_lineno ( int _line_number , yyscan_t yyscanner ); +void hsql_set_lineno (int _line_number ,yyscan_t yyscanner ); -int yyget_column ( yyscan_t yyscanner ); +int hsql_get_column (yyscan_t yyscanner ); -void yyset_column ( int _column_no , yyscan_t yyscanner ); +void hsql_set_column (int _column_no ,yyscan_t yyscanner ); -YYSTYPE * yyget_lval ( yyscan_t yyscanner ); +YYSTYPE * hsql_get_lval (yyscan_t yyscanner ); -void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); +void hsql_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); - YYLTYPE *yyget_lloc ( yyscan_t yyscanner ); + YYLTYPE *hsql_get_lloc (yyscan_t yyscanner ); - void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner ); + void hsql_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -524,18 +284,18 @@ void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap ( yyscan_t yyscanner ); +extern "C" int hsql_wrap (yyscan_t yyscanner ); #else -extern int yywrap ( yyscan_t yyscanner ); +extern int hsql_wrap (yyscan_t yyscanner ); #endif #endif #ifndef yytext_ptr -static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen ( const char * , yyscan_t yyscanner); +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT @@ -563,10 +323,10 @@ static int yy_flex_strlen ( const char * , yyscan_t yyscanner); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int yylex \ - (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner); +extern int hsql_lex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); -#define YY_DECL int yylex \ +#define YY_DECL int hsql_lex \ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) #endif /* !YY_DECL */ @@ -584,154 +344,9 @@ extern int yylex \ #undef YY_DECL #endif -#ifndef hsql__create_buffer_ALREADY_DEFINED -#undef yy_create_buffer -#endif -#ifndef hsql__delete_buffer_ALREADY_DEFINED -#undef yy_delete_buffer -#endif -#ifndef hsql__scan_buffer_ALREADY_DEFINED -#undef yy_scan_buffer -#endif -#ifndef hsql__scan_string_ALREADY_DEFINED -#undef yy_scan_string -#endif -#ifndef hsql__scan_bytes_ALREADY_DEFINED -#undef yy_scan_bytes -#endif -#ifndef hsql__init_buffer_ALREADY_DEFINED -#undef yy_init_buffer -#endif -#ifndef hsql__flush_buffer_ALREADY_DEFINED -#undef yy_flush_buffer -#endif -#ifndef hsql__load_buffer_state_ALREADY_DEFINED -#undef yy_load_buffer_state -#endif -#ifndef hsql__switch_to_buffer_ALREADY_DEFINED -#undef yy_switch_to_buffer -#endif -#ifndef hsql_push_buffer_state_ALREADY_DEFINED -#undef yypush_buffer_state -#endif -#ifndef hsql_pop_buffer_state_ALREADY_DEFINED -#undef yypop_buffer_state -#endif -#ifndef hsql_ensure_buffer_stack_ALREADY_DEFINED -#undef yyensure_buffer_stack -#endif -#ifndef hsql_lex_ALREADY_DEFINED -#undef yylex -#endif -#ifndef hsql_restart_ALREADY_DEFINED -#undef yyrestart -#endif -#ifndef hsql_lex_init_ALREADY_DEFINED -#undef yylex_init -#endif -#ifndef hsql_lex_init_extra_ALREADY_DEFINED -#undef yylex_init_extra -#endif -#ifndef hsql_lex_destroy_ALREADY_DEFINED -#undef yylex_destroy -#endif -#ifndef hsql_get_debug_ALREADY_DEFINED -#undef yyget_debug -#endif -#ifndef hsql_set_debug_ALREADY_DEFINED -#undef yyset_debug -#endif -#ifndef hsql_get_extra_ALREADY_DEFINED -#undef yyget_extra -#endif -#ifndef hsql_set_extra_ALREADY_DEFINED -#undef yyset_extra -#endif -#ifndef hsql_get_in_ALREADY_DEFINED -#undef yyget_in -#endif -#ifndef hsql_set_in_ALREADY_DEFINED -#undef yyset_in -#endif -#ifndef hsql_get_out_ALREADY_DEFINED -#undef yyget_out -#endif -#ifndef hsql_set_out_ALREADY_DEFINED -#undef yyset_out -#endif -#ifndef hsql_get_leng_ALREADY_DEFINED -#undef yyget_leng -#endif -#ifndef hsql_get_text_ALREADY_DEFINED -#undef yyget_text -#endif -#ifndef hsql_get_lineno_ALREADY_DEFINED -#undef yyget_lineno -#endif -#ifndef hsql_set_lineno_ALREADY_DEFINED -#undef yyset_lineno -#endif -#ifndef hsql_get_column_ALREADY_DEFINED -#undef yyget_column -#endif -#ifndef hsql_set_column_ALREADY_DEFINED -#undef yyset_column -#endif -#ifndef hsql_wrap_ALREADY_DEFINED -#undef yywrap -#endif -#ifndef hsql_get_lval_ALREADY_DEFINED -#undef yyget_lval -#endif -#ifndef hsql_set_lval_ALREADY_DEFINED -#undef yyset_lval -#endif -#ifndef hsql_get_lloc_ALREADY_DEFINED -#undef yyget_lloc -#endif -#ifndef hsql_set_lloc_ALREADY_DEFINED -#undef yyset_lloc -#endif -#ifndef hsql_alloc_ALREADY_DEFINED -#undef yyalloc -#endif -#ifndef hsql_realloc_ALREADY_DEFINED -#undef yyrealloc -#endif -#ifndef hsql_free_ALREADY_DEFINED -#undef yyfree -#endif -#ifndef hsql_text_ALREADY_DEFINED -#undef yytext -#endif -#ifndef hsql_leng_ALREADY_DEFINED -#undef yyleng -#endif -#ifndef hsql_in_ALREADY_DEFINED -#undef yyin -#endif -#ifndef hsql_out_ALREADY_DEFINED -#undef yyout -#endif -#ifndef hsql__flex_debug_ALREADY_DEFINED -#undef yy_flex_debug -#endif -#ifndef hsql_lineno_ALREADY_DEFINED -#undef yylineno -#endif -#ifndef hsql_tables_fload_ALREADY_DEFINED -#undef yytables_fload -#endif -#ifndef hsql_tables_destroy_ALREADY_DEFINED -#undef yytables_destroy -#endif -#ifndef hsql_TABLES_NAME_ALREADY_DEFINED -#undef yyTABLES_NAME -#endif - #line 217 "flex_lexer.l" -#line 735 "flex_lexer.h" +#line 351 "flex_lexer.h" #undef hsql_IN_HEADER #endif /* hsql_HEADER_H */ diff --git a/src/sql/CreateStatement.h b/src/sql/CreateStatement.h old mode 100644 new mode 100755 index c341219..27c8625 --- a/src/sql/CreateStatement.h +++ b/src/sql/CreateStatement.h @@ -37,8 +37,9 @@ namespace hsql { CreateType type; bool ifNotExists; // default: false - char* filePath; // default: nullptr - char* tableName; // default: nullptr + char* filePath; // default: nullptr + char* schema; // default: nullptr + char* tableName; // default: nullptr std::vector* columns; // default: nullptr std::vector* viewColumns; SelectStatement* select; diff --git a/src/sql/DeleteStatement.h b/src/sql/DeleteStatement.h old mode 100644 new mode 100755 index 2aed8a5..6936147 --- a/src/sql/DeleteStatement.h +++ b/src/sql/DeleteStatement.h @@ -13,6 +13,7 @@ namespace hsql { DeleteStatement(); virtual ~DeleteStatement(); + char* schema; char* tableName; Expr* expr; }; diff --git a/src/sql/DropStatement.h b/src/sql/DropStatement.h old mode 100644 new mode 100755 index 5944463..f6ab1ad --- a/src/sql/DropStatement.h +++ b/src/sql/DropStatement.h @@ -22,6 +22,8 @@ namespace hsql { virtual ~DropStatement(); DropType type; + bool ifExists; + char* schema; char* name; }; diff --git a/src/sql/Expr.h b/src/sql/Expr.h index 622bec3..dcaddee 100644 --- a/src/sql/Expr.h +++ b/src/sql/Expr.h @@ -29,9 +29,6 @@ namespace hsql { }; // Operator types. These are important for expressions of type kExprOperator. -// Trivial types are those that can be described by a single character e.g: -// + - * / < > = % -// Non-trivial are: <> <= >= LIKE ISNULL NOT enum OperatorType { kOpNone, diff --git a/src/sql/ImportStatement.h b/src/sql/ImportStatement.h old mode 100644 new mode 100755 index 1a63518..a10c88c --- a/src/sql/ImportStatement.h +++ b/src/sql/ImportStatement.h @@ -15,8 +15,9 @@ namespace hsql { virtual ~ImportStatement(); ImportType type; - const char* filePath; - const char* tableName; + char* filePath; + char* schema; + char* tableName; }; } // namespace hsql diff --git a/src/sql/InsertStatement.h b/src/sql/InsertStatement.h old mode 100644 new mode 100755 index bea006e..956f910 --- a/src/sql/InsertStatement.h +++ b/src/sql/InsertStatement.h @@ -17,6 +17,7 @@ namespace hsql { virtual ~InsertStatement(); InsertType type; + char* schema; char* tableName; std::vector* columns; std::vector* values; diff --git a/src/sql/SQLStatement.h b/src/sql/SQLStatement.h index 07996fc..db7cbf1 100644 --- a/src/sql/SQLStatement.h +++ b/src/sql/SQLStatement.h @@ -19,7 +19,8 @@ namespace hsql { kStmtExecute, kStmtExport, kStmtRename, - kStmtAlter + kStmtAlter, + kStmtShow }; // Base struct for every SQL statement diff --git a/src/sql/ShowStatement.h b/src/sql/ShowStatement.h new file mode 100755 index 0000000..dcacbf5 --- /dev/null +++ b/src/sql/ShowStatement.h @@ -0,0 +1,27 @@ +#ifndef __SQLPARSER__SHOW_STATEMENT_H__ +#define __SQLPARSER__SHOW_STATEMENT_H__ + +#include "SQLStatement.h" + +// Note: Implementations of constructors and destructors can be found in statements.cpp. +namespace hsql { + + enum ShowType { + kShowColumns, + kShowTables + }; + + // Represents SQL SHOW statements. + // Example "SHOW TABLES;" + struct ShowStatement : SQLStatement { + + ShowStatement(ShowType type); + virtual ~ShowStatement(); + + ShowType type; + char* schema; + char* name; + }; + +} // namespace hsql +#endif diff --git a/src/sql/Table.h b/src/sql/Table.h old mode 100644 new mode 100755 index 96ee775..f6257ee --- a/src/sql/Table.h +++ b/src/sql/Table.h @@ -19,6 +19,11 @@ namespace hsql { kTableCrossProduct }; + struct TableName { + char* schema; + char* name; + }; + // Holds reference to tables. Can be either table names or a select statement. struct TableRef { TableRef(TableRefType type); diff --git a/src/sql/statements.cpp b/src/sql/statements.cpp old mode 100644 new mode 100755 index ab4320a..380db06 --- a/src/sql/statements.cpp +++ b/src/sql/statements.cpp @@ -18,6 +18,7 @@ namespace hsql { type(type), ifNotExists(false), filePath(nullptr), + schema(nullptr), tableName(nullptr), columns(nullptr), viewColumns(nullptr), @@ -25,6 +26,7 @@ namespace hsql { CreateStatement::~CreateStatement() { free(filePath); + free(schema); free(tableName); delete select; @@ -46,10 +48,12 @@ namespace hsql { // DeleteStatement DeleteStatement::DeleteStatement() : SQLStatement(kStmtDelete), + schema(nullptr), tableName(nullptr), expr(nullptr) {}; DeleteStatement::~DeleteStatement() { + free(schema); free(tableName); delete expr; } @@ -58,9 +62,11 @@ namespace hsql { DropStatement::DropStatement(DropType type) : SQLStatement(kStmtDrop), type(type), + schema(nullptr), name(nullptr) {} DropStatement::~DropStatement() { + free(schema); free(name); } @@ -86,23 +92,27 @@ namespace hsql { SQLStatement(kStmtImport), type(type), filePath(nullptr), + schema(nullptr), tableName(nullptr) {}; ImportStatement::~ImportStatement() { - delete filePath; - delete tableName; + free(filePath); + free(schema); + free(tableName); } // InsertStatement InsertStatement::InsertStatement(InsertType type) : SQLStatement(kStmtInsert), type(type), + schema(nullptr), tableName(nullptr), columns(nullptr), values(nullptr), select(nullptr) {} InsertStatement::~InsertStatement() { + free(schema); free(tableName); delete select; @@ -121,6 +131,18 @@ namespace hsql { } } + // ShowStatament + ShowStatement::ShowStatement(ShowType type) : + SQLStatement(kStmtShow), + type(type), + schema(nullptr), + name(nullptr) {} + + ShowStatement::~ShowStatement() { + free(schema); + free(name); + } + // SelectStatement.h // OrderDescription diff --git a/src/sql/statements.h b/src/sql/statements.h index d9e59ea..0838256 100644 --- a/src/sql/statements.h +++ b/src/sql/statements.h @@ -10,5 +10,6 @@ #include "DropStatement.h" #include "PrepareStatement.h" #include "ExecuteStatement.h" +#include "ShowStatement.h" -#endif // __SQLPARSER__STATEMENTS_H__ \ No newline at end of file +#endif // __SQLPARSER__STATEMENTS_H__ diff --git a/src/util/sqlhelper.cpp b/src/util/sqlhelper.cpp old mode 100644 new mode 100755 index 0e45713..74ef81b --- a/src/util/sqlhelper.cpp +++ b/src/util/sqlhelper.cpp @@ -33,6 +33,10 @@ namespace hsql { switch (table->type) { case kTableName: inprint(table->name, numIndent); + if(table->schema) { + inprint("Schema", numIndent + 1); + inprint(table->schema, numIndent + 2); + } break; case kTableSelect: printSelectStatementInfo(table->select, numIndent); @@ -91,6 +95,10 @@ namespace hsql { break; case kExprColumnRef: inprint(expr->name, numIndent); + if(expr->table) { + inprint("Table:", numIndent+1); + inprint(expr->table, numIndent+2); + } break; // case kExprTableColumnRef: inprint(expr->table, expr->name, numIndent); break; case kExprLiteralFloat: @@ -104,11 +112,24 @@ namespace hsql { break; case kExprFunctionRef: inprint(expr->name, numIndent); - for (Expr* e : *expr->exprList) inprint(e->name, numIndent + 1); + for (Expr* e : *expr->exprList) printExpression(e, numIndent + 1); break; case kExprOperator: printOperatorExpression(expr, numIndent); break; + case kExprSelect: + printSelectStatementInfo(expr->select, numIndent); + break; + case kExprParameter: + inprint(expr->ival, numIndent); + break; + case kExprArray: + for (Expr* e : *expr->exprList) printExpression(e, numIndent + 1); + break; + case kExprArrayIndex: + printExpression(expr->expr, numIndent + 1); + inprint(expr->ival, numIndent); + break; default: std::cerr << "Unrecognized expression type " << expr->type << std::endl; return; @@ -124,8 +145,10 @@ namespace hsql { inprint("Fields:", numIndent + 1); for (Expr* expr : *stmt->selectList) printExpression(expr, numIndent + 2); - inprint("Sources:", numIndent + 1); - printTableRefInfo(stmt->fromTable, numIndent + 2); + if (stmt->fromTable != nullptr) { + inprint("Sources:", numIndent + 1); + printTableRefInfo(stmt->fromTable, numIndent + 2); + } if (stmt->whereClause != nullptr) { inprint("Search Conditions:", numIndent + 1); diff --git a/test/auto_query_file_test.cpp b/test/auto_query_file_test.cpp new file mode 100644 index 0000000..ce18300 --- /dev/null +++ b/test/auto_query_file_test.cpp @@ -0,0 +1,98 @@ +#include +#include +#include +#include +#include +#include + +#include "thirdparty/microtest/microtest.h" +#include "SQLParser.h" + +// Read all lines from the given file path. Skips comment lines. +std::vector readlines(std::string path); + +// Read the queries from all files that were supplied to the test +// through the -f argument. For all queries it is checked whether they +// can be parsed successfully. +TEST(AutoQueryFileTest) { + const std::vector& args = mt::Runtime::args(); + + std::vector query_files; + + // Parse command line arguments to retrieve query files. + uint i = 1; + for (; i < args.size(); ++i) { + if (args[i] == "-f") { + query_files.push_back(args[++i]); + } + } + + + // Read list of queries from all input files. + std::vector lines; + for (std::string path : query_files) { + std::vector tmp = readlines(path); + lines.insert(lines.end(), tmp.begin(), tmp.end()); + } + + // Execute queries. + size_t num_executed = 0; + size_t num_failed = 0; + for (std::string line : lines) { + bool expected_result = true; + std::string query = line; + + // If a line starts with '!' parsing is expected to fail. + if (query.at(0) == '!') { + expected_result = false; + query = query.substr(1); + } + + // Measuring the parsing time. + std::chrono::time_point start, end; + start = std::chrono::system_clock::now(); + + // Parse the query. + hsql::SQLParserResult result; + hsql::SQLParser::parse(query, &result); + + end = std::chrono::system_clock::now(); + std::chrono::duration elapsed_seconds = end - start; + double us = elapsed_seconds.count() * 1000 * 1000; + + if (expected_result == result.isValid()) { + printf("\033[0;32m{ ok} (%.1fus)\033[0m %s\n", us, line.c_str()); + } else { + printf("\033[0;31m{ failed}\033[0m\n"); + printf("\t\033[0;31m%s (L%d:%d)\n\033[0m", result.errorMsg(), result.errorLine(), result.errorColumn()); + printf("\t%s\n", line.c_str()); + ++num_failed; + } + ++num_executed; + } + + if (num_failed == 0) { + printf("\033[0;32m{ ok} \033[0mAll %lu grammar tests completed successfully!\n", num_executed); + } else { + fprintf(stderr, "\033[0;31m{ failed} \033[0mSome grammar tests failed! %lu out of %lu tests failed!\n", num_failed, num_executed); + } + ASSERT_EQ(num_failed, 0); +} + +std::vector readlines(std::string path) { + std::ifstream infile(path); + std::vector lines; + std::string line; + while (std::getline(infile, line)) { + std::istringstream iss(line); + + // Skip comments. + if (line[0] == '#' || + (line[0] == '-' && line[1] == '-')) { + continue; + } + + lines.push_back(line); + } + return lines; +} diff --git a/test/queries/queries-bad.sql b/test/queries/queries-bad.sql new file mode 100644 index 0000000..5437c4f --- /dev/null +++ b/test/queries/queries-bad.sql @@ -0,0 +1,12 @@ +# This file contains a list of strings that are NOT valid SQL queries. +# Each line contains a single SQL query. +# Each line starts with a '!' char to indicate that parsing should fail. +! +!1 +!gibberish; +!SELECT abc; +!CREATE TABLE "table" FROM TBL FILE 'students.tbl';SELECT 1 +!CREATE TABLE "table" FROM TBL FILE 'students.tbl';1 +!INSERT INTO test_table VALUESd (1, 2, 'test'); +!SELECT * FROM t WHERE a = ? AND b = ?;SELECT 1; +!SHOW COLUMNS; diff --git a/test/valid_queries.sql b/test/queries/queries-good.sql old mode 100644 new mode 100755 similarity index 85% rename from test/valid_queries.sql rename to test/queries/queries-good.sql index ef08be0..d91715a --- a/test/valid_queries.sql +++ b/test/queries/queries-good.sql @@ -1,6 +1,9 @@ +# This file contains a list of strings that are NOT valid SQL queries. +# Each line contains a single SQL query. # SELECT statement SELECT * FROM orders; SELECT a FROM foo WHERE a > 12 OR b > 3 AND NOT c LIMIT 10 +SELECT a FROM some_schema.foo WHERE a > 12 OR b > 3 AND NOT c LIMIT 10 SELECT col1 AS myname, col2, 'test' FROM "table", foo AS t WHERE age > 12 AND zipcode = 12345 GROUP BY col1; SELECT * from "table" JOIN table2 ON a = b WHERE (b OR NOT a) AND a = 12.5 (SELECT a FROM foo WHERE a > 12 OR b > 3 AND c NOT LIKE 's%' LIMIT 10); @@ -27,6 +30,7 @@ CREATE TABLE "table" FROM TBL FILE 'students.tbl'; SELECT * FROM "table"; INSERT INTO test_table VALUES (1, 2, 'test'); INSERT INTO test_table (id, value, name) VALUES (1, 2, 'test'); INSERT INTO test_table SELECT * FROM students; +INSERT INTO some_schema.test_table SELECT * FROM another_schema.students; # DELETE DELETE FROM students WHERE grade > 3.0 DELETE FROM students @@ -35,8 +39,11 @@ TRUNCATE students UPDATE students SET grade = 1.3 WHERE name = 'Max Mustermann'; UPDATE students SET grade = 1.3, name='Felix Fürstenberg' WHERE name = 'Max Mustermann'; UPDATE students SET grade = 1.0; +UPDATE some_schema.students SET grade = 1.0; # DROP DROP TABLE students; +DROP TABLE IF EXISTS students; +DROP VIEW IF EXISTS students; # PREPARE PREPARE prep_inst FROM 'INSERT INTO test VALUES (?, ?, ?)'; PREPARE prep2 FROM 'INSERT INTO test VALUES (?, 0, 0); INSERT INTO test VALUES (0, ?, 0); INSERT INTO test VALUES (0, 0, ?);'; @@ -47,12 +54,5 @@ DEALLOCATE PREPARE prep; SELECT * FROM test WITH HINT(NO_CACHE); SELECT * FROM test WITH HINT(NO_CACHE, NO_SAMPLING); SELECT * FROM test WITH HINT(NO_CACHE, SAMPLE_RATE(0.1), OMW(1.0, 'test')); -# Error expeced -! -!1 -!gibberish; -!SELECT abc; -!CREATE TABLE "table" FROM TBL FILE 'students.tbl';SELECT 1 -!CREATE TABLE "table" FROM TBL FILE 'students.tbl';1 -!INSERT INTO test_table VALUESd (1, 2, 'test'); -!SELECT * FROM t WHERE a = ? AND b = ?;SELECT 1; \ No newline at end of file +SHOW TABLES; +SHOW COLUMNS students; diff --git a/test/select_tests.cpp b/test/select_tests.cpp index 594f212..2d25b92 100644 --- a/test/select_tests.cpp +++ b/test/select_tests.cpp @@ -88,6 +88,18 @@ TEST(SelectDistinctTest) { ASSERT_NULL(stmt->whereClause); } +TEST(SelectSchemaTest) { + TEST_PARSE_SINGLE_SQL( + "SELECT grade FROM some_schema.students;", + kStmtSelect, + SelectStatement, + result, + stmt); + + ASSERT(stmt->fromTable); + ASSERT_EQ(std::string(stmt->fromTable->schema), "some_schema"); +} + TEST(SelectGroupDistinctTest) { TEST_PARSE_SINGLE_SQL( "SELECT city, COUNT(name), COUNT(DISTINCT grade) FROM students GROUP BY city;", diff --git a/test/sql_grammar_test.cpp b/test/sql_grammar_test.cpp deleted file mode 100644 index 8429a43..0000000 --- a/test/sql_grammar_test.cpp +++ /dev/null @@ -1,107 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -#include "thirdparty/microtest/microtest.h" -#include "SQLParser.h" - -using namespace hsql; - - -std::vector readlines(std::string path) { - std::ifstream infile(path); - std::vector lines; - std::string line; - while (std::getline(infile, line)) { - std::istringstream iss(line); - - // Skip comments - if (line[0] == '#' || - (line[0] == '-' && line[1] == '-')) { - continue; - } - - lines.push_back(line); - } - return lines; -} - -#define STREQ(a, b) (std::string(a).compare(std::string(b)) == 0) - -TEST(AutoGrammarTest) { - const std::vector& args = mt::Runtime::args(); - if (args.size() <= 1) { - fprintf(stderr, "Usage: grammar_test [--false] [-f path] query, ...\n"); - return; - } - - bool globalExpectFalse = false; - bool useFile = false; - std::string filePath = ""; - - // Parse command line arguments - uint i = 1; - for (; i < args.size(); ++i) { - if (STREQ(args[i], "--false")) globalExpectFalse = true; - else if (STREQ(args[i], "-f")) { - useFile = true; - filePath = args[++i]; - } else { - break; - } - } - - - // Read list of queries for this rest - std::vector queries; - if (useFile) { - queries = readlines(filePath); - } else { - for (; i < args.size(); ++i) queries.push_back(args[i]); - } - - - // Execute queries - int numFailed = 0; - for (std::string sql : queries) { - bool expectFalse = globalExpectFalse; - if (sql.at(0) == '!') { - expectFalse = !expectFalse; - sql = sql.substr(1); - } - - // Measuring the parsing time - std::chrono::time_point start, end; - start = std::chrono::system_clock::now(); - - // Parsing - SQLParserResult result; - SQLParser::parse(sql.c_str(), &result); - - end = std::chrono::system_clock::now(); - std::chrono::duration elapsed_seconds = end - start; - double us = elapsed_seconds.count() * 1000 * 1000; - - if (expectFalse == result.isValid()) { - printf("\033[0;31m{ failed}\033[0m\n"); - printf("\t\033[0;31m%s (L%d:%d)\n\033[0m", result.errorMsg(), result.errorLine(), result.errorColumn()); - printf("\t%s\n", sql.c_str()); - numFailed++; - } else { - // TODO: indicate whether expectFalse was set - printf("\033[0;32m{ ok} (%.1fus)\033[0m %s\n", us, sql.c_str()); - } - } - - if (numFailed == 0) { - printf("\033[0;32m{ ok} \033[0mAll %lu grammar tests completed successfully!\n", queries.size()); - } else { - fprintf(stderr, "\033[0;31m{ failed} \033[0mSome grammar tests failed! %d out of %lu tests failed!\n", numFailed, queries.size()); - } - ASSERT_EQ(numFailed, 0); -} - diff --git a/test/sql_tests.cpp b/test/sql_tests.cpp index 5e63973..fd07aa9 100644 --- a/test/sql_tests.cpp +++ b/test/sql_tests.cpp @@ -102,6 +102,21 @@ TEST(DropTableStatementTest) { result, stmt); + ASSERT_FALSE(stmt->ifExists); + ASSERT_EQ(stmt->type, kDropTable); + ASSERT_NOTNULL(stmt->name); + ASSERT_STREQ(stmt->name, "students"); +} + +TEST(DropTableIfExistsStatementTest) { + TEST_PARSE_SINGLE_SQL( + "DROP TABLE IF EXISTS students", + kStmtDrop, + DropStatement, + result, + stmt); + + ASSERT_TRUE(stmt->ifExists); ASSERT_EQ(stmt->type, kDropTable); ASSERT_NOTNULL(stmt->name); ASSERT_STREQ(stmt->name, "students"); @@ -127,6 +142,31 @@ TEST(ReleaseStatementTest) { } } +TEST(ShowTableStatementTest) { + TEST_PARSE_SINGLE_SQL( + "SHOW TABLES;", + kStmtShow, + ShowStatement, + result, + stmt); + + ASSERT_EQ(stmt->type, kShowTables); + ASSERT_NULL(stmt->name); +} + +TEST(ShowColumnsStatementTest) { + TEST_PARSE_SINGLE_SQL( + "SHOW COLUMNS students;", + kStmtShow, + ShowStatement, + result, + stmt); + + ASSERT_EQ(stmt->type, kShowColumns); + ASSERT_NOTNULL(stmt->name); + ASSERT_STREQ(stmt->name, "students"); +} + SQLParserResult parse_and_move(std::string query) { hsql::SQLParserResult result; diff --git a/test/test.sh b/test/test.sh index 06cd93f..5766a13 100755 --- a/test/test.sh +++ b/test/test.sh @@ -17,7 +17,7 @@ CONFLICT_RET=0 ################################################# # Running SQL parser tests. printf "\n${GREEN}Running SQL parser tests...${NC}\n" -bin/tests -f "test/valid_queries.sql" +bin/tests -f "test/queries/queries-good.sql" -f "test/queries/queries-bad.sql" SQL_TEST_RET=$? if [ $SQL_TEST_RET -eq 0 ]; then @@ -31,7 +31,8 @@ fi # Running memory leak checks. printf "\n${GREEN}Running memory leak checks...${NC}\n" valgrind --leak-check=full --error-exitcode=200 --log-fd=3 \ - ./bin/tests -f "test/valid_queries.sql" 3>&1 >/dev/null 2>/dev/null + bin/tests -f "test/queries/queries-good.sql" -f "test/queries/queries-bad.sql" \ + 3>&1 >/dev/null 2>/dev/null MEM_LEAK_RET=$? if [ $MEM_LEAK_RET -ne 200 ]; then