sql.c 122.2 KB
Newer Older
H
hzcheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/*
** 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:
*/
#include <stdio.h>
/************ Begin %include sections from the grammar ************************/

dengyihao's avatar
dengyihao 已提交
28
#include <stdio.h>
H
hzcheng 已提交
29 30
#include <stdlib.h>
#include <string.h>
陶建辉(Jeff)'s avatar
sql.y  
陶建辉(Jeff) 已提交
31 32
#include <assert.h>
#include <stdbool.h>
33
#include "qSqlparser.h"
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
34 35 36
#include "tcmdtype.h"
#include "tstoken.h"
#include "ttokendef.h"
H
Haojun Liao 已提交
37
#include "tutil.h"
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
38
#include "tvariant.h"
H
hzcheng 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
/**************** 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 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
**                       (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 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
**    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
85
**    YYNTOKEN           Number of terminal symbols
H
hzcheng 已提交
86 87 88 89 90 91
**    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
92 93
**    YY_MIN_REDUCE      Minimum value for reduce actions
**    YY_MAX_REDUCE      Maximum value for reduce actions
H
hzcheng 已提交
94 95 96 97 98
*/
#ifndef INTERFACE
# define INTERFACE 1
#endif
/************* Begin control #defines *****************************************/
S
slguan 已提交
99
#define YYCODETYPE unsigned short int
H
Haojun Liao 已提交
100
#define YYNOCODE 272
H
hzcheng 已提交
101
#define YYACTIONTYPE unsigned short int
H
Haojun Liao 已提交
102
#define ParseTOKENTYPE SStrToken
H
hzcheng 已提交
103 104 105
typedef union {
  int yyinit;
  ParseTOKENTYPE yy0;
H
Haojun Liao 已提交
106 107 108 109 110 111 112 113 114 115 116 117 118 119
  SSubclauseInfo* yy25;
  tSQLExpr* yy66;
  SCreateAcctSQL yy73;
  int yy82;
  SQuerySQL* yy150;
  SCreateDBInfo yy158;
  TAOS_FIELD yy181;
  SLimitVal yy188;
  tSQLExprList* yy224;
  int64_t yy271;
  tVariant yy312;
  SCreateTableSQL* yy374;
  tFieldList* yy449;
  tVariantList* yy494;
H
hzcheng 已提交
120 121 122 123 124 125 126 127 128
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
#endif
#define ParseARG_SDECL SSqlInfo* pInfo;
#define ParseARG_PDECL ,SSqlInfo* pInfo
#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo
#define ParseARG_STORE yypParser->pInfo = pInfo
#define YYFALLBACK 1
Y
yihaoDeng 已提交
129 130
#define YYNSTATE             248
#define YYNRULE              227
H
Haojun Liao 已提交
131
#define YYNTOKEN             206
Y
yihaoDeng 已提交
132 133 134 135 136 137 138 139
#define YY_MAX_SHIFT         247
#define YY_MIN_SHIFTREDUCE   409
#define YY_MAX_SHIFTREDUCE   635
#define YY_ERROR_ACTION      636
#define YY_ACCEPT_ACTION     637
#define YY_NO_ACTION         638
#define YY_MIN_REDUCE        639
#define YY_MAX_REDUCE        865
H
hzcheng 已提交
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
/************* End control #defines *******************************************/

/* Define the yytestcase() macro to be a no-op if is not already defined
** otherwise.
**
** Applications can choose to define yytestcase() in the %include section
** to a macro that can assist in verifying code coverage.  For production
** code the yytestcase() macro should be turned off.  But it is useful
** for testing.
*/
#ifndef yytestcase
# define yytestcase(X)
#endif


/* Next are the tables used to determine what action to take based on the
** current state and lookahead token.  These tables are used to implement
** functions that take a state number and lookahead value and return an
** action integer.  
**
** Suppose the action integer is N.  Then the action is determined as
** follows
**
**   0 <= N <= YY_MAX_SHIFT             Shift N.  That is, push the lookahead
**                                      token onto the stack and goto state N.
**
**   N between YY_MIN_SHIFTREDUCE       Shift to an arbitrary state then
**     and YY_MAX_SHIFTREDUCE           reduce by rule N-YY_MIN_SHIFTREDUCE.
**
**   N == YY_ERROR_ACTION               A syntax error has occurred.
**
**   N == YY_ACCEPT_ACTION              The parser accepts its input.
**
**   N == YY_NO_ACTION                  No such action.  Denotes unused
**                                      slots in the yy_action[] table.
**
176 177 178
**   N between YY_MIN_REDUCE            Reduce by rule N-YY_MIN_REDUCE
**     and YY_MAX_REDUCE
**
H
hzcheng 已提交
179
** The action table is constructed as a single large table named yy_action[].
180
** Given state S and lookahead X, the action is computed as either:
H
hzcheng 已提交
181
**
182 183
**    (A)   N = yy_action[ yy_shift_ofst[S] + X ]
**    (B)   N = yy_default[S]
H
hzcheng 已提交
184
**
185 186
** The (A) formula is preferred.  The B formula is used instead if
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X.
H
hzcheng 已提交
187
**
188
** The formulas above are for computing the action when the lookahead is
H
hzcheng 已提交
189 190
** 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
191
** the yy_shift_ofst[] array.
H
hzcheng 已提交
192 193 194 195 196 197 198 199 200 201 202 203 204
**
** The following are the tables generated in this section:
**
**  yy_action[]        A single table containing all actions.
**  yy_lookahead[]     A table containing the lookahead for each entry in
**                     yy_action.  Used to detect hash collisions.
**  yy_shift_ofst[]    For each state, the offset into yy_action for
**                     shifting terminals.
**  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.
**
*********** Begin parsing tables **********************************************/
Y
yihaoDeng 已提交
205
#define YY_ACTTAB_COUNT (555)
H
hzcheng 已提交
206
static const YYACTIONTYPE yy_action[] = {
Y
yihaoDeng 已提交
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
 /*     0 */    11,  452,  140,  452,  158,  245,   21,  139,  144,  453,
 /*    10 */   140,  453,  852,   41,   43,  771,   35,   36,  849,  163,
 /*    20 */   853,   29,  452,  848,  203,   39,   37,   40,   38,  159,
 /*    30 */   453,  782,  741,   34,   33,  739,  740,   32,   31,   30,
 /*    40 */   742,  756,  744,  745,  743,  107,  160,  410,  411,  412,
 /*    50 */   413,  414,  415,  416,  417,  418,  419,  420,  421,  246,
 /*    60 */   637,  247,  178,   41,   43,  760,   35,   36,  225,  107,
 /*    70 */   140,   29,  170,  847,  203,   39,   37,   40,   38,  162,
 /*    80 */   853,  518,  779,   34,   33,  103,  156,   32,   31,   30,
 /*    90 */   234,  760,   41,   43,  157,   35,   36,  771,  758,  200,
 /*   100 */    29,   60,   56,  203,   39,   37,   40,   38,   17,  223,
 /*   110 */   222,  188,   34,   33,  145,   26,   32,   31,   30,   43,
 /*   120 */     8,   35,   36,   63,  117,  808,   29,  198,  146,  203,
 /*   130 */    39,   37,   40,   38,   32,   31,   30,  191,   34,   33,
 /*   140 */   181,  107,   32,   31,   30,  241,   21,  185,  184,  591,
 /*   150 */    16,  214,  240,  239,  213,  212,  211,  238,  210,  237,
 /*   160 */   236,  235,  209,  737,  760,  725,  726,  727,  728,  729,
 /*   170 */   730,  731,  732,  733,  734,  735,  736,   35,   36,  171,
 /*   180 */   680,  757,   29,  130,  148,  203,   39,   37,   40,   38,
 /*   190 */   244,  243,   96,  149,   34,   33,  107,  807,   32,   31,
 /*   200 */    30,  167,  604,   78,   12,  595,   62,  598,  234,  601,
 /*   210 */   689,  167,  604,  130,  150,  595,  173,  598,   27,  601,
 /*   220 */   152,  167,  604,  572,  573,  595,  153,  598,  151,  601,
 /*   230 */    90,   89,  147,  164,  165,   34,   33,  202,  142,   32,
 /*   240 */    31,   30,  681,  164,  165,  130,  818,  550,   39,   37,
 /*   250 */    40,   38,   61,  164,  165,  563,   34,   33,   17,   46,
 /*   260 */    32,   31,   30,  102,   16,   26,  240,  239,  564,   21,
 /*   270 */    26,  238,   14,  237,  236,  235,  597,  174,  600,  547,
 /*   280 */   220,  219,   76,   80,   18,  187,  166,   21,   85,   88,
 /*   290 */    79,  138,  155,  120,  121,   21,   82,  593,   42,   70,
 /*   300 */    66,   69,  172,  542,  757,  134,  132,  143,   42,  603,
 /*   310 */   190,   93,   92,   91,  596,  141,  599,  621,   42,  603,
 /*   320 */   221,   13,  757,  605,  602,    3,  862,   13,  226,  603,
 /*   330 */   757,   47,  534,  594,  602,  531,   50,  532,  538,  533,
 /*   340 */   539,  524,  523,  817,  602,   46,   22,  207,   87,   86,
 /*   350 */    48,   22,  759,   51,   75,   74,  101,   99,   10,    9,
 /*   360 */   536,  168,  537,  175,  176,  814,  813,  169,  781,  786,
 /*   370 */   751,  800,  224,  773,  788,   26,  104,  799,  118,  189,
 /*   380 */   116,  119,  691,  208,  136,   24,  100,  217,  688,  559,
 /*   390 */   218,  861,   72,  860,  858,  122,  709,   25,   23,  137,
 /*   400 */   678,   81,  676,   83,   84,  674,  673,  177,  131,  671,
 /*   410 */   192,  670,  196,  669,  770,  668,  667,  133,  665,  663,
 /*   420 */    52,  661,  659,  657,  135,   49,   57,   58,  801,   44,
 /*   430 */   201,  199,  197,  195,  535,  193,   28,  216,   77,  227,
 /*   440 */   228,  230,  229,  231,  232,  233,  242,  635,  180,  205,
 /*   450 */    53,  179,  634,  182,  183,   64,   67,  154,  633,  626,
 /*   460 */   186,  161,  105,  672,  190,   94,  544,  666,  658,  125,
 /*   470 */   710,  123,  124,  126,  127,  108,  128,  109,  129,  110,
 /*   480 */    95,  755,  111,  112,  115,  113,  114,    2,    1,   55,
 /*   490 */    59,  560,  194,    5,  565,  106,   19,    6,  606,   20,
 /*   500 */     4,   15,   65,    7,  204,  493,  206,  489,  487,  486,
 /*   510 */   485,  482,  456,  215,   68,   45,   22,   71,   73,  520,
 /*   520 */   519,  517,   54,  477,  475,  467,  473,  469,  471,  465,
 /*   530 */   463,  492,  491,  490,  488,  484,  483,   46,  454,  425,
 /*   540 */   423,  639,  638,  638,  638,  638,  638,  638,  638,  638,
 /*   550 */   638,  638,  638,   97,   98,
H
hzcheng 已提交
263 264
};
static const YYCODETYPE yy_lookahead[] = {
Y
yihaoDeng 已提交
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
 /*     0 */   260,    1,  260,    1,  209,  210,  210,  260,  260,    9,
 /*    10 */   260,    9,  270,   13,   14,  244,   16,   17,  260,  269,
 /*    20 */   270,   21,    1,  260,   24,   25,   26,   27,   28,  258,
 /*    30 */     9,  210,  226,   33,   34,  229,  230,   37,   38,   39,
 /*    40 */   234,  245,  236,  237,  238,  210,  227,   45,   46,   47,
 /*    50 */    48,   49,   50,   51,   52,   53,   54,   55,   56,   57,
 /*    60 */   207,  208,   60,   13,   14,  246,   16,   17,  210,  210,
 /*    70 */   260,   21,  227,  260,   24,   25,   26,   27,   28,  269,
 /*    80 */   270,    5,  261,   33,   34,  210,  260,   37,   38,   39,
 /*    90 */    78,  246,   13,   14,  260,   16,   17,  244,  240,  264,
 /*   100 */    21,  266,  102,   24,   25,   26,   27,   28,   98,   33,
 /*   110 */    34,  258,   33,   34,  260,  105,   37,   38,   39,   14,
 /*   120 */    98,   16,   17,  101,  102,  266,   21,  268,  260,   24,
 /*   130 */    25,   26,   27,   28,   37,   38,   39,  262,   33,   34,
 /*   140 */   126,  210,   37,   38,   39,  227,  210,  133,  134,   99,
 /*   150 */    85,   86,   87,   88,   89,   90,   91,   92,   93,   94,
 /*   160 */    95,   96,   97,  226,  246,  228,  229,  230,  231,  232,
 /*   170 */   233,  234,  235,  236,  237,  238,  239,   16,   17,  243,
 /*   180 */   214,  245,   21,  217,  260,   24,   25,   26,   27,   28,
 /*   190 */    63,   64,   65,  260,   33,   34,  210,  266,   37,   38,
 /*   200 */    39,    1,    2,   73,   44,    5,  247,    7,   78,    9,
 /*   210 */   214,    1,    2,  217,  260,    5,   66,    7,  259,    9,
 /*   220 */    60,    1,    2,  115,  116,    5,   66,    7,  260,    9,
 /*   230 */    70,   71,   72,   33,   34,   33,   34,   37,  260,   37,
 /*   240 */    38,   39,  214,   33,   34,  217,  241,   37,   25,   26,
 /*   250 */    27,   28,  266,   33,   34,   99,   33,   34,   98,  103,
 /*   260 */    37,   38,   39,   98,   85,  105,   87,   88,   99,  210,
 /*   270 */   105,   92,  103,   94,   95,   96,    5,  127,    7,  103,
 /*   280 */   130,  131,   61,   62,  108,  125,   59,  210,   67,   68,
 /*   290 */    69,  260,  132,   61,   62,  210,   75,    1,   98,   67,
 /*   300 */    68,   69,  243,   99,  245,   61,   62,  260,   98,  109,
 /*   310 */   106,   67,   68,   69,    5,  260,    7,   99,   98,  109,
 /*   320 */   243,  103,  245,   99,  124,   98,  246,  103,  243,  109,
 /*   330 */   245,  103,    2,   37,  124,    5,  103,    7,    5,    9,
 /*   340 */     7,   99,   99,  241,  124,  103,  103,   99,   73,   74,
 /*   350 */   122,  103,  246,  120,  128,  129,   61,   62,  128,  129,
 /*   360 */     5,  241,    7,   33,   34,  241,  241,  241,  210,  210,
 /*   370 */   242,  267,  241,  244,  210,  105,  210,  267,  210,  244,
 /*   380 */   248,  210,  210,  210,  210,  210,   59,  210,  210,  109,
 /*   390 */   210,  210,  210,  210,  210,  210,  210,  210,  210,  210,
 /*   400 */   210,  210,  210,  210,  210,  210,  210,  210,  210,  210,
 /*   410 */   263,  210,  263,  210,  257,  210,  210,  210,  210,  210,
 /*   420 */   119,  210,  210,  210,  210,  121,  211,  211,  211,  118,
 /*   430 */   113,  117,  112,  111,  104,  110,  123,   76,   84,   83,
 /*   440 */    49,   82,   80,   53,   81,   79,   76,    5,    5,  211,
 /*   450 */   211,  135,    5,  135,    5,  215,  215,  211,    5,   86,
 /*   460 */   126,    1,   98,  211,  106,  212,   99,  211,  211,  219,
 /*   470 */   225,  224,  223,  222,  220,  256,  221,  255,  218,  254,
 /*   480 */   212,  244,  253,  252,  249,  251,  250,  213,  216,  107,
 /*   490 */   103,   99,   98,  114,   99,   98,  103,  114,   99,  103,
 /*   500 */    98,   98,   73,   98,  100,    9,  100,    5,    5,    5,
 /*   510 */     5,    5,   77,   15,   73,   16,  103,  129,  129,    5,
 /*   520 */     5,   99,   98,    5,    5,    5,    5,    5,    5,    5,
 /*   530 */     5,    5,    5,    5,    5,    5,    5,  103,   77,   59,
 /*   540 */    58,    0,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   550 */   271,  271,  271,   21,   21,  271,  271,  271,  271,  271,
H
Haojun Liao 已提交
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
 /*   560 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   570 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   580 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   590 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   600 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   610 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   620 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   630 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   640 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   650 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   660 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   670 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   680 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   690 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   700 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   710 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   720 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   730 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   740 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
Y
yihaoDeng 已提交
340 341
 /*   750 */   271,  271,  271,  271,  271,  271,  271,  271,  271,  271,
 /*   760 */   271,
H
hzcheng 已提交
342
};
Y
yihaoDeng 已提交
343
#define YY_SHIFT_COUNT    (247)
344
#define YY_SHIFT_MIN      (0)
Y
yihaoDeng 已提交
345
#define YY_SHIFT_MAX      (541)
346
static const unsigned short int yy_shift_ofst[] = {
Y
yihaoDeng 已提交
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371
 /*     0 */   160,   65,  179,  200,  220,   21,   21,   21,   21,   21,
 /*    10 */    21,    0,    2,  220,  330,  330,  330,   10,   21,   21,
 /*    20 */    21,   21,   21,  130,   12,   12,  555,  210,  220,  220,
 /*    30 */   220,  220,  220,  220,  220,  220,  220,  220,  220,  220,
 /*    40 */   220,  220,  220,  220,  220,  330,  330,   76,   76,   76,
 /*    50 */    76,   76,   76,   22,   76,  165,   21,   21,   21,   21,
 /*    60 */   108,  108,  176,   21,   21,   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,  270,  327,  327,  280,  280,  327,  301,  304,
 /*   110 */   311,  317,  314,  320,  322,  325,  313,  270,  327,  327,
 /*   120 */   361,  361,  327,  354,  356,  391,  362,  359,  390,  363,
 /*   130 */   366,  327,  370,  327,  370,  327,  555,  555,   50,   79,
 /*   140 */    79,   79,  105,  161,  223,  223,  223,  221,  202,  202,
 /*   150 */   202,  202,  232,  244,  150,   14,   97,   97,  127,  204,
 /*   160 */   156,  169,  218,  224,  271,  309,  296,  227,  228,  233,
 /*   170 */   242,  243,  248,  226,  230,  333,  355,  275,  295,  442,
 /*   180 */   316,  443,  447,  318,  449,  453,  373,  334,  358,  367,
 /*   190 */   382,  387,  392,  364,  460,  394,  395,  397,  393,  379,
 /*   200 */   396,  383,  399,  402,  403,  404,  405,  406,  429,  496,
 /*   210 */   502,  503,  504,  505,  506,  435,  498,  441,  499,  388,
 /*   220 */   389,  413,  514,  515,  422,  424,  413,  518,  519,  520,
 /*   230 */   521,  522,  523,  524,  525,  526,  527,  528,  529,  530,
 /*   240 */   531,  434,  461,  532,  533,  480,  482,  541,
H
hzcheng 已提交
372
};
Y
yihaoDeng 已提交
373 374 375
#define YY_REDUCE_COUNT (137)
#define YY_REDUCE_MIN   (-260)
#define YY_REDUCE_MAX   (274)
H
hzcheng 已提交
376
static const short yy_reduce_ofst[] = {
Y
yihaoDeng 已提交
377 378 379 380 381 382 383 384 385 386 387 388 389 390
 /*     0 */  -147,  -63, -194, -250, -190, -141, -165,  -64,   59,   77,
 /*    10 */    85, -179, -205, -258, -181, -155,  -82, -229, -125,  -69,
 /*    20 */   -14, -142, -204,  -34,   -4,   28,  -41, -260, -253, -252,
 /*    30 */  -242, -237, -187, -174, -166, -146, -132,  -76,  -67,  -46,
 /*    40 */   -32,  -22,   31,   47,   55,   80,  106,    5,  102,  120,
 /*    50 */   124,  125,  126,  128,  131,  129,  158,  159,  164,  166,
 /*    60 */   104,  110,  132,  168,  171,  172,  173,  174,  175,  177,
 /*    70 */   178,  180,  181,  182,  183,  184,  185,  186,  187,  188,
 /*    80 */   189,  190,  191,  192,  193,  194,  195,  196,  197,  198,
 /*    90 */   199,  201,  203,  205,  206,  207,  208,  209,  211,  212,
 /*   100 */   213,  214,  135,  215,  216,  147,  149,  217,  157,  219,
 /*   110 */   222,  225,  229,  231,  234,  236,  235,  237,  238,  239,
 /*   120 */   240,  241,  246,  245,  247,  249,  250,  251,  254,  255,
 /*   130 */   260,  252,  253,  256,  268,  257,  272,  274,
H
hzcheng 已提交
391 392
};
static const YYACTIONTYPE yy_default[] = {
Y
yihaoDeng 已提交
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
 /*     0 */   636,  690,  679,  855,  855,  636,  636,  636,  636,  636,
 /*    10 */   636,  783,  654,  855,  636,  636,  636,  636,  636,  636,
 /*    20 */   636,  636,  636,  692,  692,  692,  778,  636,  636,  636,
 /*    30 */   636,  636,  636,  636,  636,  636,  636,  636,  636,  636,
 /*    40 */   636,  636,  636,  636,  636,  636,  636,  636,  636,  636,
 /*    50 */   636,  636,  636,  636,  636,  636,  636,  785,  787,  636,
 /*    60 */   804,  804,  776,  636,  636,  636,  636,  636,  636,  636,
 /*    70 */   636,  636,  636,  636,  636,  636,  636,  636,  636,  636,
 /*    80 */   636,  677,  636,  675,  636,  636,  636,  636,  636,  636,
 /*    90 */   636,  636,  636,  636,  636,  636,  664,  636,  636,  636,
 /*   100 */   636,  636,  636,  656,  656,  636,  636,  656,  811,  815,
 /*   110 */   809,  797,  805,  796,  792,  791,  819,  636,  656,  656,
 /*   120 */   687,  687,  656,  708,  706,  704,  696,  702,  698,  700,
 /*   130 */   694,  656,  685,  656,  685,  656,  724,  738,  636,  820,
 /*   140 */   854,  810,  838,  837,  850,  844,  843,  636,  842,  841,
 /*   150 */   840,  839,  636,  636,  636,  636,  846,  845,  636,  636,
 /*   160 */   636,  636,  636,  636,  636,  636,  636,  822,  816,  812,
 /*   170 */   636,  636,  636,  636,  636,  636,  636,  636,  636,  636,
 /*   180 */   636,  636,  636,  636,  636,  636,  636,  636,  775,  636,
 /*   190 */   636,  784,  636,  636,  636,  636,  636,  636,  806,  636,
 /*   200 */   798,  636,  636,  636,  636,  636,  636,  752,  636,  636,
 /*   210 */   636,  636,  636,  636,  636,  636,  636,  636,  636,  636,
 /*   220 */   636,  859,  636,  636,  636,  746,  857,  636,  636,  636,
 /*   230 */   636,  636,  636,  636,  636,  636,  636,  636,  636,  636,
 /*   240 */   636,  711,  636,  662,  660,  636,  652,  636,
H
hzcheng 已提交
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484
};
/********** End of lemon-generated parsing tables *****************************/

/* The next table maps tokens (terminal symbols) into fallback tokens.  
** If a construct like the following:
** 
**      %fallback ID X Y Z.
**
** appears in the grammar, then ID becomes a fallback token for X, Y,
** 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[] = {
    0,  /*          $ => nothing */
    0,  /*         ID => nothing */
    1,  /*       BOOL => ID */
    1,  /*    TINYINT => ID */
    1,  /*   SMALLINT => ID */
    1,  /*    INTEGER => ID */
    1,  /*     BIGINT => ID */
    1,  /*      FLOAT => ID */
    1,  /*     DOUBLE => ID */
    1,  /*     STRING => ID */
    1,  /*  TIMESTAMP => ID */
    1,  /*     BINARY => ID */
    1,  /*      NCHAR => ID */
    0,  /*         OR => nothing */
    0,  /*        AND => nothing */
    0,  /*        NOT => nothing */
    0,  /*         EQ => nothing */
    0,  /*         NE => nothing */
    0,  /*     ISNULL => nothing */
    0,  /*    NOTNULL => nothing */
    0,  /*         IS => nothing */
    1,  /*       LIKE => ID */
    1,  /*       GLOB => ID */
    0,  /*    BETWEEN => nothing */
    0,  /*         IN => nothing */
    0,  /*         GT => nothing */
    0,  /*         GE => nothing */
    0,  /*         LT => nothing */
    0,  /*         LE => nothing */
    0,  /*     BITAND => nothing */
    0,  /*      BITOR => nothing */
    0,  /*     LSHIFT => nothing */
    0,  /*     RSHIFT => nothing */
    0,  /*       PLUS => nothing */
    0,  /*      MINUS => nothing */
    0,  /*     DIVIDE => nothing */
    0,  /*      TIMES => nothing */
    0,  /*       STAR => nothing */
    0,  /*      SLASH => nothing */
    0,  /*        REM => nothing */
    0,  /*     CONCAT => nothing */
    0,  /*     UMINUS => nothing */
    0,  /*      UPLUS => nothing */
    0,  /*     BITNOT => nothing */
    0,  /*       SHOW => nothing */
    0,  /*  DATABASES => nothing */
    0,  /*     MNODES => nothing */
    0,  /*     DNODES => nothing */
S
slguan 已提交
485
    0,  /*   ACCOUNTS => nothing */
H
hzcheng 已提交
486 487 488 489 490
    0,  /*      USERS => nothing */
    0,  /*    MODULES => nothing */
    0,  /*    QUERIES => nothing */
    0,  /* CONNECTIONS => nothing */
    0,  /*    STREAMS => nothing */
H
Haojun Liao 已提交
491
    0,  /*  VARIABLES => nothing */
H
hzcheng 已提交
492 493
    0,  /*     SCORES => nothing */
    0,  /*     GRANTS => nothing */
L
lihui 已提交
494 495
    0,  /*     VNODES => nothing */
    1,  /*    IPTOKEN => ID */
H
hzcheng 已提交
496
    0,  /*        DOT => nothing */
Y
yihaoDeng 已提交
497 498 499
    0,  /*     CREATE => nothing */
    0,  /*      TABLE => nothing */
    1,  /*   DATABASE => ID */
H
hzcheng 已提交
500 501 502 503
    0,  /*     TABLES => nothing */
    0,  /*    STABLES => nothing */
    0,  /*    VGROUPS => nothing */
    0,  /*       DROP => nothing */
S
slguan 已提交
504
    0,  /*      DNODE => nothing */
H
hzcheng 已提交
505
    0,  /*       USER => nothing */
S
slguan 已提交
506
    0,  /*    ACCOUNT => nothing */
H
hzcheng 已提交
507 508 509 510 511 512 513 514
    0,  /*        USE => nothing */
    0,  /*   DESCRIBE => nothing */
    0,  /*      ALTER => nothing */
    0,  /*       PASS => nothing */
    0,  /*  PRIVILEGE => nothing */
    0,  /*      LOCAL => nothing */
    0,  /*         IF => nothing */
    0,  /*     EXISTS => nothing */
S
slguan 已提交
515 516 517 518 519 520 521
    0,  /*        PPS => nothing */
    0,  /*    TSERIES => nothing */
    0,  /*        DBS => nothing */
    0,  /*    STORAGE => nothing */
    0,  /*      QTIME => nothing */
    0,  /*      CONNS => nothing */
    0,  /*      STATE => nothing */
H
hzcheng 已提交
522
    0,  /*       KEEP => nothing */
523
    0,  /*      CACHE => nothing */
H
hzcheng 已提交
524
    0,  /*    REPLICA => nothing */
525
    0,  /*     QUORUM => nothing */
H
hzcheng 已提交
526
    0,  /*       DAYS => nothing */
H
hjxilinx 已提交
527 528 529
    0,  /*    MINROWS => nothing */
    0,  /*    MAXROWS => nothing */
    0,  /*     BLOCKS => nothing */
H
hzcheng 已提交
530
    0,  /*      CTIME => nothing */
H
hjxilinx 已提交
531
    0,  /*        WAL => nothing */
陶建辉(Jeff)'s avatar
sql.y  
陶建辉(Jeff) 已提交
532
    0,  /*      FSYNC => nothing */
H
hzcheng 已提交
533 534 535 536 537 538 539 540
    0,  /*       COMP => nothing */
    0,  /*  PRECISION => nothing */
    0,  /*         LP => nothing */
    0,  /*         RP => nothing */
    0,  /*       TAGS => nothing */
    0,  /*      USING => nothing */
    0,  /*         AS => nothing */
    0,  /*      COMMA => nothing */
H
hjxilinx 已提交
541
    1,  /*       NULL => ID */
H
hzcheng 已提交
542
    0,  /*     SELECT => nothing */
543
    0,  /*      UNION => nothing */
544
    1,  /*        ALL => ID */
H
hzcheng 已提交
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571
    0,  /*       FROM => nothing */
    0,  /*   VARIABLE => nothing */
    0,  /*   INTERVAL => nothing */
    0,  /*       FILL => nothing */
    0,  /*    SLIDING => nothing */
    0,  /*      ORDER => nothing */
    0,  /*         BY => nothing */
    1,  /*        ASC => ID */
    1,  /*       DESC => ID */
    0,  /*      GROUP => nothing */
    0,  /*     HAVING => nothing */
    0,  /*      LIMIT => nothing */
    1,  /*     OFFSET => ID */
    0,  /*     SLIMIT => nothing */
    0,  /*    SOFFSET => nothing */
    0,  /*      WHERE => nothing */
    1,  /*        NOW => ID */
    0,  /*      RESET => nothing */
    0,  /*      QUERY => nothing */
    0,  /*        ADD => nothing */
    0,  /*     COLUMN => nothing */
    0,  /*        TAG => nothing */
    0,  /*     CHANGE => nothing */
    0,  /*        SET => nothing */
    0,  /*       KILL => nothing */
    0,  /* CONNECTION => nothing */
    0,  /*     STREAM => nothing */
572
    0,  /*      COLON => nothing */
H
hzcheng 已提交
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619
    1,  /*      ABORT => ID */
    1,  /*      AFTER => ID */
    1,  /*     ATTACH => ID */
    1,  /*     BEFORE => ID */
    1,  /*      BEGIN => ID */
    1,  /*    CASCADE => ID */
    1,  /*    CLUSTER => ID */
    1,  /*   CONFLICT => ID */
    1,  /*       COPY => ID */
    1,  /*   DEFERRED => ID */
    1,  /* DELIMITERS => ID */
    1,  /*     DETACH => ID */
    1,  /*       EACH => ID */
    1,  /*        END => ID */
    1,  /*    EXPLAIN => ID */
    1,  /*       FAIL => ID */
    1,  /*        FOR => ID */
    1,  /*     IGNORE => ID */
    1,  /*  IMMEDIATE => ID */
    1,  /*  INITIALLY => ID */
    1,  /*    INSTEAD => ID */
    1,  /*      MATCH => ID */
    1,  /*        KEY => ID */
    1,  /*         OF => ID */
    1,  /*      RAISE => ID */
    1,  /*    REPLACE => ID */
    1,  /*   RESTRICT => ID */
    1,  /*        ROW => ID */
    1,  /*  STATEMENT => ID */
    1,  /*    TRIGGER => ID */
    1,  /*       VIEW => ID */
    1,  /*      COUNT => ID */
    1,  /*        SUM => ID */
    1,  /*        AVG => ID */
    1,  /*        MIN => ID */
    1,  /*        MAX => ID */
    1,  /*      FIRST => ID */
    1,  /*       LAST => ID */
    1,  /*        TOP => ID */
    1,  /*     BOTTOM => ID */
    1,  /*     STDDEV => ID */
    1,  /* PERCENTILE => ID */
    1,  /* APERCENTILE => ID */
    1,  /* LEASTSQUARES => ID */
    1,  /*  HISTOGRAM => ID */
    1,  /*       DIFF => ID */
    1,  /*     SPREAD => ID */
S
slguan 已提交
620
    1,  /*        TWA => ID */
H
hzcheng 已提交
621 622
    1,  /*     INTERP => ID */
    1,  /*   LAST_ROW => ID */
H
hjxilinx 已提交
623 624 625 626 627 628
    1,  /*       RATE => ID */
    1,  /*      IRATE => ID */
    1,  /*   SUM_RATE => ID */
    1,  /*  SUM_IRATE => ID */
    1,  /*   AVG_RATE => ID */
    1,  /*  AVG_IRATE => ID */
629
    1,  /*       TBID => ID */
H
hzcheng 已提交
630 631 632 633 634 635 636 637 638 639
    1,  /*       SEMI => ID */
    1,  /*       NONE => ID */
    1,  /*       PREV => ID */
    1,  /*     LINEAR => ID */
    1,  /*     IMPORT => ID */
    1,  /*     METRIC => ID */
    1,  /*     TBNAME => ID */
    1,  /*       JOIN => ID */
    1,  /*    METRICS => ID */
    1,  /*     STABLE => ID */
640 641 642
    1,  /*     INSERT => ID */
    1,  /*       INTO => ID */
    1,  /*     VALUES => ID */
H
hzcheng 已提交
643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673
};
#endif /* YYFALLBACK */

/* The following structure represents a single element of the
** parser's stack.  Information stored includes:
**
**   +  The state number for the parser at this level of the stack.
**
**   +  The value of the token stored at this level of the stack.
**      (In other words, the "major" token.)
**
**   +  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, 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
                         ** is the value of the token  */
};
typedef struct yyStackEntry yyStackEntry;

/* The state of the parser is completely contained in an instance of
** the following structure */
struct yyParser {
674
  yyStackEntry *yytos;          /* Pointer to top element of the stack */
H
hzcheng 已提交
675
#ifdef YYTRACKMAXSTACKDEPTH
676
  int yyhwm;                    /* High-water mark of the stack */
H
hzcheng 已提交
677
#endif
678
#ifndef YYNOERRORRECOVERY
H
hzcheng 已提交
679
  int yyerrcnt;                 /* Shifts left before out of the error */
680
#endif
H
hzcheng 已提交
681 682 683 684
  ParseARG_SDECL                /* A place to hold %extra_argument */
#if YYSTACKDEPTH<=0
  int yystksz;                  /* Current side of the stack */
  yyStackEntry *yystack;        /* The parser's stack */
685
  yyStackEntry yystk0;          /* First stack entry */
H
hzcheng 已提交
686 687
#else
  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */
688
  yyStackEntry *yystackEnd;            /* Last entry in the stack */
H
hzcheng 已提交
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724
#endif
};
typedef struct yyParser yyParser;

#ifndef NDEBUG
#include <stdio.h>
static FILE *yyTraceFILE = 0;
static char *yyTracePrompt = 0;
#endif /* NDEBUG */

#ifndef NDEBUG
/* 
** Turn parser tracing on by giving a stream to which to write the trace
** and a prompt to preface each trace message.  Tracing is turned off
** by making either argument NULL 
**
** Inputs:
** <ul>
** <li> A FILE* to which trace output should be written.
**      If NULL, then tracing is turned off.
** <li> A prefix string written at the beginning of every
**      line of trace output.  If NULL, then tracing is
**      turned off.
** </ul>
**
** Outputs:
** None.
*/
void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
  yyTraceFILE = TraceFILE;
  yyTracePrompt = zTracePrompt;
  if( yyTraceFILE==0 ) yyTracePrompt = 0;
  else if( yyTracePrompt==0 ) yyTraceFILE = 0;
}
#endif /* NDEBUG */

725
#if defined(YYCOVERAGE) || !defined(NDEBUG)
H
hzcheng 已提交
726 727 728
/* For tracing shifts, the names of all terminals and nonterminals
** are required.  The following table supplies these names */
static const char *const yyTokenName[] = { 
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782
  /*    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",
H
Haojun Liao 已提交
783
  /*   54 */ "VARIABLES",
784 785 786 787 788
  /*   55 */ "SCORES",
  /*   56 */ "GRANTS",
  /*   57 */ "VNODES",
  /*   58 */ "IPTOKEN",
  /*   59 */ "DOT",
Y
yihaoDeng 已提交
789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806
  /*   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",
807 808 809 810 811 812 813 814
  /*   78 */ "PPS",
  /*   79 */ "TSERIES",
  /*   80 */ "DBS",
  /*   81 */ "STORAGE",
  /*   82 */ "QTIME",
  /*   83 */ "CONNS",
  /*   84 */ "STATE",
  /*   85 */ "KEEP",
H
Haojun Liao 已提交
815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999
  /*   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 */ "LP",
  /*   99 */ "RP",
  /*  100 */ "TAGS",
  /*  101 */ "USING",
  /*  102 */ "AS",
  /*  103 */ "COMMA",
  /*  104 */ "NULL",
  /*  105 */ "SELECT",
  /*  106 */ "UNION",
  /*  107 */ "ALL",
  /*  108 */ "FROM",
  /*  109 */ "VARIABLE",
  /*  110 */ "INTERVAL",
  /*  111 */ "FILL",
  /*  112 */ "SLIDING",
  /*  113 */ "ORDER",
  /*  114 */ "BY",
  /*  115 */ "ASC",
  /*  116 */ "DESC",
  /*  117 */ "GROUP",
  /*  118 */ "HAVING",
  /*  119 */ "LIMIT",
  /*  120 */ "OFFSET",
  /*  121 */ "SLIMIT",
  /*  122 */ "SOFFSET",
  /*  123 */ "WHERE",
  /*  124 */ "NOW",
  /*  125 */ "RESET",
  /*  126 */ "QUERY",
  /*  127 */ "ADD",
  /*  128 */ "COLUMN",
  /*  129 */ "TAG",
  /*  130 */ "CHANGE",
  /*  131 */ "SET",
  /*  132 */ "KILL",
  /*  133 */ "CONNECTION",
  /*  134 */ "STREAM",
  /*  135 */ "COLON",
  /*  136 */ "ABORT",
  /*  137 */ "AFTER",
  /*  138 */ "ATTACH",
  /*  139 */ "BEFORE",
  /*  140 */ "BEGIN",
  /*  141 */ "CASCADE",
  /*  142 */ "CLUSTER",
  /*  143 */ "CONFLICT",
  /*  144 */ "COPY",
  /*  145 */ "DEFERRED",
  /*  146 */ "DELIMITERS",
  /*  147 */ "DETACH",
  /*  148 */ "EACH",
  /*  149 */ "END",
  /*  150 */ "EXPLAIN",
  /*  151 */ "FAIL",
  /*  152 */ "FOR",
  /*  153 */ "IGNORE",
  /*  154 */ "IMMEDIATE",
  /*  155 */ "INITIALLY",
  /*  156 */ "INSTEAD",
  /*  157 */ "MATCH",
  /*  158 */ "KEY",
  /*  159 */ "OF",
  /*  160 */ "RAISE",
  /*  161 */ "REPLACE",
  /*  162 */ "RESTRICT",
  /*  163 */ "ROW",
  /*  164 */ "STATEMENT",
  /*  165 */ "TRIGGER",
  /*  166 */ "VIEW",
  /*  167 */ "COUNT",
  /*  168 */ "SUM",
  /*  169 */ "AVG",
  /*  170 */ "MIN",
  /*  171 */ "MAX",
  /*  172 */ "FIRST",
  /*  173 */ "LAST",
  /*  174 */ "TOP",
  /*  175 */ "BOTTOM",
  /*  176 */ "STDDEV",
  /*  177 */ "PERCENTILE",
  /*  178 */ "APERCENTILE",
  /*  179 */ "LEASTSQUARES",
  /*  180 */ "HISTOGRAM",
  /*  181 */ "DIFF",
  /*  182 */ "SPREAD",
  /*  183 */ "TWA",
  /*  184 */ "INTERP",
  /*  185 */ "LAST_ROW",
  /*  186 */ "RATE",
  /*  187 */ "IRATE",
  /*  188 */ "SUM_RATE",
  /*  189 */ "SUM_IRATE",
  /*  190 */ "AVG_RATE",
  /*  191 */ "AVG_IRATE",
  /*  192 */ "TBID",
  /*  193 */ "SEMI",
  /*  194 */ "NONE",
  /*  195 */ "PREV",
  /*  196 */ "LINEAR",
  /*  197 */ "IMPORT",
  /*  198 */ "METRIC",
  /*  199 */ "TBNAME",
  /*  200 */ "JOIN",
  /*  201 */ "METRICS",
  /*  202 */ "STABLE",
  /*  203 */ "INSERT",
  /*  204 */ "INTO",
  /*  205 */ "VALUES",
  /*  206 */ "error",
  /*  207 */ "program",
  /*  208 */ "cmd",
  /*  209 */ "dbPrefix",
  /*  210 */ "ids",
  /*  211 */ "cpxName",
  /*  212 */ "ifexists",
  /*  213 */ "alter_db_optr",
  /*  214 */ "acct_optr",
  /*  215 */ "ifnotexists",
  /*  216 */ "db_optr",
  /*  217 */ "pps",
  /*  218 */ "tseries",
  /*  219 */ "dbs",
  /*  220 */ "streams",
  /*  221 */ "storage",
  /*  222 */ "qtime",
  /*  223 */ "users",
  /*  224 */ "conns",
  /*  225 */ "state",
  /*  226 */ "keep",
  /*  227 */ "tagitemlist",
  /*  228 */ "cache",
  /*  229 */ "replica",
  /*  230 */ "quorum",
  /*  231 */ "days",
  /*  232 */ "minrows",
  /*  233 */ "maxrows",
  /*  234 */ "blocks",
  /*  235 */ "ctime",
  /*  236 */ "wal",
  /*  237 */ "fsync",
  /*  238 */ "comp",
  /*  239 */ "prec",
  /*  240 */ "typename",
  /*  241 */ "signed",
  /*  242 */ "create_table_args",
  /*  243 */ "columnlist",
  /*  244 */ "select",
  /*  245 */ "column",
  /*  246 */ "tagitem",
  /*  247 */ "selcollist",
  /*  248 */ "from",
  /*  249 */ "where_opt",
  /*  250 */ "interval_opt",
  /*  251 */ "fill_opt",
  /*  252 */ "sliding_opt",
  /*  253 */ "groupby_opt",
  /*  254 */ "orderby_opt",
  /*  255 */ "having_opt",
  /*  256 */ "slimit_opt",
  /*  257 */ "limit_opt",
  /*  258 */ "union",
  /*  259 */ "sclp",
  /*  260 */ "expr",
  /*  261 */ "as",
  /*  262 */ "tablelist",
  /*  263 */ "tmvar",
  /*  264 */ "sortlist",
  /*  265 */ "sortitem",
  /*  266 */ "item",
  /*  267 */ "sortorder",
  /*  268 */ "grouplist",
  /*  269 */ "exprlist",
  /*  270 */ "expritem",
H
hzcheng 已提交
1000
};
1001
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
H
hzcheng 已提交
1002 1003 1004 1005 1006 1007 1008 1009 1010

#ifndef NDEBUG
/* For tracing reduce actions, the names of all rules are required.
*/
static const char *const yyRuleName[] = {
 /*   0 */ "program ::= cmd",
 /*   1 */ "cmd ::= SHOW DATABASES",
 /*   2 */ "cmd ::= SHOW MNODES",
 /*   3 */ "cmd ::= SHOW DNODES",
S
slguan 已提交
1011 1012 1013 1014 1015 1016
 /*   4 */ "cmd ::= SHOW ACCOUNTS",
 /*   5 */ "cmd ::= SHOW USERS",
 /*   6 */ "cmd ::= SHOW MODULES",
 /*   7 */ "cmd ::= SHOW QUERIES",
 /*   8 */ "cmd ::= SHOW CONNECTIONS",
 /*   9 */ "cmd ::= SHOW STREAMS",
H
Haojun Liao 已提交
1017
 /*  10 */ "cmd ::= SHOW VARIABLES",
S
slguan 已提交
1018 1019
 /*  11 */ "cmd ::= SHOW SCORES",
 /*  12 */ "cmd ::= SHOW GRANTS",
L
lihui 已提交
1020 1021 1022 1023 1024 1025
 /*  13 */ "cmd ::= SHOW VNODES",
 /*  14 */ "cmd ::= SHOW VNODES IPTOKEN",
 /*  15 */ "dbPrefix ::=",
 /*  16 */ "dbPrefix ::= ids DOT",
 /*  17 */ "cpxName ::=",
 /*  18 */ "cpxName ::= DOT ids",
Y
yihaoDeng 已提交
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233
 /*  19 */ "cmd ::= SHOW CREATE TABLE ids cpxName",
 /*  20 */ "cmd ::= SHOW CREATE DATABASE ids",
 /*  21 */ "cmd ::= SHOW dbPrefix TABLES",
 /*  22 */ "cmd ::= SHOW dbPrefix TABLES LIKE ids",
 /*  23 */ "cmd ::= SHOW dbPrefix STABLES",
 /*  24 */ "cmd ::= SHOW dbPrefix STABLES LIKE ids",
 /*  25 */ "cmd ::= SHOW dbPrefix VGROUPS",
 /*  26 */ "cmd ::= SHOW dbPrefix VGROUPS ids",
 /*  27 */ "cmd ::= DROP TABLE ifexists ids cpxName",
 /*  28 */ "cmd ::= DROP DATABASE ifexists ids",
 /*  29 */ "cmd ::= DROP DNODE ids",
 /*  30 */ "cmd ::= DROP USER ids",
 /*  31 */ "cmd ::= DROP ACCOUNT ids",
 /*  32 */ "cmd ::= USE ids",
 /*  33 */ "cmd ::= DESCRIBE ids cpxName",
 /*  34 */ "cmd ::= ALTER USER ids PASS ids",
 /*  35 */ "cmd ::= ALTER USER ids PRIVILEGE ids",
 /*  36 */ "cmd ::= ALTER DNODE ids ids",
 /*  37 */ "cmd ::= ALTER DNODE ids ids ids",
 /*  38 */ "cmd ::= ALTER LOCAL ids",
 /*  39 */ "cmd ::= ALTER LOCAL ids ids",
 /*  40 */ "cmd ::= ALTER DATABASE ids alter_db_optr",
 /*  41 */ "cmd ::= ALTER ACCOUNT ids acct_optr",
 /*  42 */ "cmd ::= ALTER ACCOUNT ids PASS ids acct_optr",
 /*  43 */ "ids ::= ID",
 /*  44 */ "ids ::= STRING",
 /*  45 */ "ifexists ::= IF EXISTS",
 /*  46 */ "ifexists ::=",
 /*  47 */ "ifnotexists ::= IF NOT EXISTS",
 /*  48 */ "ifnotexists ::=",
 /*  49 */ "cmd ::= CREATE DNODE ids",
 /*  50 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr",
 /*  51 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr",
 /*  52 */ "cmd ::= CREATE USER ids PASS ids",
 /*  53 */ "pps ::=",
 /*  54 */ "pps ::= PPS INTEGER",
 /*  55 */ "tseries ::=",
 /*  56 */ "tseries ::= TSERIES INTEGER",
 /*  57 */ "dbs ::=",
 /*  58 */ "dbs ::= DBS INTEGER",
 /*  59 */ "streams ::=",
 /*  60 */ "streams ::= STREAMS INTEGER",
 /*  61 */ "storage ::=",
 /*  62 */ "storage ::= STORAGE INTEGER",
 /*  63 */ "qtime ::=",
 /*  64 */ "qtime ::= QTIME INTEGER",
 /*  65 */ "users ::=",
 /*  66 */ "users ::= USERS INTEGER",
 /*  67 */ "conns ::=",
 /*  68 */ "conns ::= CONNS INTEGER",
 /*  69 */ "state ::=",
 /*  70 */ "state ::= STATE ids",
 /*  71 */ "acct_optr ::= pps tseries storage streams qtime dbs users conns state",
 /*  72 */ "keep ::= KEEP tagitemlist",
 /*  73 */ "cache ::= CACHE INTEGER",
 /*  74 */ "replica ::= REPLICA INTEGER",
 /*  75 */ "quorum ::= QUORUM INTEGER",
 /*  76 */ "days ::= DAYS INTEGER",
 /*  77 */ "minrows ::= MINROWS INTEGER",
 /*  78 */ "maxrows ::= MAXROWS INTEGER",
 /*  79 */ "blocks ::= BLOCKS INTEGER",
 /*  80 */ "ctime ::= CTIME INTEGER",
 /*  81 */ "wal ::= WAL INTEGER",
 /*  82 */ "fsync ::= FSYNC INTEGER",
 /*  83 */ "comp ::= COMP INTEGER",
 /*  84 */ "prec ::= PRECISION STRING",
 /*  85 */ "db_optr ::=",
 /*  86 */ "db_optr ::= db_optr cache",
 /*  87 */ "db_optr ::= db_optr replica",
 /*  88 */ "db_optr ::= db_optr quorum",
 /*  89 */ "db_optr ::= db_optr days",
 /*  90 */ "db_optr ::= db_optr minrows",
 /*  91 */ "db_optr ::= db_optr maxrows",
 /*  92 */ "db_optr ::= db_optr blocks",
 /*  93 */ "db_optr ::= db_optr ctime",
 /*  94 */ "db_optr ::= db_optr wal",
 /*  95 */ "db_optr ::= db_optr fsync",
 /*  96 */ "db_optr ::= db_optr comp",
 /*  97 */ "db_optr ::= db_optr prec",
 /*  98 */ "db_optr ::= db_optr keep",
 /*  99 */ "alter_db_optr ::=",
 /* 100 */ "alter_db_optr ::= alter_db_optr replica",
 /* 101 */ "alter_db_optr ::= alter_db_optr quorum",
 /* 102 */ "alter_db_optr ::= alter_db_optr keep",
 /* 103 */ "alter_db_optr ::= alter_db_optr blocks",
 /* 104 */ "alter_db_optr ::= alter_db_optr comp",
 /* 105 */ "alter_db_optr ::= alter_db_optr wal",
 /* 106 */ "alter_db_optr ::= alter_db_optr fsync",
 /* 107 */ "typename ::= ids",
 /* 108 */ "typename ::= ids LP signed RP",
 /* 109 */ "signed ::= INTEGER",
 /* 110 */ "signed ::= PLUS INTEGER",
 /* 111 */ "signed ::= MINUS INTEGER",
 /* 112 */ "cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args",
 /* 113 */ "create_table_args ::= LP columnlist RP",
 /* 114 */ "create_table_args ::= LP columnlist RP TAGS LP columnlist RP",
 /* 115 */ "create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP",
 /* 116 */ "create_table_args ::= AS select",
 /* 117 */ "columnlist ::= columnlist COMMA column",
 /* 118 */ "columnlist ::= column",
 /* 119 */ "column ::= ids typename",
 /* 120 */ "tagitemlist ::= tagitemlist COMMA tagitem",
 /* 121 */ "tagitemlist ::= tagitem",
 /* 122 */ "tagitem ::= INTEGER",
 /* 123 */ "tagitem ::= FLOAT",
 /* 124 */ "tagitem ::= STRING",
 /* 125 */ "tagitem ::= BOOL",
 /* 126 */ "tagitem ::= NULL",
 /* 127 */ "tagitem ::= MINUS INTEGER",
 /* 128 */ "tagitem ::= MINUS FLOAT",
 /* 129 */ "tagitem ::= PLUS INTEGER",
 /* 130 */ "tagitem ::= PLUS FLOAT",
 /* 131 */ "select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt",
 /* 132 */ "union ::= select",
 /* 133 */ "union ::= LP union RP",
 /* 134 */ "union ::= union UNION ALL select",
 /* 135 */ "union ::= union UNION ALL LP select RP",
 /* 136 */ "cmd ::= union",
 /* 137 */ "select ::= SELECT selcollist",
 /* 138 */ "sclp ::= selcollist COMMA",
 /* 139 */ "sclp ::=",
 /* 140 */ "selcollist ::= sclp expr as",
 /* 141 */ "selcollist ::= sclp STAR",
 /* 142 */ "as ::= AS ids",
 /* 143 */ "as ::= ids",
 /* 144 */ "as ::=",
 /* 145 */ "from ::= FROM tablelist",
 /* 146 */ "tablelist ::= ids cpxName",
 /* 147 */ "tablelist ::= ids cpxName ids",
 /* 148 */ "tablelist ::= tablelist COMMA ids cpxName",
 /* 149 */ "tablelist ::= tablelist COMMA ids cpxName ids",
 /* 150 */ "tmvar ::= VARIABLE",
 /* 151 */ "interval_opt ::= INTERVAL LP tmvar RP",
 /* 152 */ "interval_opt ::=",
 /* 153 */ "fill_opt ::=",
 /* 154 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP",
 /* 155 */ "fill_opt ::= FILL LP ID RP",
 /* 156 */ "sliding_opt ::= SLIDING LP tmvar RP",
 /* 157 */ "sliding_opt ::=",
 /* 158 */ "orderby_opt ::=",
 /* 159 */ "orderby_opt ::= ORDER BY sortlist",
 /* 160 */ "sortlist ::= sortlist COMMA item sortorder",
 /* 161 */ "sortlist ::= item sortorder",
 /* 162 */ "item ::= ids cpxName",
 /* 163 */ "sortorder ::= ASC",
 /* 164 */ "sortorder ::= DESC",
 /* 165 */ "sortorder ::=",
 /* 166 */ "groupby_opt ::=",
 /* 167 */ "groupby_opt ::= GROUP BY grouplist",
 /* 168 */ "grouplist ::= grouplist COMMA item",
 /* 169 */ "grouplist ::= item",
 /* 170 */ "having_opt ::=",
 /* 171 */ "having_opt ::= HAVING expr",
 /* 172 */ "limit_opt ::=",
 /* 173 */ "limit_opt ::= LIMIT signed",
 /* 174 */ "limit_opt ::= LIMIT signed OFFSET signed",
 /* 175 */ "limit_opt ::= LIMIT signed COMMA signed",
 /* 176 */ "slimit_opt ::=",
 /* 177 */ "slimit_opt ::= SLIMIT signed",
 /* 178 */ "slimit_opt ::= SLIMIT signed SOFFSET signed",
 /* 179 */ "slimit_opt ::= SLIMIT signed COMMA signed",
 /* 180 */ "where_opt ::=",
 /* 181 */ "where_opt ::= WHERE expr",
 /* 182 */ "expr ::= LP expr RP",
 /* 183 */ "expr ::= ID",
 /* 184 */ "expr ::= ID DOT ID",
 /* 185 */ "expr ::= ID DOT STAR",
 /* 186 */ "expr ::= INTEGER",
 /* 187 */ "expr ::= MINUS INTEGER",
 /* 188 */ "expr ::= PLUS INTEGER",
 /* 189 */ "expr ::= FLOAT",
 /* 190 */ "expr ::= MINUS FLOAT",
 /* 191 */ "expr ::= PLUS FLOAT",
 /* 192 */ "expr ::= STRING",
 /* 193 */ "expr ::= NOW",
 /* 194 */ "expr ::= VARIABLE",
 /* 195 */ "expr ::= BOOL",
 /* 196 */ "expr ::= ID LP exprlist RP",
 /* 197 */ "expr ::= ID LP STAR RP",
 /* 198 */ "expr ::= expr AND expr",
 /* 199 */ "expr ::= expr OR expr",
 /* 200 */ "expr ::= expr LT expr",
 /* 201 */ "expr ::= expr GT expr",
 /* 202 */ "expr ::= expr LE expr",
 /* 203 */ "expr ::= expr GE expr",
 /* 204 */ "expr ::= expr NE expr",
 /* 205 */ "expr ::= expr EQ expr",
 /* 206 */ "expr ::= expr PLUS expr",
 /* 207 */ "expr ::= expr MINUS expr",
 /* 208 */ "expr ::= expr STAR expr",
 /* 209 */ "expr ::= expr SLASH expr",
 /* 210 */ "expr ::= expr REM expr",
 /* 211 */ "expr ::= expr LIKE expr",
 /* 212 */ "expr ::= expr IN LP exprlist RP",
 /* 213 */ "exprlist ::= exprlist COMMA expritem",
 /* 214 */ "exprlist ::= expritem",
 /* 215 */ "expritem ::= expr",
 /* 216 */ "expritem ::=",
 /* 217 */ "cmd ::= RESET QUERY CACHE",
 /* 218 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
 /* 219 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
 /* 220 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
 /* 221 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
 /* 222 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
 /* 223 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
 /* 224 */ "cmd ::= KILL CONNECTION INTEGER",
 /* 225 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
 /* 226 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
H
hzcheng 已提交
1234 1235 1236 1237 1238 1239
};
#endif /* NDEBUG */


#if YYSTACKDEPTH<=0
/*
1240 1241
** Try to increase the size of the parser stack.  Return the number
** of errors.  Return 0 on success.
H
hzcheng 已提交
1242
*/
1243
static int yyGrowStack(yyParser *p){
H
hzcheng 已提交
1244
  int newSize;
1245
  int idx;
H
hzcheng 已提交
1246 1247 1248
  yyStackEntry *pNew;

  newSize = p->yystksz*2 + 100;
1249 1250 1251 1252 1253 1254 1255
  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]));
  }
H
hzcheng 已提交
1256 1257
  if( pNew ){
    p->yystack = pNew;
1258
    p->yytos = &p->yystack[idx];
H
hzcheng 已提交
1259 1260
#ifndef NDEBUG
    if( yyTraceFILE ){
1261 1262
      fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
              yyTracePrompt, p->yystksz, newSize);
H
hzcheng 已提交
1263 1264
    }
#endif
1265
    p->yystksz = newSize;
H
hzcheng 已提交
1266
  }
1267
  return pNew==0; 
H
hzcheng 已提交
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279
}
#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

1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307
/* 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
H
hzcheng 已提交
1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322
/* 
** This function allocates a new parser.
** The only argument is a pointer to a function which works like
** malloc.
**
** Inputs:
** A pointer to the function used to allocate memory.
**
** Outputs:
** A pointer to a parser.  This pointer is used in subsequent calls
** to Parse and ParseFree.
*/
void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){
  yyParser *pParser;
  pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
1323
  if( pParser ) ParseInit(pParser);
H
hzcheng 已提交
1324 1325
  return pParser;
}
1326 1327
#endif /* Parse_ENGINEALWAYSONSTACK */

H
hzcheng 已提交
1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353

/* 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 */
  YYCODETYPE yymajor,     /* Type code for object to destroy */
  YYMINORTYPE *yypminor   /* The object to be destroyed */
){
  ParseARG_FETCH;
  switch( yymajor ){
    /* Here is inserted the actions which take place when a
    ** terminal or non-terminal is destroyed.  This can happen
    ** when the symbol is popped from the stack during a
    ** reduce or during error processing or when a parser is 
    ** 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
    ** inside the C code.
    */
/********* Begin destructor definitions ***************************************/
H
Haojun Liao 已提交
1354 1355 1356 1357 1358 1359 1360
    case 226: /* keep */
    case 227: /* tagitemlist */
    case 251: /* fill_opt */
    case 253: /* groupby_opt */
    case 254: /* orderby_opt */
    case 264: /* sortlist */
    case 268: /* grouplist */
H
hzcheng 已提交
1361
{
H
Haojun Liao 已提交
1362
tVariantListDestroy((yypminor->yy494));
H
hjliao 已提交
1363 1364
}
      break;
H
Haojun Liao 已提交
1365
    case 243: /* columnlist */
H
hjliao 已提交
1366
{
H
Haojun Liao 已提交
1367
tFieldListDestroy((yypminor->yy449));
H
hzcheng 已提交
1368 1369
}
      break;
H
Haojun Liao 已提交
1370
    case 244: /* select */
H
hzcheng 已提交
1371
{
H
Haojun Liao 已提交
1372
doDestroyQuerySql((yypminor->yy150));
H
hzcheng 已提交
1373 1374
}
      break;
H
Haojun Liao 已提交
1375 1376 1377
    case 247: /* selcollist */
    case 259: /* sclp */
    case 269: /* exprlist */
H
hzcheng 已提交
1378
{
H
Haojun Liao 已提交
1379
tSQLExprListDestroy((yypminor->yy224));
H
hzcheng 已提交
1380 1381
}
      break;
H
Haojun Liao 已提交
1382 1383 1384 1385
    case 249: /* where_opt */
    case 255: /* having_opt */
    case 260: /* expr */
    case 270: /* expritem */
H
hzcheng 已提交
1386
{
H
Haojun Liao 已提交
1387
tSQLExprDestroy((yypminor->yy66));
H
hzcheng 已提交
1388 1389
}
      break;
H
Haojun Liao 已提交
1390
    case 258: /* union */
1391
{
H
Haojun Liao 已提交
1392
destroyAllSelectClause((yypminor->yy25));
1393 1394
}
      break;
H
Haojun Liao 已提交
1395
    case 265: /* sortitem */
H
hzcheng 已提交
1396
{
H
Haojun Liao 已提交
1397
tVariantDestroy(&(yypminor->yy312));
H
hzcheng 已提交
1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412
}
      break;
/********* End destructor definitions *****************************************/
    default:  break;   /* If no destructor action specified: do nothing */
  }
}

/*
** Pop the parser's stack once.
**
** If there is a destructor routine associated with the token which
** is popped from the stack, then call it.
*/
static void yy_pop_parser_stack(yyParser *pParser){
  yyStackEntry *yytos;
1413 1414 1415
  assert( pParser->yytos!=0 );
  assert( pParser->yytos > pParser->yystack );
  yytos = pParser->yytos--;
H
hzcheng 已提交
1416 1417 1418 1419 1420 1421 1422 1423 1424 1425
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sPopping %s\n",
      yyTracePrompt,
      yyTokenName[yytos->major]);
  }
#endif
  yy_destructor(pParser, yytos->major, &yytos->minor);
}

1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437
/*
** 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
H
hzcheng 已提交
1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450
/* 
** Deallocate and destroy a parser.  Destructors are called for
** all stack elements before shutting the parser down.
**
** 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 */
){
#ifndef YYPARSEFREENEVERNULL
1451
  if( p==0 ) return;
L
lihui 已提交
1452
#endif
1453 1454
  ParseFinalize(p);
  (*freeProc)(p);
H
hzcheng 已提交
1455
}
1456
#endif /* Parse_ENGINEALWAYSONSTACK */
H
hzcheng 已提交
1457 1458 1459 1460 1461 1462 1463

/*
** Return the peak depth of the stack for a parser.
*/
#ifdef YYTRACKMAXSTACKDEPTH
int ParseStackPeak(void *p){
  yyParser *pParser = (yyParser*)p;
1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501
  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; stateno<YYNSTATE; stateno++){
    i = yy_shift_ofst[stateno];
    for(iLookAhead=0; iLookAhead<YYNTOKEN; iLookAhead++){
      if( yy_lookahead[i+iLookAhead]!=iLookAhead ) continue;
      if( yycoverage[stateno][iLookAhead]==0 ) nMissed++;
      if( out ){
        fprintf(out,"State %d lookahead %s %s\n", stateno,
                yyTokenName[iLookAhead],
                yycoverage[stateno][iLookAhead] ? "ok" : "missed");
      }
    }
  }
  return nMissed;
H
hzcheng 已提交
1502 1503 1504 1505 1506 1507 1508
}
#endif

/*
** Find the appropriate action for a parser given the terminal
** look-ahead token iLookAhead.
*/
1509
static unsigned int yy_find_shift_action(
H
hzcheng 已提交
1510 1511 1512 1513
  yyParser *pParser,        /* The parser */
  YYCODETYPE iLookAhead     /* The look-ahead token */
){
  int i;
1514
  int stateno = pParser->yytos->stateno;
H
hzcheng 已提交
1515
 
1516
  if( stateno>YY_MAX_SHIFT ) return stateno;
H
hzcheng 已提交
1517
  assert( stateno <= YY_SHIFT_COUNT );
1518 1519 1520
#if defined(YYCOVERAGE)
  yycoverage[stateno][iLookAhead] = 1;
#endif
H
hzcheng 已提交
1521 1522
  do{
    i = yy_shift_ofst[stateno];
1523
    assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) );
H
hzcheng 已提交
1524
    assert( iLookAhead!=YYNOCODE );
1525
    assert( iLookAhead < YYNTOKEN );
H
hzcheng 已提交
1526
    i += iLookAhead;
1527
    if( yy_lookahead[i]!=iLookAhead ){
H
hzcheng 已提交
1528
#ifdef YYFALLBACK
1529 1530 1531
      YYCODETYPE iFallback;            /* Fallback token */
      if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
             && (iFallback = yyFallback[iLookAhead])!=0 ){
H
hzcheng 已提交
1532
#ifndef NDEBUG
1533 1534 1535
        if( yyTraceFILE ){
          fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
             yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
L
lihui 已提交
1536
        }
1537 1538 1539 1540 1541
#endif
        assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
        iLookAhead = iFallback;
        continue;
      }
H
hzcheng 已提交
1542 1543
#endif
#ifdef YYWILDCARD
1544 1545 1546
      {
        int j = i - iLookAhead + YYWILDCARD;
        if( 
H
hzcheng 已提交
1547
#if YY_SHIFT_MIN+YYWILDCARD<0
1548
          j>=0 &&
H
hzcheng 已提交
1549 1550
#endif
#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
1551
          j<YY_ACTTAB_COUNT &&
H
hzcheng 已提交
1552
#endif
1553 1554
          yy_lookahead[j]==YYWILDCARD && iLookAhead>0
        ){
H
hzcheng 已提交
1555
#ifndef NDEBUG
1556 1557 1558 1559
          if( yyTraceFILE ){
            fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
               yyTracePrompt, yyTokenName[iLookAhead],
               yyTokenName[YYWILDCARD]);
L
lihui 已提交
1560
          }
1561 1562
#endif /* NDEBUG */
          return yy_action[j];
H
hzcheng 已提交
1563
        }
L
lihui 已提交
1564
      }
1565
#endif /* YYWILDCARD */
H
hzcheng 已提交
1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605
      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.
*/
static int yy_find_reduce_action(
  int stateno,              /* Current state number */
  YYCODETYPE iLookAhead     /* The look-ahead token */
){
  int i;
#ifdef YYERRORSYMBOL
  if( stateno>YY_REDUCE_COUNT ){
    return yy_default[stateno];
  }
#else
  assert( stateno<=YY_REDUCE_COUNT );
#endif
  i = yy_reduce_ofst[stateno];
  assert( iLookAhead!=YYNOCODE );
  i += iLookAhead;
#ifdef YYERRORSYMBOL
  if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
    return yy_default[stateno];
  }
#else
  assert( i>=0 && i<YY_ACTTAB_COUNT );
  assert( yy_lookahead[i]==iLookAhead );
#endif
  return yy_action[i];
}

/*
** The following routine is called if the stack overflows.
*/
1606
static void yyStackOverflow(yyParser *yypParser){
H
hzcheng 已提交
1607 1608 1609 1610 1611 1612
   ParseARG_FETCH;
#ifndef NDEBUG
   if( yyTraceFILE ){
     fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
   }
#endif
1613
   while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
H
hzcheng 已提交
1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624
   /* 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
1625
static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){
H
hzcheng 已提交
1626 1627
  if( yyTraceFILE ){
    if( yyNewState<YYNSTATE ){
1628 1629
      fprintf(yyTraceFILE,"%s%s '%s', go to state %d\n",
         yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
H
hzcheng 已提交
1630 1631
         yyNewState);
    }else{
1632 1633 1634
      fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n",
         yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
         yyNewState - YY_MIN_REDUCE);
H
hzcheng 已提交
1635 1636 1637 1638
    }
  }
}
#else
1639
# define yyTraceShift(X,Y,Z)
H
hzcheng 已提交
1640 1641 1642 1643 1644 1645 1646 1647 1648
#endif

/*
** Perform a shift action.
*/
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 */
1649
  ParseTOKENTYPE yyMinor        /* The minor token to shift in */
H
hzcheng 已提交
1650 1651
){
  yyStackEntry *yytos;
1652
  yypParser->yytos++;
H
hzcheng 已提交
1653
#ifdef YYTRACKMAXSTACKDEPTH
1654 1655 1656
  if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
    yypParser->yyhwm++;
    assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
H
hzcheng 已提交
1657 1658 1659
  }
#endif
#if YYSTACKDEPTH>0 
1660 1661 1662
  if( yypParser->yytos>yypParser->yystackEnd ){
    yypParser->yytos--;
    yyStackOverflow(yypParser);
H
hzcheng 已提交
1663 1664 1665
    return;
  }
#else
1666 1667 1668 1669
  if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
    if( yyGrowStack(yypParser) ){
      yypParser->yytos--;
      yyStackOverflow(yypParser);
H
hzcheng 已提交
1670 1671 1672 1673
      return;
    }
  }
#endif
1674 1675 1676 1677
  if( yyNewState > YY_MAX_SHIFT ){
    yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
  }
  yytos = yypParser->yytos;
H
hzcheng 已提交
1678 1679
  yytos->stateno = (YYACTIONTYPE)yyNewState;
  yytos->major = (YYCODETYPE)yyMajor;
1680 1681
  yytos->minor.yy0 = yyMinor;
  yyTraceShift(yypParser, yyNewState, "Shift");
H
hzcheng 已提交
1682 1683 1684 1685 1686 1687
}

/* The following table contains information about every rule that
** is used during the reduce.
*/
static const struct {
1688 1689
  YYCODETYPE lhs;       /* Symbol on the left-hand side of the rule */
  signed char nrhs;     /* Negative of the number of RHS symbols in the rule */
H
hzcheng 已提交
1690
} yyRuleInfo[] = {
H
Haojun Liao 已提交
1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709
  {  207,   -1 }, /* (0) program ::= cmd */
  {  208,   -2 }, /* (1) cmd ::= SHOW DATABASES */
  {  208,   -2 }, /* (2) cmd ::= SHOW MNODES */
  {  208,   -2 }, /* (3) cmd ::= SHOW DNODES */
  {  208,   -2 }, /* (4) cmd ::= SHOW ACCOUNTS */
  {  208,   -2 }, /* (5) cmd ::= SHOW USERS */
  {  208,   -2 }, /* (6) cmd ::= SHOW MODULES */
  {  208,   -2 }, /* (7) cmd ::= SHOW QUERIES */
  {  208,   -2 }, /* (8) cmd ::= SHOW CONNECTIONS */
  {  208,   -2 }, /* (9) cmd ::= SHOW STREAMS */
  {  208,   -2 }, /* (10) cmd ::= SHOW VARIABLES */
  {  208,   -2 }, /* (11) cmd ::= SHOW SCORES */
  {  208,   -2 }, /* (12) cmd ::= SHOW GRANTS */
  {  208,   -2 }, /* (13) cmd ::= SHOW VNODES */
  {  208,   -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */
  {  209,    0 }, /* (15) dbPrefix ::= */
  {  209,   -2 }, /* (16) dbPrefix ::= ids DOT */
  {  211,    0 }, /* (17) cpxName ::= */
  {  211,   -2 }, /* (18) cpxName ::= DOT ids */
Y
yihaoDeng 已提交
1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917
  {  208,   -5 }, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */
  {  208,   -4 }, /* (20) cmd ::= SHOW CREATE DATABASE ids */
  {  208,   -3 }, /* (21) cmd ::= SHOW dbPrefix TABLES */
  {  208,   -5 }, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */
  {  208,   -3 }, /* (23) cmd ::= SHOW dbPrefix STABLES */
  {  208,   -5 }, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */
  {  208,   -3 }, /* (25) cmd ::= SHOW dbPrefix VGROUPS */
  {  208,   -4 }, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */
  {  208,   -5 }, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */
  {  208,   -4 }, /* (28) cmd ::= DROP DATABASE ifexists ids */
  {  208,   -3 }, /* (29) cmd ::= DROP DNODE ids */
  {  208,   -3 }, /* (30) cmd ::= DROP USER ids */
  {  208,   -3 }, /* (31) cmd ::= DROP ACCOUNT ids */
  {  208,   -2 }, /* (32) cmd ::= USE ids */
  {  208,   -3 }, /* (33) cmd ::= DESCRIBE ids cpxName */
  {  208,   -5 }, /* (34) cmd ::= ALTER USER ids PASS ids */
  {  208,   -5 }, /* (35) cmd ::= ALTER USER ids PRIVILEGE ids */
  {  208,   -4 }, /* (36) cmd ::= ALTER DNODE ids ids */
  {  208,   -5 }, /* (37) cmd ::= ALTER DNODE ids ids ids */
  {  208,   -3 }, /* (38) cmd ::= ALTER LOCAL ids */
  {  208,   -4 }, /* (39) cmd ::= ALTER LOCAL ids ids */
  {  208,   -4 }, /* (40) cmd ::= ALTER DATABASE ids alter_db_optr */
  {  208,   -4 }, /* (41) cmd ::= ALTER ACCOUNT ids acct_optr */
  {  208,   -6 }, /* (42) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
  {  210,   -1 }, /* (43) ids ::= ID */
  {  210,   -1 }, /* (44) ids ::= STRING */
  {  212,   -2 }, /* (45) ifexists ::= IF EXISTS */
  {  212,    0 }, /* (46) ifexists ::= */
  {  215,   -3 }, /* (47) ifnotexists ::= IF NOT EXISTS */
  {  215,    0 }, /* (48) ifnotexists ::= */
  {  208,   -3 }, /* (49) cmd ::= CREATE DNODE ids */
  {  208,   -6 }, /* (50) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
  {  208,   -5 }, /* (51) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
  {  208,   -5 }, /* (52) cmd ::= CREATE USER ids PASS ids */
  {  217,    0 }, /* (53) pps ::= */
  {  217,   -2 }, /* (54) pps ::= PPS INTEGER */
  {  218,    0 }, /* (55) tseries ::= */
  {  218,   -2 }, /* (56) tseries ::= TSERIES INTEGER */
  {  219,    0 }, /* (57) dbs ::= */
  {  219,   -2 }, /* (58) dbs ::= DBS INTEGER */
  {  220,    0 }, /* (59) streams ::= */
  {  220,   -2 }, /* (60) streams ::= STREAMS INTEGER */
  {  221,    0 }, /* (61) storage ::= */
  {  221,   -2 }, /* (62) storage ::= STORAGE INTEGER */
  {  222,    0 }, /* (63) qtime ::= */
  {  222,   -2 }, /* (64) qtime ::= QTIME INTEGER */
  {  223,    0 }, /* (65) users ::= */
  {  223,   -2 }, /* (66) users ::= USERS INTEGER */
  {  224,    0 }, /* (67) conns ::= */
  {  224,   -2 }, /* (68) conns ::= CONNS INTEGER */
  {  225,    0 }, /* (69) state ::= */
  {  225,   -2 }, /* (70) state ::= STATE ids */
  {  214,   -9 }, /* (71) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
  {  226,   -2 }, /* (72) keep ::= KEEP tagitemlist */
  {  228,   -2 }, /* (73) cache ::= CACHE INTEGER */
  {  229,   -2 }, /* (74) replica ::= REPLICA INTEGER */
  {  230,   -2 }, /* (75) quorum ::= QUORUM INTEGER */
  {  231,   -2 }, /* (76) days ::= DAYS INTEGER */
  {  232,   -2 }, /* (77) minrows ::= MINROWS INTEGER */
  {  233,   -2 }, /* (78) maxrows ::= MAXROWS INTEGER */
  {  234,   -2 }, /* (79) blocks ::= BLOCKS INTEGER */
  {  235,   -2 }, /* (80) ctime ::= CTIME INTEGER */
  {  236,   -2 }, /* (81) wal ::= WAL INTEGER */
  {  237,   -2 }, /* (82) fsync ::= FSYNC INTEGER */
  {  238,   -2 }, /* (83) comp ::= COMP INTEGER */
  {  239,   -2 }, /* (84) prec ::= PRECISION STRING */
  {  216,    0 }, /* (85) db_optr ::= */
  {  216,   -2 }, /* (86) db_optr ::= db_optr cache */
  {  216,   -2 }, /* (87) db_optr ::= db_optr replica */
  {  216,   -2 }, /* (88) db_optr ::= db_optr quorum */
  {  216,   -2 }, /* (89) db_optr ::= db_optr days */
  {  216,   -2 }, /* (90) db_optr ::= db_optr minrows */
  {  216,   -2 }, /* (91) db_optr ::= db_optr maxrows */
  {  216,   -2 }, /* (92) db_optr ::= db_optr blocks */
  {  216,   -2 }, /* (93) db_optr ::= db_optr ctime */
  {  216,   -2 }, /* (94) db_optr ::= db_optr wal */
  {  216,   -2 }, /* (95) db_optr ::= db_optr fsync */
  {  216,   -2 }, /* (96) db_optr ::= db_optr comp */
  {  216,   -2 }, /* (97) db_optr ::= db_optr prec */
  {  216,   -2 }, /* (98) db_optr ::= db_optr keep */
  {  213,    0 }, /* (99) alter_db_optr ::= */
  {  213,   -2 }, /* (100) alter_db_optr ::= alter_db_optr replica */
  {  213,   -2 }, /* (101) alter_db_optr ::= alter_db_optr quorum */
  {  213,   -2 }, /* (102) alter_db_optr ::= alter_db_optr keep */
  {  213,   -2 }, /* (103) alter_db_optr ::= alter_db_optr blocks */
  {  213,   -2 }, /* (104) alter_db_optr ::= alter_db_optr comp */
  {  213,   -2 }, /* (105) alter_db_optr ::= alter_db_optr wal */
  {  213,   -2 }, /* (106) alter_db_optr ::= alter_db_optr fsync */
  {  240,   -1 }, /* (107) typename ::= ids */
  {  240,   -4 }, /* (108) typename ::= ids LP signed RP */
  {  241,   -1 }, /* (109) signed ::= INTEGER */
  {  241,   -2 }, /* (110) signed ::= PLUS INTEGER */
  {  241,   -2 }, /* (111) signed ::= MINUS INTEGER */
  {  208,   -6 }, /* (112) cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */
  {  242,   -3 }, /* (113) create_table_args ::= LP columnlist RP */
  {  242,   -7 }, /* (114) create_table_args ::= LP columnlist RP TAGS LP columnlist RP */
  {  242,   -7 }, /* (115) create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */
  {  242,   -2 }, /* (116) create_table_args ::= AS select */
  {  243,   -3 }, /* (117) columnlist ::= columnlist COMMA column */
  {  243,   -1 }, /* (118) columnlist ::= column */
  {  245,   -2 }, /* (119) column ::= ids typename */
  {  227,   -3 }, /* (120) tagitemlist ::= tagitemlist COMMA tagitem */
  {  227,   -1 }, /* (121) tagitemlist ::= tagitem */
  {  246,   -1 }, /* (122) tagitem ::= INTEGER */
  {  246,   -1 }, /* (123) tagitem ::= FLOAT */
  {  246,   -1 }, /* (124) tagitem ::= STRING */
  {  246,   -1 }, /* (125) tagitem ::= BOOL */
  {  246,   -1 }, /* (126) tagitem ::= NULL */
  {  246,   -2 }, /* (127) tagitem ::= MINUS INTEGER */
  {  246,   -2 }, /* (128) tagitem ::= MINUS FLOAT */
  {  246,   -2 }, /* (129) tagitem ::= PLUS INTEGER */
  {  246,   -2 }, /* (130) tagitem ::= PLUS FLOAT */
  {  244,  -12 }, /* (131) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
  {  258,   -1 }, /* (132) union ::= select */
  {  258,   -3 }, /* (133) union ::= LP union RP */
  {  258,   -4 }, /* (134) union ::= union UNION ALL select */
  {  258,   -6 }, /* (135) union ::= union UNION ALL LP select RP */
  {  208,   -1 }, /* (136) cmd ::= union */
  {  244,   -2 }, /* (137) select ::= SELECT selcollist */
  {  259,   -2 }, /* (138) sclp ::= selcollist COMMA */
  {  259,    0 }, /* (139) sclp ::= */
  {  247,   -3 }, /* (140) selcollist ::= sclp expr as */
  {  247,   -2 }, /* (141) selcollist ::= sclp STAR */
  {  261,   -2 }, /* (142) as ::= AS ids */
  {  261,   -1 }, /* (143) as ::= ids */
  {  261,    0 }, /* (144) as ::= */
  {  248,   -2 }, /* (145) from ::= FROM tablelist */
  {  262,   -2 }, /* (146) tablelist ::= ids cpxName */
  {  262,   -3 }, /* (147) tablelist ::= ids cpxName ids */
  {  262,   -4 }, /* (148) tablelist ::= tablelist COMMA ids cpxName */
  {  262,   -5 }, /* (149) tablelist ::= tablelist COMMA ids cpxName ids */
  {  263,   -1 }, /* (150) tmvar ::= VARIABLE */
  {  250,   -4 }, /* (151) interval_opt ::= INTERVAL LP tmvar RP */
  {  250,    0 }, /* (152) interval_opt ::= */
  {  251,    0 }, /* (153) fill_opt ::= */
  {  251,   -6 }, /* (154) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
  {  251,   -4 }, /* (155) fill_opt ::= FILL LP ID RP */
  {  252,   -4 }, /* (156) sliding_opt ::= SLIDING LP tmvar RP */
  {  252,    0 }, /* (157) sliding_opt ::= */
  {  254,    0 }, /* (158) orderby_opt ::= */
  {  254,   -3 }, /* (159) orderby_opt ::= ORDER BY sortlist */
  {  264,   -4 }, /* (160) sortlist ::= sortlist COMMA item sortorder */
  {  264,   -2 }, /* (161) sortlist ::= item sortorder */
  {  266,   -2 }, /* (162) item ::= ids cpxName */
  {  267,   -1 }, /* (163) sortorder ::= ASC */
  {  267,   -1 }, /* (164) sortorder ::= DESC */
  {  267,    0 }, /* (165) sortorder ::= */
  {  253,    0 }, /* (166) groupby_opt ::= */
  {  253,   -3 }, /* (167) groupby_opt ::= GROUP BY grouplist */
  {  268,   -3 }, /* (168) grouplist ::= grouplist COMMA item */
  {  268,   -1 }, /* (169) grouplist ::= item */
  {  255,    0 }, /* (170) having_opt ::= */
  {  255,   -2 }, /* (171) having_opt ::= HAVING expr */
  {  257,    0 }, /* (172) limit_opt ::= */
  {  257,   -2 }, /* (173) limit_opt ::= LIMIT signed */
  {  257,   -4 }, /* (174) limit_opt ::= LIMIT signed OFFSET signed */
  {  257,   -4 }, /* (175) limit_opt ::= LIMIT signed COMMA signed */
  {  256,    0 }, /* (176) slimit_opt ::= */
  {  256,   -2 }, /* (177) slimit_opt ::= SLIMIT signed */
  {  256,   -4 }, /* (178) slimit_opt ::= SLIMIT signed SOFFSET signed */
  {  256,   -4 }, /* (179) slimit_opt ::= SLIMIT signed COMMA signed */
  {  249,    0 }, /* (180) where_opt ::= */
  {  249,   -2 }, /* (181) where_opt ::= WHERE expr */
  {  260,   -3 }, /* (182) expr ::= LP expr RP */
  {  260,   -1 }, /* (183) expr ::= ID */
  {  260,   -3 }, /* (184) expr ::= ID DOT ID */
  {  260,   -3 }, /* (185) expr ::= ID DOT STAR */
  {  260,   -1 }, /* (186) expr ::= INTEGER */
  {  260,   -2 }, /* (187) expr ::= MINUS INTEGER */
  {  260,   -2 }, /* (188) expr ::= PLUS INTEGER */
  {  260,   -1 }, /* (189) expr ::= FLOAT */
  {  260,   -2 }, /* (190) expr ::= MINUS FLOAT */
  {  260,   -2 }, /* (191) expr ::= PLUS FLOAT */
  {  260,   -1 }, /* (192) expr ::= STRING */
  {  260,   -1 }, /* (193) expr ::= NOW */
  {  260,   -1 }, /* (194) expr ::= VARIABLE */
  {  260,   -1 }, /* (195) expr ::= BOOL */
  {  260,   -4 }, /* (196) expr ::= ID LP exprlist RP */
  {  260,   -4 }, /* (197) expr ::= ID LP STAR RP */
  {  260,   -3 }, /* (198) expr ::= expr AND expr */
  {  260,   -3 }, /* (199) expr ::= expr OR expr */
  {  260,   -3 }, /* (200) expr ::= expr LT expr */
  {  260,   -3 }, /* (201) expr ::= expr GT expr */
  {  260,   -3 }, /* (202) expr ::= expr LE expr */
  {  260,   -3 }, /* (203) expr ::= expr GE expr */
  {  260,   -3 }, /* (204) expr ::= expr NE expr */
  {  260,   -3 }, /* (205) expr ::= expr EQ expr */
  {  260,   -3 }, /* (206) expr ::= expr PLUS expr */
  {  260,   -3 }, /* (207) expr ::= expr MINUS expr */
  {  260,   -3 }, /* (208) expr ::= expr STAR expr */
  {  260,   -3 }, /* (209) expr ::= expr SLASH expr */
  {  260,   -3 }, /* (210) expr ::= expr REM expr */
  {  260,   -3 }, /* (211) expr ::= expr LIKE expr */
  {  260,   -5 }, /* (212) expr ::= expr IN LP exprlist RP */
  {  269,   -3 }, /* (213) exprlist ::= exprlist COMMA expritem */
  {  269,   -1 }, /* (214) exprlist ::= expritem */
  {  270,   -1 }, /* (215) expritem ::= expr */
  {  270,    0 }, /* (216) expritem ::= */
  {  208,   -3 }, /* (217) cmd ::= RESET QUERY CACHE */
  {  208,   -7 }, /* (218) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
  {  208,   -7 }, /* (219) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
  {  208,   -7 }, /* (220) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
  {  208,   -7 }, /* (221) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
  {  208,   -8 }, /* (222) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
  {  208,   -9 }, /* (223) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
  {  208,   -3 }, /* (224) cmd ::= KILL CONNECTION INTEGER */
  {  208,   -5 }, /* (225) cmd ::= KILL STREAM INTEGER COLON INTEGER */
  {  208,   -5 }, /* (226) cmd ::= KILL QUERY INTEGER COLON INTEGER */
H
hzcheng 已提交
1918 1919 1920 1921 1922 1923 1924
};

static void yy_accept(yyParser*);  /* Forward Declaration */

/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
1925 1926 1927 1928 1929 1930
**
** 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.
H
hzcheng 已提交
1931 1932 1933
*/
static void yy_reduce(
  yyParser *yypParser,         /* The parser */
1934 1935 1936
  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 */
H
hzcheng 已提交
1937 1938 1939 1940 1941 1942
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  ParseARG_FETCH;
1943 1944 1945
  (void)yyLookahead;
  (void)yyLookaheadToken;
  yymsp = yypParser->yytos;
H
hzcheng 已提交
1946
#ifndef NDEBUG
1947
  if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
H
hzcheng 已提交
1948
    yysize = yyRuleInfo[yyruleno].nrhs;
1949 1950 1951 1952 1953 1954 1955 1956
    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]);
    }
H
hzcheng 已提交
1957 1958
  }
#endif /* NDEBUG */
1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984

  /* 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
  }
H
hzcheng 已提交
1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995

  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
/********** Begin reduce actions **********************************************/
1996
        YYMINORTYPE yylhsminor;
H
hzcheng 已提交
1997 1998 1999 2000
      case 0: /* program ::= cmd */
{}
        break;
      case 1: /* cmd ::= SHOW DATABASES */
2001
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_DB, 0, 0);}
H
hzcheng 已提交
2002 2003
        break;
      case 2: /* cmd ::= SHOW MNODES */
2004
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_MNODE, 0, 0);}
H
hzcheng 已提交
2005 2006
        break;
      case 3: /* cmd ::= SHOW DNODES */
2007
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_DNODE, 0, 0);}
H
hzcheng 已提交
2008
        break;
S
slguan 已提交
2009
      case 4: /* cmd ::= SHOW ACCOUNTS */
2010
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_ACCT, 0, 0);}
S
slguan 已提交
2011 2012
        break;
      case 5: /* cmd ::= SHOW USERS */
2013
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_USER, 0, 0);}
H
hzcheng 已提交
2014
        break;
S
slguan 已提交
2015
      case 6: /* cmd ::= SHOW MODULES */
2016
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_MODULE, 0, 0);  }
H
hzcheng 已提交
2017
        break;
S
slguan 已提交
2018
      case 7: /* cmd ::= SHOW QUERIES */
2019
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_QUERIES, 0, 0);  }
H
hzcheng 已提交
2020
        break;
S
slguan 已提交
2021
      case 8: /* cmd ::= SHOW CONNECTIONS */
2022
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_CONNS, 0, 0);}
H
hzcheng 已提交
2023
        break;
S
slguan 已提交
2024
      case 9: /* cmd ::= SHOW STREAMS */
2025
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_STREAMS, 0, 0);  }
H
hzcheng 已提交
2026
        break;
H
Haojun Liao 已提交
2027 2028
      case 10: /* cmd ::= SHOW VARIABLES */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_VARIABLES, 0, 0);  }
H
hzcheng 已提交
2029
        break;
S
slguan 已提交
2030
      case 11: /* cmd ::= SHOW SCORES */
2031
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0);   }
H
hzcheng 已提交
2032
        break;
S
slguan 已提交
2033
      case 12: /* cmd ::= SHOW GRANTS */
2034
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0);   }
H
hzcheng 已提交
2035
        break;
L
lihui 已提交
2036
      case 13: /* cmd ::= SHOW VNODES */
2037
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, 0, 0); }
L
lihui 已提交
2038 2039
        break;
      case 14: /* cmd ::= SHOW VNODES IPTOKEN */
2040
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, &yymsp[0].minor.yy0, 0); }
H
hzcheng 已提交
2041
        break;
L
lihui 已提交
2042
      case 15: /* dbPrefix ::= */
2043
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.type = 0;}
H
hzcheng 已提交
2044
        break;
L
lihui 已提交
2045
      case 16: /* dbPrefix ::= ids DOT */
2046 2047
{yylhsminor.yy0 = yymsp[-1].minor.yy0;  }
  yymsp[-1].minor.yy0 = yylhsminor.yy0;
H
hzcheng 已提交
2048
        break;
L
lihui 已提交
2049
      case 17: /* cpxName ::= */
2050
{yymsp[1].minor.yy0.n = 0;  }
H
hzcheng 已提交
2051
        break;
L
lihui 已提交
2052
      case 18: /* cpxName ::= DOT ids */
2053
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n += 1;    }
L
lihui 已提交
2054
        break;
Y
yihaoDeng 已提交
2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066
      case 19: /* cmd ::= SHOW CREATE TABLE ids cpxName */
{
   yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
   setDCLSQLElems(pInfo, TSDB_SQL_SHOW_CREATE_TABLE, 1, &yymsp[-1].minor.yy0);
}
        break;
      case 20: /* cmd ::= SHOW CREATE DATABASE ids */
{
  setDCLSQLElems(pInfo, TSDB_SQL_SHOW_CREATE_DATABASE, 1, &yymsp[0].minor.yy0);
}
        break;
      case 21: /* cmd ::= SHOW dbPrefix TABLES */
H
hzcheng 已提交
2067
{
2068
    setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &yymsp[-1].minor.yy0, 0);
H
hzcheng 已提交
2069 2070
}
        break;
Y
yihaoDeng 已提交
2071
      case 22: /* cmd ::= SHOW dbPrefix TABLES LIKE ids */
H
hzcheng 已提交
2072
{
2073
    setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
H
hzcheng 已提交
2074 2075
}
        break;
Y
yihaoDeng 已提交
2076
      case 23: /* cmd ::= SHOW dbPrefix STABLES */
H
hzcheng 已提交
2077
{
2078
    setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &yymsp[-1].minor.yy0, 0);
H
hzcheng 已提交
2079 2080
}
        break;
Y
yihaoDeng 已提交
2081
      case 24: /* cmd ::= SHOW dbPrefix STABLES LIKE ids */
H
hzcheng 已提交
2082
{
H
Haojun Liao 已提交
2083
    SStrToken token;
H
hzcheng 已提交
2084
    setDBName(&token, &yymsp[-3].minor.yy0);
2085
    setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &token, &yymsp[0].minor.yy0);
H
hzcheng 已提交
2086 2087
}
        break;
Y
yihaoDeng 已提交
2088
      case 25: /* cmd ::= SHOW dbPrefix VGROUPS */
H
hzcheng 已提交
2089
{
H
Haojun Liao 已提交
2090
    SStrToken token;
H
hzcheng 已提交
2091
    setDBName(&token, &yymsp[-1].minor.yy0);
2092
    setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, 0);
H
hzcheng 已提交
2093 2094
}
        break;
Y
yihaoDeng 已提交
2095
      case 26: /* cmd ::= SHOW dbPrefix VGROUPS ids */
L
[1361]  
lihui 已提交
2096
{
H
Haojun Liao 已提交
2097
    SStrToken token;
L
[1361]  
lihui 已提交
2098
    setDBName(&token, &yymsp[-2].minor.yy0);    
H
hjxilinx 已提交
2099
    setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, &yymsp[0].minor.yy0);
L
[1361]  
lihui 已提交
2100 2101
}
        break;
Y
yihaoDeng 已提交
2102
      case 27: /* cmd ::= DROP TABLE ifexists ids cpxName */
H
hzcheng 已提交
2103 2104
{
    yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
2105
    setDropDBTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &yymsp[-1].minor.yy0, &yymsp[-2].minor.yy0);
H
hzcheng 已提交
2106 2107
}
        break;
Y
yihaoDeng 已提交
2108
      case 28: /* cmd ::= DROP DATABASE ifexists ids */
2109
{ setDropDBTableInfo(pInfo, TSDB_SQL_DROP_DB, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0); }
H
hzcheng 已提交
2110
        break;
Y
yihaoDeng 已提交
2111
      case 29: /* cmd ::= DROP DNODE ids */
2112
{ setDCLSQLElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &yymsp[0].minor.yy0);    }
S
slguan 已提交
2113
        break;
Y
yihaoDeng 已提交
2114
      case 30: /* cmd ::= DROP USER ids */
2115
{ setDCLSQLElems(pInfo, TSDB_SQL_DROP_USER, 1, &yymsp[0].minor.yy0);     }
H
hzcheng 已提交
2116
        break;
Y
yihaoDeng 已提交
2117
      case 31: /* cmd ::= DROP ACCOUNT ids */
2118
{ setDCLSQLElems(pInfo, TSDB_SQL_DROP_ACCT, 1, &yymsp[0].minor.yy0);  }
S
slguan 已提交
2119
        break;
Y
yihaoDeng 已提交
2120
      case 32: /* cmd ::= USE ids */
2121
{ setDCLSQLElems(pInfo, TSDB_SQL_USE_DB, 1, &yymsp[0].minor.yy0);}
H
hzcheng 已提交
2122
        break;
Y
yihaoDeng 已提交
2123
      case 33: /* cmd ::= DESCRIBE ids cpxName */
H
hzcheng 已提交
2124 2125
{
    yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
2126
    setDCLSQLElems(pInfo, TSDB_SQL_DESCRIBE_TABLE, 1, &yymsp[-1].minor.yy0);
H
hzcheng 已提交
2127 2128
}
        break;
Y
yihaoDeng 已提交
2129
      case 34: /* cmd ::= ALTER USER ids PASS ids */
2130
{ setAlterUserSQL(pInfo, TSDB_ALTER_USER_PASSWD, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, NULL);    }
H
hzcheng 已提交
2131
        break;
Y
yihaoDeng 已提交
2132
      case 35: /* cmd ::= ALTER USER ids PRIVILEGE ids */
2133
{ setAlterUserSQL(pInfo, TSDB_ALTER_USER_PRIVILEGES, &yymsp[-2].minor.yy0, NULL, &yymsp[0].minor.yy0);}
H
hzcheng 已提交
2134
        break;
Y
yihaoDeng 已提交
2135
      case 36: /* cmd ::= ALTER DNODE ids ids */
2136
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);          }
H
hzcheng 已提交
2137
        break;
Y
yihaoDeng 已提交
2138
      case 37: /* cmd ::= ALTER DNODE ids ids ids */
2139
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 3, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);      }
H
hzcheng 已提交
2140
        break;
Y
yihaoDeng 已提交
2141
      case 38: /* cmd ::= ALTER LOCAL ids */
2142
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 1, &yymsp[0].minor.yy0);              }
H
hzcheng 已提交
2143
        break;
Y
yihaoDeng 已提交
2144
      case 39: /* cmd ::= ALTER LOCAL ids ids */
2145
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);          }
S
slguan 已提交
2146
        break;
Y
yihaoDeng 已提交
2147
      case 40: /* cmd ::= ALTER DATABASE ids alter_db_optr */
H
Haojun Liao 已提交
2148
{ SStrToken t = {0};  setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy158, &t);}
H
hzcheng 已提交
2149
        break;
Y
yihaoDeng 已提交
2150
      case 41: /* cmd ::= ALTER ACCOUNT ids acct_optr */
H
Haojun Liao 已提交
2151
{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy73);}
S
slguan 已提交
2152
        break;
Y
yihaoDeng 已提交
2153
      case 42: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
H
Haojun Liao 已提交
2154
{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy73);}
H
hzcheng 已提交
2155
        break;
Y
yihaoDeng 已提交
2156 2157
      case 43: /* ids ::= ID */
      case 44: /* ids ::= STRING */ yytestcase(yyruleno==44);
2158 2159
{yylhsminor.yy0 = yymsp[0].minor.yy0; }
  yymsp[0].minor.yy0 = yylhsminor.yy0;
H
hjxilinx 已提交
2160
        break;
Y
yihaoDeng 已提交
2161
      case 45: /* ifexists ::= IF EXISTS */
2162 2163
{yymsp[-1].minor.yy0.n = 1;}
        break;
Y
yihaoDeng 已提交
2164 2165
      case 46: /* ifexists ::= */
      case 48: /* ifnotexists ::= */ yytestcase(yyruleno==48);
2166 2167
{yymsp[1].minor.yy0.n = 0;}
        break;
Y
yihaoDeng 已提交
2168
      case 47: /* ifnotexists ::= IF NOT EXISTS */
2169
{yymsp[-2].minor.yy0.n = 1;}
H
hzcheng 已提交
2170
        break;
Y
yihaoDeng 已提交
2171
      case 49: /* cmd ::= CREATE DNODE ids */
2172
{ setDCLSQLElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);}
S
slguan 已提交
2173
        break;
Y
yihaoDeng 已提交
2174
      case 50: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
H
Haojun Liao 已提交
2175
{ setCreateAcctSQL(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy73);}
S
slguan 已提交
2176
        break;
Y
yihaoDeng 已提交
2177
      case 51: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */
H
Haojun Liao 已提交
2178
{ setCreateDBSQL(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy158, &yymsp[-2].minor.yy0);}
H
hzcheng 已提交
2179
        break;
Y
yihaoDeng 已提交
2180
      case 52: /* cmd ::= CREATE USER ids PASS ids */
2181
{ setCreateUserSQL(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
H
hzcheng 已提交
2182
        break;
Y
yihaoDeng 已提交
2183 2184 2185 2186 2187 2188 2189 2190 2191
      case 53: /* pps ::= */
      case 55: /* tseries ::= */ yytestcase(yyruleno==55);
      case 57: /* dbs ::= */ yytestcase(yyruleno==57);
      case 59: /* streams ::= */ yytestcase(yyruleno==59);
      case 61: /* storage ::= */ yytestcase(yyruleno==61);
      case 63: /* qtime ::= */ yytestcase(yyruleno==63);
      case 65: /* users ::= */ yytestcase(yyruleno==65);
      case 67: /* conns ::= */ yytestcase(yyruleno==67);
      case 69: /* state ::= */ yytestcase(yyruleno==69);
2192
{yymsp[1].minor.yy0.n = 0;   }
L
lihui 已提交
2193
        break;
Y
yihaoDeng 已提交
2194 2195 2196 2197 2198 2199 2200 2201 2202
      case 54: /* pps ::= PPS INTEGER */
      case 56: /* tseries ::= TSERIES INTEGER */ yytestcase(yyruleno==56);
      case 58: /* dbs ::= DBS INTEGER */ yytestcase(yyruleno==58);
      case 60: /* streams ::= STREAMS INTEGER */ yytestcase(yyruleno==60);
      case 62: /* storage ::= STORAGE INTEGER */ yytestcase(yyruleno==62);
      case 64: /* qtime ::= QTIME INTEGER */ yytestcase(yyruleno==64);
      case 66: /* users ::= USERS INTEGER */ yytestcase(yyruleno==66);
      case 68: /* conns ::= CONNS INTEGER */ yytestcase(yyruleno==68);
      case 70: /* state ::= STATE ids */ yytestcase(yyruleno==70);
2203
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;     }
L
lihui 已提交
2204
        break;
Y
yihaoDeng 已提交
2205
      case 71: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
S
slguan 已提交
2206
{
H
Haojun Liao 已提交
2207 2208 2209 2210 2211 2212 2213 2214 2215
    yylhsminor.yy73.maxUsers   = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
    yylhsminor.yy73.maxDbs     = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
    yylhsminor.yy73.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
    yylhsminor.yy73.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
    yylhsminor.yy73.maxPointsPerSecond     = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
    yylhsminor.yy73.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
    yylhsminor.yy73.maxQueryTime   = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
    yylhsminor.yy73.maxConnections   = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
    yylhsminor.yy73.stat    = yymsp[0].minor.yy0;
S
slguan 已提交
2216
}
H
Haojun Liao 已提交
2217
  yymsp[-8].minor.yy73 = yylhsminor.yy73;
L
lihui 已提交
2218
        break;
Y
yihaoDeng 已提交
2219
      case 72: /* keep ::= KEEP tagitemlist */
H
Haojun Liao 已提交
2220 2221
{ yymsp[-1].minor.yy494 = yymsp[0].minor.yy494; }
        break;
Y
yihaoDeng 已提交
2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233
      case 73: /* cache ::= CACHE INTEGER */
      case 74: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==74);
      case 75: /* quorum ::= QUORUM INTEGER */ yytestcase(yyruleno==75);
      case 76: /* days ::= DAYS INTEGER */ yytestcase(yyruleno==76);
      case 77: /* minrows ::= MINROWS INTEGER */ yytestcase(yyruleno==77);
      case 78: /* maxrows ::= MAXROWS INTEGER */ yytestcase(yyruleno==78);
      case 79: /* blocks ::= BLOCKS INTEGER */ yytestcase(yyruleno==79);
      case 80: /* ctime ::= CTIME INTEGER */ yytestcase(yyruleno==80);
      case 81: /* wal ::= WAL INTEGER */ yytestcase(yyruleno==81);
      case 82: /* fsync ::= FSYNC INTEGER */ yytestcase(yyruleno==82);
      case 83: /* comp ::= COMP INTEGER */ yytestcase(yyruleno==83);
      case 84: /* prec ::= PRECISION STRING */ yytestcase(yyruleno==84);
2234
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
L
lihui 已提交
2235
        break;
Y
yihaoDeng 已提交
2236
      case 85: /* db_optr ::= */
H
Haojun Liao 已提交
2237 2238
{setDefaultCreateDbOption(&yymsp[1].minor.yy158);}
        break;
Y
yihaoDeng 已提交
2239
      case 86: /* db_optr ::= db_optr cache */
H
Haojun Liao 已提交
2240 2241 2242
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2243 2244
      case 87: /* db_optr ::= db_optr replica */
      case 100: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==100);
H
Haojun Liao 已提交
2245 2246 2247
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2248 2249
      case 88: /* db_optr ::= db_optr quorum */
      case 101: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==101);
H
Haojun Liao 已提交
2250 2251 2252
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2253
      case 89: /* db_optr ::= db_optr days */
H
Haojun Liao 已提交
2254 2255 2256
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2257
      case 90: /* db_optr ::= db_optr minrows */
H
Haojun Liao 已提交
2258 2259 2260
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2261
      case 91: /* db_optr ::= db_optr maxrows */
H
Haojun Liao 已提交
2262 2263 2264
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2265 2266
      case 92: /* db_optr ::= db_optr blocks */
      case 103: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==103);
H
Haojun Liao 已提交
2267 2268 2269
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2270
      case 93: /* db_optr ::= db_optr ctime */
H
Haojun Liao 已提交
2271 2272 2273
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2274 2275
      case 94: /* db_optr ::= db_optr wal */
      case 105: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==105);
H
Haojun Liao 已提交
2276 2277 2278
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2279 2280
      case 95: /* db_optr ::= db_optr fsync */
      case 106: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==106);
H
Haojun Liao 已提交
2281 2282 2283
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2284 2285
      case 96: /* db_optr ::= db_optr comp */
      case 104: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==104);
H
Haojun Liao 已提交
2286 2287 2288
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2289
      case 97: /* db_optr ::= db_optr prec */
H
Haojun Liao 已提交
2290 2291 2292
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.precision = yymsp[0].minor.yy0; }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2293 2294
      case 98: /* db_optr ::= db_optr keep */
      case 102: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==102);
H
Haojun Liao 已提交
2295 2296 2297
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.keep = yymsp[0].minor.yy494; }
  yymsp[-1].minor.yy158 = yylhsminor.yy158;
        break;
Y
yihaoDeng 已提交
2298
      case 99: /* alter_db_optr ::= */
H
Haojun Liao 已提交
2299 2300
{ setDefaultCreateDbOption(&yymsp[1].minor.yy158);}
        break;
Y
yihaoDeng 已提交
2301
      case 107: /* typename ::= ids */
dengyihao's avatar
dengyihao 已提交
2302 2303
{ 
  yymsp[0].minor.yy0.type = 0;
H
Haojun Liao 已提交
2304
  tSQLSetColumnType (&yylhsminor.yy181, &yymsp[0].minor.yy0); 
dengyihao's avatar
dengyihao 已提交
2305
}
H
Haojun Liao 已提交
2306
  yymsp[0].minor.yy181 = yylhsminor.yy181;
L
lihui 已提交
2307
        break;
Y
yihaoDeng 已提交
2308
      case 108: /* typename ::= ids LP signed RP */
H
hzcheng 已提交
2309
{
H
Haojun Liao 已提交
2310
    if (yymsp[-1].minor.yy271 <= 0) {
dengyihao's avatar
dengyihao 已提交
2311
      yymsp[-3].minor.yy0.type = 0;
H
Haojun Liao 已提交
2312
      tSQLSetColumnType(&yylhsminor.yy181, &yymsp[-3].minor.yy0);
dengyihao's avatar
dengyihao 已提交
2313
    } else {
H
Haojun Liao 已提交
2314 2315
      yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy271;          // negative value of name length
      tSQLSetColumnType(&yylhsminor.yy181, &yymsp[-3].minor.yy0);
dengyihao's avatar
dengyihao 已提交
2316
    }
H
hzcheng 已提交
2317
}
H
Haojun Liao 已提交
2318
  yymsp[-3].minor.yy181 = yylhsminor.yy181;
H
hzcheng 已提交
2319
        break;
Y
yihaoDeng 已提交
2320
      case 109: /* signed ::= INTEGER */
H
Haojun Liao 已提交
2321 2322
{ yylhsminor.yy271 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[0].minor.yy271 = yylhsminor.yy271;
2323
        break;
Y
yihaoDeng 已提交
2324
      case 110: /* signed ::= PLUS INTEGER */
H
Haojun Liao 已提交
2325
{ yymsp[-1].minor.yy271 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
H
hjxilinx 已提交
2326
        break;
Y
yihaoDeng 已提交
2327
      case 111: /* signed ::= MINUS INTEGER */
H
Haojun Liao 已提交
2328
{ yymsp[-1].minor.yy271 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
H
hzcheng 已提交
2329
        break;
Y
yihaoDeng 已提交
2330
      case 112: /* cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */
H
hzcheng 已提交
2331 2332
{
    yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
H
hjxilinx 已提交
2333
    setCreatedTableName(pInfo, &yymsp[-2].minor.yy0, &yymsp[-3].minor.yy0);
H
hzcheng 已提交
2334 2335
}
        break;
Y
yihaoDeng 已提交
2336
      case 113: /* create_table_args ::= LP columnlist RP */
H
hzcheng 已提交
2337
{
H
Haojun Liao 已提交
2338 2339
    yymsp[-2].minor.yy374 = tSetCreateSQLElems(yymsp[-1].minor.yy449, NULL, NULL, NULL, NULL, TSQL_CREATE_TABLE);
    setSQLInfo(pInfo, yymsp[-2].minor.yy374, NULL, TSDB_SQL_CREATE_TABLE);
H
hzcheng 已提交
2340 2341
}
        break;
Y
yihaoDeng 已提交
2342
      case 114: /* create_table_args ::= LP columnlist RP TAGS LP columnlist RP */
H
hzcheng 已提交
2343
{
H
Haojun Liao 已提交
2344 2345
    yymsp[-6].minor.yy374 = tSetCreateSQLElems(yymsp[-5].minor.yy449, yymsp[-1].minor.yy449, NULL, NULL, NULL, TSQL_CREATE_STABLE);
    setSQLInfo(pInfo, yymsp[-6].minor.yy374, NULL, TSDB_SQL_CREATE_TABLE);
H
hzcheng 已提交
2346 2347
}
        break;
Y
yihaoDeng 已提交
2348
      case 115: /* create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */
H
hzcheng 已提交
2349 2350
{
    yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
H
Haojun Liao 已提交
2351 2352
    yymsp[-6].minor.yy374 = tSetCreateSQLElems(NULL, NULL, &yymsp[-5].minor.yy0, yymsp[-1].minor.yy494, NULL, TSQL_CREATE_TABLE_FROM_STABLE);
    setSQLInfo(pInfo, yymsp[-6].minor.yy374, NULL, TSDB_SQL_CREATE_TABLE);
H
hzcheng 已提交
2353 2354
}
        break;
Y
yihaoDeng 已提交
2355
      case 116: /* create_table_args ::= AS select */
H
hzcheng 已提交
2356
{
H
Haojun Liao 已提交
2357 2358
    yymsp[-1].minor.yy374 = tSetCreateSQLElems(NULL, NULL, NULL, NULL, yymsp[0].minor.yy150, TSQL_CREATE_STREAM);
    setSQLInfo(pInfo, yymsp[-1].minor.yy374, NULL, TSDB_SQL_CREATE_TABLE);
H
hzcheng 已提交
2359 2360
}
        break;
Y
yihaoDeng 已提交
2361
      case 117: /* columnlist ::= columnlist COMMA column */
H
Haojun Liao 已提交
2362 2363
{yylhsminor.yy449 = tFieldListAppend(yymsp[-2].minor.yy449, &yymsp[0].minor.yy181);   }
  yymsp[-2].minor.yy449 = yylhsminor.yy449;
H
hzcheng 已提交
2364
        break;
Y
yihaoDeng 已提交
2365
      case 118: /* columnlist ::= column */
H
Haojun Liao 已提交
2366 2367
{yylhsminor.yy449 = tFieldListAppend(NULL, &yymsp[0].minor.yy181);}
  yymsp[0].minor.yy449 = yylhsminor.yy449;
H
hzcheng 已提交
2368
        break;
Y
yihaoDeng 已提交
2369
      case 119: /* column ::= ids typename */
H
hzcheng 已提交
2370
{
H
Haojun Liao 已提交
2371
    tSQLSetColumnInfo(&yylhsminor.yy181, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy181);
H
hzcheng 已提交
2372
}
H
Haojun Liao 已提交
2373 2374
  yymsp[-1].minor.yy181 = yylhsminor.yy181;
        break;
Y
yihaoDeng 已提交
2375
      case 120: /* tagitemlist ::= tagitemlist COMMA tagitem */
H
Haojun Liao 已提交
2376 2377 2378
{ yylhsminor.yy494 = tVariantListAppend(yymsp[-2].minor.yy494, &yymsp[0].minor.yy312, -1);    }
  yymsp[-2].minor.yy494 = yylhsminor.yy494;
        break;
Y
yihaoDeng 已提交
2379
      case 121: /* tagitemlist ::= tagitem */
H
Haojun Liao 已提交
2380 2381 2382
{ yylhsminor.yy494 = tVariantListAppend(NULL, &yymsp[0].minor.yy312, -1); }
  yymsp[0].minor.yy494 = yylhsminor.yy494;
        break;
Y
yihaoDeng 已提交
2383 2384 2385 2386
      case 122: /* tagitem ::= INTEGER */
      case 123: /* tagitem ::= FLOAT */ yytestcase(yyruleno==123);
      case 124: /* tagitem ::= STRING */ yytestcase(yyruleno==124);
      case 125: /* tagitem ::= BOOL */ yytestcase(yyruleno==125);
H
Haojun Liao 已提交
2387 2388 2389
{toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy312, &yymsp[0].minor.yy0); }
  yymsp[0].minor.yy312 = yylhsminor.yy312;
        break;
Y
yihaoDeng 已提交
2390
      case 126: /* tagitem ::= NULL */
H
Haojun Liao 已提交
2391 2392 2393
{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy312, &yymsp[0].minor.yy0); }
  yymsp[0].minor.yy312 = yylhsminor.yy312;
        break;
Y
yihaoDeng 已提交
2394 2395 2396 2397
      case 127: /* tagitem ::= MINUS INTEGER */
      case 128: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==128);
      case 129: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==129);
      case 130: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==130);
H
hzcheng 已提交
2398 2399 2400 2401
{
    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);
H
Haojun Liao 已提交
2402
    tVariantCreate(&yylhsminor.yy312, &yymsp[-1].minor.yy0);
2403
}
H
Haojun Liao 已提交
2404
  yymsp[-1].minor.yy312 = yylhsminor.yy312;
2405
        break;
Y
yihaoDeng 已提交
2406
      case 131: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
2407
{
H
Haojun Liao 已提交
2408
  yylhsminor.yy150 = tSetQuerySQLElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy224, yymsp[-9].minor.yy494, yymsp[-8].minor.yy66, yymsp[-4].minor.yy494, yymsp[-3].minor.yy494, &yymsp[-7].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy494, &yymsp[0].minor.yy188, &yymsp[-1].minor.yy188);
H
hzcheng 已提交
2409
}
H
Haojun Liao 已提交
2410
  yymsp[-11].minor.yy150 = yylhsminor.yy150;
H
hzcheng 已提交
2411
        break;
Y
yihaoDeng 已提交
2412
      case 132: /* union ::= select */
H
Haojun Liao 已提交
2413 2414
{ yylhsminor.yy25 = setSubclause(NULL, yymsp[0].minor.yy150); }
  yymsp[0].minor.yy25 = yylhsminor.yy25;
H
hzcheng 已提交
2415
        break;
Y
yihaoDeng 已提交
2416
      case 133: /* union ::= LP union RP */
H
Haojun Liao 已提交
2417
{ yymsp[-2].minor.yy25 = yymsp[-1].minor.yy25; }
H
hzcheng 已提交
2418
        break;
Y
yihaoDeng 已提交
2419
      case 134: /* union ::= union UNION ALL select */
H
Haojun Liao 已提交
2420 2421
{ yylhsminor.yy25 = appendSelectClause(yymsp[-3].minor.yy25, yymsp[0].minor.yy150); }
  yymsp[-3].minor.yy25 = yylhsminor.yy25;
2422
        break;
Y
yihaoDeng 已提交
2423
      case 135: /* union ::= union UNION ALL LP select RP */
H
Haojun Liao 已提交
2424 2425
{ yylhsminor.yy25 = appendSelectClause(yymsp[-5].minor.yy25, yymsp[-1].minor.yy150); }
  yymsp[-5].minor.yy25 = yylhsminor.yy25;
2426
        break;
Y
yihaoDeng 已提交
2427
      case 136: /* cmd ::= union */
H
Haojun Liao 已提交
2428
{ setSQLInfo(pInfo, yymsp[0].minor.yy25, NULL, TSDB_SQL_SELECT); }
H
hjxilinx 已提交
2429
        break;
Y
yihaoDeng 已提交
2430
      case 137: /* select ::= SELECT selcollist */
2431
{
H
Haojun Liao 已提交
2432
  yylhsminor.yy150 = tSetQuerySQLElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy224, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
2433
}
H
Haojun Liao 已提交
2434
  yymsp[-1].minor.yy150 = yylhsminor.yy150;
H
hzcheng 已提交
2435
        break;
Y
yihaoDeng 已提交
2436
      case 138: /* sclp ::= selcollist COMMA */
H
Haojun Liao 已提交
2437 2438
{yylhsminor.yy224 = yymsp[-1].minor.yy224;}
  yymsp[-1].minor.yy224 = yylhsminor.yy224;
H
hzcheng 已提交
2439
        break;
Y
yihaoDeng 已提交
2440
      case 139: /* sclp ::= */
H
Haojun Liao 已提交
2441
{yymsp[1].minor.yy224 = 0;}
2442
        break;
Y
yihaoDeng 已提交
2443
      case 140: /* selcollist ::= sclp expr as */
H
hzcheng 已提交
2444
{
H
Haojun Liao 已提交
2445
   yylhsminor.yy224 = tSQLExprListAppend(yymsp[-2].minor.yy224, yymsp[-1].minor.yy66, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
H
hzcheng 已提交
2446
}
H
Haojun Liao 已提交
2447
  yymsp[-2].minor.yy224 = yylhsminor.yy224;
H
hzcheng 已提交
2448
        break;
Y
yihaoDeng 已提交
2449
      case 141: /* selcollist ::= sclp STAR */
H
hzcheng 已提交
2450 2451
{
   tSQLExpr *pNode = tSQLExprIdValueCreate(NULL, TK_ALL);
H
Haojun Liao 已提交
2452
   yylhsminor.yy224 = tSQLExprListAppend(yymsp[-1].minor.yy224, pNode, 0);
H
hzcheng 已提交
2453
}
H
Haojun Liao 已提交
2454
  yymsp[-1].minor.yy224 = yylhsminor.yy224;
2455
        break;
Y
yihaoDeng 已提交
2456
      case 142: /* as ::= AS ids */
2457
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;    }
H
hjxilinx 已提交
2458
        break;
Y
yihaoDeng 已提交
2459
      case 143: /* as ::= ids */
2460 2461
{ yylhsminor.yy0 = yymsp[0].minor.yy0;    }
  yymsp[0].minor.yy0 = yylhsminor.yy0;
H
hzcheng 已提交
2462
        break;
Y
yihaoDeng 已提交
2463
      case 144: /* as ::= */
2464
{ yymsp[1].minor.yy0.n = 0;  }
H
hzcheng 已提交
2465
        break;
Y
yihaoDeng 已提交
2466
      case 145: /* from ::= FROM tablelist */
H
Haojun Liao 已提交
2467
{yymsp[-1].minor.yy494 = yymsp[0].minor.yy494;}
H
hzcheng 已提交
2468
        break;
Y
yihaoDeng 已提交
2469
      case 146: /* tablelist ::= ids cpxName */
H
Haojun Liao 已提交
2470 2471 2472
{
  toTSDBType(yymsp[-1].minor.yy0.type);
  yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
H
Haojun Liao 已提交
2473 2474
  yylhsminor.yy494 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
  yylhsminor.yy494 = tVariantListAppendToken(yylhsminor.yy494, &yymsp[-1].minor.yy0, -1);  // table alias name
H
Haojun Liao 已提交
2475
}
H
Haojun Liao 已提交
2476
  yymsp[-1].minor.yy494 = yylhsminor.yy494;
S
slguan 已提交
2477
        break;
Y
yihaoDeng 已提交
2478
      case 147: /* tablelist ::= ids cpxName ids */
H
Haojun Liao 已提交
2479 2480 2481 2482
{
   toTSDBType(yymsp[-2].minor.yy0.type);
   toTSDBType(yymsp[0].minor.yy0.type);
   yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
H
Haojun Liao 已提交
2483 2484
   yylhsminor.yy494 = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
   yylhsminor.yy494 = tVariantListAppendToken(yylhsminor.yy494, &yymsp[0].minor.yy0, -1);
H
Haojun Liao 已提交
2485
}
H
Haojun Liao 已提交
2486
  yymsp[-2].minor.yy494 = yylhsminor.yy494;
H
Haojun Liao 已提交
2487
        break;
Y
yihaoDeng 已提交
2488
      case 148: /* tablelist ::= tablelist COMMA ids cpxName */
H
Haojun Liao 已提交
2489 2490 2491
{
  toTSDBType(yymsp[-1].minor.yy0.type);
  yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
H
Haojun Liao 已提交
2492 2493
  yylhsminor.yy494 = tVariantListAppendToken(yymsp[-3].minor.yy494, &yymsp[-1].minor.yy0, -1);
  yylhsminor.yy494 = tVariantListAppendToken(yylhsminor.yy494, &yymsp[-1].minor.yy0, -1);
H
Haojun Liao 已提交
2494
}
H
Haojun Liao 已提交
2495
  yymsp[-3].minor.yy494 = yylhsminor.yy494;
S
slguan 已提交
2496
        break;
Y
yihaoDeng 已提交
2497
      case 149: /* tablelist ::= tablelist COMMA ids cpxName ids */
H
Haojun Liao 已提交
2498 2499 2500 2501
{
   toTSDBType(yymsp[-2].minor.yy0.type);
   toTSDBType(yymsp[0].minor.yy0.type);
   yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
H
Haojun Liao 已提交
2502 2503
   yylhsminor.yy494 = tVariantListAppendToken(yymsp[-4].minor.yy494, &yymsp[-2].minor.yy0, -1);
   yylhsminor.yy494 = tVariantListAppendToken(yylhsminor.yy494, &yymsp[0].minor.yy0, -1);
H
Haojun Liao 已提交
2504
}
H
Haojun Liao 已提交
2505
  yymsp[-4].minor.yy494 = yylhsminor.yy494;
H
Haojun Liao 已提交
2506
        break;
Y
yihaoDeng 已提交
2507
      case 150: /* tmvar ::= VARIABLE */
2508 2509
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
  yymsp[0].minor.yy0 = yylhsminor.yy0;
H
hzcheng 已提交
2510
        break;
Y
yihaoDeng 已提交
2511 2512
      case 151: /* interval_opt ::= INTERVAL LP tmvar RP */
      case 156: /* sliding_opt ::= SLIDING LP tmvar RP */ yytestcase(yyruleno==156);
2513
{yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0;     }
H
hzcheng 已提交
2514
        break;
Y
yihaoDeng 已提交
2515 2516
      case 152: /* interval_opt ::= */
      case 157: /* sliding_opt ::= */ yytestcase(yyruleno==157);
2517
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0;   }
H
hjxilinx 已提交
2518
        break;
Y
yihaoDeng 已提交
2519
      case 153: /* fill_opt ::= */
H
Haojun Liao 已提交
2520
{yymsp[1].minor.yy494 = 0;     }
2521
        break;
Y
yihaoDeng 已提交
2522
      case 154: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
H
hzcheng 已提交
2523 2524 2525 2526 2527
{
    tVariant A = {0};
    toTSDBType(yymsp[-3].minor.yy0.type);
    tVariantCreate(&A, &yymsp[-3].minor.yy0);

H
Haojun Liao 已提交
2528 2529
    tVariantListInsert(yymsp[-1].minor.yy494, &A, -1, 0);
    yymsp[-5].minor.yy494 = yymsp[-1].minor.yy494;
H
hzcheng 已提交
2530 2531
}
        break;
Y
yihaoDeng 已提交
2532
      case 155: /* fill_opt ::= FILL LP ID RP */
H
hzcheng 已提交
2533 2534
{
    toTSDBType(yymsp[-1].minor.yy0.type);
H
Haojun Liao 已提交
2535
    yymsp[-3].minor.yy494 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
H
hzcheng 已提交
2536 2537
}
        break;
Y
yihaoDeng 已提交
2538 2539
      case 158: /* orderby_opt ::= */
      case 166: /* groupby_opt ::= */ yytestcase(yyruleno==166);
H
Haojun Liao 已提交
2540
{yymsp[1].minor.yy494 = 0;}
H
hjxilinx 已提交
2541
        break;
Y
yihaoDeng 已提交
2542 2543
      case 159: /* orderby_opt ::= ORDER BY sortlist */
      case 167: /* groupby_opt ::= GROUP BY grouplist */ yytestcase(yyruleno==167);
H
Haojun Liao 已提交
2544
{yymsp[-2].minor.yy494 = yymsp[0].minor.yy494;}
2545
        break;
Y
yihaoDeng 已提交
2546
      case 160: /* sortlist ::= sortlist COMMA item sortorder */
H
hzcheng 已提交
2547
{
H
Haojun Liao 已提交
2548
    yylhsminor.yy494 = tVariantListAppend(yymsp[-3].minor.yy494, &yymsp[-1].minor.yy312, yymsp[0].minor.yy82);
H
hzcheng 已提交
2549
}
H
Haojun Liao 已提交
2550
  yymsp[-3].minor.yy494 = yylhsminor.yy494;
H
hzcheng 已提交
2551
        break;
Y
yihaoDeng 已提交
2552
      case 161: /* sortlist ::= item sortorder */
H
hzcheng 已提交
2553
{
H
Haojun Liao 已提交
2554
  yylhsminor.yy494 = tVariantListAppend(NULL, &yymsp[-1].minor.yy312, yymsp[0].minor.yy82);
H
hzcheng 已提交
2555
}
H
Haojun Liao 已提交
2556
  yymsp[-1].minor.yy494 = yylhsminor.yy494;
H
hzcheng 已提交
2557
        break;
Y
yihaoDeng 已提交
2558
      case 162: /* item ::= ids cpxName */
H
hzcheng 已提交
2559
{
2560 2561 2562
  toTSDBType(yymsp[-1].minor.yy0.type);
  yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;

H
Haojun Liao 已提交
2563
  tVariantCreate(&yylhsminor.yy312, &yymsp[-1].minor.yy0);
H
hzcheng 已提交
2564
}
H
Haojun Liao 已提交
2565
  yymsp[-1].minor.yy312 = yylhsminor.yy312;
H
hzcheng 已提交
2566
        break;
Y
yihaoDeng 已提交
2567
      case 163: /* sortorder ::= ASC */
H
Haojun Liao 已提交
2568
{yymsp[0].minor.yy82 = TSDB_ORDER_ASC; }
H
hzcheng 已提交
2569
        break;
Y
yihaoDeng 已提交
2570
      case 164: /* sortorder ::= DESC */
H
Haojun Liao 已提交
2571
{yymsp[0].minor.yy82 = TSDB_ORDER_DESC;}
H
hzcheng 已提交
2572
        break;
Y
yihaoDeng 已提交
2573
      case 165: /* sortorder ::= */
H
Haojun Liao 已提交
2574
{yymsp[1].minor.yy82 = TSDB_ORDER_ASC;}
H
hzcheng 已提交
2575
        break;
Y
yihaoDeng 已提交
2576
      case 168: /* grouplist ::= grouplist COMMA item */
H
hzcheng 已提交
2577
{
H
Haojun Liao 已提交
2578
  yylhsminor.yy494 = tVariantListAppend(yymsp[-2].minor.yy494, &yymsp[0].minor.yy312, -1);
H
hzcheng 已提交
2579
}
H
Haojun Liao 已提交
2580
  yymsp[-2].minor.yy494 = yylhsminor.yy494;
H
hzcheng 已提交
2581
        break;
Y
yihaoDeng 已提交
2582
      case 169: /* grouplist ::= item */
H
hzcheng 已提交
2583
{
H
Haojun Liao 已提交
2584
  yylhsminor.yy494 = tVariantListAppend(NULL, &yymsp[0].minor.yy312, -1);
H
hzcheng 已提交
2585
}
H
Haojun Liao 已提交
2586
  yymsp[0].minor.yy494 = yylhsminor.yy494;
H
hzcheng 已提交
2587
        break;
Y
yihaoDeng 已提交
2588 2589 2590
      case 170: /* having_opt ::= */
      case 180: /* where_opt ::= */ yytestcase(yyruleno==180);
      case 216: /* expritem ::= */ yytestcase(yyruleno==216);
H
Haojun Liao 已提交
2591
{yymsp[1].minor.yy66 = 0;}
H
hzcheng 已提交
2592
        break;
Y
yihaoDeng 已提交
2593 2594
      case 171: /* having_opt ::= HAVING expr */
      case 181: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==181);
H
Haojun Liao 已提交
2595
{yymsp[-1].minor.yy66 = yymsp[0].minor.yy66;}
H
hzcheng 已提交
2596
        break;
Y
yihaoDeng 已提交
2597 2598
      case 172: /* limit_opt ::= */
      case 176: /* slimit_opt ::= */ yytestcase(yyruleno==176);
H
Haojun Liao 已提交
2599
{yymsp[1].minor.yy188.limit = -1; yymsp[1].minor.yy188.offset = 0;}
H
hzcheng 已提交
2600
        break;
Y
yihaoDeng 已提交
2601 2602
      case 173: /* limit_opt ::= LIMIT signed */
      case 177: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==177);
H
Haojun Liao 已提交
2603
{yymsp[-1].minor.yy188.limit = yymsp[0].minor.yy271;  yymsp[-1].minor.yy188.offset = 0;}
H
hzcheng 已提交
2604
        break;
Y
yihaoDeng 已提交
2605 2606
      case 174: /* limit_opt ::= LIMIT signed OFFSET signed */
      case 178: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ yytestcase(yyruleno==178);
H
Haojun Liao 已提交
2607
{yymsp[-3].minor.yy188.limit = yymsp[-2].minor.yy271;  yymsp[-3].minor.yy188.offset = yymsp[0].minor.yy271;}
H
hzcheng 已提交
2608
        break;
Y
yihaoDeng 已提交
2609 2610
      case 175: /* limit_opt ::= LIMIT signed COMMA signed */
      case 179: /* slimit_opt ::= SLIMIT signed COMMA signed */ yytestcase(yyruleno==179);
H
Haojun Liao 已提交
2611
{yymsp[-3].minor.yy188.limit = yymsp[0].minor.yy271;  yymsp[-3].minor.yy188.offset = yymsp[-2].minor.yy271;}
S
slguan 已提交
2612
        break;
Y
yihaoDeng 已提交
2613
      case 182: /* expr ::= LP expr RP */
H
Haojun Liao 已提交
2614
{yymsp[-2].minor.yy66 = yymsp[-1].minor.yy66; }
H
hzcheng 已提交
2615
        break;
Y
yihaoDeng 已提交
2616
      case 183: /* expr ::= ID */
H
Haojun Liao 已提交
2617 2618
{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);}
  yymsp[0].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2619
        break;
Y
yihaoDeng 已提交
2620
      case 184: /* expr ::= ID DOT ID */
H
Haojun Liao 已提交
2621 2622
{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);}
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2623
        break;
Y
yihaoDeng 已提交
2624
      case 185: /* expr ::= ID DOT STAR */
H
Haojun Liao 已提交
2625 2626
{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);}
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
2627
        break;
Y
yihaoDeng 已提交
2628
      case 186: /* expr ::= INTEGER */
H
Haojun Liao 已提交
2629 2630
{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);}
  yymsp[0].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2631
        break;
Y
yihaoDeng 已提交
2632 2633
      case 187: /* expr ::= MINUS INTEGER */
      case 188: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==188);
H
Haojun Liao 已提交
2634 2635
{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);}
  yymsp[-1].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2636
        break;
Y
yihaoDeng 已提交
2637
      case 189: /* expr ::= FLOAT */
H
Haojun Liao 已提交
2638 2639
{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);}
  yymsp[0].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2640
        break;
Y
yihaoDeng 已提交
2641 2642
      case 190: /* expr ::= MINUS FLOAT */
      case 191: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==191);
H
Haojun Liao 已提交
2643 2644
{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);}
  yymsp[-1].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2645
        break;
Y
yihaoDeng 已提交
2646
      case 192: /* expr ::= STRING */
H
Haojun Liao 已提交
2647 2648
{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);}
  yymsp[0].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2649
        break;
Y
yihaoDeng 已提交
2650
      case 193: /* expr ::= NOW */
H
Haojun Liao 已提交
2651 2652
{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); }
  yymsp[0].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2653
        break;
Y
yihaoDeng 已提交
2654
      case 194: /* expr ::= VARIABLE */
H
Haojun Liao 已提交
2655 2656
{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);}
  yymsp[0].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2657
        break;
Y
yihaoDeng 已提交
2658
      case 195: /* expr ::= BOOL */
H
Haojun Liao 已提交
2659 2660
{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);}
  yymsp[0].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2661
        break;
Y
yihaoDeng 已提交
2662
      case 196: /* expr ::= ID LP exprlist RP */
H
hzcheng 已提交
2663
{
H
Haojun Liao 已提交
2664
  yylhsminor.yy66 = tSQLExprCreateFunction(yymsp[-1].minor.yy224, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type);
H
hzcheng 已提交
2665
}
H
Haojun Liao 已提交
2666
  yymsp[-3].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2667
        break;
Y
yihaoDeng 已提交
2668
      case 197: /* expr ::= ID LP STAR RP */
H
hzcheng 已提交
2669
{
H
Haojun Liao 已提交
2670
  yylhsminor.yy66 = tSQLExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type);
H
hzcheng 已提交
2671
}
H
Haojun Liao 已提交
2672
  yymsp[-3].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2673
        break;
Y
yihaoDeng 已提交
2674
      case 198: /* expr ::= expr AND expr */
H
Haojun Liao 已提交
2675 2676
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_AND);}
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2677
        break;
Y
yihaoDeng 已提交
2678
      case 199: /* expr ::= expr OR expr */
H
Haojun Liao 已提交
2679 2680
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_OR); }
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2681
        break;
Y
yihaoDeng 已提交
2682
      case 200: /* expr ::= expr LT expr */
H
Haojun Liao 已提交
2683 2684
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_LT);}
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2685
        break;
Y
yihaoDeng 已提交
2686
      case 201: /* expr ::= expr GT expr */
H
Haojun Liao 已提交
2687 2688
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_GT);}
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2689
        break;
Y
yihaoDeng 已提交
2690
      case 202: /* expr ::= expr LE expr */
H
Haojun Liao 已提交
2691 2692
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_LE);}
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2693
        break;
Y
yihaoDeng 已提交
2694
      case 203: /* expr ::= expr GE expr */
H
Haojun Liao 已提交
2695 2696
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_GE);}
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2697
        break;
Y
yihaoDeng 已提交
2698
      case 204: /* expr ::= expr NE expr */
H
Haojun Liao 已提交
2699 2700
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_NE);}
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2701
        break;
Y
yihaoDeng 已提交
2702
      case 205: /* expr ::= expr EQ expr */
H
Haojun Liao 已提交
2703 2704
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_EQ);}
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2705
        break;
Y
yihaoDeng 已提交
2706
      case 206: /* expr ::= expr PLUS expr */
H
Haojun Liao 已提交
2707 2708
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_PLUS);  }
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2709
        break;
Y
yihaoDeng 已提交
2710
      case 207: /* expr ::= expr MINUS expr */
H
Haojun Liao 已提交
2711 2712
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_MINUS); }
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2713
        break;
Y
yihaoDeng 已提交
2714
      case 208: /* expr ::= expr STAR expr */
H
Haojun Liao 已提交
2715 2716
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_STAR);  }
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2717
        break;
Y
yihaoDeng 已提交
2718
      case 209: /* expr ::= expr SLASH expr */
H
Haojun Liao 已提交
2719 2720
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_DIVIDE);}
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2721
        break;
Y
yihaoDeng 已提交
2722
      case 210: /* expr ::= expr REM expr */
H
Haojun Liao 已提交
2723 2724
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_REM);   }
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2725
        break;
Y
yihaoDeng 已提交
2726
      case 211: /* expr ::= expr LIKE expr */
H
Haojun Liao 已提交
2727 2728
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_LIKE);  }
  yymsp[-2].minor.yy66 = yylhsminor.yy66;
H
hjxilinx 已提交
2729
        break;
Y
yihaoDeng 已提交
2730
      case 212: /* expr ::= expr IN LP exprlist RP */
H
Haojun Liao 已提交
2731 2732
{yylhsminor.yy66 = tSQLExprCreate(yymsp[-4].minor.yy66, (tSQLExpr*)yymsp[-1].minor.yy224, TK_IN); }
  yymsp[-4].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2733
        break;
Y
yihaoDeng 已提交
2734
      case 213: /* exprlist ::= exprlist COMMA expritem */
H
Haojun Liao 已提交
2735 2736
{yylhsminor.yy224 = tSQLExprListAppend(yymsp[-2].minor.yy224,yymsp[0].minor.yy66,0);}
  yymsp[-2].minor.yy224 = yylhsminor.yy224;
H
hzcheng 已提交
2737
        break;
Y
yihaoDeng 已提交
2738
      case 214: /* exprlist ::= expritem */
H
Haojun Liao 已提交
2739 2740
{yylhsminor.yy224 = tSQLExprListAppend(0,yymsp[0].minor.yy66,0);}
  yymsp[0].minor.yy224 = yylhsminor.yy224;
H
hzcheng 已提交
2741
        break;
Y
yihaoDeng 已提交
2742
      case 215: /* expritem ::= expr */
H
Haojun Liao 已提交
2743 2744
{yylhsminor.yy66 = yymsp[0].minor.yy66;}
  yymsp[0].minor.yy66 = yylhsminor.yy66;
H
hzcheng 已提交
2745
        break;
Y
yihaoDeng 已提交
2746
      case 217: /* cmd ::= RESET QUERY CACHE */
2747
{ setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
H
hzcheng 已提交
2748
        break;
Y
yihaoDeng 已提交
2749
      case 218: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
H
hzcheng 已提交
2750 2751
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
H
Haojun Liao 已提交
2752
    SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy449, NULL, TSDB_ALTER_TABLE_ADD_COLUMN);
2753
    setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
H
hzcheng 已提交
2754 2755
}
        break;
Y
yihaoDeng 已提交
2756
      case 219: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
H
hzcheng 已提交
2757 2758 2759 2760
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;

    toTSDBType(yymsp[0].minor.yy0.type);
2761
    tVariantList* K = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1);
H
hzcheng 已提交
2762

2763 2764
    SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN);
    setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
H
hzcheng 已提交
2765 2766
}
        break;
Y
yihaoDeng 已提交
2767
      case 220: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
H
hzcheng 已提交
2768 2769
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
H
Haojun Liao 已提交
2770
    SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy449, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN);
2771
    setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
H
hzcheng 已提交
2772 2773
}
        break;
Y
yihaoDeng 已提交
2774
      case 221: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
H
hzcheng 已提交
2775 2776 2777 2778
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;

    toTSDBType(yymsp[0].minor.yy0.type);
2779
    tVariantList* A = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1);
H
hzcheng 已提交
2780

2781 2782
    SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN);
    setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
H
hzcheng 已提交
2783 2784
}
        break;
Y
yihaoDeng 已提交
2785
      case 222: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
H
hzcheng 已提交
2786 2787 2788 2789
{
    yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;

    toTSDBType(yymsp[-1].minor.yy0.type);
2790
    tVariantList* A = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
H
hzcheng 已提交
2791 2792

    toTSDBType(yymsp[0].minor.yy0.type);
2793
    A = tVariantListAppendToken(A, &yymsp[0].minor.yy0, -1);
H
hzcheng 已提交
2794

2795 2796
    SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN);
    setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
H
hzcheng 已提交
2797 2798
}
        break;
Y
yihaoDeng 已提交
2799
      case 223: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
H
hzcheng 已提交
2800
{
2801
    yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;
H
hzcheng 已提交
2802 2803

    toTSDBType(yymsp[-2].minor.yy0.type);
2804
    tVariantList* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
H
Haojun Liao 已提交
2805
    A = tVariantListAppend(A, &yymsp[0].minor.yy312, -1);
H
hzcheng 已提交
2806

2807 2808
    SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL);
    setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
H
hzcheng 已提交
2809 2810
}
        break;
Y
yihaoDeng 已提交
2811
      case 224: /* cmd ::= KILL CONNECTION INTEGER */
2812
{setKillSQL(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);}
H
hzcheng 已提交
2813
        break;
Y
yihaoDeng 已提交
2814
      case 225: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */
2815
{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);}
H
hzcheng 已提交
2816
        break;
Y
yihaoDeng 已提交
2817
      case 226: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
2818
{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);}
H
hzcheng 已提交
2819 2820 2821 2822 2823
        break;
      default:
        break;
/********** End reduce actions ************************************************/
  };
2824
  assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
H
hzcheng 已提交
2825 2826
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840
  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");
H
hzcheng 已提交
2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855
}

/*
** The following code executes when the parse fails
*/
#ifndef YYNOERRORRECOVERY
static void yy_parse_failed(
  yyParser *yypParser           /* The parser */
){
  ParseARG_FETCH;
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
  }
#endif
2856
  while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
H
hzcheng 已提交
2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870
  /* 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 */

/*
** The following code executes when a syntax error first occurs.
*/
static void yy_syntax_error(
  yyParser *yypParser,           /* The parser */
  int yymajor,                   /* The major type of the error token */
2871
  ParseTOKENTYPE yyminor         /* The minor type of the error token */
H
hzcheng 已提交
2872 2873
){
  ParseARG_FETCH;
2874
#define TOKEN yyminor
H
hzcheng 已提交
2875 2876
/************ Begin %syntax_error code ****************************************/

2877
  pInfo->valid = false;
H
hzcheng 已提交
2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913
  int32_t outputBufLen = tListLen(pInfo->pzErrMsg);
  int32_t len = 0;

  if(TOKEN.z) {
    char msg[] = "syntax error near \"%s\"";
    int32_t sqlLen = strlen(&TOKEN.z[0]);

    if (sqlLen + sizeof(msg)/sizeof(msg[0]) + 1 > outputBufLen) {
        char tmpstr[128] = {0};
        memcpy(tmpstr, &TOKEN.z[0], sizeof(tmpstr)/sizeof(tmpstr[0]) - 1);
        len = sprintf(pInfo->pzErrMsg, msg, tmpstr);
    } else {
        len = sprintf(pInfo->pzErrMsg, msg, &TOKEN.z[0]);
    }

  } else {
    len = sprintf(pInfo->pzErrMsg, "Incomplete SQL statement");
  }

  assert(len <= outputBufLen);
/************ End %syntax_error code ******************************************/
  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/*
** The following is executed when the parser accepts
*/
static void yy_accept(
  yyParser *yypParser           /* The parser */
){
  ParseARG_FETCH;
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
  }
#endif
2914 2915 2916 2917
#ifndef YYNOERRORRECOVERY
  yypParser->yyerrcnt = -1;
#endif
  assert( yypParser->yytos==yypParser->yystack );
H
hzcheng 已提交
2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951
  /* Here code is inserted which will be executed whenever the
  ** parser accepts */
/*********** Begin %parse_accept code *****************************************/

/*********** End %parse_accept code *******************************************/
  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/* The main parser program.
** The first argument is a pointer to a structure obtained from
** "ParseAlloc" which describes the current state of the parser.
** The second argument is the major token number.  The third is
** the minor token.  The fourth optional argument is whatever the
** user wants (and specified in the grammar) and is available for
** use by the action routines.
**
** Inputs:
** <ul>
** <li> A pointer to the parser (an opaque structure.)
** <li> The major token number.
** <li> The minor token number.
** <li> An option argument of a grammar-specified type.
** </ul>
**
** Outputs:
** None.
*/
void Parse(
  void *yyp,                   /* The parser */
  int yymajor,                 /* The major token code number */
  ParseTOKENTYPE yyminor       /* The value for the token */
  ParseARG_PDECL               /* Optional %extra_argument parameter */
){
  YYMINORTYPE yyminorunion;
2952
  unsigned int yyact;   /* The parser action. */
H
hzcheng 已提交
2953 2954 2955 2956 2957 2958 2959 2960 2961
#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 */

  yypParser = (yyParser*)yyp;
2962
  assert( yypParser->yytos!=0 );
H
hzcheng 已提交
2963 2964 2965 2966 2967 2968 2969
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
  yyendofinput = (yymajor==0);
#endif
  ParseARG_STORE;

#ifndef NDEBUG
  if( yyTraceFILE ){
2970 2971 2972 2973 2974 2975 2976 2977
    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);
    }
H
hzcheng 已提交
2978 2979 2980 2981 2982
  }
#endif

  do{
    yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
2983 2984 2985 2986 2987
    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
H
hzcheng 已提交
2988
      yypParser->yyerrcnt--;
2989
#endif
H
hzcheng 已提交
2990
      yymajor = YYNOCODE;
2991 2992 2993 2994
    }else if( yyact==YY_ACCEPT_ACTION ){
      yypParser->yytos--;
      yy_accept(yypParser);
      return;
H
hzcheng 已提交
2995 2996
    }else{
      assert( yyact == YY_ERROR_ACTION );
2997
      yyminorunion.yy0 = yyminor;
H
hzcheng 已提交
2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026
#ifdef YYERRORSYMBOL
      int yymx;
#endif
#ifndef NDEBUG
      if( yyTraceFILE ){
        fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
      }
#endif
#ifdef YYERRORSYMBOL
      /* A syntax error has occurred.
      ** The response to an error depends upon whether or not the
      ** grammar defines an error token "ERROR".  
      **
      ** This is what we do if the grammar does define ERROR:
      **
      **  * Call the %syntax_error function.
      **
      **  * Begin popping the stack until we enter a state where
      **    it is legal to shift the error symbol, then shift
      **    the error symbol.
      **
      **  * Set the error count to three.
      **
      **  * Begin accepting and shifting new tokens.  No new error
      **    processing will occur until three tokens have been
      **    shifted successfully.
      **
      */
      if( yypParser->yyerrcnt<0 ){
3027
        yy_syntax_error(yypParser,yymajor,yyminor);
H
hzcheng 已提交
3028
      }
3029
      yymx = yypParser->yytos->major;
H
hzcheng 已提交
3030 3031 3032 3033 3034 3035 3036
      if( yymx==YYERRORSYMBOL || yyerrorhit ){
#ifndef NDEBUG
        if( yyTraceFILE ){
          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
             yyTracePrompt,yyTokenName[yymajor]);
        }
#endif
3037
        yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
H
hzcheng 已提交
3038 3039
        yymajor = YYNOCODE;
      }else{
3040 3041 3042 3043
        while( yypParser->yytos >= yypParser->yystack
            && yymx != YYERRORSYMBOL
            && (yyact = yy_find_reduce_action(
                        yypParser->yytos->stateno,
H
hzcheng 已提交
3044 3045 3046 3047
                        YYERRORSYMBOL)) >= YY_MIN_REDUCE
        ){
          yy_pop_parser_stack(yypParser);
        }
3048
        if( yypParser->yytos < yypParser->yystack || yymajor==0 ){
H
hzcheng 已提交
3049 3050
          yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
          yy_parse_failed(yypParser);
3051 3052 3053
#ifndef YYNOERRORRECOVERY
          yypParser->yyerrcnt = -1;
#endif
H
hzcheng 已提交
3054 3055
          yymajor = YYNOCODE;
        }else if( yymx!=YYERRORSYMBOL ){
3056
          yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
H
hzcheng 已提交
3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068
        }
      }
      yypParser->yyerrcnt = 3;
      yyerrorhit = 1;
#elif defined(YYNOERRORRECOVERY)
      /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
      ** do any kind of error recovery.  Instead, simply invoke the syntax
      ** error routine and continue going as if nothing had happened.
      **
      ** Applications can set this macro (for example inside %include) if
      ** they intend to abandon the parse upon the first syntax error seen.
      */
3069
      yy_syntax_error(yypParser,yymajor, yyminor);
H
hzcheng 已提交
3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083
      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
      yymajor = YYNOCODE;
      
#else  /* YYERRORSYMBOL is not defined */
      /* This is what we do if the grammar does not define ERROR:
      **
      **  * Report an error message, and throw away the input token.
      **
      **  * If the input token is $, then fail the parse.
      **
      ** As before, subsequent error messages are suppressed until
      ** three input tokens have been successfully shifted.
      */
      if( yypParser->yyerrcnt<=0 ){
3084
        yy_syntax_error(yypParser,yymajor, yyminor);
H
hzcheng 已提交
3085 3086 3087 3088 3089
      }
      yypParser->yyerrcnt = 3;
      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
      if( yyendofinput ){
        yy_parse_failed(yypParser);
3090 3091 3092
#ifndef YYNOERRORRECOVERY
        yypParser->yyerrcnt = -1;
#endif
H
hzcheng 已提交
3093 3094 3095 3096
      }
      yymajor = YYNOCODE;
#endif
    }
3097
  }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack );
H
hzcheng 已提交
3098 3099
#ifndef NDEBUG
  if( yyTraceFILE ){
3100 3101
    yyStackEntry *i;
    char cDiv = '[';
H
hzcheng 已提交
3102
    fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
3103 3104 3105 3106
    for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){
      fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]);
      cDiv = ' ';
    }
H
hzcheng 已提交
3107 3108 3109 3110 3111
    fprintf(yyTraceFILE,"]\n");
  }
#endif
  return;
}