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 3553cd7..2f3d90e 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ 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++11 -Wall -Werror $(OPT_FLAG) +LIB_CFLAGS = -std=c++1z -Wall -Werror $(OPT_FLAG) static ?= no ifeq ($(static), yes) @@ -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..6cbaf04 100644 --- a/src/parser/bison_parser.cpp +++ b/src/parser/bison_parser.cpp @@ -324,6 +324,7 @@ union HSQL_STYPE hsql::DropStatement* drop_stmt; hsql::PrepareStatement* prep_stmt; hsql::ExecuteStatement* exec_stmt; + hsql::ShowStatement* show_stmt; hsql::TableRef* table; hsql::Expr* expr; @@ -343,7 +344,7 @@ union HSQL_STYPE std::vector* expr_vec; std::vector* order_vec; -#line 347 "bison_parser.cpp" /* yacc.c:355 */ +#line 348 "bison_parser.cpp" /* yacc.c:355 */ }; typedef union HSQL_STYPE HSQL_STYPE; @@ -373,7 +374,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 378 "bison_parser.cpp" /* yacc.c:358 */ #ifdef short # undef short @@ -615,18 +616,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 574 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 151 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 85 +#define YYNNTS 86 /* YYNRULES -- Number of rules. */ -#define YYNRULES 196 +#define YYNRULES 199 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 362 +#define YYNSTATES 367 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ @@ -685,26 +686,26 @@ 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, 242, 242, 263, 264, 268, 272, 276, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 300, 301, 306, + 307, 311, 315, 327, 334, 337, 341, 353, 361, 365, + 375, 378, 391, 397, 403, 413, 414, 418, 419, 423, + 430, 431, 432, 433, 443, 447, 451, 463, 471, 483, + 489, 499, 500, 510, 519, 520, 524, 536, 537, 538, + 555, 556, 560, 561, 565, 575, 592, 596, 597, 598, + 602, 603, 607, 619, 620, 624, 628, 633, 634, 638, + 643, 647, 648, 651, 652, 656, 657, 661, 665, 666, + 667, 673, 674, 678, 679, 680, 687, 688, 692, 693, + 697, 704, 705, 706, 707, 708, 712, 713, 714, 715, + 716, 717, 718, 719, 720, 724, 725, 729, 730, 731, + 732, 733, 737, 738, 739, 740, 741, 742, 743, 744, + 745, 746, 747, 751, 752, 756, 757, 758, 759, 764, + 766, 770, 771, 775, 776, 777, 778, 779, 780, 784, + 785, 789, 793, 797, 801, 802, 803, 804, 808, 809, + 810, 811, 815, 820, 821, 825, 829, 833, 845, 846, + 856, 857, 861, 862, 871, 872, 877, 887, 895, 896, + 901, 902, 906, 907, 915, 923, 933, 952, 953, 954, + 955, 956, 957, 958, 959, 964, 973, 974, 979, 980 }; #endif @@ -735,25 +736,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", "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 +782,57 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -259 +#define YYPACT_NINF -231 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-259))) + (!!((Yystate) == (-231))) -#define YYTABLE_NINF -192 +#define YYTABLE_NINF -195 #define yytable_value_is_error(Yytable_value) \ - (!!((Yytable_value) == (-192))) + (!!((Yytable_value) == (-195))) /* 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 + 231, -3, 32, 33, 50, -30, 15, 22, 10, 34, + 32, -28, 9, -34, 115, 16, -231, 66, 66, -231, + -231, -231, -231, -231, -231, -231, -231, -231, -231, 20, + -231, 12, 160, 23, -231, 24, 96, 68, 68, 32, + 94, 32, 206, 205, 112, -231, 32, 32, 32, -231, + 78, 83, -231, 231, -231, 150, -231, -231, -231, -231, + -231, -34, 134, 125, -34, 178, -231, 242, 7, 245, + 141, 32, 32, 184, -231, 179, 123, -231, -231, -231, + 81, 257, -231, -231, -231, -231, -231, -231, 126, -231, + 210, -231, -231, -231, 81, 210, 206, -231, -231, -231, + -231, -231, -231, 29, -231, -231, -231, -231, -231, -231, + -231, -231, 232, -64, 123, 81, -231, 275, 278, -17, + 8, 133, 195, 146, 139, 177, -231, 70, 213, 148, + -231, 74, 211, -231, -231, -231, -231, -231, -231, -231, + -231, -231, -231, -231, -231, -231, -231, 169, -50, -231, + 295, 178, 152, -231, -59, 178, 259, -231, 7, -231, + 191, 304, 194, -53, 225, -231, -231, 48, 166, -231, + 2, 4, 268, 81, 173, 177, 377, 81, 149, 180, + -76, 13, 184, 81, -231, 81, 320, 81, -231, -231, + 177, -231, 177, -63, 176, 14, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 206, 81, 257, -231, 185, 54, -231, -231, 81, -231, + -231, -231, -231, 206, -231, 252, -6, 56, -231, -34, + 32, -231, 322, 7, -231, 81, -231, -231, 187, -39, + 268, 246, -32, -231, -231, -34, -231, 40, -231, -231, + 6, -231, 282, -231, -231, -231, 236, 318, 405, 177, + 198, 70, -231, 256, 212, 405, 405, 405, 431, 431, + 431, 431, 149, 149, -91, -91, -91, 30, 214, -53, + -231, 7, -231, 295, -231, -231, 275, -231, -231, -231, + -231, -231, -231, 304, -231, -231, -231, 60, 64, -231, + 177, 215, -231, 219, 270, -231, -231, -231, 289, 291, + 13, 280, -231, 253, -231, 177, 405, 70, 221, 65, + -231, -231, 76, -231, -231, -231, -231, -231, 274, -231, + 6, 13, -231, -231, 175, 220, 13, 81, 377, 224, + 93, -231, -231, -231, 177, -231, -231, -231, 13, 244, + -5, -231, -231, 344, 175, 226, 81, 81, -231, -231, + 5, -53, -231, -53, 227, 229, -231 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -839,71 +840,71 @@ 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, 92, + 0, 0, 0, 0, 0, 197, 3, 18, 18, 16, + 9, 7, 10, 15, 12, 13, 11, 14, 8, 57, + 58, 84, 0, 178, 48, 25, 0, 36, 36, 0, + 0, 0, 0, 74, 0, 177, 0, 0, 0, 30, + 0, 0, 1, 196, 2, 0, 6, 5, 68, 69, + 67, 0, 71, 0, 0, 95, 46, 0, 0, 0, + 0, 0, 0, 78, 28, 0, 52, 165, 91, 73, + 0, 0, 44, 45, 31, 61, 60, 4, 0, 62, + 84, 63, 70, 66, 0, 84, 0, 64, 179, 162, + 163, 166, 167, 0, 98, 158, 159, 164, 160, 161, + 24, 23, 0, 0, 52, 0, 47, 0, 0, 0, + 154, 0, 0, 0, 0, 0, 156, 0, 0, 75, + 96, 183, 101, 108, 109, 110, 103, 105, 111, 104, + 122, 112, 113, 107, 102, 115, 116, 0, 78, 54, + 0, 95, 83, 85, 90, 95, 93, 26, 0, 35, + 0, 0, 0, 77, 0, 29, 198, 0, 0, 50, + 74, 0, 0, 0, 0, 0, 118, 0, 117, 0, + 0, 0, 78, 0, 181, 0, 0, 0, 182, 100, + 0, 119, 0, 0, 0, 0, 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, 53, 21, 0, 19, 59, 0, 89, + 88, 87, 65, 0, 99, 0, 0, 0, 37, 0, + 0, 51, 0, 0, 149, 0, 155, 157, 0, 0, + 0, 0, 0, 114, 106, 0, 76, 168, 170, 172, + 183, 171, 80, 97, 133, 180, 134, 0, 129, 0, + 0, 0, 120, 0, 132, 131, 143, 144, 145, 146, + 147, 148, 124, 123, 126, 125, 127, 128, 0, 56, + 55, 0, 17, 0, 86, 94, 0, 41, 42, 43, + 40, 39, 33, 0, 34, 27, 199, 0, 0, 141, + 0, 0, 151, 0, 0, 193, 187, 188, 192, 191, + 0, 0, 176, 0, 72, 0, 130, 0, 0, 0, + 121, 152, 0, 20, 32, 38, 49, 150, 0, 142, + 183, 0, 190, 189, 174, 169, 0, 0, 153, 0, + 0, 137, 135, 22, 0, 139, 173, 184, 0, 194, + 82, 138, 136, 0, 175, 0, 0, 0, 79, 140, + 0, 195, 185, 81, 154, 0, 186 }; /* 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 + -231, -231, -231, 307, -231, 354, -231, 90, -231, -231, + -231, -231, -231, 91, -231, -231, 340, -231, 87, -231, + -231, -231, -231, -231, 267, -231, -231, 170, -140, 52, + 321, -13, 353, -231, -231, 190, 216, -231, -231, -121, + -231, -231, 72, -231, 172, -231, -231, 41, -171, -203, + 204, -93, -68, -231, -231, -231, -231, -231, -231, -231, + -231, -231, -231, -231, -231, 28, -65, -112, -231, -38, + -231, -231, -231, -149, 62, -231, -231, -231, 0, -231, + -230, -231, -231, -231, -231, -231 }; /* 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, 215, 216, 18, 111, + 19, 20, 75, 164, 21, 22, 71, 227, 228, 291, + 23, 24, 25, 26, 119, 27, 148, 149, 28, 29, + 90, 30, 61, 62, 93, 31, 80, 128, 182, 116, + 314, 358, 65, 152, 153, 221, 43, 97, 129, 103, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 105, 106, 107, + 108, 109, 246, 247, 248, 335, 249, 44, 250, 188, + 189, 251, 311, 362, 54, 167 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -911,122 +912,126 @@ 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, 154, 34, 104, 78, 165, 242, 236, 364, 184, + 45, 99, 100, 77, 79, 9, 33, 160, 219, 287, + 312, 58, 163, 115, 32, 259, 185, 213, 48, 58, + 297, 288, 9, 196, 180, 33, 35, 357, 168, 73, + 37, 76, 46, 185, 220, 187, 82, 83, 84, 185, + 209, 59, 210, 36, 260, 176, 300, 178, 156, 59, + 49, 252, 187, 185, 298, 50, 304, 38, 187, 47, + 244, 113, 114, 120, 99, 100, 77, 184, 322, 63, + 239, 161, 187, 60, 120, 99, 100, 77, 289, 294, + 319, 60, 254, 224, 256, 41, 39, 101, 305, 212, + 346, 290, 306, 40, 262, 303, 169, 176, 307, 308, + 121, 13, 302, 89, 179, 52, 89, 183, 279, 9, + 186, 121, 257, 263, 258, 154, -194, 309, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 237, 126, 183, 122, 340, 42, 234, 120, + 99, 100, 77, 170, 196, 171, 122, 102, 245, 238, + 101, 334, 151, 66, 53, 55, 350, 155, 104, 68, + 67, 101, 278, 210, 165, 157, 185, 69, 158, 123, + 120, 99, 100, 77, 70, 285, 174, 349, 186, 310, + 123, 316, 217, 124, 231, 187, 222, 232, 74, 354, + 282, 304, 292, 283, 124, 293, 326, 125, 126, 158, + 327, 342, 77, 183, 183, 127, 104, 79, 125, 126, + 102, 122, 343, 81, 85, 158, 127, 301, 190, 86, + 295, 102, 328, 305, 88, 92, 101, 306, 1, 352, + 94, 96, 183, 307, 308, 98, 2, 338, 318, 110, + 112, 91, 122, 3, 91, 175, 191, 115, 4, 117, + 147, -194, 309, 361, 363, 5, 6, 101, 118, 124, + 304, 150, 159, 196, 7, 8, 353, 63, 172, 99, + 9, 166, 177, 125, 126, 10, 175, 206, 207, 208, + 209, 127, 210, 173, 181, 211, 102, 183, 214, 192, + 124, 218, 305, 225, 339, 223, 306, 226, 229, 11, + 230, 233, 307, 308, 125, 126, 355, 9, 240, 191, + 193, 261, 127, 255, 12, 296, 243, 102, 194, 195, + 281, 309, 286, 299, 259, 196, 197, 198, 185, 199, + 200, 201, 313, 317, 202, 203, 320, 204, 205, 206, + 207, 208, 209, 344, 210, 210, 331, 332, 321, 333, + 87, 329, 192, 191, 356, 330, 336, 341, 337, 348, + 351, 360, 57, 323, 171, 366, 13, 324, 72, 345, + 325, 162, 280, 241, 64, 95, 235, 253, 365, 191, + 284, 0, 195, 347, 0, 0, 0, 0, 196, 197, + 198, 0, 199, 200, 201, 0, 192, 202, 203, 0, + 204, 205, 206, 207, 208, 209, 0, 210, 0, 0, + 315, 0, 191, 0, 0, 0, 0, 241, 0, 0, + 0, 0, 192, 0, 0, 0, 195, 0, 0, 0, + 0, 0, 196, 197, 198, 0, 199, 200, 201, 359, + 191, 202, 203, 241, 204, 205, 206, 207, 208, 209, + 0, 210, 195, 0, 0, 192, 0, 0, 196, 197, + 198, 0, 199, 200, 201, 0, 191, 202, 203, 0, + 204, 205, 206, 207, 208, 209, 241, 210, 0, 0, + 0, 0, 0, -195, 0, 195, 0, 0, 0, 0, + 0, 196, 197, 198, 0, 199, 200, 201, 0, 0, + 202, 203, 0, 204, 205, 206, 207, 208, 209, 0, + 210, 0, 0, 195, 0, 0, 0, 0, 0, 196, + -195, -195, 0, -195, 200, 201, 0, 0, 202, 203, + 0, 204, 205, 206, 207, 208, 209, 0, 210, 195, + 0, 0, 0, 0, 0, 196, 0, 0, 0, 0, + -195, -195, 0, 0, -195, -195, 0, 204, 205, 206, + 207, 208, 209, 0, 210 }; 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, - -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 + 13, 94, 2, 68, 42, 117, 177, 3, 3, 3, + 10, 4, 5, 6, 12, 49, 3, 81, 77, 25, + 250, 9, 115, 73, 27, 88, 102, 148, 19, 9, + 233, 37, 49, 124, 127, 3, 3, 42, 55, 39, + 70, 41, 70, 102, 103, 121, 46, 47, 48, 102, + 141, 39, 143, 3, 117, 123, 95, 125, 96, 39, + 51, 182, 121, 102, 235, 13, 26, 97, 121, 97, + 146, 71, 72, 3, 4, 5, 6, 3, 281, 67, + 173, 145, 121, 71, 3, 4, 5, 6, 94, 229, + 261, 71, 185, 158, 187, 85, 81, 90, 58, 149, + 330, 107, 62, 81, 90, 245, 119, 175, 68, 69, + 40, 145, 144, 61, 127, 0, 64, 149, 211, 49, + 114, 40, 190, 109, 192, 218, 86, 87, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 138, 138, 149, 75, 317, 113, 146, 3, + 4, 5, 6, 145, 124, 147, 75, 150, 145, 172, + 90, 310, 90, 3, 148, 99, 337, 95, 233, 145, + 147, 90, 210, 143, 286, 146, 102, 81, 149, 109, + 3, 4, 5, 6, 116, 223, 40, 336, 114, 149, + 109, 259, 151, 123, 146, 121, 155, 149, 104, 348, + 146, 26, 146, 149, 123, 149, 146, 137, 138, 149, + 146, 146, 6, 149, 149, 145, 281, 12, 137, 138, + 150, 75, 146, 111, 146, 149, 145, 240, 17, 146, + 230, 150, 300, 58, 84, 101, 90, 62, 7, 146, + 115, 63, 149, 68, 69, 3, 15, 315, 261, 4, + 109, 61, 75, 22, 64, 109, 45, 73, 27, 80, + 3, 86, 87, 356, 357, 34, 35, 90, 145, 123, + 26, 145, 40, 124, 43, 44, 344, 67, 145, 4, + 49, 3, 143, 137, 138, 54, 109, 138, 139, 140, + 141, 145, 143, 98, 81, 126, 150, 149, 3, 88, + 123, 149, 58, 112, 317, 46, 62, 3, 114, 78, + 85, 145, 68, 69, 137, 138, 72, 49, 145, 45, + 109, 145, 145, 3, 93, 3, 146, 150, 117, 118, + 145, 87, 80, 146, 88, 124, 125, 126, 102, 128, + 129, 130, 60, 145, 133, 134, 90, 136, 137, 138, + 139, 140, 141, 79, 143, 143, 86, 68, 144, 68, + 53, 146, 88, 45, 120, 146, 86, 146, 115, 149, + 146, 145, 18, 283, 147, 146, 145, 286, 38, 105, + 293, 114, 212, 109, 31, 64, 170, 183, 360, 45, + 218, -1, 118, 331, -1, -1, -1, -1, 124, 125, + 126, -1, 128, 129, 130, -1, 88, 133, 134, -1, + 136, 137, 138, 139, 140, 141, -1, 143, -1, -1, + 102, -1, 45, -1, -1, -1, -1, 109, -1, -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, 45, 133, 134, -1, + 136, 137, 138, 139, 140, 141, 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, 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 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1034,92 +1039,92 @@ 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, 172, 173, 174, 176, 179, 180, + 182, 186, 27, 3, 229, 3, 3, 70, 97, 81, + 81, 85, 113, 197, 228, 229, 70, 97, 19, 51, + 180, 182, 0, 148, 235, 99, 156, 156, 9, 39, + 71, 183, 184, 67, 183, 193, 3, 147, 145, 81, + 116, 167, 167, 229, 104, 163, 229, 6, 220, 12, + 187, 111, 229, 229, 229, 146, 146, 154, 84, 180, + 181, 186, 101, 185, 115, 181, 63, 198, 3, 4, + 5, 90, 150, 200, 217, 218, 219, 220, 221, 222, + 4, 160, 109, 229, 229, 73, 190, 80, 145, 175, + 3, 40, 75, 109, 123, 137, 138, 145, 188, 199, + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 216, 217, 3, 177, 178, + 145, 193, 194, 195, 202, 193, 220, 146, 149, 40, + 81, 145, 175, 202, 164, 218, 3, 236, 55, 182, + 145, 147, 145, 98, 40, 109, 203, 143, 203, 182, + 202, 81, 189, 149, 3, 102, 114, 121, 230, 231, + 17, 45, 88, 109, 117, 118, 124, 125, 126, 128, + 129, 130, 133, 134, 136, 137, 138, 139, 140, 141, + 143, 126, 149, 190, 3, 157, 158, 198, 149, 77, + 103, 196, 198, 46, 217, 112, 3, 168, 169, 114, + 85, 146, 149, 145, 146, 187, 3, 138, 182, 202, + 145, 109, 199, 146, 146, 145, 223, 224, 225, 227, + 229, 232, 190, 201, 202, 3, 202, 203, 203, 88, + 117, 145, 90, 109, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 220, 202, + 178, 145, 146, 149, 195, 220, 80, 25, 37, 94, + 107, 170, 146, 149, 179, 229, 3, 200, 199, 146, + 95, 182, 144, 179, 26, 58, 62, 68, 69, 87, + 149, 233, 231, 60, 191, 102, 203, 145, 182, 199, + 90, 144, 200, 158, 164, 169, 146, 146, 203, 146, + 146, 86, 68, 68, 224, 226, 86, 115, 203, 182, + 199, 146, 146, 146, 79, 105, 231, 225, 149, 224, + 199, 146, 146, 203, 224, 72, 120, 42, 192, 105, + 145, 202, 234, 202, 3, 216, 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, 173, 174, + 174, 175, 175, 176, 177, 177, 178, 179, 179, 179, + 180, 180, 181, 181, 182, 182, 183, 184, 184, 184, + 185, 185, 186, 187, 187, 188, 189, 190, 190, 191, + 191, 192, 192, 193, 193, 194, 194, 195, 196, 196, + 196, 197, 197, 198, 198, 198, 199, 199, 200, 200, + 201, 202, 202, 202, 202, 202, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 204, 204, 205, 205, 205, + 205, 205, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 207, 207, 208, 208, 208, 208, 209, + 209, 210, 210, 211, 211, 211, 211, 211, 211, 212, + 212, 213, 214, 215, 216, 216, 216, 216, 217, 217, + 217, 217, 218, 219, 219, 220, 221, 222, 223, 223, + 224, 224, 225, 225, 226, 226, 227, 228, 229, 229, + 230, 230, 231, 231, 232, 232, 232, 233, 233, 233, + 233, 233, 233, 233, 233, 234, 235, 235, 236, 236 }; /* 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, 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 }; @@ -1616,31 +1621,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 136 "bison_parser.y" /* yacc.c:1257 */ { free( (((*yyvaluep).sval)) ); } -#line 1622 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1627 "bison_parser.cpp" /* yacc.c:1257 */ break; case 4: /* STRING */ -#line 135 "bison_parser.y" /* yacc.c:1257 */ +#line 136 "bison_parser.y" /* yacc.c:1257 */ { free( (((*yyvaluep).sval)) ); } -#line 1628 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1633 "bison_parser.cpp" /* yacc.c:1257 */ break; case 5: /* FLOATVAL */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ +#line 135 "bison_parser.y" /* yacc.c:1257 */ { } -#line 1634 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1639 "bison_parser.cpp" /* yacc.c:1257 */ break; case 6: /* INTVAL */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ +#line 135 "bison_parser.y" /* yacc.c:1257 */ { } -#line 1640 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1645 "bison_parser.cpp" /* yacc.c:1257 */ break; case 153: /* statement_list */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).stmt_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).stmt_vec))) { @@ -1649,23 +1654,23 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).stmt_vec)); } -#line 1653 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1658 "bison_parser.cpp" /* yacc.c:1257 */ break; case 154: /* statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).statement)); } -#line 1659 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1664 "bison_parser.cpp" /* yacc.c:1257 */ break; case 155: /* preparable_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).statement)); } -#line 1665 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1670 "bison_parser.cpp" /* yacc.c:1257 */ break; case 156: /* opt_hints */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).expr_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).expr_vec))) { @@ -1674,11 +1679,11 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).expr_vec)); } -#line 1678 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1683 "bison_parser.cpp" /* yacc.c:1257 */ break; case 157: /* hint_list */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).expr_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).expr_vec))) { @@ -1687,65 +1692,71 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).expr_vec)); } -#line 1691 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1696 "bison_parser.cpp" /* yacc.c:1257 */ break; case 158: /* hint */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 1697 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1702 "bison_parser.cpp" /* yacc.c:1257 */ break; case 159: /* prepare_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).prep_stmt)); } -#line 1703 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1708 "bison_parser.cpp" /* yacc.c:1257 */ break; case 160: /* prepare_target_query */ -#line 135 "bison_parser.y" /* yacc.c:1257 */ +#line 136 "bison_parser.y" /* yacc.c:1257 */ { free( (((*yyvaluep).sval)) ); } -#line 1709 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1714 "bison_parser.cpp" /* yacc.c:1257 */ break; case 161: /* execute_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).exec_stmt)); } -#line 1715 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1720 "bison_parser.cpp" /* yacc.c:1257 */ break; case 162: /* import_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).import_stmt)); } -#line 1721 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1726 "bison_parser.cpp" /* yacc.c:1257 */ break; case 163: /* import_file_type */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ +#line 135 "bison_parser.y" /* yacc.c:1257 */ { } -#line 1727 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1732 "bison_parser.cpp" /* yacc.c:1257 */ break; case 164: /* file_path */ -#line 135 "bison_parser.y" /* yacc.c:1257 */ - { free( (((*yyvaluep).sval)) ); } -#line 1733 "bison_parser.cpp" /* yacc.c:1257 */ - break; - - case 165: /* create_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ - { delete (((*yyvaluep).create_stmt)); } -#line 1739 "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 */ #line 136 "bison_parser.y" /* yacc.c:1257 */ + { free( (((*yyvaluep).sval)) ); } +#line 1738 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 165: /* show_statement */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ + { delete (((*yyvaluep).show_stmt)); } +#line 1744 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 166: /* create_statement */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ + { delete (((*yyvaluep).create_stmt)); } +#line 1750 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 167: /* opt_not_exists */ +#line 135 "bison_parser.y" /* yacc.c:1257 */ + { } +#line 1756 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 168: /* column_def_commalist */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).column_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).column_vec))) { @@ -1754,47 +1765,47 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).column_vec)); } -#line 1758 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1769 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 168: /* column_def */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 169: /* column_def */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).column_t)); } -#line 1764 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1775 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 169: /* column_type */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ + case 170: /* column_type */ +#line 135 "bison_parser.y" /* yacc.c:1257 */ { } -#line 1770 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1781 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 170: /* drop_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 171: /* drop_statement */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).drop_stmt)); } -#line 1776 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1787 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 171: /* delete_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 172: /* delete_statement */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).delete_stmt)); } -#line 1782 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1793 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 172: /* truncate_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 173: /* truncate_statement */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).delete_stmt)); } -#line 1788 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1799 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 173: /* insert_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 174: /* insert_statement */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).insert_stmt)); } -#line 1794 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1805 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 174: /* opt_column_list */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 175: /* opt_column_list */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).str_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).str_vec))) { @@ -1803,17 +1814,17 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).str_vec)); } -#line 1807 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1818 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 175: /* update_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 176: /* update_statement */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).update_stmt)); } -#line 1813 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1824 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 176: /* update_clause_commalist */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 177: /* update_clause_commalist */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).update_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).update_vec))) { @@ -1822,53 +1833,53 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).update_vec)); } -#line 1826 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1837 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 177: /* update_clause */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 178: /* update_clause */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).update_t)); } -#line 1832 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1843 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 178: /* select_statement */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 179: /* select_statement */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).select_stmt)); } -#line 1838 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1849 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 179: /* select_with_paren */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 180: /* select_with_paren */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).select_stmt)); } -#line 1844 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1855 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 180: /* select_paren_or_clause */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 181: /* select_paren_or_clause */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).select_stmt)); } -#line 1850 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1861 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 181: /* select_no_paren */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 182: /* select_no_paren */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).select_stmt)); } -#line 1856 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1867 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 185: /* select_clause */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 186: /* select_clause */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).select_stmt)); } -#line 1862 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1873 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 186: /* opt_distinct */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ + case 187: /* opt_distinct */ +#line 135 "bison_parser.y" /* yacc.c:1257 */ { } -#line 1868 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1879 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 187: /* select_list */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 188: /* select_list */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).expr_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).expr_vec))) { @@ -1877,35 +1888,35 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).expr_vec)); } -#line 1881 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1892 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 188: /* from_clause */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 189: /* from_clause */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 1887 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1898 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 189: /* opt_where */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 190: /* opt_where */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 1893 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1904 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 190: /* opt_group */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 191: /* opt_group */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).group_t)); } -#line 1899 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1910 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 191: /* opt_having */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 192: /* opt_having */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 1905 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1916 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 192: /* opt_order */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 193: /* opt_order */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).order_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).order_vec))) { @@ -1914,11 +1925,11 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).order_vec)); } -#line 1918 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1929 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 193: /* order_list */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 194: /* order_list */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).order_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).order_vec))) { @@ -1927,35 +1938,35 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).order_vec)); } -#line 1931 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1942 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 194: /* order_desc */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 195: /* order_desc */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).order)); } -#line 1937 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1948 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 195: /* opt_order_type */ -#line 134 "bison_parser.y" /* yacc.c:1257 */ + case 196: /* opt_order_type */ +#line 135 "bison_parser.y" /* yacc.c:1257 */ { } -#line 1943 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1954 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 196: /* opt_top */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 197: /* opt_top */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).limit)); } -#line 1949 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1960 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 197: /* opt_limit */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 198: /* opt_limit */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).limit)); } -#line 1955 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1966 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 198: /* expr_list */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 199: /* expr_list */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).expr_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).expr_vec))) { @@ -1964,11 +1975,11 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).expr_vec)); } -#line 1968 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1979 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 199: /* literal_list */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 200: /* literal_list */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).expr_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).expr_vec))) { @@ -1977,161 +1988,161 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).expr_vec)); } -#line 1981 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1992 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 200: /* expr_alias */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 201: /* expr_alias */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 1987 "bison_parser.cpp" /* yacc.c:1257 */ +#line 1998 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 201: /* expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 202: /* expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 1993 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2004 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 202: /* operand */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 203: /* operand */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 1999 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2010 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 203: /* scalar_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 204: /* scalar_expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2005 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2016 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 204: /* unary_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 205: /* unary_expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2011 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2022 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 205: /* binary_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 206: /* binary_expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2017 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2028 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 206: /* logic_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 207: /* logic_expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2023 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2034 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 207: /* in_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 208: /* in_expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2029 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2040 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 208: /* case_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 209: /* case_expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2035 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2046 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 209: /* exists_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 210: /* exists_expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2041 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2052 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 210: /* comp_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 211: /* comp_expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2047 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2058 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 211: /* function_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 212: /* function_expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2053 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2064 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 212: /* array_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 213: /* array_expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2059 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2070 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 213: /* array_index */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 214: /* array_index */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2065 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2076 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 214: /* between_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 215: /* between_expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2071 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2082 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 215: /* column_name */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 216: /* column_name */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2077 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2088 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 216: /* literal */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 217: /* literal */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2083 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2094 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 217: /* string_literal */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 218: /* string_literal */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2089 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2100 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 218: /* num_literal */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 219: /* num_literal */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2095 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2106 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 219: /* int_literal */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 220: /* int_literal */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2101 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2112 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 220: /* null_literal */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 221: /* null_literal */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2107 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2118 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 221: /* param_expr */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 222: /* param_expr */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).expr)); } -#line 2113 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2124 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 222: /* table_ref */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 223: /* table_ref */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 2119 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2130 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 223: /* table_ref_atomic */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 224: /* table_ref_atomic */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 2125 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2136 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 224: /* nonjoin_table_ref_atomic */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 225: /* nonjoin_table_ref_atomic */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 2131 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2142 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 225: /* table_ref_commalist */ -#line 136 "bison_parser.y" /* yacc.c:1257 */ + case 226: /* table_ref_commalist */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).table_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).table_vec))) { @@ -2140,59 +2151,59 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).table_vec)); } -#line 2144 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2155 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 226: /* table_ref_name */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 227: /* table_ref_name */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 2150 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2161 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 227: /* table_ref_name_no_alias */ -#line 144 "bison_parser.y" /* yacc.c:1257 */ + case 228: /* table_ref_name_no_alias */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ { delete (((*yyvaluep).table)); } -#line 2156 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2167 "bison_parser.cpp" /* yacc.c:1257 */ break; - case 228: /* table_name */ -#line 135 "bison_parser.y" /* yacc.c:1257 */ - { free( (((*yyvaluep).sval)) ); } -#line 2162 "bison_parser.cpp" /* yacc.c:1257 */ - break; - - case 229: /* alias */ -#line 135 "bison_parser.y" /* yacc.c:1257 */ - { free( (((*yyvaluep).sval)) ); } -#line 2168 "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 */ - { delete (((*yyvaluep).table)); } -#line 2180 "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 229: /* table_name */ #line 136 "bison_parser.y" /* yacc.c:1257 */ + { free( (((*yyvaluep).sval)) ); } +#line 2173 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 230: /* alias */ +#line 136 "bison_parser.y" /* yacc.c:1257 */ + { free( (((*yyvaluep).sval)) ); } +#line 2179 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 231: /* opt_alias */ +#line 136 "bison_parser.y" /* yacc.c:1257 */ + { free( (((*yyvaluep).sval)) ); } +#line 2185 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 232: /* join_clause */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ + { delete (((*yyvaluep).table)); } +#line 2191 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 233: /* opt_join_type */ +#line 135 "bison_parser.y" /* yacc.c:1257 */ + { } +#line 2197 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 234: /* join_condition */ +#line 145 "bison_parser.y" /* yacc.c:1257 */ + { delete (((*yyvaluep).expr)); } +#line 2203 "bison_parser.cpp" /* yacc.c:1257 */ + break; + + case 236: /* ident_commalist */ +#line 137 "bison_parser.y" /* yacc.c:1257 */ { if ((((*yyvaluep).str_vec)) != nullptr) { for (auto ptr : *(((*yyvaluep).str_vec))) { @@ -2201,7 +2212,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio } delete (((*yyvaluep).str_vec)); } -#line 2205 "bison_parser.cpp" /* yacc.c:1257 */ +#line 2216 "bison_parser.cpp" /* yacc.c:1257 */ break; @@ -2319,7 +2330,7 @@ YYLTYPE yylloc = yyloc_default; yylloc.total_column = 0; } -#line 2323 "bison_parser.cpp" /* yacc.c:1429 */ +#line 2334 "bison_parser.cpp" /* yacc.c:1429 */ yylsp[0] = yylloc; goto yysetstate; @@ -2506,7 +2517,7 @@ yyreduce: switch (yyn) { case 2: -#line 240 "bison_parser.y" /* yacc.c:1646 */ +#line 242 "bison_parser.y" /* yacc.c:1646 */ { for (SQLStatement* stmt : *(yyvsp[-1].stmt_vec)) { // Transfers ownership of the statement. @@ -2524,211 +2535,236 @@ yyreduce: } delete (yyvsp[-1].stmt_vec); } -#line 2528 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2539 "bison_parser.cpp" /* yacc.c:1646 */ break; case 3: -#line 261 "bison_parser.y" /* yacc.c:1646 */ +#line 263 "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 2545 "bison_parser.cpp" /* yacc.c:1646 */ break; case 4: -#line 262 "bison_parser.y" /* yacc.c:1646 */ +#line 264 "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 2551 "bison_parser.cpp" /* yacc.c:1646 */ break; case 5: -#line 266 "bison_parser.y" /* yacc.c:1646 */ +#line 268 "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 2560 "bison_parser.cpp" /* yacc.c:1646 */ break; case 6: -#line 270 "bison_parser.y" /* yacc.c:1646 */ +#line 272 "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 2569 "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 276 "bison_parser.y" /* yacc.c:1646 */ + { + (yyval.statement) = (yyvsp[0].show_stmt); + } +#line 2577 "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 283 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].select_stmt); } +#line 2583 "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 284 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].import_stmt); } +#line 2589 "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 285 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].create_stmt); } +#line 2595 "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 286 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].insert_stmt); } +#line 2601 "bison_parser.cpp" /* yacc.c:1646 */ break; case 12: -#line 283 "bison_parser.y" /* yacc.c:1646 */ +#line 287 "bison_parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].delete_stmt); } -#line 2594 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2607 "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 288 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].delete_stmt); } +#line 2613 "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 289 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].update_stmt); } +#line 2619 "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 290 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].drop_stmt); } +#line 2625 "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 291 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.statement) = (yyvsp[0].exec_stmt); } +#line 2631 "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 300 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr_vec) = (yyvsp[-1].expr_vec); } +#line 2637 "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 */ + { (yyval.expr_vec) = nullptr; } +#line 2643 "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 306 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr_vec) = new std::vector(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); } +#line 2649 "bison_parser.cpp" /* yacc.c:1646 */ break; case 20: -#line 306 "bison_parser.y" /* yacc.c:1646 */ +#line 307 "bison_parser.y" /* yacc.c:1646 */ + { (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); } +#line 2655 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 21: +#line 311 "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 2664 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 21: -#line 310 "bison_parser.y" /* yacc.c:1646 */ + case 22: +#line 315 "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 2674 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 22: -#line 322 "bison_parser.y" /* yacc.c:1646 */ + case 23: +#line 327 "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 2684 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 24: -#line 332 "bison_parser.y" /* yacc.c:1646 */ + case 25: +#line 337 "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 2693 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 25: -#line 336 "bison_parser.y" /* yacc.c:1646 */ + case 26: +#line 341 "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 */ +#line 2703 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 26: -#line 348 "bison_parser.y" /* yacc.c:1646 */ + case 27: +#line 353 "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 */ - break; - - case 27: -#line 356 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kImportCSV; } -#line 2700 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2713 "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 361 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kImportCSV; } +#line 2719 "bison_parser.cpp" /* yacc.c:1646 */ break; case 29: -#line 370 "bison_parser.y" /* yacc.c:1646 */ +#line 365 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.sval) = strdup((yyvsp[0].expr)->name); delete (yyvsp[0].expr); } +#line 2725 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 30: +#line 375 "bison_parser.y" /* yacc.c:1646 */ + { + (yyval.show_stmt) = new ShowStatement(kShowTables); + } +#line 2733 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 31: +#line 378 "bison_parser.y" /* yacc.c:1646 */ + { + (yyval.show_stmt) = new ShowStatement(kShowColumns); + (yyval.show_stmt)->name = (yyvsp[0].sval); + } +#line 2742 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 32: +#line 391 "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 2753 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 30: -#line 376 "bison_parser.y" /* yacc.c:1646 */ + case 33: +#line 397 "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); } -#line 2728 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2764 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 31: -#line 382 "bison_parser.y" /* yacc.c:1646 */ + case 34: +#line 403 "bison_parser.y" /* yacc.c:1646 */ { (yyval.create_stmt) = new CreateStatement(kCreateView); (yyval.create_stmt)->ifNotExists = (yyvsp[-4].bval); @@ -2736,180 +2772,180 @@ yyreduce: (yyval.create_stmt)->viewColumns = (yyvsp[-2].str_vec); (yyval.create_stmt)->select = (yyvsp[0].select_stmt); } -#line 2740 "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 */ - break; - - case 33: -#line 393 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.bval) = false; } -#line 2752 "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 */ +#line 2776 "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 */ +#line 413 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.bval) = true; } +#line 2782 "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 */ +#line 414 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.bval) = false; } +#line 2788 "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 */ +#line 418 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.column_vec) = new std::vector(); (yyval.column_vec)->push_back((yyvsp[0].column_t)); } +#line 2794 "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 */ +#line 419 "bison_parser.y" /* yacc.c:1646 */ + { (yyvsp[-2].column_vec)->push_back((yyvsp[0].column_t)); (yyval.column_vec) = (yyvsp[-2].column_vec); } +#line 2800 "bison_parser.cpp" /* yacc.c:1646 */ break; case 39: -#line 411 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = ColumnDefinition::DOUBLE; } -#line 2790 "bison_parser.cpp" /* yacc.c:1646 */ +#line 423 "bison_parser.y" /* yacc.c:1646 */ + { + (yyval.column_t) = new ColumnDefinition((yyvsp[-1].sval), (ColumnDefinition::DataType) (yyvsp[0].uval)); + } +#line 2808 "bison_parser.cpp" /* yacc.c:1646 */ break; case 40: -#line 412 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = ColumnDefinition::TEXT; } -#line 2796 "bison_parser.cpp" /* yacc.c:1646 */ +#line 430 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = ColumnDefinition::INT; } +#line 2814 "bison_parser.cpp" /* yacc.c:1646 */ break; case 41: -#line 422 "bison_parser.y" /* yacc.c:1646 */ +#line 431 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = ColumnDefinition::INT; } +#line 2820 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 42: +#line 432 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = ColumnDefinition::DOUBLE; } +#line 2826 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 43: +#line 433 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = ColumnDefinition::TEXT; } +#line 2832 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 44: +#line 443 "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 */ +#line 2841 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 42: -#line 426 "bison_parser.y" /* yacc.c:1646 */ + case 45: +#line 447 "bison_parser.y" /* yacc.c:1646 */ { (yyval.drop_stmt) = new DropStatement(kDropView); (yyval.drop_stmt)->name = (yyvsp[0].sval); } -#line 2814 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2850 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 43: -#line 430 "bison_parser.y" /* yacc.c:1646 */ + case 46: +#line 451 "bison_parser.y" /* yacc.c:1646 */ { (yyval.drop_stmt) = new DropStatement(kDropPreparedStatement); (yyval.drop_stmt)->name = (yyvsp[0].sval); } -#line 2823 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2859 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 44: -#line 442 "bison_parser.y" /* yacc.c:1646 */ + case 47: +#line 463 "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); } -#line 2833 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2869 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 45: -#line 450 "bison_parser.y" /* yacc.c:1646 */ + case 48: +#line 471 "bison_parser.y" /* yacc.c:1646 */ { (yyval.delete_stmt) = new DeleteStatement(); (yyval.delete_stmt)->tableName = (yyvsp[0].sval); } -#line 2842 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2878 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 46: -#line 462 "bison_parser.y" /* yacc.c:1646 */ + case 49: +#line 483 "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); } -#line 2853 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2889 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 47: -#line 468 "bison_parser.y" /* yacc.c:1646 */ + case 50: +#line 489 "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 2900 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 48: -#line 478 "bison_parser.y" /* yacc.c:1646 */ + case 51: +#line 499 "bison_parser.y" /* yacc.c:1646 */ { (yyval.str_vec) = (yyvsp[-1].str_vec); } -#line 2870 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2906 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 49: -#line 479 "bison_parser.y" /* yacc.c:1646 */ + case 52: +#line 500 "bison_parser.y" /* yacc.c:1646 */ { (yyval.str_vec) = nullptr; } -#line 2876 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2912 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 50: -#line 489 "bison_parser.y" /* yacc.c:1646 */ + case 53: +#line 510 "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 2923 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 51: -#line 498 "bison_parser.y" /* yacc.c:1646 */ + case 54: +#line 519 "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 2929 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 52: -#line 499 "bison_parser.y" /* yacc.c:1646 */ + case 55: +#line 520 "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 2935 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 53: -#line 503 "bison_parser.y" /* yacc.c:1646 */ + case 56: +#line 524 "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 2945 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 56: -#line 517 "bison_parser.y" /* yacc.c:1646 */ + case 59: +#line 538 "bison_parser.y" /* yacc.c:1646 */ { // TODO: allow multiple unions (through linked list) // TODO: capture type of set_operator @@ -2924,23 +2960,23 @@ yyreduce: (yyval.select_stmt)->limit = (yyvsp[0].limit); } } -#line 2928 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2964 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 57: -#line 534 "bison_parser.y" /* yacc.c:1646 */ + case 60: +#line 555 "bison_parser.y" /* yacc.c:1646 */ { (yyval.select_stmt) = (yyvsp[-1].select_stmt); } -#line 2934 "bison_parser.cpp" /* yacc.c:1646 */ - break; - - case 58: -#line 535 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.select_stmt) = (yyvsp[-1].select_stmt); } -#line 2940 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2970 "bison_parser.cpp" /* yacc.c:1646 */ break; case 61: -#line 544 "bison_parser.y" /* yacc.c:1646 */ +#line 556 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.select_stmt) = (yyvsp[-1].select_stmt); } +#line 2976 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 64: +#line 565 "bison_parser.y" /* yacc.c:1646 */ { (yyval.select_stmt) = (yyvsp[-2].select_stmt); (yyval.select_stmt)->order = (yyvsp[-1].order_vec); @@ -2951,11 +2987,11 @@ yyreduce: (yyval.select_stmt)->limit = (yyvsp[0].limit); } } -#line 2955 "bison_parser.cpp" /* yacc.c:1646 */ +#line 2991 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 62: -#line 554 "bison_parser.y" /* yacc.c:1646 */ + case 65: +#line 575 "bison_parser.y" /* yacc.c:1646 */ { // TODO: allow multiple unions (through linked list) // TODO: capture type of set_operator @@ -2970,11 +3006,11 @@ yyreduce: (yyval.select_stmt)->limit = (yyvsp[0].limit); } } -#line 2974 "bison_parser.cpp" /* yacc.c:1646 */ +#line 3010 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 69: -#line 586 "bison_parser.y" /* yacc.c:1646 */ + case 72: +#line 607 "bison_parser.y" /* yacc.c:1646 */ { (yyval.select_stmt) = new SelectStatement(); (yyval.select_stmt)->limit = (yyvsp[-5].limit); @@ -2984,538 +3020,538 @@ 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 */ +#line 3024 "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 */ +#line 619 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.bval) = true; } +#line 3030 "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 */ - break; - - case 75: -#line 613 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = nullptr; } -#line 3018 "bison_parser.cpp" /* yacc.c:1646 */ +#line 620 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.bval) = false; } +#line 3036 "bison_parser.cpp" /* yacc.c:1646 */ break; case 76: -#line 617 "bison_parser.y" /* yacc.c:1646 */ +#line 628 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.table) = (yyvsp[0].table); } +#line 3042 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 77: +#line 633 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[0].expr); } +#line 3048 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 78: +#line 634 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = nullptr; } +#line 3054 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 79: +#line 638 "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 */ - 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 */ 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); } + case 80: +#line 643 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.group_t) = nullptr; } #line 3070 "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)); } + case 81: +#line 647 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[0].expr); } #line 3076 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 85: -#line 644 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.order_type) = kOrderAsc; } + case 82: +#line 648 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = nullptr; } #line 3082 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 86: -#line 645 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.order_type) = kOrderDesc; } + case 83: +#line 651 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order_vec) = (yyvsp[0].order_vec); } #line 3088 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 87: -#line 646 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.order_type) = kOrderAsc; } + case 84: +#line 652 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order_vec) = nullptr; } #line 3094 "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); } + case 85: +#line 656 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order_vec) = new std::vector(); (yyval.order_vec)->push_back((yyvsp[0].order)); } #line 3100 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 89: -#line 653 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.limit) = nullptr; } + case 86: +#line 657 "bison_parser.y" /* yacc.c:1646 */ + { (yyvsp[-2].order_vec)->push_back((yyvsp[0].order)); (yyval.order_vec) = (yyvsp[-2].order_vec); } #line 3106 "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); } + case 87: +#line 661 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order) = new OrderDescription((yyvsp[0].order_type), (yyvsp[-1].expr)); } #line 3112 "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); } + case 88: +#line 665 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order_type) = kOrderAsc; } #line 3118 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 92: -#line 659 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.limit) = nullptr; } + case 89: +#line 666 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order_type) = kOrderDesc; } #line 3124 "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)); } + case 90: +#line 667 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.order_type) = kOrderAsc; } #line 3130 "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); } + case 91: +#line 673 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.limit) = new LimitDescription((yyvsp[0].expr)->ival, kNoOffset); delete (yyvsp[0].expr); } #line 3136 "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)); } + case 92: +#line 674 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.limit) = nullptr; } #line 3142 "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); } + case 93: +#line 678 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.limit) = new LimitDescription((yyvsp[0].expr)->ival, kNoOffset); delete (yyvsp[0].expr); } #line 3148 "bison_parser.cpp" /* yacc.c:1646 */ break; + case 94: +#line 679 "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 3154 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 95: +#line 680 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.limit) = nullptr; } +#line 3160 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 96: +#line 687 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr_vec) = new std::vector(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); } +#line 3166 "bison_parser.cpp" /* yacc.c:1646 */ + break; + case 97: -#line 676 "bison_parser.y" /* yacc.c:1646 */ +#line 688 "bison_parser.y" /* yacc.c:1646 */ + { (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); } +#line 3172 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 98: +#line 692 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr_vec) = new std::vector(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); } +#line 3178 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 99: +#line 693 "bison_parser.y" /* yacc.c:1646 */ + { (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); } +#line 3184 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 100: +#line 697 "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 */ - break; - - case 103: -#line 691 "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 */ - 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 */ - 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: + case 106: #line 712 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeOpUnary(kOpIsNull, (yyvsp[-3].expr))); } + { (yyval.expr) = (yyvsp[-1].expr); } #line 3199 "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)); } + case 114: +#line 720 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeSelect((yyvsp[-1].select_stmt)); } #line 3205 "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)); } + case 117: +#line 729 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpUnaryMinus, (yyvsp[0].expr)); } #line 3211 "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)); } + case 118: +#line 730 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpNot, (yyvsp[0].expr)); } #line 3217 "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)); } + case 119: +#line 731 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpIsNull, (yyvsp[-1].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)); } + case 120: +#line 732 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpIsNull, (yyvsp[-2].expr)); } #line 3229 "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)); } + case 121: +#line 733 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeOpUnary(kOpIsNull, (yyvsp[-3].expr))); } #line 3235 "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)); } + case 123: +#line 738 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpMinus, (yyvsp[0].expr)); } #line 3241 "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)); } + case 124: +#line 739 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpPlus, (yyvsp[0].expr)); } #line 3247 "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)); } + case 125: +#line 740 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpSlash, (yyvsp[0].expr)); } #line 3253 "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)); } + case 126: +#line 741 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpAsterisk, (yyvsp[0].expr)); } #line 3259 "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)); } + case 127: +#line 742 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpPercentage, (yyvsp[0].expr)); } #line 3265 "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)); } + case 128: +#line 743 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpCaret, (yyvsp[0].expr)); } #line 3271 "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)); } + case 129: +#line 744 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLike, (yyvsp[0].expr)); } #line 3277 "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))); } + case 130: +#line 745 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-3].expr), kOpNotLike, (yyvsp[0].expr)); } #line 3283 "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)); } + case 131: +#line 746 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpILike, (yyvsp[0].expr)); } #line 3289 "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))); } + case 132: +#line 747 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpConcat, (yyvsp[0].expr)); } #line 3295 "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)); } + case 133: +#line 751 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpAnd, (yyvsp[0].expr)); } #line 3301 "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)); } + case 134: +#line 752 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpOr, (yyvsp[0].expr)); } #line 3307 "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)); } + case 135: +#line 756 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeInOperator((yyvsp[-4].expr), (yyvsp[-1].expr_vec)); } #line 3313 "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))); } + case 136: +#line 757 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeInOperator((yyvsp[-5].expr), (yyvsp[-1].expr_vec))); } #line 3319 "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)); } + case 137: +#line 758 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeInOperator((yyvsp[-4].expr), (yyvsp[-1].select_stmt)); } #line 3325 "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)); } + case 138: +#line 759 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeInOperator((yyvsp[-5].expr), (yyvsp[-1].select_stmt))); } #line 3331 "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)); } + case 139: +#line 764 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeCase((yyvsp[-3].expr), (yyvsp[-1].expr)); } #line 3337 "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)); } + case 140: +#line 766 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeCase((yyvsp[-5].expr), (yyvsp[-3].expr), (yyvsp[-1].expr)); } #line 3343 "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)); } + case 141: +#line 770 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeExists((yyvsp[-1].select_stmt)); } #line 3349 "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)); } + case 142: +#line 771 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeExists((yyvsp[-1].select_stmt))); } #line 3355 "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); } + case 143: +#line 775 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpEquals, (yyvsp[0].expr)); } #line 3361 "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)); } + case 144: +#line 776 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpNotEquals, (yyvsp[0].expr)); } #line 3367 "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)); } + case 145: +#line 777 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLess, (yyvsp[0].expr)); } #line 3373 "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); } + case 146: +#line 778 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpGreater, (yyvsp[0].expr)); } #line 3379 "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)); } + case 147: +#line 779 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLessEq, (yyvsp[0].expr)); } #line 3385 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 151: + case 148: #line 780 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeColumnRef((yyvsp[0].sval)); } + { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpGreaterEq, (yyvsp[0].expr)); } #line 3391 "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)); } + case 149: +#line 784 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeFunctionRef((yyvsp[-2].sval), new std::vector(), false); } #line 3397 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 153: -#line 782 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeStar(); } + case 150: +#line 785 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeFunctionRef((yyvsp[-4].sval), (yyvsp[-1].expr_vec), (yyvsp[-2].bval)); } #line 3403 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 154: -#line 783 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeStar((yyvsp[-2].sval)); } + case 151: +#line 789 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeArray((yyvsp[-1].expr_vec)); } #line 3409 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 159: -#line 794 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeLiteral((yyvsp[0].sval)); } + case 152: +#line 793 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeArrayIndex((yyvsp[-3].expr), (yyvsp[-1].expr)->ival); } #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)); } + case 153: +#line 797 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeBetween((yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); } #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)); } + case 154: +#line 801 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeColumnRef((yyvsp[0].sval)); } #line 3427 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 163: -#line 808 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.expr) = Expr::makeNullLiteral(); } + case 155: +#line 802 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeColumnRef((yyvsp[-2].sval), (yyvsp[0].sval)); } #line 3433 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 164: -#line 812 "bison_parser.y" /* yacc.c:1646 */ + case 156: +#line 803 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeStar(); } +#line 3439 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 157: +#line 804 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeStar((yyvsp[-2].sval)); } +#line 3445 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 162: +#line 815 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeLiteral((yyvsp[0].sval)); } +#line 3451 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 163: +#line 820 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeLiteral((yyvsp[0].fval)); } +#line 3457 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 165: +#line 825 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeLiteral((yyvsp[0].ival)); } +#line 3463 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 166: +#line 829 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.expr) = Expr::makeNullLiteral(); } +#line 3469 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 167: +#line 833 "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 3479 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 166: -#line 825 "bison_parser.y" /* yacc.c:1646 */ + case 169: +#line 846 "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 3490 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 170: -#line 841 "bison_parser.y" /* yacc.c:1646 */ + case 173: +#line 862 "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 */ +#line 3501 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 171: -#line 850 "bison_parser.y" /* yacc.c:1646 */ + case 174: +#line 871 "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 */ +#line 3507 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 172: -#line 851 "bison_parser.y" /* yacc.c:1646 */ + case 175: +#line 872 "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 */ +#line 3513 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 173: -#line 856 "bison_parser.y" /* yacc.c:1646 */ + case 176: +#line 877 "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 */ +#line 3524 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 174: -#line 866 "bison_parser.y" /* yacc.c:1646 */ + case 177: +#line 887 "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 3533 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 176: -#line 875 "bison_parser.y" /* yacc.c:1646 */ + case 179: +#line 896 "bison_parser.y" /* yacc.c:1646 */ { (yyval.sval) = (yyvsp[0].sval); } -#line 3503 "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 3539 "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 901 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].sval); } +#line 3545 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 181: -#line 895 "bison_parser.y" /* yacc.c:1646 */ + case 183: +#line 907 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.sval) = nullptr; } +#line 3551 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 184: +#line 916 "bison_parser.y" /* yacc.c:1646 */ { (yyval.table) = new TableRef(kTableJoin); (yyval.table)->join = new JoinDefinition(); @@ -3523,12 +3559,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 3563 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 182: -#line 903 "bison_parser.y" /* yacc.c:1646 */ - { + case 185: +#line 924 "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 +3572,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 3576 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 183: -#line 913 "bison_parser.y" /* yacc.c:1646 */ - { + case 186: +#line 934 "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 +3592,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 */ - break; - - case 189: -#line 936 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kJoinRight; } #line 3596 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 190: -#line 937 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kJoinCross; } + case 187: +#line 952 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinInner; } #line 3602 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 191: -#line 938 "bison_parser.y" /* yacc.c:1646 */ - { (yyval.uval) = kJoinInner; } + case 188: +#line 953 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinOuter; } #line 3608 "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)); } + case 189: +#line 954 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinLeftOuter; } #line 3614 "bison_parser.cpp" /* yacc.c:1646 */ break; - case 196: -#line 959 "bison_parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].str_vec)->push_back((yyvsp[0].sval)); (yyval.str_vec) = (yyvsp[-2].str_vec); } + case 190: +#line 955 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinRightOuter; } #line 3620 "bison_parser.cpp" /* yacc.c:1646 */ break; + case 191: +#line 956 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinLeft; } +#line 3626 "bison_parser.cpp" /* yacc.c:1646 */ + break; -#line 3624 "bison_parser.cpp" /* yacc.c:1646 */ + case 192: +#line 957 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinRight; } +#line 3632 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 193: +#line 958 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinCross; } +#line 3638 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 194: +#line 959 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.uval) = kJoinInner; } +#line 3644 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 198: +#line 979 "bison_parser.y" /* yacc.c:1646 */ + { (yyval.str_vec) = new std::vector(); (yyval.str_vec)->push_back((yyvsp[0].sval)); } +#line 3650 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + case 199: +#line 980 "bison_parser.y" /* yacc.c:1646 */ + { (yyvsp[-2].str_vec)->push_back((yyvsp[0].sval)); (yyval.str_vec) = (yyvsp[-2].str_vec); } +#line 3656 "bison_parser.cpp" /* yacc.c:1646 */ + break; + + +#line 3660 "bison_parser.cpp" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -3855,7 +3891,7 @@ yyreturn: #endif return yyresult; } -#line 962 "bison_parser.y" /* yacc.c:1906 */ +#line 983 "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..c2a852d 100644 --- a/src/parser/bison_parser.h +++ b/src/parser/bison_parser.h @@ -235,6 +235,7 @@ union HSQL_STYPE hsql::DropStatement* drop_stmt; hsql::PrepareStatement* prep_stmt; hsql::ExecuteStatement* exec_stmt; + hsql::ShowStatement* show_stmt; hsql::TableRef* table; hsql::Expr* expr; @@ -254,7 +255,7 @@ union HSQL_STYPE std::vector* expr_vec; std::vector* order_vec; -#line 258 "bison_parser.h" /* yacc.c:1909 */ +#line 259 "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 index bb96826..8fd6a5b 100644 --- a/src/parser/bison_parser.y +++ b/src/parser/bison_parser.y @@ -107,6 +107,7 @@ 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::TableRef* table; hsql::Expr* expr; @@ -182,6 +183,7 @@ int yyerror(YYLTYPE* llocp, SQLParserResult* result, yyscan_t scanner, const cha %type delete_statement truncate_statement %type update_statement %type drop_statement +%type show_statement %type table_name opt_alias alias file_path prepare_target_query %type opt_not_exists opt_distinct %type import_file_type opt_join_type column_type @@ -271,6 +273,9 @@ statement: $$ = $1; $$->hints = $2; } + | show_statement { + $$ = $1; + } ; @@ -361,6 +366,22 @@ file_path: ; +/****************************** + * Show Statement + * SHOW TABLES; + ******************************/ + +show_statement: + SHOW TABLES { + $$ = new ShowStatement(kShowTables); + } + | SHOW COLUMNS table_name { + $$ = new ShowStatement(kShowColumns); + $$->name = $3; + } + ; + + /****************************** * Create Statement * CREATE TABLE students (name TEXT, student_number INTEGER, city TEXT, grade DOUBLE) @@ -500,7 +521,7 @@ update_clause_commalist: ; update_clause: - IDENTIFIER '=' literal { + IDENTIFIER '=' expr { $$ = new UpdateClause(); $$->column = $1; $$->value = $3; @@ -836,7 +857,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); @@ -900,7 +921,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 +931,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/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/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 100644 index 0000000..206a819 --- /dev/null +++ b/src/sql/ShowStatement.h @@ -0,0 +1,26 @@ +#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* name; + }; + +} // namespace hsql +#endif diff --git a/src/sql/statements.cpp b/src/sql/statements.cpp index ab4320a..af83ae2 100644 --- a/src/sql/statements.cpp +++ b/src/sql/statements.cpp @@ -121,6 +121,16 @@ namespace hsql { } } + // ShowStatament + ShowStatement::ShowStatement(ShowType type) : + SQLStatement(kStmtShow), + type(type), + name(nullptr) {} + + ShowStatement::~ShowStatement() { + 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/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 similarity index 90% rename from test/valid_queries.sql rename to test/queries/queries-good.sql index ef08be0..ec0d431 100644 --- a/test/valid_queries.sql +++ b/test/queries/queries-good.sql @@ -1,3 +1,5 @@ +# 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 @@ -47,12 +49,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/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..9c9cc82 100644 --- a/test/sql_tests.cpp +++ b/test/sql_tests.cpp @@ -127,6 +127,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