From 87e45c7931daeed3518720161fe74090ac14198e Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 16 Jan 2021 15:09:02 +0800 Subject: [PATCH] [TD-225]update sql.c --- src/inc/ttokendef.h | 198 ++-- src/query/src/sql.c | 2760 ++++++++++++++++++++++--------------------- 2 files changed, 1530 insertions(+), 1428 deletions(-) diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index bc11f84e62..a4de75e938 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -17,105 +17,105 @@ #define TDENGINE_TTOKENDEF_H -#define TK_ID 1 -#define TK_BOOL 2 -#define TK_TINYINT 3 -#define TK_SMALLINT 4 -#define TK_INTEGER 5 -#define TK_BIGINT 6 -#define TK_FLOAT 7 -#define TK_DOUBLE 8 -#define TK_STRING 9 -#define TK_TIMESTAMP 10 -#define TK_BINARY 11 -#define TK_NCHAR 12 -#define TK_OR 13 -#define TK_AND 14 -#define TK_NOT 15 -#define TK_EQ 16 -#define TK_NE 17 -#define TK_ISNULL 18 -#define TK_NOTNULL 19 -#define TK_IS 20 -#define TK_LIKE 21 -#define TK_GLOB 22 -#define TK_BETWEEN 23 -#define TK_IN 24 -#define TK_GT 25 -#define TK_GE 26 -#define TK_LT 27 -#define TK_LE 28 -#define TK_BITAND 29 -#define TK_BITOR 30 -#define TK_LSHIFT 31 -#define TK_RSHIFT 32 -#define TK_PLUS 33 -#define TK_MINUS 34 -#define TK_DIVIDE 35 -#define TK_TIMES 36 -#define TK_STAR 37 -#define TK_SLASH 38 -#define TK_REM 39 -#define TK_CONCAT 40 -#define TK_UMINUS 41 -#define TK_UPLUS 42 -#define TK_BITNOT 43 -#define TK_SHOW 44 -#define TK_DATABASES 45 -#define TK_MNODES 46 -#define TK_DNODES 47 -#define TK_ACCOUNTS 48 -#define TK_USERS 49 -#define TK_MODULES 50 -#define TK_QUERIES 51 -#define TK_CONNECTIONS 52 -#define TK_STREAMS 53 -#define TK_VARIABLES 54 -#define TK_SCORES 55 -#define TK_GRANTS 56 -#define TK_VNODES 57 -#define TK_IPTOKEN 58 -#define TK_DOT 59 -#define TK_CREATE 60 -#define TK_TABLE 61 -#define TK_DATABASE 62 -#define TK_TABLES 63 -#define TK_STABLES 64 -#define TK_VGROUPS 65 -#define TK_DROP 66 -#define TK_DNODE 67 -#define TK_USER 68 -#define TK_ACCOUNT 69 -#define TK_USE 70 -#define TK_DESCRIBE 71 -#define TK_ALTER 72 -#define TK_PASS 73 -#define TK_PRIVILEGE 74 -#define TK_LOCAL 75 -#define TK_IF 76 -#define TK_EXISTS 77 -#define TK_PPS 78 -#define TK_TSERIES 79 -#define TK_DBS 80 -#define TK_STORAGE 81 -#define TK_QTIME 82 -#define TK_CONNS 83 -#define TK_STATE 84 -#define TK_KEEP 85 -#define TK_CACHE 86 -#define TK_REPLICA 87 -#define TK_QUORUM 88 -#define TK_DAYS 89 -#define TK_MINROWS 90 -#define TK_MAXROWS 91 -#define TK_BLOCKS 92 -#define TK_CTIME 93 -#define TK_WAL 94 -#define TK_FSYNC 95 -#define TK_COMP 96 -#define TK_PRECISION 97 -#define TK_UPDATE 98 -#define TK_CACHELAST 99 +#define TK_ID 1 +#define TK_BOOL 2 +#define TK_TINYINT 3 +#define TK_SMALLINT 4 +#define TK_INTEGER 5 +#define TK_BIGINT 6 +#define TK_FLOAT 7 +#define TK_DOUBLE 8 +#define TK_STRING 9 +#define TK_TIMESTAMP 10 +#define TK_BINARY 11 +#define TK_NCHAR 12 +#define TK_OR 13 +#define TK_AND 14 +#define TK_NOT 15 +#define TK_EQ 16 +#define TK_NE 17 +#define TK_ISNULL 18 +#define TK_NOTNULL 19 +#define TK_IS 20 +#define TK_LIKE 21 +#define TK_GLOB 22 +#define TK_BETWEEN 23 +#define TK_IN 24 +#define TK_GT 25 +#define TK_GE 26 +#define TK_LT 27 +#define TK_LE 28 +#define TK_BITAND 29 +#define TK_BITOR 30 +#define TK_LSHIFT 31 +#define TK_RSHIFT 32 +#define TK_PLUS 33 +#define TK_MINUS 34 +#define TK_DIVIDE 35 +#define TK_TIMES 36 +#define TK_STAR 37 +#define TK_SLASH 38 +#define TK_REM 39 +#define TK_CONCAT 40 +#define TK_UMINUS 41 +#define TK_UPLUS 42 +#define TK_BITNOT 43 +#define TK_SHOW 44 +#define TK_DATABASES 45 +#define TK_MNODES 46 +#define TK_DNODES 47 +#define TK_ACCOUNTS 48 +#define TK_USERS 49 +#define TK_MODULES 50 +#define TK_QUERIES 51 +#define TK_CONNECTIONS 52 +#define TK_STREAMS 53 +#define TK_VARIABLES 54 +#define TK_SCORES 55 +#define TK_GRANTS 56 +#define TK_VNODES 57 +#define TK_IPTOKEN 58 +#define TK_DOT 59 +#define TK_CREATE 60 +#define TK_TABLE 61 +#define TK_DATABASE 62 +#define TK_TABLES 63 +#define TK_STABLES 64 +#define TK_VGROUPS 65 +#define TK_DROP 66 +#define TK_DNODE 67 +#define TK_USER 68 +#define TK_ACCOUNT 69 +#define TK_USE 70 +#define TK_DESCRIBE 71 +#define TK_ALTER 72 +#define TK_PASS 73 +#define TK_PRIVILEGE 74 +#define TK_LOCAL 75 +#define TK_IF 76 +#define TK_EXISTS 77 +#define TK_PPS 78 +#define TK_TSERIES 79 +#define TK_DBS 80 +#define TK_STORAGE 81 +#define TK_QTIME 82 +#define TK_CONNS 83 +#define TK_STATE 84 +#define TK_KEEP 85 +#define TK_CACHE 86 +#define TK_REPLICA 87 +#define TK_QUORUM 88 +#define TK_DAYS 89 +#define TK_MINROWS 90 +#define TK_MAXROWS 91 +#define TK_BLOCKS 92 +#define TK_CTIME 93 +#define TK_WAL 94 +#define TK_FSYNC 95 +#define TK_COMP 96 +#define TK_PRECISION 97 +#define TK_UPDATE 98 +#define TK_CACHELAST 99 #define TK_LP 100 #define TK_RP 101 #define TK_UNSIGNED 102 diff --git a/src/query/src/sql.c b/src/query/src/sql.c index f559c55922..f540e49646 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -1,10 +1,29 @@ -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. +/* +** 2000-05-29 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** Driver template for the LEMON parser generator. +** +** The "lemon" program processes an LALR(1) input grammar file, then uses +** this template to construct a parser. The "lemon" program inserts text +** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the +** interstitial "-" characters) contained in this template is changed into +** the value of the %name directive from the grammar. Otherwise, the content +** of this template is copied straight through into the generate parser +** source file. +** +** The following is the concatenation of all %include directives from the +** input grammar file: */ -/* First off, code is included that follows the "include" declaration -** in the input grammar file. */ #include -#line 23 "sql.y" +/************ Begin %include sections from the grammar ************************/ #include #include @@ -17,56 +36,66 @@ #include "ttokendef.h" #include "tutil.h" #include "tvariant.h" -#line 21 "sql.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* -** These constants (all generated automatically by the parser generator) -** specify the various kinds of tokens (terminals) that the parser -** understands. -** -** Each symbol here is a terminal symbol in the grammar. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control +/**************** End of %include directives **********************************/ +/* These constants specify the various numeric values for terminal symbols +** in a format understandable to "makeheaders". This section is blank unless +** "lemon" is run with the "-m" command-line option. +***************** Begin makeheaders token definitions *************************/ +/**************** End makeheaders token definitions ***************************/ + +/* The next sections is a series of control #defines. ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. +** YYCODETYPE is the data type used to store the integer codes +** that represent terminal and non-terminal symbols. +** "unsigned char" is used if there are fewer than +** 256 symbols. Larger types otherwise. +** YYNOCODE is a number of type YYCODETYPE that is not used for +** any terminal or nonterminal symbol. ** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** ParseTOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** (also known as: "terminal symbols") have fall-back +** values which should be used if the original symbol +** would not parse. This permits keywords to sometimes +** be used as identifiers, for example. +** YYACTIONTYPE is the data type used for "action codes" - numbers +** that indicate what to do in response to the next +** token. +** ParseTOKENTYPE is the data type used for minor type for terminal +** symbols. Background: A "minor type" is a semantic +** value associated with a terminal or non-terminal +** symbols. For example, for an "ID" terminal symbol, +** the minor type might be the name of the identifier. +** Each non-terminal can have a different minor type. +** Terminal symbols all have the same minor type, though. +** This macros defines the minor type for terminal +** symbols. +** YYMINORTYPE is the data type used for all minor types. ** This is typically a union of many types, one of ** which is ParseTOKENTYPE. The entry in the union -** for base tokens is called "yy0". +** for terminal symbols is called "yy0". ** YYSTACKDEPTH is the maximum depth of the parser's stack. If ** zero the stack is dynamically sized using realloc() ** ParseARG_SDECL A static variable declaration for the %extra_argument ** ParseARG_PDECL A parameter declaration for the %extra_argument ** ParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. +** YYNSTATE the combined number of states. +** YYNRULE the number of rules in the grammar +** YYNTOKEN Number of terminal symbols +** YY_MAX_SHIFT Maximum value for shift actions +** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions +** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions +** YY_ERROR_ACTION The yy_action[] code for syntax error +** YY_ACCEPT_ACTION The yy_action[] code for accept +** YY_NO_ACTION The yy_action[] code for no-op +** YY_MIN_REDUCE Minimum value for reduce actions +** YY_MAX_REDUCE Maximum value for reduce actions */ +#ifndef INTERFACE +# define INTERFACE 1 +#endif +/************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int #define YYNOCODE 281 #define YYACTIONTYPE unsigned short int @@ -97,16 +126,19 @@ typedef union { #define ParseARG_PDECL ,SSqlInfo* pInfo #define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo #define ParseARG_STORE yypParser->pInfo = pInfo -#define YYNSTATE 433 -#define YYNRULE 242 #define YYFALLBACK 1 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) - -/* The yyzerominor constant is used to initialize instances of -** YYMINORTYPE objects to zero. */ -static const YYMINORTYPE yyzerominor = { 0 }; +#define YYNSTATE 259 +#define YYNRULE 242 +#define YYNTOKEN 210 +#define YY_MAX_SHIFT 258 +#define YY_MIN_SHIFTREDUCE 433 +#define YY_MAX_SHIFTREDUCE 674 +#define YY_ERROR_ACTION 675 +#define YY_ACCEPT_ACTION 676 +#define YY_NO_ACTION 677 +#define YY_MIN_REDUCE 678 +#define YY_MAX_REDUCE 919 +/************* End control #defines *******************************************/ /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. @@ -129,33 +161,35 @@ static const YYMINORTYPE yyzerominor = { 0 }; ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then +** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == YY_ERROR_ACTION A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == YY_ACCEPT_ACTION The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused +** N == YY_NO_ACTION No such action. Denotes unused ** slots in the yy_action[] table. ** +** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE +** and YY_MAX_REDUCE +** ** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as +** Given state S and lookahead X, the action is computed as either: ** -** yy_action[ yy_shift_ofst[S] + X ] +** (A) N = yy_action[ yy_shift_ofst[S] + X ] +** (B) N = yy_default[S] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** The (A) formula is preferred. The B formula is used instead if +** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X. ** -** The formula above is for computing the action when the lookahead is +** The formulas above are for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after ** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** the yy_shift_ofst[] array. ** ** The following are the tables generated in this section: ** @@ -167,252 +201,233 @@ static const YYMINORTYPE yyzerominor = { 0 }; ** yy_reduce_ofst[] For each state, the offset into yy_action for ** shifting non-terminals after a reduce. ** yy_default[] Default action for each state. -*/ -#define YY_ACTTAB_COUNT (690) +** +*********** Begin parsing tables **********************************************/ +#define YY_ACTTAB_COUNT (578) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 417, 36, 35, 79, 83, 34, 33, 32, 416, 88, - /* 10 */ 91, 82, 37, 38, 67, 39, 40, 85, 212, 174, - /* 20 */ 31, 676, 258, 211, 43, 41, 45, 42, 255, 254, - /* 30 */ 99, 172, 36, 35, 104, 102, 34, 33, 32, 37, - /* 40 */ 38, 433, 39, 40, 9, 320, 174, 31, 66, 121, - /* 50 */ 211, 43, 41, 45, 42, 34, 33, 32, 144, 36, - /* 60 */ 35, 180, 266, 34, 33, 32, 37, 38, 289, 39, - /* 70 */ 40, 356, 4, 174, 31, 144, 196, 211, 43, 41, - /* 80 */ 45, 42, 65, 419, 168, 290, 36, 35, 417, 307, - /* 90 */ 34, 33, 32, 90, 89, 38, 416, 39, 40, 233, - /* 100 */ 232, 174, 31, 52, 57, 211, 43, 41, 45, 42, - /* 110 */ 310, 321, 22, 318, 36, 35, 138, 136, 34, 33, - /* 120 */ 32, 53, 96, 95, 94, 306, 182, 308, 369, 230, - /* 130 */ 229, 134, 432, 431, 430, 429, 428, 427, 426, 425, - /* 140 */ 424, 423, 422, 421, 257, 101, 325, 186, 337, 336, - /* 150 */ 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, - /* 160 */ 324, 323, 420, 17, 224, 251, 250, 223, 222, 221, - /* 170 */ 249, 220, 248, 247, 246, 219, 245, 244, 39, 40, - /* 180 */ 23, 553, 174, 31, 189, 23, 211, 43, 41, 45, - /* 190 */ 42, 193, 192, 11, 10, 36, 35, 111, 274, 34, - /* 200 */ 33, 32, 173, 296, 19, 13, 305, 111, 300, 392, - /* 210 */ 299, 391, 173, 296, 78, 77, 305, 235, 300, 351, - /* 220 */ 299, 156, 231, 394, 351, 23, 397, 157, 396, 49, - /* 230 */ 395, 93, 92, 151, 170, 171, 286, 285, 210, 43, - /* 240 */ 41, 45, 42, 345, 170, 171, 134, 36, 35, 50, - /* 250 */ 144, 34, 33, 32, 183, 184, 208, 226, 62, 169, - /* 260 */ 290, 18, 178, 377, 351, 23, 379, 378, 281, 28, - /* 270 */ 206, 376, 268, 374, 373, 375, 370, 372, 371, 134, - /* 280 */ 3, 125, 17, 252, 251, 250, 73, 69, 72, 249, - /* 290 */ 195, 248, 247, 246, 319, 245, 244, 159, 390, 48, - /* 300 */ 389, 44, 177, 55, 351, 353, 388, 214, 317, 23, - /* 310 */ 295, 44, 24, 24, 297, 14, 291, 304, 302, 303, - /* 320 */ 301, 14, 181, 64, 297, 277, 278, 276, 393, 298, - /* 330 */ 15, 48, 108, 265, 417, 58, 105, 266, 81, 298, - /* 340 */ 111, 198, 416, 243, 28, 111, 267, 106, 358, 18, - /* 350 */ 179, 164, 166, 269, 352, 163, 256, 28, 100, 409, - /* 360 */ 48, 387, 386, 385, 384, 383, 382, 381, 380, 368, - /* 370 */ 367, 366, 365, 388, 364, 388, 363, 362, 361, 24, - /* 380 */ 357, 355, 354, 76, 74, 344, 47, 71, 343, 225, - /* 390 */ 342, 341, 340, 339, 68, 66, 16, 215, 338, 8, - /* 400 */ 213, 63, 309, 5, 199, 288, 282, 7, 21, 271, - /* 410 */ 6, 20, 279, 167, 194, 110, 202, 109, 198, 275, - /* 420 */ 56, 263, 262, 261, 191, 61, 190, 260, 188, 187, - /* 430 */ 259, 253, 1, 2, 103, 415, 130, 131, 98, 97, - /* 440 */ 133, 237, 410, 403, 240, 127, 316, 242, 28, 158, - /* 450 */ 30, 117, 119, 129, 132, 217, 70, 216, 128, 241, - /* 460 */ 238, 239, 359, 162, 236, 201, 80, 203, 116, 226, - /* 470 */ 205, 207, 51, 284, 204, 46, 60, 165, 59, 677, - /* 480 */ 139, 418, 414, 413, 412, 411, 137, 677, 408, 407, - /* 490 */ 406, 405, 404, 677, 135, 185, 118, 402, 677, 197, - /* 500 */ 115, 209, 401, 114, 234, 243, 113, 280, 112, 120, - /* 510 */ 315, 264, 87, 54, 86, 400, 398, 677, 200, 677, - /* 520 */ 84, 399, 677, 677, 29, 677, 677, 677, 287, 145, - /* 530 */ 677, 283, 176, 314, 677, 677, 141, 677, 25, 27, - /* 540 */ 360, 126, 350, 349, 75, 348, 228, 677, 346, 227, - /* 550 */ 677, 677, 26, 140, 677, 218, 322, 124, 123, 122, - /* 560 */ 107, 677, 273, 272, 677, 677, 677, 677, 677, 677, - /* 570 */ 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, - /* 580 */ 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, - /* 590 */ 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, - /* 600 */ 677, 677, 677, 677, 677, 677, 677, 677, 677, 270, - /* 610 */ 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, - /* 620 */ 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, - /* 630 */ 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, - /* 640 */ 677, 677, 677, 313, 175, 312, 311, 677, 677, 677, - /* 650 */ 677, 677, 677, 677, 347, 677, 677, 677, 677, 677, - /* 660 */ 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, - /* 670 */ 152, 142, 153, 155, 154, 150, 149, 147, 146, 161, - /* 680 */ 160, 677, 294, 293, 292, 148, 143, 677, 677, 12, + /* 0 */ 144, 476, 144, 23, 676, 258, 831, 549, 12, 477, + /* 10 */ 906, 169, 907, 37, 38, 820, 39, 40, 143, 23, + /* 20 */ 174, 31, 476, 476, 211, 43, 41, 45, 42, 164, + /* 30 */ 477, 477, 106, 36, 35, 233, 232, 34, 33, 32, + /* 40 */ 37, 38, 805, 39, 40, 820, 148, 174, 31, 163, + /* 50 */ 256, 211, 43, 41, 45, 42, 177, 166, 806, 196, + /* 60 */ 36, 35, 828, 903, 34, 33, 32, 434, 435, 436, + /* 70 */ 437, 438, 439, 440, 441, 442, 443, 444, 445, 257, + /* 80 */ 809, 226, 186, 37, 38, 719, 39, 40, 134, 199, + /* 90 */ 174, 31, 144, 798, 211, 43, 41, 45, 42, 111, + /* 100 */ 111, 168, 907, 36, 35, 57, 243, 34, 33, 32, + /* 110 */ 17, 224, 251, 250, 223, 222, 221, 249, 220, 248, + /* 120 */ 247, 246, 219, 245, 244, 179, 902, 778, 628, 766, + /* 130 */ 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, + /* 140 */ 777, 779, 780, 38, 18, 39, 40, 23, 809, 174, + /* 150 */ 31, 901, 28, 211, 43, 41, 45, 42, 111, 208, + /* 160 */ 859, 62, 36, 35, 23, 212, 34, 33, 32, 226, + /* 170 */ 39, 40, 180, 111, 174, 31, 160, 65, 211, 43, + /* 180 */ 41, 45, 42, 13, 178, 181, 806, 36, 35, 189, + /* 190 */ 584, 34, 33, 32, 173, 641, 193, 192, 632, 156, + /* 200 */ 635, 231, 638, 806, 161, 157, 797, 22, 799, 93, + /* 210 */ 92, 151, 173, 641, 609, 610, 632, 807, 635, 860, + /* 220 */ 638, 206, 17, 252, 251, 250, 170, 171, 23, 249, + /* 230 */ 210, 248, 247, 246, 63, 245, 244, 182, 9, 18, + /* 240 */ 230, 229, 66, 121, 170, 171, 809, 28, 784, 67, + /* 250 */ 146, 782, 783, 255, 254, 99, 785, 644, 787, 788, + /* 260 */ 786, 81, 789, 790, 588, 235, 243, 806, 195, 916, + /* 270 */ 43, 41, 45, 42, 728, 159, 596, 134, 36, 35, + /* 280 */ 800, 108, 34, 33, 32, 568, 720, 64, 565, 134, + /* 290 */ 566, 630, 567, 44, 79, 83, 808, 3, 125, 58, + /* 300 */ 88, 91, 82, 73, 69, 72, 640, 147, 85, 36, + /* 310 */ 35, 44, 105, 34, 33, 32, 183, 184, 576, 581, + /* 320 */ 28, 639, 138, 136, 640, 19, 198, 631, 96, 95, + /* 330 */ 94, 34, 33, 32, 172, 600, 601, 49, 660, 639, + /* 340 */ 48, 15, 642, 14, 634, 52, 637, 14, 633, 557, + /* 350 */ 636, 214, 149, 558, 24, 150, 24, 50, 48, 78, + /* 360 */ 77, 154, 55, 53, 548, 572, 570, 573, 571, 155, + /* 370 */ 11, 10, 90, 89, 153, 4, 104, 102, 142, 152, + /* 380 */ 145, 870, 869, 175, 822, 830, 29, 866, 865, 176, + /* 390 */ 569, 234, 837, 839, 107, 852, 851, 122, 123, 120, + /* 400 */ 124, 730, 595, 218, 28, 140, 26, 197, 227, 727, + /* 410 */ 228, 915, 75, 914, 912, 126, 748, 27, 25, 141, + /* 420 */ 717, 84, 715, 86, 87, 103, 54, 819, 713, 712, + /* 430 */ 185, 200, 135, 710, 709, 708, 707, 706, 137, 704, + /* 440 */ 702, 165, 700, 698, 696, 204, 139, 51, 46, 112, + /* 450 */ 209, 207, 205, 203, 201, 59, 30, 60, 853, 80, + /* 460 */ 236, 237, 238, 239, 240, 241, 242, 253, 674, 188, + /* 470 */ 162, 187, 216, 217, 673, 158, 190, 191, 70, 672, + /* 480 */ 665, 194, 711, 198, 578, 97, 98, 597, 705, 129, + /* 490 */ 56, 128, 749, 127, 130, 131, 133, 132, 1, 697, + /* 500 */ 109, 61, 2, 167, 202, 804, 117, 113, 114, 602, + /* 510 */ 115, 116, 118, 119, 110, 20, 6, 7, 643, 21, + /* 520 */ 5, 8, 645, 16, 68, 213, 517, 215, 513, 66, + /* 530 */ 511, 510, 509, 506, 480, 225, 74, 47, 71, 76, + /* 540 */ 24, 551, 550, 547, 501, 499, 491, 497, 493, 495, + /* 550 */ 489, 487, 519, 518, 516, 515, 514, 512, 508, 507, + /* 560 */ 48, 478, 449, 447, 678, 677, 677, 677, 677, 677, + /* 570 */ 677, 677, 677, 677, 677, 677, 100, 101, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 1, 33, 34, 61, 62, 37, 38, 39, 9, 67, - /* 10 */ 68, 69, 13, 14, 219, 16, 17, 75, 15, 20, - /* 20 */ 21, 211, 212, 24, 25, 26, 27, 28, 63, 64, - /* 30 */ 65, 59, 33, 34, 61, 62, 37, 38, 39, 13, - /* 40 */ 14, 0, 16, 17, 100, 250, 20, 21, 104, 105, - /* 50 */ 24, 25, 26, 27, 28, 37, 38, 39, 269, 33, - /* 60 */ 34, 66, 252, 37, 38, 39, 13, 14, 279, 16, - /* 70 */ 17, 5, 100, 20, 21, 269, 266, 24, 25, 26, - /* 80 */ 27, 28, 219, 59, 278, 279, 33, 34, 1, 1, - /* 90 */ 37, 38, 39, 73, 74, 14, 9, 16, 17, 33, - /* 100 */ 34, 20, 21, 106, 105, 24, 25, 26, 27, 28, - /* 110 */ 107, 248, 249, 250, 33, 34, 61, 62, 37, 38, - /* 120 */ 39, 124, 67, 68, 69, 37, 131, 101, 218, 134, - /* 130 */ 135, 221, 45, 46, 47, 48, 49, 50, 51, 52, - /* 140 */ 53, 54, 55, 56, 57, 21, 230, 60, 232, 233, - /* 150 */ 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, - /* 160 */ 244, 245, 58, 85, 86, 87, 88, 89, 90, 91, - /* 170 */ 92, 93, 94, 95, 96, 97, 98, 99, 16, 17, - /* 180 */ 214, 0, 20, 21, 130, 214, 24, 25, 26, 27, - /* 190 */ 28, 137, 138, 132, 133, 33, 34, 214, 106, 37, - /* 200 */ 38, 39, 1, 2, 112, 44, 5, 214, 7, 5, - /* 210 */ 9, 7, 1, 2, 132, 133, 5, 251, 7, 253, - /* 220 */ 9, 60, 251, 2, 253, 214, 5, 66, 7, 106, - /* 230 */ 9, 70, 71, 72, 33, 34, 119, 120, 37, 25, - /* 240 */ 26, 27, 28, 218, 33, 34, 221, 33, 34, 126, - /* 250 */ 269, 37, 38, 39, 33, 34, 273, 76, 275, 278, - /* 260 */ 279, 100, 251, 230, 253, 214, 233, 234, 275, 108, - /* 270 */ 277, 238, 37, 240, 241, 242, 218, 244, 245, 221, - /* 280 */ 61, 62, 85, 231, 87, 88, 67, 68, 69, 92, - /* 290 */ 129, 94, 95, 96, 101, 98, 99, 136, 5, 106, - /* 300 */ 7, 100, 251, 100, 253, 102, 254, 101, 101, 214, - /* 310 */ 101, 100, 106, 106, 113, 106, 101, 5, 5, 7, - /* 320 */ 7, 106, 214, 255, 113, 101, 101, 101, 107, 128, - /* 330 */ 106, 106, 106, 101, 1, 267, 100, 252, 73, 128, - /* 340 */ 214, 109, 9, 78, 108, 214, 111, 214, 253, 100, - /* 350 */ 231, 266, 231, 214, 246, 213, 214, 108, 21, 77, - /* 360 */ 106, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 370 */ 5, 5, 5, 254, 5, 254, 5, 5, 5, 106, - /* 380 */ 101, 5, 5, 133, 133, 77, 16, 73, 5, 15, - /* 390 */ 5, 5, 5, 5, 73, 104, 100, 103, 9, 100, - /* 400 */ 103, 275, 107, 100, 271, 101, 275, 118, 106, 270, - /* 410 */ 118, 106, 101, 1, 130, 100, 100, 100, 109, 101, - /* 420 */ 110, 101, 86, 5, 5, 106, 139, 5, 5, 139, - /* 430 */ 5, 76, 220, 217, 59, 215, 226, 224, 216, 216, - /* 440 */ 222, 49, 215, 215, 53, 228, 252, 79, 108, 215, - /* 450 */ 127, 259, 257, 223, 225, 215, 219, 215, 227, 81, - /* 460 */ 80, 82, 229, 215, 83, 114, 84, 115, 260, 76, - /* 470 */ 116, 121, 125, 215, 272, 122, 215, 272, 215, 280, - /* 480 */ 214, 214, 214, 214, 214, 214, 214, 280, 214, 214, - /* 490 */ 214, 214, 214, 280, 214, 214, 258, 214, 280, 252, - /* 500 */ 261, 117, 214, 262, 247, 78, 263, 113, 264, 256, - /* 510 */ 265, 252, 214, 123, 214, 214, 254, 280, 272, 280, - /* 520 */ 214, 214, 280, 280, 268, 280, 280, 280, 276, 269, - /* 530 */ 280, 276, 247, 247, 280, 280, 214, 280, 214, 214, - /* 540 */ 214, 214, 214, 214, 214, 214, 214, 280, 214, 214, - /* 550 */ 280, 280, 214, 214, 280, 214, 214, 214, 214, 214, - /* 560 */ 214, 280, 214, 214, 280, 280, 280, 280, 280, 280, - /* 570 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 0 */ 269, 1, 269, 214, 211, 212, 214, 5, 269, 9, + /* 10 */ 279, 278, 279, 13, 14, 252, 16, 17, 269, 214, + /* 20 */ 20, 21, 1, 1, 24, 25, 26, 27, 28, 266, + /* 30 */ 9, 9, 214, 33, 34, 33, 34, 37, 38, 39, + /* 40 */ 13, 14, 253, 16, 17, 252, 269, 20, 21, 213, + /* 50 */ 214, 24, 25, 26, 27, 28, 251, 231, 253, 266, + /* 60 */ 33, 34, 270, 269, 37, 38, 39, 45, 46, 47, + /* 70 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + /* 80 */ 254, 76, 60, 13, 14, 218, 16, 17, 221, 271, + /* 90 */ 20, 21, 269, 0, 24, 25, 26, 27, 28, 214, + /* 100 */ 214, 278, 279, 33, 34, 105, 78, 37, 38, 39, + /* 110 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + /* 120 */ 95, 96, 97, 98, 99, 231, 269, 230, 101, 232, + /* 130 */ 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + /* 140 */ 243, 244, 245, 14, 100, 16, 17, 214, 254, 20, + /* 150 */ 21, 269, 108, 24, 25, 26, 27, 28, 214, 273, + /* 160 */ 275, 275, 33, 34, 214, 15, 37, 38, 39, 76, + /* 170 */ 16, 17, 66, 214, 20, 21, 269, 219, 24, 25, + /* 180 */ 26, 27, 28, 44, 251, 214, 253, 33, 34, 130, + /* 190 */ 37, 37, 38, 39, 1, 2, 137, 138, 5, 60, + /* 200 */ 7, 251, 9, 253, 269, 66, 248, 249, 250, 70, + /* 210 */ 71, 72, 1, 2, 119, 120, 5, 246, 7, 275, + /* 220 */ 9, 277, 85, 231, 87, 88, 33, 34, 214, 92, + /* 230 */ 37, 94, 95, 96, 275, 98, 99, 131, 100, 100, + /* 240 */ 134, 135, 104, 105, 33, 34, 254, 108, 230, 219, + /* 250 */ 269, 233, 234, 63, 64, 65, 238, 107, 240, 241, + /* 260 */ 242, 73, 244, 245, 111, 251, 78, 253, 129, 254, + /* 270 */ 25, 26, 27, 28, 218, 136, 101, 221, 33, 34, + /* 280 */ 250, 106, 37, 38, 39, 2, 218, 255, 5, 221, + /* 290 */ 7, 1, 9, 100, 61, 62, 254, 61, 62, 267, + /* 300 */ 67, 68, 69, 67, 68, 69, 113, 269, 75, 33, + /* 310 */ 34, 100, 100, 37, 38, 39, 33, 34, 101, 106, + /* 320 */ 108, 128, 61, 62, 113, 112, 109, 37, 67, 68, + /* 330 */ 69, 37, 38, 39, 59, 101, 101, 106, 101, 128, + /* 340 */ 106, 106, 101, 106, 5, 106, 7, 106, 5, 101, + /* 350 */ 7, 101, 269, 101, 106, 269, 106, 126, 106, 132, + /* 360 */ 133, 269, 100, 124, 102, 5, 5, 7, 7, 269, + /* 370 */ 132, 133, 73, 74, 269, 100, 61, 62, 269, 269, + /* 380 */ 269, 247, 247, 247, 252, 214, 268, 247, 247, 247, + /* 390 */ 107, 247, 214, 214, 214, 276, 276, 214, 214, 256, + /* 400 */ 214, 214, 113, 214, 108, 214, 214, 252, 214, 214, + /* 410 */ 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, + /* 420 */ 214, 214, 214, 214, 214, 59, 123, 265, 214, 214, + /* 430 */ 214, 272, 214, 214, 214, 214, 214, 214, 214, 214, + /* 440 */ 214, 272, 214, 214, 214, 272, 214, 125, 122, 264, + /* 450 */ 117, 121, 116, 115, 114, 215, 127, 215, 215, 84, + /* 460 */ 83, 49, 80, 82, 53, 81, 79, 76, 5, 5, + /* 470 */ 215, 139, 215, 215, 5, 215, 139, 5, 219, 5, + /* 480 */ 86, 130, 215, 109, 101, 216, 216, 101, 215, 223, + /* 490 */ 110, 227, 229, 228, 226, 224, 222, 225, 220, 215, + /* 500 */ 100, 106, 217, 1, 100, 252, 259, 263, 262, 101, + /* 510 */ 261, 260, 258, 257, 100, 106, 118, 118, 101, 106, + /* 520 */ 100, 100, 107, 100, 73, 103, 9, 103, 5, 104, + /* 530 */ 5, 5, 5, 5, 77, 15, 133, 16, 73, 133, + /* 540 */ 106, 5, 5, 101, 5, 5, 5, 5, 5, 5, + /* 550 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + /* 560 */ 106, 77, 59, 58, 0, 280, 280, 280, 280, 280, + /* 570 */ 280, 280, 280, 280, 280, 280, 21, 21, 280, 280, /* 580 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, /* 590 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 600 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 214, + /* 600 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, /* 610 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, /* 620 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, /* 630 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 640 */ 280, 280, 280, 247, 247, 247, 247, 280, 280, 280, - /* 650 */ 280, 280, 280, 280, 254, 280, 280, 280, 280, 280, + /* 640 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 650 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, /* 660 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 670 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, - /* 680 */ 269, 280, 269, 269, 269, 269, 269, 280, 280, 269, + /* 670 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 680 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 690 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 700 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 710 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 720 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 730 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 740 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 750 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 760 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 770 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + /* 780 */ 280, 280, 280, 280, 280, 280, 280, 280, }; -#define YY_SHIFT_USE_DFLT (-59) -#define YY_SHIFT_COUNT (258) -#define YY_SHIFT_MIN (-58) -#define YY_SHIFT_MAX (427) -static const short yy_shift_ofst[] = { - /* 0 */ 161, 78, 197, 393, 201, 211, 333, 333, 333, 333, - /* 10 */ 333, 333, -1, 87, 211, 221, 221, 221, 249, 333, - /* 20 */ 333, 333, 181, 333, 333, 265, 427, 427, -59, 211, +#define YY_SHIFT_COUNT (258) +#define YY_SHIFT_MIN (0) +#define YY_SHIFT_MAX (564) +static const unsigned short int yy_shift_ofst[] = { + /* 0 */ 139, 25, 137, 5, 193, 211, 21, 21, 21, 21, + /* 10 */ 21, 21, 0, 22, 211, 283, 283, 283, 44, 21, + /* 20 */ 21, 21, 93, 21, 21, 188, 28, 28, 578, 211, /* 30 */ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, - /* 40 */ 211, 211, 211, 211, 211, 211, 211, 221, 221, 66, - /* 50 */ 66, 66, 66, 66, 66, 66, 236, 333, 235, 333, - /* 60 */ 333, 333, 117, 117, 92, 333, 333, 333, 333, 333, - /* 70 */ 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, - /* 80 */ 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, - /* 90 */ 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, - /* 100 */ 333, 333, 333, 333, 333, 340, 375, 375, 394, 394, - /* 110 */ 394, 375, 390, 347, 353, 384, 350, 354, 352, 351, - /* 120 */ 323, 340, 375, 375, 375, 393, 375, 382, 381, 392, - /* 130 */ 380, 379, 391, 378, 368, 375, 355, 375, 355, 375, - /* 140 */ -59, -59, 26, 53, 53, 53, 81, 162, 214, 214, - /* 150 */ 214, -58, -32, -32, -32, -32, 219, 55, -5, 54, - /* 160 */ 18, 18, -56, -35, 232, 226, 225, 224, 215, 209, - /* 170 */ 313, 312, 88, -28, 3, 123, -3, 207, 206, 193, - /* 180 */ 82, 203, 61, 293, 204, 20, -27, 425, 290, 423, - /* 190 */ 422, 287, 419, 418, 336, 284, 309, 320, 310, 319, - /* 200 */ 318, 317, 412, 316, 311, 315, 305, 292, 302, 289, - /* 210 */ 304, 303, 295, 299, 297, 296, 294, 291, 321, 389, - /* 220 */ 388, 387, 386, 385, 383, 308, 374, 314, 370, 251, - /* 230 */ 250, 273, 377, 376, 279, 273, 373, 372, 371, 369, - /* 240 */ 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, - /* 250 */ 357, 356, 254, 282, 337, 124, 24, 104, 41, + /* 40 */ 211, 211, 211, 211, 211, 211, 211, 283, 283, 2, + /* 50 */ 2, 2, 2, 2, 2, 2, 212, 21, 153, 21, + /* 60 */ 21, 21, 95, 95, 213, 21, 21, 21, 21, 21, + /* 70 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + /* 80 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + /* 90 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + /* 100 */ 21, 21, 21, 21, 21, 296, 366, 366, 289, 289, + /* 110 */ 289, 366, 303, 322, 326, 333, 330, 336, 338, 340, + /* 120 */ 329, 296, 366, 366, 366, 5, 366, 375, 377, 412, + /* 130 */ 382, 381, 411, 384, 387, 366, 391, 366, 391, 366, + /* 140 */ 578, 578, 27, 70, 70, 70, 129, 154, 245, 245, + /* 150 */ 245, 233, 276, 276, 276, 276, 236, 261, 106, 59, + /* 160 */ 294, 294, 138, 190, 217, 175, 234, 235, 237, 241, + /* 170 */ 339, 343, 290, 275, 150, 231, 239, 248, 250, 252, + /* 180 */ 227, 262, 238, 360, 361, 299, 315, 463, 332, 464, + /* 190 */ 469, 337, 472, 474, 394, 351, 374, 383, 380, 395, + /* 200 */ 386, 400, 502, 404, 408, 414, 409, 398, 413, 399, + /* 210 */ 417, 420, 415, 421, 422, 423, 424, 425, 451, 517, + /* 220 */ 523, 525, 526, 527, 528, 457, 520, 465, 521, 403, + /* 230 */ 406, 434, 536, 537, 442, 434, 539, 540, 541, 542, + /* 240 */ 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, + /* 250 */ 553, 554, 454, 484, 555, 556, 503, 505, 564, }; -#define YY_REDUCE_USE_DFLT (-212) #define YY_REDUCE_COUNT (141) -#define YY_REDUCE_MIN (-211) -#define YY_REDUCE_MAX (420) +#define YY_REDUCE_MIN (-269) +#define YY_REDUCE_MAX (285) static const short yy_reduce_ofst[] = { - /* 0 */ -190, -84, 33, -137, -19, -194, -7, -17, 51, 11, - /* 10 */ -29, -34, 139, 142, -211, 121, 119, 52, 85, 133, - /* 20 */ 131, 126, -205, 108, 95, 58, 25, -90, 68, 420, - /* 30 */ 417, 416, 415, 414, 413, 411, 410, 409, 408, 407, - /* 40 */ 406, 405, 404, 403, 402, 401, 260, 400, 262, 399, - /* 50 */ 398, 397, 396, 286, 285, 257, 259, 395, 256, 349, - /* 60 */ 348, 346, 255, 252, 253, 345, 344, 343, 342, 341, - /* 70 */ 339, 338, 335, 334, 332, 331, 330, 329, 328, 327, - /* 80 */ 326, 325, 324, 322, 307, 306, 301, 300, 298, 288, - /* 90 */ 283, 281, 280, 278, 277, 276, 275, 274, 272, 271, - /* 100 */ 270, 269, 268, 267, 266, 247, 263, 261, 246, 205, - /* 110 */ 202, 258, 245, 244, 243, 241, 239, 208, 192, 238, - /* 120 */ 195, 194, 248, 242, 240, 237, 234, 233, 217, 231, - /* 130 */ 230, 210, 213, 229, 218, 228, 223, 227, 222, 220, - /* 140 */ 212, 216, + /* 0 */ -207, -103, 18, -42, -267, -177, -56, -114, -195, -67, + /* 10 */ -50, 14, -208, -164, -269, -174, -106, -8, -237, -182, + /* 20 */ -115, -41, 30, -29, -211, -133, 56, 68, 32, -261, + /* 30 */ -251, -223, -206, -143, -118, -93, -65, -19, 38, 83, + /* 40 */ 86, 92, 100, 105, 109, 110, 111, 15, 42, 134, + /* 50 */ 135, 136, 140, 141, 142, 144, 132, 171, 118, 178, + /* 60 */ 179, 180, 119, 120, 143, 183, 184, 186, 187, 189, + /* 70 */ 191, 192, 194, 195, 196, 197, 198, 199, 200, 201, + /* 80 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 214, + /* 90 */ 215, 216, 218, 219, 220, 221, 222, 223, 224, 225, + /* 100 */ 226, 228, 229, 230, 232, 155, 240, 242, 159, 169, + /* 110 */ 173, 243, 162, 185, 244, 246, 249, 251, 247, 254, + /* 120 */ 256, 253, 255, 257, 258, 259, 260, 263, 265, 264, + /* 130 */ 266, 268, 271, 272, 274, 267, 269, 273, 270, 284, + /* 140 */ 278, 285, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 675, 484, 473, 481, 664, 664, 675, 675, 675, 675, - /* 10 */ 675, 675, 587, 448, 664, 675, 675, 675, 675, 675, - /* 20 */ 675, 675, 481, 675, 675, 486, 486, 486, 582, 675, + /* 0 */ 675, 729, 718, 726, 909, 909, 675, 675, 675, 675, + /* 10 */ 675, 675, 832, 693, 909, 675, 675, 675, 675, 675, + /* 20 */ 675, 675, 726, 675, 675, 731, 731, 731, 827, 675, /* 30 */ 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, /* 40 */ 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, - /* 50 */ 675, 675, 675, 675, 675, 675, 675, 675, 589, 591, - /* 60 */ 593, 675, 611, 611, 580, 675, 675, 675, 675, 675, + /* 50 */ 675, 675, 675, 675, 675, 675, 675, 675, 834, 836, + /* 60 */ 838, 675, 856, 856, 825, 675, 675, 675, 675, 675, /* 70 */ 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, - /* 80 */ 675, 675, 675, 675, 471, 675, 469, 675, 675, 675, - /* 90 */ 675, 675, 675, 675, 675, 675, 675, 675, 675, 458, - /* 100 */ 675, 675, 675, 675, 675, 675, 450, 450, 675, 675, - /* 110 */ 675, 450, 618, 622, 616, 604, 612, 603, 599, 598, - /* 120 */ 626, 675, 450, 450, 450, 481, 450, 502, 500, 498, - /* 130 */ 490, 496, 492, 494, 488, 450, 479, 450, 479, 450, - /* 140 */ 520, 536, 675, 627, 663, 617, 653, 652, 659, 651, - /* 150 */ 650, 675, 646, 647, 649, 648, 675, 675, 675, 675, - /* 160 */ 655, 654, 675, 675, 675, 675, 675, 675, 675, 675, - /* 170 */ 675, 675, 675, 629, 675, 623, 619, 675, 675, 675, - /* 180 */ 675, 546, 675, 675, 675, 675, 675, 675, 675, 675, - /* 190 */ 675, 675, 675, 675, 675, 675, 579, 675, 675, 590, - /* 200 */ 675, 675, 675, 675, 675, 675, 613, 675, 605, 675, - /* 210 */ 675, 675, 675, 675, 556, 675, 675, 675, 675, 675, + /* 80 */ 675, 675, 675, 675, 716, 675, 714, 675, 675, 675, + /* 90 */ 675, 675, 675, 675, 675, 675, 675, 675, 675, 703, + /* 100 */ 675, 675, 675, 675, 675, 675, 695, 695, 675, 675, + /* 110 */ 675, 695, 863, 867, 861, 849, 857, 848, 844, 843, + /* 120 */ 871, 675, 695, 695, 695, 726, 695, 747, 745, 743, + /* 130 */ 735, 741, 737, 739, 733, 695, 724, 695, 724, 695, + /* 140 */ 765, 781, 675, 872, 908, 862, 898, 897, 904, 896, + /* 150 */ 895, 675, 891, 892, 894, 893, 675, 675, 675, 675, + /* 160 */ 900, 899, 675, 675, 675, 675, 675, 675, 675, 675, + /* 170 */ 675, 675, 675, 874, 675, 868, 864, 675, 675, 675, + /* 180 */ 675, 791, 675, 675, 675, 675, 675, 675, 675, 675, + /* 190 */ 675, 675, 675, 675, 675, 675, 824, 675, 675, 835, + /* 200 */ 675, 675, 675, 675, 675, 675, 858, 675, 850, 675, + /* 210 */ 675, 675, 675, 675, 801, 675, 675, 675, 675, 675, /* 220 */ 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, - /* 230 */ 675, 668, 675, 675, 675, 666, 675, 675, 675, 675, + /* 230 */ 675, 913, 675, 675, 675, 911, 675, 675, 675, 675, /* 240 */ 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, - /* 250 */ 675, 675, 505, 675, 456, 454, 675, 446, 675, 674, - /* 260 */ 673, 672, 665, 578, 577, 576, 575, 588, 584, 586, - /* 270 */ 585, 583, 592, 594, 581, 597, 596, 601, 600, 602, - /* 280 */ 595, 615, 614, 607, 608, 610, 609, 606, 643, 661, - /* 290 */ 662, 660, 658, 657, 656, 642, 641, 640, 639, 638, - /* 300 */ 635, 637, 634, 636, 633, 632, 631, 630, 628, 645, - /* 310 */ 644, 625, 624, 621, 620, 574, 559, 557, 554, 558, - /* 320 */ 555, 552, 485, 535, 534, 533, 532, 531, 530, 529, - /* 330 */ 528, 527, 526, 525, 524, 523, 522, 521, 517, 513, - /* 340 */ 511, 510, 509, 506, 480, 483, 482, 671, 670, 669, - /* 350 */ 667, 561, 562, 548, 551, 550, 549, 547, 560, 504, - /* 360 */ 503, 501, 499, 491, 497, 493, 495, 489, 487, 475, - /* 370 */ 474, 545, 544, 543, 542, 541, 540, 539, 538, 537, - /* 380 */ 519, 518, 516, 515, 514, 512, 508, 507, 564, 573, - /* 390 */ 572, 571, 570, 569, 568, 567, 566, 565, 563, 472, - /* 400 */ 470, 468, 467, 466, 465, 464, 463, 462, 461, 478, - /* 410 */ 460, 459, 457, 455, 453, 452, 477, 476, 451, 449, - /* 420 */ 447, 445, 444, 443, 442, 441, 440, 439, 438, 437, - /* 430 */ 436, 435, 434, + /* 250 */ 675, 675, 750, 675, 701, 699, 675, 691, 675, }; +/********** End of lemon-generated parsing tables *****************************/ -/* The next table maps tokens into fallback tokens. If a construct -** like the following: +/* The next table maps tokens (terminal symbols) into fallback tokens. +** If a construct like the following: ** ** %fallback ID X Y Z. ** @@ -420,6 +435,10 @@ static const YYACTIONTYPE yy_default[] = { ** and Z. Whenever one of the tokens X, Y, or Z is input to the parser ** but it does not parse, the type of the token is changed to ID and ** the parse is retried before an error is thrown. +** +** This feature can be used, for example, to cause some keywords in a language +** to revert to identifiers if they keyword does not apply in the context where +** it appears. */ #ifdef YYFALLBACK static const YYCODETYPE yyFallback[] = { @@ -647,9 +666,13 @@ static const YYCODETYPE yyFallback[] = { ** + The semantic value stored at this level of the stack. This is ** the information used by the action routines in the grammar. ** It is sometimes called the "minor" token. +** +** After the "shift" half of a SHIFTREDUCE action, the stateno field +** actually contains the reduce action for the second half of the +** SHIFTREDUCE. */ struct yyStackEntry { - YYACTIONTYPE stateno; /* The state-number */ + YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */ YYCODETYPE major; /* The major token value. This is the code ** number for the token at this stack level */ YYMINORTYPE minor; /* The user-supplied minor token value. This @@ -660,17 +683,21 @@ typedef struct yyStackEntry yyStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ struct yyParser { - int yyidx; /* Index of top element in stack */ + yyStackEntry *yytos; /* Pointer to top element of the stack */ #ifdef YYTRACKMAXSTACKDEPTH - int yyidxMax; /* Maximum value of yyidx */ + int yyhwm; /* High-water mark of the stack */ #endif +#ifndef YYNOERRORRECOVERY int yyerrcnt; /* Shifts left before out of the error */ +#endif ParseARG_SDECL /* A place to hold %extra_argument */ #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ + yyStackEntry yystk0; /* First stack entry */ #else yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ + yyStackEntry *yystackEnd; /* Last entry in the stack */ #endif }; typedef struct yyParser yyParser; @@ -707,82 +734,292 @@ void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ } #endif /* NDEBUG */ -#ifndef NDEBUG +#if defined(YYCOVERAGE) || !defined(NDEBUG) /* For tracing shifts, the names of all terminals and nonterminals ** are required. The following table supplies these names */ static const char *const yyTokenName[] = { - "$", "ID", "BOOL", "TINYINT", - "SMALLINT", "INTEGER", "BIGINT", "FLOAT", - "DOUBLE", "STRING", "TIMESTAMP", "BINARY", - "NCHAR", "OR", "AND", "NOT", - "EQ", "NE", "ISNULL", "NOTNULL", - "IS", "LIKE", "GLOB", "BETWEEN", - "IN", "GT", "GE", "LT", - "LE", "BITAND", "BITOR", "LSHIFT", - "RSHIFT", "PLUS", "MINUS", "DIVIDE", - "TIMES", "STAR", "SLASH", "REM", - "CONCAT", "UMINUS", "UPLUS", "BITNOT", - "SHOW", "DATABASES", "MNODES", "DNODES", - "ACCOUNTS", "USERS", "MODULES", "QUERIES", - "CONNECTIONS", "STREAMS", "VARIABLES", "SCORES", - "GRANTS", "VNODES", "IPTOKEN", "DOT", - "CREATE", "TABLE", "DATABASE", "TABLES", - "STABLES", "VGROUPS", "DROP", "DNODE", - "USER", "ACCOUNT", "USE", "DESCRIBE", - "ALTER", "PASS", "PRIVILEGE", "LOCAL", - "IF", "EXISTS", "PPS", "TSERIES", - "DBS", "STORAGE", "QTIME", "CONNS", - "STATE", "KEEP", "CACHE", "REPLICA", - "QUORUM", "DAYS", "MINROWS", "MAXROWS", - "BLOCKS", "CTIME", "WAL", "FSYNC", - "COMP", "PRECISION", "UPDATE", "CACHELAST", - "LP", "RP", "UNSIGNED", "TAGS", - "USING", "AS", "COMMA", "NULL", - "SELECT", "UNION", "ALL", "DISTINCT", - "FROM", "VARIABLE", "INTERVAL", "FILL", - "SLIDING", "ORDER", "BY", "ASC", - "DESC", "GROUP", "HAVING", "LIMIT", - "OFFSET", "SLIMIT", "SOFFSET", "WHERE", - "NOW", "RESET", "QUERY", "ADD", - "COLUMN", "TAG", "CHANGE", "SET", - "KILL", "CONNECTION", "STREAM", "COLON", - "ABORT", "AFTER", "ATTACH", "BEFORE", - "BEGIN", "CASCADE", "CLUSTER", "CONFLICT", - "COPY", "DEFERRED", "DELIMITERS", "DETACH", - "EACH", "END", "EXPLAIN", "FAIL", - "FOR", "IGNORE", "IMMEDIATE", "INITIALLY", - "INSTEAD", "MATCH", "KEY", "OF", - "RAISE", "REPLACE", "RESTRICT", "ROW", - "STATEMENT", "TRIGGER", "VIEW", "COUNT", - "SUM", "AVG", "MIN", "MAX", - "FIRST", "LAST", "TOP", "BOTTOM", - "STDDEV", "PERCENTILE", "APERCENTILE", "LEASTSQUARES", - "HISTOGRAM", "DIFF", "SPREAD", "TWA", - "INTERP", "LAST_ROW", "RATE", "IRATE", - "SUM_RATE", "SUM_IRATE", "AVG_RATE", "AVG_IRATE", - "TBID", "SEMI", "NONE", "PREV", - "LINEAR", "IMPORT", "METRIC", "TBNAME", - "JOIN", "METRICS", "STABLE", "INSERT", - "INTO", "VALUES", "error", "program", - "cmd", "dbPrefix", "ids", "cpxName", - "ifexists", "alter_db_optr", "acct_optr", "ifnotexists", - "db_optr", "pps", "tseries", "dbs", - "streams", "storage", "qtime", "users", - "conns", "state", "keep", "tagitemlist", - "cache", "replica", "quorum", "days", - "minrows", "maxrows", "blocks", "ctime", - "wal", "fsync", "comp", "prec", - "update", "cachelast", "typename", "signed", - "create_table_args", "create_table_list", "create_from_stable", "columnlist", - "select", "column", "tagitem", "selcollist", - "from", "where_opt", "interval_opt", "fill_opt", - "sliding_opt", "groupby_opt", "orderby_opt", "having_opt", - "slimit_opt", "limit_opt", "union", "sclp", - "distinct", "expr", "as", "tablelist", - "tmvar", "sortlist", "sortitem", "item", - "sortorder", "grouplist", "exprlist", "expritem", + /* 0 */ "$", + /* 1 */ "ID", + /* 2 */ "BOOL", + /* 3 */ "TINYINT", + /* 4 */ "SMALLINT", + /* 5 */ "INTEGER", + /* 6 */ "BIGINT", + /* 7 */ "FLOAT", + /* 8 */ "DOUBLE", + /* 9 */ "STRING", + /* 10 */ "TIMESTAMP", + /* 11 */ "BINARY", + /* 12 */ "NCHAR", + /* 13 */ "OR", + /* 14 */ "AND", + /* 15 */ "NOT", + /* 16 */ "EQ", + /* 17 */ "NE", + /* 18 */ "ISNULL", + /* 19 */ "NOTNULL", + /* 20 */ "IS", + /* 21 */ "LIKE", + /* 22 */ "GLOB", + /* 23 */ "BETWEEN", + /* 24 */ "IN", + /* 25 */ "GT", + /* 26 */ "GE", + /* 27 */ "LT", + /* 28 */ "LE", + /* 29 */ "BITAND", + /* 30 */ "BITOR", + /* 31 */ "LSHIFT", + /* 32 */ "RSHIFT", + /* 33 */ "PLUS", + /* 34 */ "MINUS", + /* 35 */ "DIVIDE", + /* 36 */ "TIMES", + /* 37 */ "STAR", + /* 38 */ "SLASH", + /* 39 */ "REM", + /* 40 */ "CONCAT", + /* 41 */ "UMINUS", + /* 42 */ "UPLUS", + /* 43 */ "BITNOT", + /* 44 */ "SHOW", + /* 45 */ "DATABASES", + /* 46 */ "MNODES", + /* 47 */ "DNODES", + /* 48 */ "ACCOUNTS", + /* 49 */ "USERS", + /* 50 */ "MODULES", + /* 51 */ "QUERIES", + /* 52 */ "CONNECTIONS", + /* 53 */ "STREAMS", + /* 54 */ "VARIABLES", + /* 55 */ "SCORES", + /* 56 */ "GRANTS", + /* 57 */ "VNODES", + /* 58 */ "IPTOKEN", + /* 59 */ "DOT", + /* 60 */ "CREATE", + /* 61 */ "TABLE", + /* 62 */ "DATABASE", + /* 63 */ "TABLES", + /* 64 */ "STABLES", + /* 65 */ "VGROUPS", + /* 66 */ "DROP", + /* 67 */ "DNODE", + /* 68 */ "USER", + /* 69 */ "ACCOUNT", + /* 70 */ "USE", + /* 71 */ "DESCRIBE", + /* 72 */ "ALTER", + /* 73 */ "PASS", + /* 74 */ "PRIVILEGE", + /* 75 */ "LOCAL", + /* 76 */ "IF", + /* 77 */ "EXISTS", + /* 78 */ "PPS", + /* 79 */ "TSERIES", + /* 80 */ "DBS", + /* 81 */ "STORAGE", + /* 82 */ "QTIME", + /* 83 */ "CONNS", + /* 84 */ "STATE", + /* 85 */ "KEEP", + /* 86 */ "CACHE", + /* 87 */ "REPLICA", + /* 88 */ "QUORUM", + /* 89 */ "DAYS", + /* 90 */ "MINROWS", + /* 91 */ "MAXROWS", + /* 92 */ "BLOCKS", + /* 93 */ "CTIME", + /* 94 */ "WAL", + /* 95 */ "FSYNC", + /* 96 */ "COMP", + /* 97 */ "PRECISION", + /* 98 */ "UPDATE", + /* 99 */ "CACHELAST", + /* 100 */ "LP", + /* 101 */ "RP", + /* 102 */ "UNSIGNED", + /* 103 */ "TAGS", + /* 104 */ "USING", + /* 105 */ "AS", + /* 106 */ "COMMA", + /* 107 */ "NULL", + /* 108 */ "SELECT", + /* 109 */ "UNION", + /* 110 */ "ALL", + /* 111 */ "DISTINCT", + /* 112 */ "FROM", + /* 113 */ "VARIABLE", + /* 114 */ "INTERVAL", + /* 115 */ "FILL", + /* 116 */ "SLIDING", + /* 117 */ "ORDER", + /* 118 */ "BY", + /* 119 */ "ASC", + /* 120 */ "DESC", + /* 121 */ "GROUP", + /* 122 */ "HAVING", + /* 123 */ "LIMIT", + /* 124 */ "OFFSET", + /* 125 */ "SLIMIT", + /* 126 */ "SOFFSET", + /* 127 */ "WHERE", + /* 128 */ "NOW", + /* 129 */ "RESET", + /* 130 */ "QUERY", + /* 131 */ "ADD", + /* 132 */ "COLUMN", + /* 133 */ "TAG", + /* 134 */ "CHANGE", + /* 135 */ "SET", + /* 136 */ "KILL", + /* 137 */ "CONNECTION", + /* 138 */ "STREAM", + /* 139 */ "COLON", + /* 140 */ "ABORT", + /* 141 */ "AFTER", + /* 142 */ "ATTACH", + /* 143 */ "BEFORE", + /* 144 */ "BEGIN", + /* 145 */ "CASCADE", + /* 146 */ "CLUSTER", + /* 147 */ "CONFLICT", + /* 148 */ "COPY", + /* 149 */ "DEFERRED", + /* 150 */ "DELIMITERS", + /* 151 */ "DETACH", + /* 152 */ "EACH", + /* 153 */ "END", + /* 154 */ "EXPLAIN", + /* 155 */ "FAIL", + /* 156 */ "FOR", + /* 157 */ "IGNORE", + /* 158 */ "IMMEDIATE", + /* 159 */ "INITIALLY", + /* 160 */ "INSTEAD", + /* 161 */ "MATCH", + /* 162 */ "KEY", + /* 163 */ "OF", + /* 164 */ "RAISE", + /* 165 */ "REPLACE", + /* 166 */ "RESTRICT", + /* 167 */ "ROW", + /* 168 */ "STATEMENT", + /* 169 */ "TRIGGER", + /* 170 */ "VIEW", + /* 171 */ "COUNT", + /* 172 */ "SUM", + /* 173 */ "AVG", + /* 174 */ "MIN", + /* 175 */ "MAX", + /* 176 */ "FIRST", + /* 177 */ "LAST", + /* 178 */ "TOP", + /* 179 */ "BOTTOM", + /* 180 */ "STDDEV", + /* 181 */ "PERCENTILE", + /* 182 */ "APERCENTILE", + /* 183 */ "LEASTSQUARES", + /* 184 */ "HISTOGRAM", + /* 185 */ "DIFF", + /* 186 */ "SPREAD", + /* 187 */ "TWA", + /* 188 */ "INTERP", + /* 189 */ "LAST_ROW", + /* 190 */ "RATE", + /* 191 */ "IRATE", + /* 192 */ "SUM_RATE", + /* 193 */ "SUM_IRATE", + /* 194 */ "AVG_RATE", + /* 195 */ "AVG_IRATE", + /* 196 */ "TBID", + /* 197 */ "SEMI", + /* 198 */ "NONE", + /* 199 */ "PREV", + /* 200 */ "LINEAR", + /* 201 */ "IMPORT", + /* 202 */ "METRIC", + /* 203 */ "TBNAME", + /* 204 */ "JOIN", + /* 205 */ "METRICS", + /* 206 */ "STABLE", + /* 207 */ "INSERT", + /* 208 */ "INTO", + /* 209 */ "VALUES", + /* 210 */ "error", + /* 211 */ "program", + /* 212 */ "cmd", + /* 213 */ "dbPrefix", + /* 214 */ "ids", + /* 215 */ "cpxName", + /* 216 */ "ifexists", + /* 217 */ "alter_db_optr", + /* 218 */ "acct_optr", + /* 219 */ "ifnotexists", + /* 220 */ "db_optr", + /* 221 */ "pps", + /* 222 */ "tseries", + /* 223 */ "dbs", + /* 224 */ "streams", + /* 225 */ "storage", + /* 226 */ "qtime", + /* 227 */ "users", + /* 228 */ "conns", + /* 229 */ "state", + /* 230 */ "keep", + /* 231 */ "tagitemlist", + /* 232 */ "cache", + /* 233 */ "replica", + /* 234 */ "quorum", + /* 235 */ "days", + /* 236 */ "minrows", + /* 237 */ "maxrows", + /* 238 */ "blocks", + /* 239 */ "ctime", + /* 240 */ "wal", + /* 241 */ "fsync", + /* 242 */ "comp", + /* 243 */ "prec", + /* 244 */ "update", + /* 245 */ "cachelast", + /* 246 */ "typename", + /* 247 */ "signed", + /* 248 */ "create_table_args", + /* 249 */ "create_table_list", + /* 250 */ "create_from_stable", + /* 251 */ "columnlist", + /* 252 */ "select", + /* 253 */ "column", + /* 254 */ "tagitem", + /* 255 */ "selcollist", + /* 256 */ "from", + /* 257 */ "where_opt", + /* 258 */ "interval_opt", + /* 259 */ "fill_opt", + /* 260 */ "sliding_opt", + /* 261 */ "groupby_opt", + /* 262 */ "orderby_opt", + /* 263 */ "having_opt", + /* 264 */ "slimit_opt", + /* 265 */ "limit_opt", + /* 266 */ "union", + /* 267 */ "sclp", + /* 268 */ "distinct", + /* 269 */ "expr", + /* 270 */ "as", + /* 271 */ "tablelist", + /* 272 */ "tmvar", + /* 273 */ "sortlist", + /* 274 */ "sortitem", + /* 275 */ "item", + /* 276 */ "sortorder", + /* 277 */ "grouplist", + /* 278 */ "exprlist", + /* 279 */ "expritem", }; -#endif /* NDEBUG */ +#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. @@ -1036,27 +1273,74 @@ static const char *const yyRuleName[] = { #if YYSTACKDEPTH<=0 /* -** Try to increase the size of the parser stack. +** Try to increase the size of the parser stack. Return the number +** of errors. Return 0 on success. */ -static void yyGrowStack(yyParser *p){ +static int yyGrowStack(yyParser *p){ int newSize; + int idx; yyStackEntry *pNew; newSize = p->yystksz*2 + 100; - pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); + idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; + if( p->yystack==&p->yystk0 ){ + pNew = malloc(newSize*sizeof(pNew[0])); + if( pNew ) pNew[0] = p->yystk0; + }else{ + pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); + } if( pNew ){ p->yystack = pNew; - p->yystksz = newSize; + p->yytos = &p->yystack[idx]; #ifndef NDEBUG if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack grows to %d entries!\n", - yyTracePrompt, p->yystksz); + fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", + yyTracePrompt, p->yystksz, newSize); } #endif + p->yystksz = newSize; } + return pNew==0; } #endif +/* Datatype of the argument to the memory allocated passed as the +** second argument to ParseAlloc() below. This can be changed by +** putting an appropriate #define in the %include section of the input +** grammar. +*/ +#ifndef YYMALLOCARGTYPE +# define YYMALLOCARGTYPE size_t +#endif + +/* Initialize a new parser that has already been allocated. +*/ +void ParseInit(void *yypParser){ + yyParser *pParser = (yyParser*)yypParser; +#ifdef YYTRACKMAXSTACKDEPTH + pParser->yyhwm = 0; +#endif +#if YYSTACKDEPTH<=0 + pParser->yytos = NULL; + pParser->yystack = NULL; + pParser->yystksz = 0; + if( yyGrowStack(pParser) ){ + pParser->yystack = &pParser->yystk0; + pParser->yystksz = 1; + } +#endif +#ifndef YYNOERRORRECOVERY + pParser->yyerrcnt = -1; +#endif + pParser->yytos = pParser->yystack; + pParser->yystack[0].stateno = 0; + pParser->yystack[0].major = 0; +#if YYSTACKDEPTH>0 + pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; +#endif +} + +#ifndef Parse_ENGINEALWAYSONSTACK /* ** This function allocates a new parser. ** The only argument is a pointer to a function which works like @@ -1069,27 +1353,21 @@ static void yyGrowStack(yyParser *p){ ** A pointer to a parser. This pointer is used in subsequent calls ** to Parse and ParseFree. */ -void *ParseAlloc(void *(*mallocProc)(size_t)){ +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; -#ifdef YYTRACKMAXSTACKDEPTH - pParser->yyidxMax = 0; -#endif -#if YYSTACKDEPTH<=0 - pParser->yystack = NULL; - pParser->yystksz = 0; - yyGrowStack(pParser); -#endif - } + pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( pParser ) ParseInit(pParser); return pParser; } +#endif /* Parse_ENGINEALWAYSONSTACK */ + -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. +/* The following function deletes the "minor type" or semantic value +** associated with a symbol. The symbol can be either a terminal +** or nonterminal. "yymajor" is the symbol code, and "yypminor" is +** a pointer to the value to be deleted. The code used to do the +** deletions is derived from the %destructor and/or %token_destructor +** directives of the input grammar. */ static void yy_destructor( yyParser *yypParser, /* The parser */ @@ -1105,9 +1383,10 @@ static void yy_destructor( ** being destroyed before it is finished parsing. ** ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used + ** which appear on the RHS of the rule, but which are *not* used ** inside the C code. */ +/********* Begin destructor definitions ***************************************/ case 230: /* keep */ case 231: /* tagitemlist */ case 251: /* columnlist */ @@ -1117,32 +1396,24 @@ static void yy_destructor( case 273: /* sortlist */ case 277: /* grouplist */ { -#line 227 "sql.y" taosArrayDestroy((yypminor->yy221)); -#line 1123 "sql.c" } break; case 249: /* create_table_list */ { -#line 311 "sql.y" destroyCreateTableSql((yypminor->yy358)); -#line 1130 "sql.c" } break; case 252: /* select */ { -#line 418 "sql.y" doDestroyQuerySql((yypminor->yy344)); -#line 1137 "sql.c" } break; case 255: /* selcollist */ case 267: /* sclp */ case 278: /* exprlist */ { -#line 445 "sql.y" tSqlExprListDestroy((yypminor->yy178)); -#line 1146 "sql.c" } break; case 257: /* where_opt */ @@ -1150,25 +1421,20 @@ tSqlExprListDestroy((yypminor->yy178)); case 269: /* expr */ case 279: /* expritem */ { -#line 612 "sql.y" tSqlExprDestroy((yypminor->yy50)); -#line 1156 "sql.c" } break; case 266: /* union */ { -#line 424 "sql.y" destroyAllSelectClause((yypminor->yy273)); -#line 1163 "sql.c" } break; case 274: /* sortitem */ { -#line 545 "sql.y" tVariantDestroy(&(yypminor->yy106)); -#line 1170 "sql.c" } break; +/********* End destructor definitions *****************************************/ default: break; /* If no destructor action specified: do nothing */ } } @@ -1178,51 +1444,53 @@ tVariantDestroy(&(yypminor->yy106)); ** ** If there is a destructor routine associated with the token which ** is popped from the stack, then call it. -** -** Return the major token number for the symbol popped. */ -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; +static void yy_pop_parser_stack(yyParser *pParser){ + yyStackEntry *yytos; + assert( pParser->yytos!=0 ); + assert( pParser->yytos > pParser->yystack ); + yytos = pParser->yytos--; #ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ + if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sPopping %s\n", yyTracePrompt, yyTokenName[yytos->major]); } #endif - yymajor = yytos->major; - yy_destructor(pParser, yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; + yy_destructor(pParser, yytos->major, &yytos->minor); +} + +/* +** Clear all secondary memory allocations from the parser +*/ +void ParseFinalize(void *p){ + yyParser *pParser = (yyParser*)p; + while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); +#if YYSTACKDEPTH<=0 + if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); +#endif } +#ifndef Parse_ENGINEALWAYSONSTACK /* -** Deallocate and destroy a parser. Destructors are all called for +** Deallocate and destroy a parser. Destructors are called for ** all stack elements before shutting the parser down. ** -** Inputs: -**
    -**
  • A pointer to the parser. This should be a pointer -** obtained from ParseAlloc. -**
  • A pointer to a function used to reclaim memory obtained -** from malloc. -**
+** If the YYPARSEFREENEVERNULL macro exists (for example because it +** is defined in a %include section of the input grammar) then it is +** assumed that the input pointer is never NULL. */ void ParseFree( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); -#if YYSTACKDEPTH<=0 - free(pParser->yystack); +#ifndef YYPARSEFREENEVERNULL + if( p==0 ) return; #endif - (*freeProc)((void*)pParser); + ParseFinalize(p); + (*freeProc)(p); } +#endif /* Parse_ENGINEALWAYSONSTACK */ /* ** Return the peak depth of the stack for a parser. @@ -1230,33 +1498,70 @@ void ParseFree( #ifdef YYTRACKMAXSTACKDEPTH int ParseStackPeak(void *p){ yyParser *pParser = (yyParser*)p; - return pParser->yyidxMax; + return pParser->yyhwm; +} +#endif + +/* This array of booleans keeps track of the parser statement +** coverage. The element yycoverage[X][Y] is set when the parser +** is in state X and has a lookahead token Y. In a well-tested +** systems, every element of this matrix should end up being set. +*/ +#if defined(YYCOVERAGE) +static unsigned char yycoverage[YYNSTATE][YYNTOKEN]; +#endif + +/* +** Write into out a description of every state/lookahead combination that +** +** (1) has not been used by the parser, and +** (2) is not a syntax error. +** +** Return the number of missed state/lookahead combinations. +*/ +#if defined(YYCOVERAGE) +int ParseCoverage(FILE *out){ + int stateno, iLookAhead, i; + int nMissed = 0; + for(stateno=0; statenoyystack[pParser->yyidx].stateno; + int stateno = pParser->yytos->stateno; - if( stateno>YY_SHIFT_COUNT - || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - assert( iLookAhead!=YYNOCODE ); - i += iLookAhead; - if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ - if( iLookAhead>0 ){ + if( stateno>YY_MAX_SHIFT ) return stateno; + assert( stateno <= YY_SHIFT_COUNT ); +#if defined(YYCOVERAGE) + yycoverage[stateno][iLookAhead] = 1; +#endif + do{ + i = yy_shift_ofst[stateno]; + assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) ); + assert( iLookAhead!=YYNOCODE ); + assert( iLookAhead < YYNTOKEN ); + i += iLookAhead; + if( yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ if( iLookAhead=YY_ACTTAB_COUNT j0 ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]); + yyTracePrompt, yyTokenName[iLookAhead], + yyTokenName[YYWILDCARD]); } #endif /* NDEBUG */ return yy_action[j]; } } #endif /* YYWILDCARD */ + return yy_default[stateno]; + }else{ + return yy_action[i]; } - return yy_default[stateno]; - }else{ - return yy_action[i]; - } + }while(1); } /* ** Find the appropriate action for a parser given the non-terminal ** look-ahead token iLookAhead. -** -** If the look-ahead token is YYNOCODE, then check to see if the action is -** independent of the look-ahead. If it is, return the action, otherwise -** return YY_NO_ACTION. */ static int yy_find_reduce_action( int stateno, /* Current state number */ @@ -1320,7 +1624,6 @@ static int yy_find_reduce_action( assert( stateno<=YY_REDUCE_COUNT ); #endif i = yy_reduce_ofst[stateno]; - assert( i!=YY_REDUCE_USE_DFLT ); assert( iLookAhead!=YYNOCODE ); i += iLookAhead; #ifdef YYERRORSYMBOL @@ -1337,20 +1640,42 @@ static int yy_find_reduce_action( /* ** The following routine is called if the stack overflows. */ -static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){ +static void yyStackOverflow(yyParser *yypParser){ ParseARG_FETCH; - yypParser->yyidx--; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ +/******** Begin %stack_overflow code ******************************************/ +/******** End %stack_overflow code ********************************************/ ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ } +/* +** Print tracing information for a SHIFT action +*/ +#ifndef NDEBUG +static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){ + if( yyTraceFILE ){ + if( yyNewStateyytos->major], + yyNewState); + }else{ + fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n", + yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major], + yyNewState - YY_MIN_REDUCE); + } + } +} +#else +# define yyTraceShift(X,Y,Z) +#endif + /* ** Perform a shift action. */ @@ -1358,294 +1683,290 @@ static void yy_shift( yyParser *yypParser, /* The parser to be shifted */ int yyNewState, /* The new state to shift in */ int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer to the minor token to shift in */ + ParseTOKENTYPE yyMinor /* The minor token to shift in */ ){ yyStackEntry *yytos; - yypParser->yyidx++; + yypParser->yytos++; #ifdef YYTRACKMAXSTACKDEPTH - if( yypParser->yyidx>yypParser->yyidxMax ){ - yypParser->yyidxMax = yypParser->yyidx; + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); } #endif #if YYSTACKDEPTH>0 - if( yypParser->yyidx>=YYSTACKDEPTH ){ - yyStackOverflow(yypParser, yypMinor); + if( yypParser->yytos>yypParser->yystackEnd ){ + yypParser->yytos--; + yyStackOverflow(yypParser); return; } #else - if( yypParser->yyidx>=yypParser->yystksz ){ - yyGrowStack(yypParser); - if( yypParser->yyidx>=yypParser->yystksz ){ - yyStackOverflow(yypParser, yypMinor); + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ + if( yyGrowStack(yypParser) ){ + yypParser->yytos--; + yyStackOverflow(yypParser); return; } } #endif - yytos = &yypParser->yystack[yypParser->yyidx]; + if( yyNewState > YY_MAX_SHIFT ){ + yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; + } + yytos = yypParser->yytos; yytos->stateno = (YYACTIONTYPE)yyNewState; yytos->major = (YYCODETYPE)yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif + yytos->minor.yy0 = yyMinor; + yyTraceShift(yypParser, yyNewState, "Shift"); } /* The following table contains information about every rule that ** is used during the reduce. */ static const struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ + YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 211, 1 }, - { 212, 2 }, - { 212, 2 }, - { 212, 2 }, - { 212, 2 }, - { 212, 2 }, - { 212, 2 }, - { 212, 2 }, - { 212, 2 }, - { 212, 2 }, - { 212, 2 }, - { 212, 2 }, - { 212, 2 }, - { 212, 2 }, - { 212, 3 }, - { 213, 0 }, - { 213, 2 }, - { 215, 0 }, - { 215, 2 }, - { 212, 5 }, - { 212, 4 }, - { 212, 3 }, - { 212, 5 }, - { 212, 3 }, - { 212, 5 }, - { 212, 3 }, - { 212, 4 }, - { 212, 5 }, - { 212, 4 }, - { 212, 3 }, - { 212, 3 }, - { 212, 3 }, - { 212, 2 }, - { 212, 3 }, - { 212, 5 }, - { 212, 5 }, - { 212, 4 }, - { 212, 5 }, - { 212, 3 }, - { 212, 4 }, - { 212, 4 }, - { 212, 4 }, - { 212, 6 }, - { 214, 1 }, - { 214, 1 }, - { 216, 2 }, - { 216, 0 }, - { 219, 3 }, - { 219, 0 }, - { 212, 3 }, - { 212, 6 }, - { 212, 5 }, - { 212, 5 }, - { 221, 0 }, - { 221, 2 }, - { 222, 0 }, - { 222, 2 }, - { 223, 0 }, - { 223, 2 }, - { 224, 0 }, - { 224, 2 }, - { 225, 0 }, - { 225, 2 }, - { 226, 0 }, - { 226, 2 }, - { 227, 0 }, - { 227, 2 }, - { 228, 0 }, - { 228, 2 }, - { 229, 0 }, - { 229, 2 }, - { 218, 9 }, - { 230, 2 }, - { 232, 2 }, - { 233, 2 }, - { 234, 2 }, - { 235, 2 }, - { 236, 2 }, - { 237, 2 }, - { 238, 2 }, - { 239, 2 }, - { 240, 2 }, - { 241, 2 }, - { 242, 2 }, - { 243, 2 }, - { 244, 2 }, - { 245, 2 }, - { 220, 0 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 220, 2 }, - { 217, 0 }, - { 217, 2 }, - { 217, 2 }, - { 217, 2 }, - { 217, 2 }, - { 217, 2 }, - { 217, 2 }, - { 217, 2 }, - { 217, 2 }, - { 217, 2 }, - { 246, 1 }, - { 246, 4 }, - { 246, 2 }, - { 247, 1 }, - { 247, 2 }, - { 247, 2 }, - { 212, 3 }, - { 212, 3 }, - { 249, 1 }, - { 249, 2 }, - { 248, 6 }, - { 248, 10 }, - { 250, 10 }, - { 248, 5 }, - { 251, 3 }, - { 251, 1 }, - { 253, 2 }, - { 231, 3 }, - { 231, 1 }, - { 254, 1 }, - { 254, 1 }, - { 254, 1 }, - { 254, 1 }, - { 254, 1 }, - { 254, 2 }, - { 254, 2 }, - { 254, 2 }, - { 254, 2 }, - { 252, 12 }, - { 266, 1 }, - { 266, 3 }, - { 266, 4 }, - { 266, 6 }, - { 212, 1 }, - { 252, 2 }, - { 267, 2 }, - { 267, 0 }, - { 255, 4 }, - { 255, 2 }, - { 270, 2 }, - { 270, 1 }, - { 270, 0 }, - { 268, 1 }, - { 268, 0 }, - { 256, 2 }, - { 271, 2 }, - { 271, 3 }, - { 271, 4 }, - { 271, 5 }, - { 272, 1 }, - { 258, 4 }, - { 258, 6 }, - { 258, 0 }, - { 259, 0 }, - { 259, 6 }, - { 259, 4 }, - { 260, 4 }, - { 260, 0 }, - { 262, 0 }, - { 262, 3 }, - { 273, 4 }, - { 273, 2 }, - { 275, 2 }, - { 276, 1 }, - { 276, 1 }, - { 276, 0 }, - { 261, 0 }, - { 261, 3 }, - { 277, 3 }, - { 277, 1 }, - { 263, 0 }, - { 263, 2 }, - { 265, 0 }, - { 265, 2 }, - { 265, 4 }, - { 265, 4 }, - { 264, 0 }, - { 264, 2 }, - { 264, 4 }, - { 264, 4 }, - { 257, 0 }, - { 257, 2 }, - { 269, 3 }, - { 269, 1 }, - { 269, 3 }, - { 269, 3 }, - { 269, 1 }, - { 269, 2 }, - { 269, 2 }, - { 269, 1 }, - { 269, 2 }, - { 269, 2 }, - { 269, 1 }, - { 269, 1 }, - { 269, 1 }, - { 269, 1 }, - { 269, 4 }, - { 269, 4 }, - { 269, 3 }, - { 269, 4 }, - { 269, 3 }, - { 269, 3 }, - { 269, 3 }, - { 269, 3 }, - { 269, 3 }, - { 269, 3 }, - { 269, 3 }, - { 269, 3 }, - { 269, 3 }, - { 269, 3 }, - { 269, 3 }, - { 269, 3 }, - { 269, 3 }, - { 269, 3 }, - { 269, 5 }, - { 278, 3 }, - { 278, 1 }, - { 279, 1 }, - { 279, 0 }, - { 212, 3 }, - { 212, 7 }, - { 212, 7 }, - { 212, 7 }, - { 212, 7 }, - { 212, 8 }, - { 212, 9 }, - { 212, 3 }, - { 212, 5 }, - { 212, 5 }, + { 211, -1 }, /* (0) program ::= cmd */ + { 212, -2 }, /* (1) cmd ::= SHOW DATABASES */ + { 212, -2 }, /* (2) cmd ::= SHOW MNODES */ + { 212, -2 }, /* (3) cmd ::= SHOW DNODES */ + { 212, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */ + { 212, -2 }, /* (5) cmd ::= SHOW USERS */ + { 212, -2 }, /* (6) cmd ::= SHOW MODULES */ + { 212, -2 }, /* (7) cmd ::= SHOW QUERIES */ + { 212, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */ + { 212, -2 }, /* (9) cmd ::= SHOW STREAMS */ + { 212, -2 }, /* (10) cmd ::= SHOW VARIABLES */ + { 212, -2 }, /* (11) cmd ::= SHOW SCORES */ + { 212, -2 }, /* (12) cmd ::= SHOW GRANTS */ + { 212, -2 }, /* (13) cmd ::= SHOW VNODES */ + { 212, -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */ + { 213, 0 }, /* (15) dbPrefix ::= */ + { 213, -2 }, /* (16) dbPrefix ::= ids DOT */ + { 215, 0 }, /* (17) cpxName ::= */ + { 215, -2 }, /* (18) cpxName ::= DOT ids */ + { 212, -5 }, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */ + { 212, -4 }, /* (20) cmd ::= SHOW CREATE DATABASE ids */ + { 212, -3 }, /* (21) cmd ::= SHOW dbPrefix TABLES */ + { 212, -5 }, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + { 212, -3 }, /* (23) cmd ::= SHOW dbPrefix STABLES */ + { 212, -5 }, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + { 212, -3 }, /* (25) cmd ::= SHOW dbPrefix VGROUPS */ + { 212, -4 }, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */ + { 212, -5 }, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */ + { 212, -4 }, /* (28) cmd ::= DROP DATABASE ifexists ids */ + { 212, -3 }, /* (29) cmd ::= DROP DNODE ids */ + { 212, -3 }, /* (30) cmd ::= DROP USER ids */ + { 212, -3 }, /* (31) cmd ::= DROP ACCOUNT ids */ + { 212, -2 }, /* (32) cmd ::= USE ids */ + { 212, -3 }, /* (33) cmd ::= DESCRIBE ids cpxName */ + { 212, -5 }, /* (34) cmd ::= ALTER USER ids PASS ids */ + { 212, -5 }, /* (35) cmd ::= ALTER USER ids PRIVILEGE ids */ + { 212, -4 }, /* (36) cmd ::= ALTER DNODE ids ids */ + { 212, -5 }, /* (37) cmd ::= ALTER DNODE ids ids ids */ + { 212, -3 }, /* (38) cmd ::= ALTER LOCAL ids */ + { 212, -4 }, /* (39) cmd ::= ALTER LOCAL ids ids */ + { 212, -4 }, /* (40) cmd ::= ALTER DATABASE ids alter_db_optr */ + { 212, -4 }, /* (41) cmd ::= ALTER ACCOUNT ids acct_optr */ + { 212, -6 }, /* (42) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + { 214, -1 }, /* (43) ids ::= ID */ + { 214, -1 }, /* (44) ids ::= STRING */ + { 216, -2 }, /* (45) ifexists ::= IF EXISTS */ + { 216, 0 }, /* (46) ifexists ::= */ + { 219, -3 }, /* (47) ifnotexists ::= IF NOT EXISTS */ + { 219, 0 }, /* (48) ifnotexists ::= */ + { 212, -3 }, /* (49) cmd ::= CREATE DNODE ids */ + { 212, -6 }, /* (50) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + { 212, -5 }, /* (51) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + { 212, -5 }, /* (52) cmd ::= CREATE USER ids PASS ids */ + { 221, 0 }, /* (53) pps ::= */ + { 221, -2 }, /* (54) pps ::= PPS INTEGER */ + { 222, 0 }, /* (55) tseries ::= */ + { 222, -2 }, /* (56) tseries ::= TSERIES INTEGER */ + { 223, 0 }, /* (57) dbs ::= */ + { 223, -2 }, /* (58) dbs ::= DBS INTEGER */ + { 224, 0 }, /* (59) streams ::= */ + { 224, -2 }, /* (60) streams ::= STREAMS INTEGER */ + { 225, 0 }, /* (61) storage ::= */ + { 225, -2 }, /* (62) storage ::= STORAGE INTEGER */ + { 226, 0 }, /* (63) qtime ::= */ + { 226, -2 }, /* (64) qtime ::= QTIME INTEGER */ + { 227, 0 }, /* (65) users ::= */ + { 227, -2 }, /* (66) users ::= USERS INTEGER */ + { 228, 0 }, /* (67) conns ::= */ + { 228, -2 }, /* (68) conns ::= CONNS INTEGER */ + { 229, 0 }, /* (69) state ::= */ + { 229, -2 }, /* (70) state ::= STATE ids */ + { 218, -9 }, /* (71) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + { 230, -2 }, /* (72) keep ::= KEEP tagitemlist */ + { 232, -2 }, /* (73) cache ::= CACHE INTEGER */ + { 233, -2 }, /* (74) replica ::= REPLICA INTEGER */ + { 234, -2 }, /* (75) quorum ::= QUORUM INTEGER */ + { 235, -2 }, /* (76) days ::= DAYS INTEGER */ + { 236, -2 }, /* (77) minrows ::= MINROWS INTEGER */ + { 237, -2 }, /* (78) maxrows ::= MAXROWS INTEGER */ + { 238, -2 }, /* (79) blocks ::= BLOCKS INTEGER */ + { 239, -2 }, /* (80) ctime ::= CTIME INTEGER */ + { 240, -2 }, /* (81) wal ::= WAL INTEGER */ + { 241, -2 }, /* (82) fsync ::= FSYNC INTEGER */ + { 242, -2 }, /* (83) comp ::= COMP INTEGER */ + { 243, -2 }, /* (84) prec ::= PRECISION STRING */ + { 244, -2 }, /* (85) update ::= UPDATE INTEGER */ + { 245, -2 }, /* (86) cachelast ::= CACHELAST INTEGER */ + { 220, 0 }, /* (87) db_optr ::= */ + { 220, -2 }, /* (88) db_optr ::= db_optr cache */ + { 220, -2 }, /* (89) db_optr ::= db_optr replica */ + { 220, -2 }, /* (90) db_optr ::= db_optr quorum */ + { 220, -2 }, /* (91) db_optr ::= db_optr days */ + { 220, -2 }, /* (92) db_optr ::= db_optr minrows */ + { 220, -2 }, /* (93) db_optr ::= db_optr maxrows */ + { 220, -2 }, /* (94) db_optr ::= db_optr blocks */ + { 220, -2 }, /* (95) db_optr ::= db_optr ctime */ + { 220, -2 }, /* (96) db_optr ::= db_optr wal */ + { 220, -2 }, /* (97) db_optr ::= db_optr fsync */ + { 220, -2 }, /* (98) db_optr ::= db_optr comp */ + { 220, -2 }, /* (99) db_optr ::= db_optr prec */ + { 220, -2 }, /* (100) db_optr ::= db_optr keep */ + { 220, -2 }, /* (101) db_optr ::= db_optr update */ + { 220, -2 }, /* (102) db_optr ::= db_optr cachelast */ + { 217, 0 }, /* (103) alter_db_optr ::= */ + { 217, -2 }, /* (104) alter_db_optr ::= alter_db_optr replica */ + { 217, -2 }, /* (105) alter_db_optr ::= alter_db_optr quorum */ + { 217, -2 }, /* (106) alter_db_optr ::= alter_db_optr keep */ + { 217, -2 }, /* (107) alter_db_optr ::= alter_db_optr blocks */ + { 217, -2 }, /* (108) alter_db_optr ::= alter_db_optr comp */ + { 217, -2 }, /* (109) alter_db_optr ::= alter_db_optr wal */ + { 217, -2 }, /* (110) alter_db_optr ::= alter_db_optr fsync */ + { 217, -2 }, /* (111) alter_db_optr ::= alter_db_optr update */ + { 217, -2 }, /* (112) alter_db_optr ::= alter_db_optr cachelast */ + { 246, -1 }, /* (113) typename ::= ids */ + { 246, -4 }, /* (114) typename ::= ids LP signed RP */ + { 246, -2 }, /* (115) typename ::= ids UNSIGNED */ + { 247, -1 }, /* (116) signed ::= INTEGER */ + { 247, -2 }, /* (117) signed ::= PLUS INTEGER */ + { 247, -2 }, /* (118) signed ::= MINUS INTEGER */ + { 212, -3 }, /* (119) cmd ::= CREATE TABLE create_table_args */ + { 212, -3 }, /* (120) cmd ::= CREATE TABLE create_table_list */ + { 249, -1 }, /* (121) create_table_list ::= create_from_stable */ + { 249, -2 }, /* (122) create_table_list ::= create_table_list create_from_stable */ + { 248, -6 }, /* (123) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + { 248, -10 }, /* (124) create_table_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + { 250, -10 }, /* (125) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + { 248, -5 }, /* (126) create_table_args ::= ifnotexists ids cpxName AS select */ + { 251, -3 }, /* (127) columnlist ::= columnlist COMMA column */ + { 251, -1 }, /* (128) columnlist ::= column */ + { 253, -2 }, /* (129) column ::= ids typename */ + { 231, -3 }, /* (130) tagitemlist ::= tagitemlist COMMA tagitem */ + { 231, -1 }, /* (131) tagitemlist ::= tagitem */ + { 254, -1 }, /* (132) tagitem ::= INTEGER */ + { 254, -1 }, /* (133) tagitem ::= FLOAT */ + { 254, -1 }, /* (134) tagitem ::= STRING */ + { 254, -1 }, /* (135) tagitem ::= BOOL */ + { 254, -1 }, /* (136) tagitem ::= NULL */ + { 254, -2 }, /* (137) tagitem ::= MINUS INTEGER */ + { 254, -2 }, /* (138) tagitem ::= MINUS FLOAT */ + { 254, -2 }, /* (139) tagitem ::= PLUS INTEGER */ + { 254, -2 }, /* (140) tagitem ::= PLUS FLOAT */ + { 252, -12 }, /* (141) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + { 266, -1 }, /* (142) union ::= select */ + { 266, -3 }, /* (143) union ::= LP union RP */ + { 266, -4 }, /* (144) union ::= union UNION ALL select */ + { 266, -6 }, /* (145) union ::= union UNION ALL LP select RP */ + { 212, -1 }, /* (146) cmd ::= union */ + { 252, -2 }, /* (147) select ::= SELECT selcollist */ + { 267, -2 }, /* (148) sclp ::= selcollist COMMA */ + { 267, 0 }, /* (149) sclp ::= */ + { 255, -4 }, /* (150) selcollist ::= sclp distinct expr as */ + { 255, -2 }, /* (151) selcollist ::= sclp STAR */ + { 270, -2 }, /* (152) as ::= AS ids */ + { 270, -1 }, /* (153) as ::= ids */ + { 270, 0 }, /* (154) as ::= */ + { 268, -1 }, /* (155) distinct ::= DISTINCT */ + { 268, 0 }, /* (156) distinct ::= */ + { 256, -2 }, /* (157) from ::= FROM tablelist */ + { 271, -2 }, /* (158) tablelist ::= ids cpxName */ + { 271, -3 }, /* (159) tablelist ::= ids cpxName ids */ + { 271, -4 }, /* (160) tablelist ::= tablelist COMMA ids cpxName */ + { 271, -5 }, /* (161) tablelist ::= tablelist COMMA ids cpxName ids */ + { 272, -1 }, /* (162) tmvar ::= VARIABLE */ + { 258, -4 }, /* (163) interval_opt ::= INTERVAL LP tmvar RP */ + { 258, -6 }, /* (164) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + { 258, 0 }, /* (165) interval_opt ::= */ + { 259, 0 }, /* (166) fill_opt ::= */ + { 259, -6 }, /* (167) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + { 259, -4 }, /* (168) fill_opt ::= FILL LP ID RP */ + { 260, -4 }, /* (169) sliding_opt ::= SLIDING LP tmvar RP */ + { 260, 0 }, /* (170) sliding_opt ::= */ + { 262, 0 }, /* (171) orderby_opt ::= */ + { 262, -3 }, /* (172) orderby_opt ::= ORDER BY sortlist */ + { 273, -4 }, /* (173) sortlist ::= sortlist COMMA item sortorder */ + { 273, -2 }, /* (174) sortlist ::= item sortorder */ + { 275, -2 }, /* (175) item ::= ids cpxName */ + { 276, -1 }, /* (176) sortorder ::= ASC */ + { 276, -1 }, /* (177) sortorder ::= DESC */ + { 276, 0 }, /* (178) sortorder ::= */ + { 261, 0 }, /* (179) groupby_opt ::= */ + { 261, -3 }, /* (180) groupby_opt ::= GROUP BY grouplist */ + { 277, -3 }, /* (181) grouplist ::= grouplist COMMA item */ + { 277, -1 }, /* (182) grouplist ::= item */ + { 263, 0 }, /* (183) having_opt ::= */ + { 263, -2 }, /* (184) having_opt ::= HAVING expr */ + { 265, 0 }, /* (185) limit_opt ::= */ + { 265, -2 }, /* (186) limit_opt ::= LIMIT signed */ + { 265, -4 }, /* (187) limit_opt ::= LIMIT signed OFFSET signed */ + { 265, -4 }, /* (188) limit_opt ::= LIMIT signed COMMA signed */ + { 264, 0 }, /* (189) slimit_opt ::= */ + { 264, -2 }, /* (190) slimit_opt ::= SLIMIT signed */ + { 264, -4 }, /* (191) slimit_opt ::= SLIMIT signed SOFFSET signed */ + { 264, -4 }, /* (192) slimit_opt ::= SLIMIT signed COMMA signed */ + { 257, 0 }, /* (193) where_opt ::= */ + { 257, -2 }, /* (194) where_opt ::= WHERE expr */ + { 269, -3 }, /* (195) expr ::= LP expr RP */ + { 269, -1 }, /* (196) expr ::= ID */ + { 269, -3 }, /* (197) expr ::= ID DOT ID */ + { 269, -3 }, /* (198) expr ::= ID DOT STAR */ + { 269, -1 }, /* (199) expr ::= INTEGER */ + { 269, -2 }, /* (200) expr ::= MINUS INTEGER */ + { 269, -2 }, /* (201) expr ::= PLUS INTEGER */ + { 269, -1 }, /* (202) expr ::= FLOAT */ + { 269, -2 }, /* (203) expr ::= MINUS FLOAT */ + { 269, -2 }, /* (204) expr ::= PLUS FLOAT */ + { 269, -1 }, /* (205) expr ::= STRING */ + { 269, -1 }, /* (206) expr ::= NOW */ + { 269, -1 }, /* (207) expr ::= VARIABLE */ + { 269, -1 }, /* (208) expr ::= BOOL */ + { 269, -4 }, /* (209) expr ::= ID LP exprlist RP */ + { 269, -4 }, /* (210) expr ::= ID LP STAR RP */ + { 269, -3 }, /* (211) expr ::= expr IS NULL */ + { 269, -4 }, /* (212) expr ::= expr IS NOT NULL */ + { 269, -3 }, /* (213) expr ::= expr LT expr */ + { 269, -3 }, /* (214) expr ::= expr GT expr */ + { 269, -3 }, /* (215) expr ::= expr LE expr */ + { 269, -3 }, /* (216) expr ::= expr GE expr */ + { 269, -3 }, /* (217) expr ::= expr NE expr */ + { 269, -3 }, /* (218) expr ::= expr EQ expr */ + { 269, -3 }, /* (219) expr ::= expr AND expr */ + { 269, -3 }, /* (220) expr ::= expr OR expr */ + { 269, -3 }, /* (221) expr ::= expr PLUS expr */ + { 269, -3 }, /* (222) expr ::= expr MINUS expr */ + { 269, -3 }, /* (223) expr ::= expr STAR expr */ + { 269, -3 }, /* (224) expr ::= expr SLASH expr */ + { 269, -3 }, /* (225) expr ::= expr REM expr */ + { 269, -3 }, /* (226) expr ::= expr LIKE expr */ + { 269, -5 }, /* (227) expr ::= expr IN LP exprlist RP */ + { 278, -3 }, /* (228) exprlist ::= exprlist COMMA expritem */ + { 278, -1 }, /* (229) exprlist ::= expritem */ + { 279, -1 }, /* (230) expritem ::= expr */ + { 279, 0 }, /* (231) expritem ::= */ + { 212, -3 }, /* (232) cmd ::= RESET QUERY CACHE */ + { 212, -7 }, /* (233) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + { 212, -7 }, /* (234) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + { 212, -7 }, /* (235) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + { 212, -7 }, /* (236) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + { 212, -8 }, /* (237) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + { 212, -9 }, /* (238) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + { 212, -3 }, /* (239) cmd ::= KILL CONNECTION INTEGER */ + { 212, -5 }, /* (240) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + { 212, -5 }, /* (241) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -1653,43 +1974,66 @@ static void yy_accept(yyParser*); /* Forward Declaration */ /* ** Perform a reduce action and the shift that must immediately ** follow the reduce. +** +** The yyLookahead and yyLookaheadToken parameters provide reduce actions +** access to the lookahead token (if any). The yyLookahead will be YYNOCODE +** if the lookahead token has already been consumed. As this procedure is +** only called from one place, optimizing compilers will in-line it, which +** means that the extra parameters have no performance impact. */ static void yy_reduce( yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ + unsigned int yyruleno, /* Number of the rule by which to reduce */ + int yyLookahead, /* Lookahead token, or YYNOCODE if none */ + ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ ){ int yygoto; /* The next state */ int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ ParseARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; + (void)yyLookahead; + (void)yyLookaheadToken; + yymsp = yypParser->yytos; #ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt, - yyRuleName[yyruleno]); + if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ + yysize = yyRuleInfo[yyruleno].nrhs; + if( yysize ){ + fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n", + yyTracePrompt, + yyruleno, yyRuleName[yyruleno], yymsp[yysize].stateno); + }else{ + fprintf(yyTraceFILE, "%sReduce %d [%s].\n", + yyTracePrompt, yyruleno, yyRuleName[yyruleno]); + } } #endif /* NDEBUG */ - /* Silence complaints from purify about yygotominor being uninitialized - ** in some cases when it is copied into the stack after the following - ** switch. yygotominor is uninitialized when a rule reduces that does - ** not set the value of its left-hand side nonterminal. Leaving the - ** value of the nonterminal uninitialized is utterly harmless as long - ** as the value is never used. So really the only thing this code - ** accomplishes is to quieten purify. - ** - ** 2007-01-16: The wireshark project (www.wireshark.org) reports that - ** without this code, their parser segfaults. I'm not sure what there - ** parser is doing to make this happen. This is the second bug report - ** from wireshark this week. Clearly they are stressing Lemon in ways - ** that it has not been previously stressed... (SQLite ticket #2172) - */ - /*memset(&yygotominor, 0, sizeof(yygotominor));*/ - yygotominor = yyzerominor; - + /* Check that the stack is large enough to grow by a single entry + ** if the RHS of the rule is empty. This ensures that there is room + ** enough on the stack to push the LHS value */ + if( yyRuleInfo[yyruleno].nrhs==0 ){ +#ifdef YYTRACKMAXSTACKDEPTH + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>=yypParser->yystackEnd ){ + yyStackOverflow(yypParser); + return; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ + if( yyGrowStack(yypParser) ){ + yyStackOverflow(yypParser); + return; + } + yymsp = yypParser->yytos; + } +#endif + } switch( yyruleno ){ /* Beginning here are the reduction cases. A typical example @@ -1700,288 +2044,195 @@ static void yy_reduce( ** #line ** break; */ +/********** Begin reduce actions **********************************************/ + YYMINORTYPE yylhsminor; case 0: /* program ::= cmd */ -#line 63 "sql.y" + case 119: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==119); {} -#line 1707 "sql.c" break; case 1: /* cmd ::= SHOW DATABASES */ -#line 66 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_DB, 0, 0);} -#line 1712 "sql.c" break; case 2: /* cmd ::= SHOW MNODES */ -#line 67 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_MNODE, 0, 0);} -#line 1717 "sql.c" break; case 3: /* cmd ::= SHOW DNODES */ -#line 68 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_DNODE, 0, 0);} -#line 1722 "sql.c" break; case 4: /* cmd ::= SHOW ACCOUNTS */ -#line 69 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_ACCT, 0, 0);} -#line 1727 "sql.c" break; case 5: /* cmd ::= SHOW USERS */ -#line 70 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_USER, 0, 0);} -#line 1732 "sql.c" break; case 6: /* cmd ::= SHOW MODULES */ -#line 72 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_MODULE, 0, 0); } -#line 1737 "sql.c" break; case 7: /* cmd ::= SHOW QUERIES */ -#line 73 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_QUERIES, 0, 0); } -#line 1742 "sql.c" break; case 8: /* cmd ::= SHOW CONNECTIONS */ -#line 74 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_CONNS, 0, 0);} -#line 1747 "sql.c" break; case 9: /* cmd ::= SHOW STREAMS */ -#line 75 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_STREAMS, 0, 0); } -#line 1752 "sql.c" break; case 10: /* cmd ::= SHOW VARIABLES */ -#line 76 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_VARIABLES, 0, 0); } -#line 1757 "sql.c" break; case 11: /* cmd ::= SHOW SCORES */ -#line 77 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0); } -#line 1762 "sql.c" break; case 12: /* cmd ::= SHOW GRANTS */ -#line 78 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0); } -#line 1767 "sql.c" break; case 13: /* cmd ::= SHOW VNODES */ -#line 80 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, 0, 0); } -#line 1772 "sql.c" break; case 14: /* cmd ::= SHOW VNODES IPTOKEN */ -#line 81 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, &yymsp[0].minor.yy0, 0); } -#line 1777 "sql.c" break; case 15: /* dbPrefix ::= */ -#line 85 "sql.y" -{yygotominor.yy0.n = 0; yygotominor.yy0.type = 0;} -#line 1782 "sql.c" +{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.type = 0;} break; case 16: /* dbPrefix ::= ids DOT */ -#line 86 "sql.y" -{yygotominor.yy0 = yymsp[-1].minor.yy0; } -#line 1787 "sql.c" +{yylhsminor.yy0 = yymsp[-1].minor.yy0; } + yymsp[-1].minor.yy0 = yylhsminor.yy0; break; case 17: /* cpxName ::= */ -#line 89 "sql.y" -{yygotominor.yy0.n = 0; } -#line 1792 "sql.c" +{yymsp[1].minor.yy0.n = 0; } break; case 18: /* cpxName ::= DOT ids */ -#line 90 "sql.y" -{yygotominor.yy0 = yymsp[0].minor.yy0; yygotominor.yy0.n += 1; } -#line 1797 "sql.c" +{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n += 1; } break; case 19: /* cmd ::= SHOW CREATE TABLE ids cpxName */ -#line 92 "sql.y" { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDCLSQLElems(pInfo, TSDB_SQL_SHOW_CREATE_TABLE, 1, &yymsp[-1].minor.yy0); } -#line 1805 "sql.c" break; case 20: /* cmd ::= SHOW CREATE DATABASE ids */ -#line 97 "sql.y" { setDCLSQLElems(pInfo, TSDB_SQL_SHOW_CREATE_DATABASE, 1, &yymsp[0].minor.yy0); } -#line 1812 "sql.c" break; case 21: /* cmd ::= SHOW dbPrefix TABLES */ -#line 101 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &yymsp[-1].minor.yy0, 0); } -#line 1819 "sql.c" break; case 22: /* cmd ::= SHOW dbPrefix TABLES LIKE ids */ -#line 105 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0); } -#line 1826 "sql.c" break; case 23: /* cmd ::= SHOW dbPrefix STABLES */ -#line 109 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &yymsp[-1].minor.yy0, 0); } -#line 1833 "sql.c" break; case 24: /* cmd ::= SHOW dbPrefix STABLES LIKE ids */ -#line 113 "sql.y" { SStrToken token; setDbName(&token, &yymsp[-3].minor.yy0); setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &token, &yymsp[0].minor.yy0); } -#line 1842 "sql.c" break; case 25: /* cmd ::= SHOW dbPrefix VGROUPS */ -#line 119 "sql.y" { SStrToken token; setDbName(&token, &yymsp[-1].minor.yy0); setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, 0); } -#line 1851 "sql.c" break; case 26: /* cmd ::= SHOW dbPrefix VGROUPS ids */ -#line 125 "sql.y" { SStrToken token; setDbName(&token, &yymsp[-2].minor.yy0); setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, &yymsp[0].minor.yy0); } -#line 1860 "sql.c" break; case 27: /* cmd ::= DROP TABLE ifexists ids cpxName */ -#line 132 "sql.y" { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &yymsp[-1].minor.yy0, &yymsp[-2].minor.yy0); } -#line 1868 "sql.c" break; case 28: /* cmd ::= DROP DATABASE ifexists ids */ -#line 137 "sql.y" { setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0); } -#line 1873 "sql.c" break; case 29: /* cmd ::= DROP DNODE ids */ -#line 138 "sql.y" { setDCLSQLElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &yymsp[0].minor.yy0); } -#line 1878 "sql.c" break; case 30: /* cmd ::= DROP USER ids */ -#line 139 "sql.y" { setDCLSQLElems(pInfo, TSDB_SQL_DROP_USER, 1, &yymsp[0].minor.yy0); } -#line 1883 "sql.c" break; case 31: /* cmd ::= DROP ACCOUNT ids */ -#line 140 "sql.y" { setDCLSQLElems(pInfo, TSDB_SQL_DROP_ACCT, 1, &yymsp[0].minor.yy0); } -#line 1888 "sql.c" break; case 32: /* cmd ::= USE ids */ -#line 143 "sql.y" { setDCLSQLElems(pInfo, TSDB_SQL_USE_DB, 1, &yymsp[0].minor.yy0);} -#line 1893 "sql.c" break; case 33: /* cmd ::= DESCRIBE ids cpxName */ -#line 146 "sql.y" { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDCLSQLElems(pInfo, TSDB_SQL_DESCRIBE_TABLE, 1, &yymsp[-1].minor.yy0); } -#line 1901 "sql.c" break; case 34: /* cmd ::= ALTER USER ids PASS ids */ -#line 152 "sql.y" { setAlterUserSql(pInfo, TSDB_ALTER_USER_PASSWD, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, NULL); } -#line 1906 "sql.c" break; case 35: /* cmd ::= ALTER USER ids PRIVILEGE ids */ -#line 153 "sql.y" { setAlterUserSql(pInfo, TSDB_ALTER_USER_PRIVILEGES, &yymsp[-2].minor.yy0, NULL, &yymsp[0].minor.yy0);} -#line 1911 "sql.c" break; case 36: /* cmd ::= ALTER DNODE ids ids */ -#line 154 "sql.y" { setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 1916 "sql.c" break; case 37: /* cmd ::= ALTER DNODE ids ids ids */ -#line 155 "sql.y" { setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 3, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 1921 "sql.c" break; case 38: /* cmd ::= ALTER LOCAL ids */ -#line 156 "sql.y" { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 1, &yymsp[0].minor.yy0); } -#line 1926 "sql.c" break; case 39: /* cmd ::= ALTER LOCAL ids ids */ -#line 157 "sql.y" { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 1931 "sql.c" break; case 40: /* cmd ::= ALTER DATABASE ids alter_db_optr */ -#line 158 "sql.y" { SStrToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy478, &t);} -#line 1936 "sql.c" break; case 41: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -#line 160 "sql.y" { setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy79);} -#line 1941 "sql.c" break; case 42: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ -#line 161 "sql.y" { setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy79);} -#line 1946 "sql.c" break; case 43: /* ids ::= ID */ case 44: /* ids ::= STRING */ yytestcase(yyruleno==44); -#line 167 "sql.y" -{yygotominor.yy0 = yymsp[0].minor.yy0; } -#line 1952 "sql.c" +{yylhsminor.yy0 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 45: /* ifexists ::= IF EXISTS */ - case 47: /* ifnotexists ::= IF NOT EXISTS */ yytestcase(yyruleno==47); -#line 171 "sql.y" -{ yygotominor.yy0.n = 1;} -#line 1958 "sql.c" +{ yymsp[-1].minor.yy0.n = 1;} break; case 46: /* ifexists ::= */ case 48: /* ifnotexists ::= */ yytestcase(yyruleno==48); case 156: /* distinct ::= */ yytestcase(yyruleno==156); -#line 172 "sql.y" -{ yygotominor.yy0.n = 0;} -#line 1965 "sql.c" +{ yymsp[1].minor.yy0.n = 0;} + break; + case 47: /* ifnotexists ::= IF NOT EXISTS */ +{ yymsp[-2].minor.yy0.n = 1;} break; case 49: /* cmd ::= CREATE DNODE ids */ -#line 180 "sql.y" { setDCLSQLElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} -#line 1970 "sql.c" break; case 50: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ -#line 182 "sql.y" { setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy79);} -#line 1975 "sql.c" break; case 51: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ -#line 183 "sql.y" { setCreateDBSQL(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy478, &yymsp[-2].minor.yy0);} -#line 1980 "sql.c" break; case 52: /* cmd ::= CREATE USER ids PASS ids */ -#line 184 "sql.y" { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} -#line 1985 "sql.c" break; case 53: /* pps ::= */ case 55: /* tseries ::= */ yytestcase(yyruleno==55); @@ -1992,9 +2243,7 @@ static void yy_reduce( case 65: /* users ::= */ yytestcase(yyruleno==65); case 67: /* conns ::= */ yytestcase(yyruleno==67); case 69: /* state ::= */ yytestcase(yyruleno==69); -#line 186 "sql.y" -{ yygotominor.yy0.n = 0; } -#line 1998 "sql.c" +{ yymsp[1].minor.yy0.n = 0; } break; case 54: /* pps ::= PPS INTEGER */ case 56: /* tseries ::= TSERIES INTEGER */ yytestcase(yyruleno==56); @@ -2005,29 +2254,24 @@ static void yy_reduce( case 66: /* users ::= USERS INTEGER */ yytestcase(yyruleno==66); case 68: /* conns ::= CONNS INTEGER */ yytestcase(yyruleno==68); case 70: /* state ::= STATE ids */ yytestcase(yyruleno==70); -#line 187 "sql.y" -{ yygotominor.yy0 = yymsp[0].minor.yy0; } -#line 2011 "sql.c" +{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 71: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ -#line 214 "sql.y" { - yygotominor.yy79.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yygotominor.yy79.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yygotominor.yy79.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yygotominor.yy79.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yygotominor.yy79.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yygotominor.yy79.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yygotominor.yy79.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yygotominor.yy79.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yygotominor.yy79.stat = yymsp[0].minor.yy0; -} -#line 2026 "sql.c" + yylhsminor.yy79.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy79.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy79.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy79.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy79.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy79.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy79.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy79.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy79.stat = yymsp[0].minor.yy0; +} + yymsp[-8].minor.yy79 = yylhsminor.yy79; break; case 72: /* keep ::= KEEP tagitemlist */ -#line 228 "sql.y" -{ yygotominor.yy221 = yymsp[0].minor.yy221; } -#line 2031 "sql.c" +{ yymsp[-1].minor.yy221 = yymsp[0].minor.yy221; } break; case 73: /* cache ::= CACHE INTEGER */ case 74: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==74); @@ -2043,742 +2287,599 @@ static void yy_reduce( case 84: /* prec ::= PRECISION STRING */ yytestcase(yyruleno==84); case 85: /* update ::= UPDATE INTEGER */ yytestcase(yyruleno==85); case 86: /* cachelast ::= CACHELAST INTEGER */ yytestcase(yyruleno==86); -#line 230 "sql.y" -{ yygotominor.yy0 = yymsp[0].minor.yy0; } -#line 2049 "sql.c" +{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 87: /* db_optr ::= */ -#line 246 "sql.y" -{setDefaultCreateDbOption(&yygotominor.yy478);} -#line 2054 "sql.c" +{setDefaultCreateDbOption(&yymsp[1].minor.yy478);} break; case 88: /* db_optr ::= db_optr cache */ -#line 248 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2059 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 89: /* db_optr ::= db_optr replica */ case 104: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==104); -#line 249 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2065 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 90: /* db_optr ::= db_optr quorum */ case 105: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==105); -#line 250 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2071 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 91: /* db_optr ::= db_optr days */ -#line 251 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2076 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 92: /* db_optr ::= db_optr minrows */ -#line 252 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } -#line 2081 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 93: /* db_optr ::= db_optr maxrows */ -#line 253 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } -#line 2086 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 94: /* db_optr ::= db_optr blocks */ case 107: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==107); -#line 254 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2092 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 95: /* db_optr ::= db_optr ctime */ -#line 255 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2097 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 96: /* db_optr ::= db_optr wal */ case 109: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==109); -#line 256 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2103 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 97: /* db_optr ::= db_optr fsync */ case 110: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==110); -#line 257 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2109 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 98: /* db_optr ::= db_optr comp */ case 108: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==108); -#line 258 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2115 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 99: /* db_optr ::= db_optr prec */ -#line 259 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.precision = yymsp[0].minor.yy0; } -#line 2120 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 100: /* db_optr ::= db_optr keep */ case 106: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==106); -#line 260 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.keep = yymsp[0].minor.yy221; } -#line 2126 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.keep = yymsp[0].minor.yy221; } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 101: /* db_optr ::= db_optr update */ case 111: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==111); -#line 261 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2132 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 102: /* db_optr ::= db_optr cachelast */ case 112: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==112); -#line 262 "sql.y" -{ yygotominor.yy478 = yymsp[-1].minor.yy478; yygotominor.yy478.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2138 "sql.c" +{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 103: /* alter_db_optr ::= */ -#line 265 "sql.y" -{ setDefaultCreateDbOption(&yygotominor.yy478);} -#line 2143 "sql.c" +{ setDefaultCreateDbOption(&yymsp[1].minor.yy478);} break; case 113: /* typename ::= ids */ -#line 278 "sql.y" { yymsp[0].minor.yy0.type = 0; - tSqlSetColumnType (&yygotominor.yy503, &yymsp[0].minor.yy0); + tSqlSetColumnType (&yylhsminor.yy503, &yymsp[0].minor.yy0); } -#line 2151 "sql.c" + yymsp[0].minor.yy503 = yylhsminor.yy503; break; case 114: /* typename ::= ids LP signed RP */ -#line 284 "sql.y" { if (yymsp[-1].minor.yy109 <= 0) { yymsp[-3].minor.yy0.type = 0; - tSqlSetColumnType(&yygotominor.yy503, &yymsp[-3].minor.yy0); + tSqlSetColumnType(&yylhsminor.yy503, &yymsp[-3].minor.yy0); } else { yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy109; // negative value of name length - tSqlSetColumnType(&yygotominor.yy503, &yymsp[-3].minor.yy0); + tSqlSetColumnType(&yylhsminor.yy503, &yymsp[-3].minor.yy0); } } -#line 2164 "sql.c" + yymsp[-3].minor.yy503 = yylhsminor.yy503; break; case 115: /* typename ::= ids UNSIGNED */ -#line 295 "sql.y" { yymsp[-1].minor.yy0.type = 0; yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z); - tSqlSetColumnType (&yygotominor.yy503, &yymsp[-1].minor.yy0); + tSqlSetColumnType (&yylhsminor.yy503, &yymsp[-1].minor.yy0); } -#line 2173 "sql.c" + yymsp[-1].minor.yy503 = yylhsminor.yy503; break; case 116: /* signed ::= INTEGER */ - case 117: /* signed ::= PLUS INTEGER */ yytestcase(yyruleno==117); -#line 302 "sql.y" -{ yygotominor.yy109 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2179 "sql.c" +{ yylhsminor.yy109 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy109 = yylhsminor.yy109; + break; + case 117: /* signed ::= PLUS INTEGER */ +{ yymsp[-1].minor.yy109 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; case 118: /* signed ::= MINUS INTEGER */ - case 119: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==119); -#line 304 "sql.y" -{ yygotominor.yy109 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} -#line 2185 "sql.c" +{ yymsp[-1].minor.yy109 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} break; case 120: /* cmd ::= CREATE TABLE create_table_list */ -#line 308 "sql.y" { pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy358;} -#line 2190 "sql.c" break; case 121: /* create_table_list ::= create_from_stable */ -#line 312 "sql.y" { SCreateTableSQL* pCreateTable = calloc(1, sizeof(SCreateTableSQL)); pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo)); taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy416); pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE; - yygotominor.yy358 = pCreateTable; + yylhsminor.yy358 = pCreateTable; } -#line 2202 "sql.c" + yymsp[0].minor.yy358 = yylhsminor.yy358; break; case 122: /* create_table_list ::= create_table_list create_from_stable */ -#line 321 "sql.y" { taosArrayPush(yymsp[-1].minor.yy358->childTableInfo, &yymsp[0].minor.yy416); - yygotominor.yy358 = yymsp[-1].minor.yy358; + yylhsminor.yy358 = yymsp[-1].minor.yy358; } -#line 2210 "sql.c" + yymsp[-1].minor.yy358 = yylhsminor.yy358; break; case 123: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ -#line 327 "sql.y" { - yygotominor.yy358 = tSetCreateSqlElems(yymsp[-1].minor.yy221, NULL, NULL, TSQL_CREATE_TABLE); - setSqlInfo(pInfo, yygotominor.yy358, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy358 = tSetCreateSqlElems(yymsp[-1].minor.yy221, NULL, NULL, TSQL_CREATE_TABLE); + setSqlInfo(pInfo, yylhsminor.yy358, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0); } -#line 2221 "sql.c" + yymsp[-5].minor.yy358 = yylhsminor.yy358; break; case 124: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ -#line 336 "sql.y" { - yygotominor.yy358 = tSetCreateSqlElems(yymsp[-5].minor.yy221, yymsp[-1].minor.yy221, NULL, TSQL_CREATE_STABLE); - setSqlInfo(pInfo, yygotominor.yy358, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy358 = tSetCreateSqlElems(yymsp[-5].minor.yy221, yymsp[-1].minor.yy221, NULL, TSQL_CREATE_STABLE); + setSqlInfo(pInfo, yylhsminor.yy358, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } -#line 2232 "sql.c" + yymsp[-9].minor.yy358 = yylhsminor.yy358; break; case 125: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ -#line 347 "sql.y" { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; - yygotominor.yy416 = createNewChildTableInfo(&yymsp[-5].minor.yy0, yymsp[-1].minor.yy221, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); + yylhsminor.yy416 = createNewChildTableInfo(&yymsp[-5].minor.yy0, yymsp[-1].minor.yy221, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } -#line 2241 "sql.c" + yymsp[-9].minor.yy416 = yylhsminor.yy416; break; case 126: /* create_table_args ::= ifnotexists ids cpxName AS select */ -#line 355 "sql.y" { - yygotominor.yy358 = tSetCreateSqlElems(NULL, NULL, yymsp[0].minor.yy344, TSQL_CREATE_STREAM); - setSqlInfo(pInfo, yygotominor.yy358, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy358 = tSetCreateSqlElems(NULL, NULL, yymsp[0].minor.yy344, TSQL_CREATE_STREAM); + setSqlInfo(pInfo, yylhsminor.yy358, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0); } -#line 2252 "sql.c" + yymsp[-4].minor.yy358 = yylhsminor.yy358; break; case 127: /* columnlist ::= columnlist COMMA column */ -#line 366 "sql.y" -{taosArrayPush(yymsp[-2].minor.yy221, &yymsp[0].minor.yy503); yygotominor.yy221 = yymsp[-2].minor.yy221; } -#line 2257 "sql.c" +{taosArrayPush(yymsp[-2].minor.yy221, &yymsp[0].minor.yy503); yylhsminor.yy221 = yymsp[-2].minor.yy221; } + yymsp[-2].minor.yy221 = yylhsminor.yy221; break; case 128: /* columnlist ::= column */ -#line 367 "sql.y" -{yygotominor.yy221 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yygotominor.yy221, &yymsp[0].minor.yy503);} -#line 2262 "sql.c" +{yylhsminor.yy221 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy221, &yymsp[0].minor.yy503);} + yymsp[0].minor.yy221 = yylhsminor.yy221; break; case 129: /* column ::= ids typename */ -#line 371 "sql.y" { - tSqlSetColumnInfo(&yygotominor.yy503, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy503); + tSqlSetColumnInfo(&yylhsminor.yy503, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy503); } -#line 2269 "sql.c" + yymsp[-1].minor.yy503 = yylhsminor.yy503; break; case 130: /* tagitemlist ::= tagitemlist COMMA tagitem */ -#line 379 "sql.y" -{ yygotominor.yy221 = tVariantListAppend(yymsp[-2].minor.yy221, &yymsp[0].minor.yy106, -1); } -#line 2274 "sql.c" +{ yylhsminor.yy221 = tVariantListAppend(yymsp[-2].minor.yy221, &yymsp[0].minor.yy106, -1); } + yymsp[-2].minor.yy221 = yylhsminor.yy221; break; case 131: /* tagitemlist ::= tagitem */ -#line 380 "sql.y" -{ yygotominor.yy221 = tVariantListAppend(NULL, &yymsp[0].minor.yy106, -1); } -#line 2279 "sql.c" +{ yylhsminor.yy221 = tVariantListAppend(NULL, &yymsp[0].minor.yy106, -1); } + yymsp[0].minor.yy221 = yylhsminor.yy221; break; case 132: /* tagitem ::= INTEGER */ case 133: /* tagitem ::= FLOAT */ yytestcase(yyruleno==133); case 134: /* tagitem ::= STRING */ yytestcase(yyruleno==134); case 135: /* tagitem ::= BOOL */ yytestcase(yyruleno==135); -#line 382 "sql.y" -{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yygotominor.yy106, &yymsp[0].minor.yy0); } -#line 2287 "sql.c" +{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy106, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy106 = yylhsminor.yy106; break; case 136: /* tagitem ::= NULL */ -#line 386 "sql.y" -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yygotominor.yy106, &yymsp[0].minor.yy0); } -#line 2292 "sql.c" +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy106, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy106 = yylhsminor.yy106; break; case 137: /* tagitem ::= MINUS INTEGER */ case 138: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==138); case 139: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==139); case 140: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==140); -#line 388 "sql.y" { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type; toTSDBType(yymsp[-1].minor.yy0.type); - tVariantCreate(&yygotominor.yy106, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy106, &yymsp[-1].minor.yy0); } -#line 2305 "sql.c" + yymsp[-1].minor.yy106 = yylhsminor.yy106; break; case 141: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ -#line 419 "sql.y" { - yygotominor.yy344 = tSetQuerySqlElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy178, yymsp[-9].minor.yy221, yymsp[-8].minor.yy50, yymsp[-4].minor.yy221, yymsp[-3].minor.yy221, &yymsp[-7].minor.yy280, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy221, &yymsp[0].minor.yy454, &yymsp[-1].minor.yy454); + yylhsminor.yy344 = tSetQuerySqlElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy178, yymsp[-9].minor.yy221, yymsp[-8].minor.yy50, yymsp[-4].minor.yy221, yymsp[-3].minor.yy221, &yymsp[-7].minor.yy280, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy221, &yymsp[0].minor.yy454, &yymsp[-1].minor.yy454); } -#line 2312 "sql.c" + yymsp[-11].minor.yy344 = yylhsminor.yy344; break; case 142: /* union ::= select */ -#line 426 "sql.y" -{ yygotominor.yy273 = setSubclause(NULL, yymsp[0].minor.yy344); } -#line 2317 "sql.c" +{ yylhsminor.yy273 = setSubclause(NULL, yymsp[0].minor.yy344); } + yymsp[0].minor.yy273 = yylhsminor.yy273; break; case 143: /* union ::= LP union RP */ -#line 427 "sql.y" -{ yygotominor.yy273 = yymsp[-1].minor.yy273; } -#line 2322 "sql.c" +{ yymsp[-2].minor.yy273 = yymsp[-1].minor.yy273; } break; case 144: /* union ::= union UNION ALL select */ -#line 428 "sql.y" -{ yygotominor.yy273 = appendSelectClause(yymsp[-3].minor.yy273, yymsp[0].minor.yy344); } -#line 2327 "sql.c" +{ yylhsminor.yy273 = appendSelectClause(yymsp[-3].minor.yy273, yymsp[0].minor.yy344); } + yymsp[-3].minor.yy273 = yylhsminor.yy273; break; case 145: /* union ::= union UNION ALL LP select RP */ -#line 429 "sql.y" -{ yygotominor.yy273 = appendSelectClause(yymsp[-5].minor.yy273, yymsp[-1].minor.yy344); } -#line 2332 "sql.c" +{ yylhsminor.yy273 = appendSelectClause(yymsp[-5].minor.yy273, yymsp[-1].minor.yy344); } + yymsp[-5].minor.yy273 = yylhsminor.yy273; break; case 146: /* cmd ::= union */ -#line 431 "sql.y" { setSqlInfo(pInfo, yymsp[0].minor.yy273, NULL, TSDB_SQL_SELECT); } -#line 2337 "sql.c" break; case 147: /* select ::= SELECT selcollist */ -#line 437 "sql.y" { - yygotominor.yy344 = tSetQuerySqlElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy178, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy344 = tSetQuerySqlElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy178, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } -#line 2344 "sql.c" + yymsp[-1].minor.yy344 = yylhsminor.yy344; break; case 148: /* sclp ::= selcollist COMMA */ -#line 449 "sql.y" -{yygotominor.yy178 = yymsp[-1].minor.yy178;} -#line 2349 "sql.c" +{yylhsminor.yy178 = yymsp[-1].minor.yy178;} + yymsp[-1].minor.yy178 = yylhsminor.yy178; break; case 149: /* sclp ::= */ -#line 450 "sql.y" -{yygotominor.yy178 = 0;} -#line 2354 "sql.c" +{yymsp[1].minor.yy178 = 0;} break; case 150: /* selcollist ::= sclp distinct expr as */ -#line 451 "sql.y" { - yygotominor.yy178 = tSqlExprListAppend(yymsp[-3].minor.yy178, yymsp[-1].minor.yy50, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy178 = tSqlExprListAppend(yymsp[-3].minor.yy178, yymsp[-1].minor.yy50, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } -#line 2361 "sql.c" + yymsp[-3].minor.yy178 = yylhsminor.yy178; break; case 151: /* selcollist ::= sclp STAR */ -#line 455 "sql.y" { tSQLExpr *pNode = tSqlExprIdValueCreate(NULL, TK_ALL); - yygotominor.yy178 = tSqlExprListAppend(yymsp[-1].minor.yy178, pNode, 0, 0); + yylhsminor.yy178 = tSqlExprListAppend(yymsp[-1].minor.yy178, pNode, 0, 0); } -#line 2369 "sql.c" + yymsp[-1].minor.yy178 = yylhsminor.yy178; break; case 152: /* as ::= AS ids */ - case 153: /* as ::= ids */ yytestcase(yyruleno==153); -#line 464 "sql.y" -{ yygotominor.yy0 = yymsp[0].minor.yy0; } -#line 2375 "sql.c" +{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } + break; + case 153: /* as ::= ids */ +{ yylhsminor.yy0 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 154: /* as ::= */ -#line 466 "sql.y" -{ yygotominor.yy0.n = 0; } -#line 2380 "sql.c" +{ yymsp[1].minor.yy0.n = 0; } break; case 155: /* distinct ::= DISTINCT */ -#line 469 "sql.y" -{ yygotominor.yy0 = yymsp[0].minor.yy0; } -#line 2385 "sql.c" +{ yylhsminor.yy0 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 157: /* from ::= FROM tablelist */ - case 172: /* orderby_opt ::= ORDER BY sortlist */ yytestcase(yyruleno==172); -#line 475 "sql.y" -{yygotominor.yy221 = yymsp[0].minor.yy221;} -#line 2391 "sql.c" +{yymsp[-1].minor.yy221 = yymsp[0].minor.yy221;} break; case 158: /* tablelist ::= ids cpxName */ -#line 478 "sql.y" { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yygotominor.yy221 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); - yygotominor.yy221 = tVariantListAppendToken(yygotominor.yy221, &yymsp[-1].minor.yy0, -1); // table alias name + yylhsminor.yy221 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy221 = tVariantListAppendToken(yylhsminor.yy221, &yymsp[-1].minor.yy0, -1); // table alias name } -#line 2401 "sql.c" + yymsp[-1].minor.yy221 = yylhsminor.yy221; break; case 159: /* tablelist ::= ids cpxName ids */ -#line 485 "sql.y" { toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yygotominor.yy221 = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - yygotominor.yy221 = tVariantListAppendToken(yygotominor.yy221, &yymsp[0].minor.yy0, -1); + yylhsminor.yy221 = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); + yylhsminor.yy221 = tVariantListAppendToken(yylhsminor.yy221, &yymsp[0].minor.yy0, -1); } -#line 2412 "sql.c" + yymsp[-2].minor.yy221 = yylhsminor.yy221; break; case 160: /* tablelist ::= tablelist COMMA ids cpxName */ -#line 493 "sql.y" { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yygotominor.yy221 = tVariantListAppendToken(yymsp[-3].minor.yy221, &yymsp[-1].minor.yy0, -1); - yygotominor.yy221 = tVariantListAppendToken(yygotominor.yy221, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy221 = tVariantListAppendToken(yymsp[-3].minor.yy221, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy221 = tVariantListAppendToken(yylhsminor.yy221, &yymsp[-1].minor.yy0, -1); } -#line 2422 "sql.c" + yymsp[-3].minor.yy221 = yylhsminor.yy221; break; case 161: /* tablelist ::= tablelist COMMA ids cpxName ids */ -#line 500 "sql.y" { toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yygotominor.yy221 = tVariantListAppendToken(yymsp[-4].minor.yy221, &yymsp[-2].minor.yy0, -1); - yygotominor.yy221 = tVariantListAppendToken(yygotominor.yy221, &yymsp[0].minor.yy0, -1); + yylhsminor.yy221 = tVariantListAppendToken(yymsp[-4].minor.yy221, &yymsp[-2].minor.yy0, -1); + yylhsminor.yy221 = tVariantListAppendToken(yylhsminor.yy221, &yymsp[0].minor.yy0, -1); } -#line 2433 "sql.c" + yymsp[-4].minor.yy221 = yylhsminor.yy221; break; case 162: /* tmvar ::= VARIABLE */ -#line 510 "sql.y" -{yygotominor.yy0 = yymsp[0].minor.yy0;} -#line 2438 "sql.c" +{yylhsminor.yy0 = yymsp[0].minor.yy0;} + yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 163: /* interval_opt ::= INTERVAL LP tmvar RP */ -#line 513 "sql.y" -{yygotominor.yy280.interval = yymsp[-1].minor.yy0; yygotominor.yy280.offset.n = 0; yygotominor.yy280.offset.z = NULL; yygotominor.yy280.offset.type = 0;} -#line 2443 "sql.c" +{yymsp[-3].minor.yy280.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy280.offset.n = 0; yymsp[-3].minor.yy280.offset.z = NULL; yymsp[-3].minor.yy280.offset.type = 0;} break; case 164: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ -#line 514 "sql.y" -{yygotominor.yy280.interval = yymsp[-3].minor.yy0; yygotominor.yy280.offset = yymsp[-1].minor.yy0;} -#line 2448 "sql.c" +{yymsp[-5].minor.yy280.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy280.offset = yymsp[-1].minor.yy0;} break; case 165: /* interval_opt ::= */ -#line 515 "sql.y" -{memset(&yygotominor.yy280, 0, sizeof(yygotominor.yy280));} -#line 2453 "sql.c" +{memset(&yymsp[1].minor.yy280, 0, sizeof(yymsp[1].minor.yy280));} break; case 166: /* fill_opt ::= */ -#line 519 "sql.y" -{yygotominor.yy221 = 0; } -#line 2458 "sql.c" +{yymsp[1].minor.yy221 = 0; } break; case 167: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ -#line 520 "sql.y" { tVariant A = {0}; toTSDBType(yymsp[-3].minor.yy0.type); tVariantCreate(&A, &yymsp[-3].minor.yy0); tVariantListInsert(yymsp[-1].minor.yy221, &A, -1, 0); - yygotominor.yy221 = yymsp[-1].minor.yy221; + yymsp[-5].minor.yy221 = yymsp[-1].minor.yy221; } -#line 2470 "sql.c" break; case 168: /* fill_opt ::= FILL LP ID RP */ -#line 529 "sql.y" { toTSDBType(yymsp[-1].minor.yy0.type); - yygotominor.yy221 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yymsp[-3].minor.yy221 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); } -#line 2478 "sql.c" break; case 169: /* sliding_opt ::= SLIDING LP tmvar RP */ -#line 535 "sql.y" -{yygotominor.yy0 = yymsp[-1].minor.yy0; } -#line 2483 "sql.c" +{yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; } break; case 170: /* sliding_opt ::= */ -#line 536 "sql.y" -{yygotominor.yy0.n = 0; yygotominor.yy0.z = NULL; yygotominor.yy0.type = 0; } -#line 2488 "sql.c" +{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; case 171: /* orderby_opt ::= */ -#line 547 "sql.y" -{yygotominor.yy221 = 0;} -#line 2493 "sql.c" +{yymsp[1].minor.yy221 = 0;} + break; + case 172: /* orderby_opt ::= ORDER BY sortlist */ +{yymsp[-2].minor.yy221 = yymsp[0].minor.yy221;} break; case 173: /* sortlist ::= sortlist COMMA item sortorder */ -#line 550 "sql.y" { - yygotominor.yy221 = tVariantListAppend(yymsp[-3].minor.yy221, &yymsp[-1].minor.yy106, yymsp[0].minor.yy172); + yylhsminor.yy221 = tVariantListAppend(yymsp[-3].minor.yy221, &yymsp[-1].minor.yy106, yymsp[0].minor.yy172); } -#line 2500 "sql.c" + yymsp[-3].minor.yy221 = yylhsminor.yy221; break; case 174: /* sortlist ::= item sortorder */ -#line 554 "sql.y" { - yygotominor.yy221 = tVariantListAppend(NULL, &yymsp[-1].minor.yy106, yymsp[0].minor.yy172); + yylhsminor.yy221 = tVariantListAppend(NULL, &yymsp[-1].minor.yy106, yymsp[0].minor.yy172); } -#line 2507 "sql.c" + yymsp[-1].minor.yy221 = yylhsminor.yy221; break; case 175: /* item ::= ids cpxName */ -#line 559 "sql.y" { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - tVariantCreate(&yygotominor.yy106, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy106, &yymsp[-1].minor.yy0); } -#line 2517 "sql.c" + yymsp[-1].minor.yy106 = yylhsminor.yy106; break; case 176: /* sortorder ::= ASC */ - case 178: /* sortorder ::= */ yytestcase(yyruleno==178); -#line 567 "sql.y" -{ yygotominor.yy172 = TSDB_ORDER_ASC; } -#line 2523 "sql.c" +{ yymsp[0].minor.yy172 = TSDB_ORDER_ASC; } break; case 177: /* sortorder ::= DESC */ -#line 568 "sql.y" -{ yygotominor.yy172 = TSDB_ORDER_DESC;} -#line 2528 "sql.c" +{ yymsp[0].minor.yy172 = TSDB_ORDER_DESC;} + break; + case 178: /* sortorder ::= */ +{ yymsp[1].minor.yy172 = TSDB_ORDER_ASC; } break; case 179: /* groupby_opt ::= */ -#line 577 "sql.y" -{ yygotominor.yy221 = 0;} -#line 2533 "sql.c" +{ yymsp[1].minor.yy221 = 0;} break; case 180: /* groupby_opt ::= GROUP BY grouplist */ -#line 578 "sql.y" -{ yygotominor.yy221 = yymsp[0].minor.yy221;} -#line 2538 "sql.c" +{ yymsp[-2].minor.yy221 = yymsp[0].minor.yy221;} break; case 181: /* grouplist ::= grouplist COMMA item */ -#line 580 "sql.y" { - yygotominor.yy221 = tVariantListAppend(yymsp[-2].minor.yy221, &yymsp[0].minor.yy106, -1); + yylhsminor.yy221 = tVariantListAppend(yymsp[-2].minor.yy221, &yymsp[0].minor.yy106, -1); } -#line 2545 "sql.c" + yymsp[-2].minor.yy221 = yylhsminor.yy221; break; case 182: /* grouplist ::= item */ -#line 584 "sql.y" { - yygotominor.yy221 = tVariantListAppend(NULL, &yymsp[0].minor.yy106, -1); + yylhsminor.yy221 = tVariantListAppend(NULL, &yymsp[0].minor.yy106, -1); } -#line 2552 "sql.c" + yymsp[0].minor.yy221 = yylhsminor.yy221; break; case 183: /* having_opt ::= */ case 193: /* where_opt ::= */ yytestcase(yyruleno==193); case 231: /* expritem ::= */ yytestcase(yyruleno==231); -#line 591 "sql.y" -{yygotominor.yy50 = 0;} -#line 2559 "sql.c" +{yymsp[1].minor.yy50 = 0;} break; case 184: /* having_opt ::= HAVING expr */ case 194: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==194); - case 230: /* expritem ::= expr */ yytestcase(yyruleno==230); -#line 592 "sql.y" -{yygotominor.yy50 = yymsp[0].minor.yy50;} -#line 2566 "sql.c" +{yymsp[-1].minor.yy50 = yymsp[0].minor.yy50;} break; case 185: /* limit_opt ::= */ case 189: /* slimit_opt ::= */ yytestcase(yyruleno==189); -#line 596 "sql.y" -{yygotominor.yy454.limit = -1; yygotominor.yy454.offset = 0;} -#line 2572 "sql.c" +{yymsp[1].minor.yy454.limit = -1; yymsp[1].minor.yy454.offset = 0;} break; case 186: /* limit_opt ::= LIMIT signed */ case 190: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==190); -#line 597 "sql.y" -{yygotominor.yy454.limit = yymsp[0].minor.yy109; yygotominor.yy454.offset = 0;} -#line 2578 "sql.c" +{yymsp[-1].minor.yy454.limit = yymsp[0].minor.yy109; yymsp[-1].minor.yy454.offset = 0;} break; case 187: /* limit_opt ::= LIMIT signed OFFSET signed */ -#line 599 "sql.y" -{ yygotominor.yy454.limit = yymsp[-2].minor.yy109; yygotominor.yy454.offset = yymsp[0].minor.yy109;} -#line 2583 "sql.c" +{ yymsp[-3].minor.yy454.limit = yymsp[-2].minor.yy109; yymsp[-3].minor.yy454.offset = yymsp[0].minor.yy109;} break; case 188: /* limit_opt ::= LIMIT signed COMMA signed */ -#line 601 "sql.y" -{ yygotominor.yy454.limit = yymsp[0].minor.yy109; yygotominor.yy454.offset = yymsp[-2].minor.yy109;} -#line 2588 "sql.c" +{ yymsp[-3].minor.yy454.limit = yymsp[0].minor.yy109; yymsp[-3].minor.yy454.offset = yymsp[-2].minor.yy109;} break; case 191: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ -#line 607 "sql.y" -{yygotominor.yy454.limit = yymsp[-2].minor.yy109; yygotominor.yy454.offset = yymsp[0].minor.yy109;} -#line 2593 "sql.c" +{yymsp[-3].minor.yy454.limit = yymsp[-2].minor.yy109; yymsp[-3].minor.yy454.offset = yymsp[0].minor.yy109;} break; case 192: /* slimit_opt ::= SLIMIT signed COMMA signed */ -#line 609 "sql.y" -{yygotominor.yy454.limit = yymsp[0].minor.yy109; yygotominor.yy454.offset = yymsp[-2].minor.yy109;} -#line 2598 "sql.c" +{yymsp[-3].minor.yy454.limit = yymsp[0].minor.yy109; yymsp[-3].minor.yy454.offset = yymsp[-2].minor.yy109;} break; case 195: /* expr ::= LP expr RP */ -#line 622 "sql.y" -{yygotominor.yy50 = yymsp[-1].minor.yy50; yygotominor.yy50->token.z = yymsp[-2].minor.yy0.z; yygotominor.yy50->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} -#line 2603 "sql.c" +{yylhsminor.yy50 = yymsp[-1].minor.yy50; yylhsminor.yy50->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy50->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 196: /* expr ::= ID */ -#line 624 "sql.y" -{ yygotominor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} -#line 2608 "sql.c" +{ yylhsminor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy50 = yylhsminor.yy50; break; case 197: /* expr ::= ID DOT ID */ -#line 625 "sql.y" -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yygotominor.yy50 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} -#line 2613 "sql.c" +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy50 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 198: /* expr ::= ID DOT STAR */ -#line 626 "sql.y" -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yygotominor.yy50 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} -#line 2618 "sql.c" +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy50 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 199: /* expr ::= INTEGER */ -#line 628 "sql.y" -{ yygotominor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} -#line 2623 "sql.c" +{ yylhsminor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy50 = yylhsminor.yy50; break; case 200: /* expr ::= MINUS INTEGER */ case 201: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==201); -#line 629 "sql.y" -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yygotominor.yy50 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} -#line 2629 "sql.c" +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy50 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy50 = yylhsminor.yy50; break; case 202: /* expr ::= FLOAT */ -#line 631 "sql.y" -{ yygotominor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} -#line 2634 "sql.c" +{ yylhsminor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy50 = yylhsminor.yy50; break; case 203: /* expr ::= MINUS FLOAT */ case 204: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==204); -#line 632 "sql.y" -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yygotominor.yy50 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} -#line 2640 "sql.c" +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy50 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy50 = yylhsminor.yy50; break; case 205: /* expr ::= STRING */ -#line 634 "sql.y" -{ yygotominor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} -#line 2645 "sql.c" +{ yylhsminor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy50 = yylhsminor.yy50; break; case 206: /* expr ::= NOW */ -#line 635 "sql.y" -{ yygotominor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } -#line 2650 "sql.c" +{ yylhsminor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy50 = yylhsminor.yy50; break; case 207: /* expr ::= VARIABLE */ -#line 636 "sql.y" -{ yygotominor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} -#line 2655 "sql.c" +{ yylhsminor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy50 = yylhsminor.yy50; break; case 208: /* expr ::= BOOL */ -#line 637 "sql.y" -{ yygotominor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} -#line 2660 "sql.c" +{ yylhsminor.yy50 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy50 = yylhsminor.yy50; break; case 209: /* expr ::= ID LP exprlist RP */ -#line 640 "sql.y" -{ yygotominor.yy50 = tSqlExprCreateFunction(yymsp[-1].minor.yy178, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } -#line 2665 "sql.c" +{ yylhsminor.yy50 = tSqlExprCreateFunction(yymsp[-1].minor.yy178, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy50 = yylhsminor.yy50; break; case 210: /* expr ::= ID LP STAR RP */ -#line 643 "sql.y" -{ yygotominor.yy50 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } -#line 2670 "sql.c" +{ yylhsminor.yy50 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy50 = yylhsminor.yy50; break; case 211: /* expr ::= expr IS NULL */ -#line 646 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, NULL, TK_ISNULL);} -#line 2675 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, NULL, TK_ISNULL);} + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 212: /* expr ::= expr IS NOT NULL */ -#line 647 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-3].minor.yy50, NULL, TK_NOTNULL);} -#line 2680 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-3].minor.yy50, NULL, TK_NOTNULL);} + yymsp[-3].minor.yy50 = yylhsminor.yy50; break; case 213: /* expr ::= expr LT expr */ -#line 650 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_LT);} -#line 2685 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_LT);} + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 214: /* expr ::= expr GT expr */ -#line 651 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_GT);} -#line 2690 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_GT);} + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 215: /* expr ::= expr LE expr */ -#line 652 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_LE);} -#line 2695 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_LE);} + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 216: /* expr ::= expr GE expr */ -#line 653 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_GE);} -#line 2700 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_GE);} + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 217: /* expr ::= expr NE expr */ -#line 654 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_NE);} -#line 2705 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_NE);} + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 218: /* expr ::= expr EQ expr */ -#line 655 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_EQ);} -#line 2710 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_EQ);} + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 219: /* expr ::= expr AND expr */ -#line 657 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_AND);} -#line 2715 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_AND);} + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 220: /* expr ::= expr OR expr */ -#line 658 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_OR); } -#line 2720 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_OR); } + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 221: /* expr ::= expr PLUS expr */ -#line 661 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_PLUS); } -#line 2725 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_PLUS); } + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 222: /* expr ::= expr MINUS expr */ -#line 662 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_MINUS); } -#line 2730 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_MINUS); } + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 223: /* expr ::= expr STAR expr */ -#line 663 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_STAR); } -#line 2735 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_STAR); } + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 224: /* expr ::= expr SLASH expr */ -#line 664 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_DIVIDE);} -#line 2740 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_DIVIDE);} + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 225: /* expr ::= expr REM expr */ -#line 665 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_REM); } -#line 2745 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_REM); } + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 226: /* expr ::= expr LIKE expr */ -#line 668 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_LIKE); } -#line 2750 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-2].minor.yy50, yymsp[0].minor.yy50, TK_LIKE); } + yymsp[-2].minor.yy50 = yylhsminor.yy50; break; case 227: /* expr ::= expr IN LP exprlist RP */ -#line 671 "sql.y" -{yygotominor.yy50 = tSqlExprCreate(yymsp[-4].minor.yy50, (tSQLExpr*)yymsp[-1].minor.yy178, TK_IN); } -#line 2755 "sql.c" +{yylhsminor.yy50 = tSqlExprCreate(yymsp[-4].minor.yy50, (tSQLExpr*)yymsp[-1].minor.yy178, TK_IN); } + yymsp[-4].minor.yy50 = yylhsminor.yy50; break; case 228: /* exprlist ::= exprlist COMMA expritem */ -#line 679 "sql.y" -{yygotominor.yy178 = tSqlExprListAppend(yymsp[-2].minor.yy178,yymsp[0].minor.yy50,0, 0);} -#line 2760 "sql.c" +{yylhsminor.yy178 = tSqlExprListAppend(yymsp[-2].minor.yy178,yymsp[0].minor.yy50,0, 0);} + yymsp[-2].minor.yy178 = yylhsminor.yy178; break; case 229: /* exprlist ::= expritem */ -#line 680 "sql.y" -{yygotominor.yy178 = tSqlExprListAppend(0,yymsp[0].minor.yy50,0, 0);} -#line 2765 "sql.c" +{yylhsminor.yy178 = tSqlExprListAppend(0,yymsp[0].minor.yy50,0, 0);} + yymsp[0].minor.yy178 = yylhsminor.yy178; + break; + case 230: /* expritem ::= expr */ +{yylhsminor.yy50 = yymsp[0].minor.yy50;} + yymsp[0].minor.yy50 = yylhsminor.yy50; break; case 232: /* cmd ::= RESET QUERY CACHE */ -#line 685 "sql.y" { setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} -#line 2770 "sql.c" break; case 233: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ -#line 688 "sql.y" { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy221, NULL, TSDB_ALTER_TABLE_ADD_COLUMN); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 2779 "sql.c" break; case 234: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ -#line 694 "sql.y" { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -2788,19 +2889,15 @@ static void yy_reduce( SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 2792 "sql.c" break; case 235: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ -#line 705 "sql.y" { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy221, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 2801 "sql.c" break; case 236: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ -#line 710 "sql.y" { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -2810,10 +2907,8 @@ static void yy_reduce( SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 2814 "sql.c" break; case 237: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ -#line 720 "sql.y" { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -2826,10 +2921,8 @@ static void yy_reduce( SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 2830 "sql.c" break; case 238: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ -#line 733 "sql.y" { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; @@ -2840,51 +2933,37 @@ static void yy_reduce( SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 2844 "sql.c" break; case 239: /* cmd ::= KILL CONNECTION INTEGER */ -#line 745 "sql.y" {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} -#line 2849 "sql.c" break; case 240: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ -#line 746 "sql.y" {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} -#line 2854 "sql.c" break; case 241: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ -#line 747 "sql.y" {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} -#line 2859 "sql.c" break; default: break; +/********** End reduce actions ************************************************/ }; + assert( yyrulenoyyidx -= yysize; - yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto); - if( yyact < YYNSTATE ){ -#ifdef NDEBUG - /* If we are not debugging and the reduce action popped at least - ** one element off the stack, then we can push the new element back - ** onto the stack here, and skip the stack overflow test in yy_shift(). - ** That gives a significant speed improvement. */ - if( yysize ){ - yypParser->yyidx++; - yymsp -= yysize-1; - yymsp->stateno = (YYACTIONTYPE)yyact; - yymsp->major = (YYCODETYPE)yygoto; - yymsp->minor = yygotominor; - }else -#endif - { - yy_shift(yypParser,yyact,yygoto,&yygotominor); - } - }else{ - assert( yyact == YYNSTATE + YYNRULE + 1 ); - yy_accept(yypParser); - } + yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto); + + /* There are no SHIFTREDUCE actions on nonterminals because the table + ** generator has simplified them to pure REDUCE actions. */ + assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) ); + + /* It is not possible for a REDUCE to be followed by an error */ + assert( yyact!=YY_ERROR_ACTION ); + + yymsp += yysize+1; + yypParser->yytos = yymsp; + yymsp->stateno = (YYACTIONTYPE)yyact; + yymsp->major = (YYCODETYPE)yygoto; + yyTraceShift(yypParser, yyact, "... then shift"); } /* @@ -2900,9 +2979,11 @@ static void yy_parse_failed( fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will be executed whenever the ** parser fails */ +/************ Begin %parse_failure code ***************************************/ +/************ End %parse_failure code *****************************************/ ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } #endif /* YYNOERRORRECOVERY */ @@ -2913,11 +2994,11 @@ static void yy_parse_failed( static void yy_syntax_error( yyParser *yypParser, /* The parser */ int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ + ParseTOKENTYPE yyminor /* The minor type of the error token */ ){ ParseARG_FETCH; -#define TOKEN (yyminor.yy0) -#line 37 "sql.y" +#define TOKEN yyminor +/************ Begin %syntax_error code ****************************************/ pInfo->valid = false; int32_t outputBufLen = tListLen(pInfo->pzErrMsg); @@ -2940,7 +3021,7 @@ static void yy_syntax_error( } assert(len <= outputBufLen); -#line 2944 "sql.c" +/************ End %syntax_error code ******************************************/ ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } @@ -2956,11 +3037,15 @@ static void yy_accept( fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + assert( yypParser->yytos==yypParser->yystack ); /* Here code is inserted which will be executed whenever the ** parser accepts */ -#line 61 "sql.y" -#line 2964 "sql.c" +/*********** Begin %parse_accept code *****************************************/ + +/*********** End %parse_accept code *******************************************/ ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } @@ -2990,50 +3075,52 @@ void Parse( ParseARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ + unsigned int yyact; /* The parser action. */ +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) int yyendofinput; /* True if we are at the end of input */ +#endif #ifdef YYERRORSYMBOL int yyerrorhit = 0; /* True if yymajor has invoked an error */ #endif yyParser *yypParser; /* The parser */ - /* (re)initialize the parser, if necessary */ yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ -#if YYSTACKDEPTH<=0 - if( yypParser->yystksz <=0 ){ - /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/ - yyminorunion = yyzerominor; - yyStackOverflow(yypParser, &yyminorunion); - return; - } -#endif - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; + assert( yypParser->yytos!=0 ); +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor==0); +#endif ParseARG_STORE; #ifndef NDEBUG if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); + int stateno = yypParser->yytos->stateno; + if( stateno < YY_MIN_REDUCE ){ + fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", + yyTracePrompt,yyTokenName[yymajor],stateno); + }else{ + fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", + yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE); + } } #endif do{ yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); - if( yyact= YY_MIN_REDUCE ){ + yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); + }else if( yyact <= YY_MAX_SHIFTREDUCE ){ + yy_shift(yypParser,yyact,yymajor,yyminor); +#ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; +#endif yymajor = YYNOCODE; - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); + }else if( yyact==YY_ACCEPT_ACTION ){ + yypParser->yytos--; + yy_accept(yypParser); + return; }else{ assert( yyact == YY_ERROR_ACTION ); + yyminorunion.yy0 = yyminor; #ifdef YYERRORSYMBOL int yymx; #endif @@ -3063,9 +3150,9 @@ void Parse( ** */ if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + yy_syntax_error(yypParser,yymajor,yyminor); } - yymx = yypParser->yystack[yypParser->yyidx].major; + yymx = yypParser->yytos->major; if( yymx==YYERRORSYMBOL || yyerrorhit ){ #ifndef NDEBUG if( yyTraceFILE ){ @@ -3073,26 +3160,26 @@ void Parse( yyTracePrompt,yyTokenName[yymajor]); } #endif - yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion); + yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_reduce_action( - yypParser->yystack[yypParser->yyidx].stateno, - YYERRORSYMBOL)) >= YYNSTATE + while( yypParser->yytos >= yypParser->yystack + && yymx != YYERRORSYMBOL + && (yyact = yy_find_reduce_action( + yypParser->yytos->stateno, + YYERRORSYMBOL)) >= YY_MIN_REDUCE ){ yy_pop_parser_stack(yypParser); } - if( yypParser->yyidx < 0 || yymajor==0 ){ + if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif yymajor = YYNOCODE; }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); + yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); } } yypParser->yyerrcnt = 3; @@ -3105,7 +3192,7 @@ void Parse( ** Applications can set this macro (for example inside %include) if ** they intend to abandon the parse upon the first syntax error seen. */ - yy_syntax_error(yypParser,yymajor,yyminorunion); + yy_syntax_error(yypParser,yymajor, yyminor); yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yymajor = YYNOCODE; @@ -3120,16 +3207,31 @@ void Parse( ** three input tokens have been successfully shifted. */ if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + yy_syntax_error(yypParser,yymajor, yyminor); } yypParser->yyerrcnt = 3; yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); if( yyendofinput ){ yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif } yymajor = YYNOCODE; #endif } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); + }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); +#ifndef NDEBUG + if( yyTraceFILE ){ + yyStackEntry *i; + char cDiv = '['; + fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt); + for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){ + fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]); + cDiv = ' '; + } + fprintf(yyTraceFILE,"]\n"); + } +#endif return; } -- GitLab