sql.c 99.1 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
/*
** 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:
*/
S
slguan 已提交
25 26
#pragma GCC diagnostic ignored "-Wunused-variable"

H
hzcheng 已提交
27 28 29 30 31 32 33 34
#include <stdio.h>
/************ Begin %include sections from the grammar ************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
H
hjxilinx 已提交
35
#include "tscSQLParser.h"
H
hzcheng 已提交
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
#include "tutil.h"
/**************** 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
**    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
L
lihui 已提交
86
**    YY_MIN_REDUCE      Maximum value for reduce actions
H
hzcheng 已提交
87 88 89 90 91 92 93 94
**    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
*/
#ifndef INTERFACE
# define INTERFACE 1
#endif
/************* Begin control #defines *****************************************/
S
slguan 已提交
95
#define YYCODETYPE unsigned short int
L
lihui 已提交
96
#define YYNOCODE 262
H
hzcheng 已提交
97 98 99 100 101
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SSQLToken
typedef union {
  int yyinit;
  ParseTOKENTYPE yy0;
L
lihui 已提交
102 103 104 105 106 107 108 109 110 111 112 113 114 115
  SQuerySQL* yy138;
  SCreateAcctSQL yy155;
  SLimitVal yy162;
  int yy220;
  tVariant yy236;
  tSQLExprListList* yy237;
  tSQLExpr* yy244;
  SCreateDBInfo yy262;
  tSQLExprList* yy284;
  SCreateTableSQL* yy344;
  int64_t yy369;
  TAOS_FIELD yy397;
  tFieldList* yy421;
  tVariantList* yy480;
H
hzcheng 已提交
116 117 118 119 120 121 122 123 124
} 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
L
lihui 已提交
125 126 127 128 129 130 131 132 133 134
#define YYNSTATE             252
#define YYNRULE              216
#define YY_MAX_SHIFT         251
#define YY_MIN_SHIFTREDUCE   403
#define YY_MAX_SHIFTREDUCE   618
#define YY_MIN_REDUCE        619
#define YY_MAX_REDUCE        834
#define YY_ERROR_ACTION      835
#define YY_ACCEPT_ACTION     836
#define YY_NO_ACTION         837
H
hzcheng 已提交
135 136
/************* End control #defines *******************************************/

L
lihui 已提交
137 138 139 140
/* The yyzerominor constant is used to initialize instances of
** YYMINORTYPE objects to zero. */
static const YYMINORTYPE yyzerominor = { 0 };

H
hzcheng 已提交
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
/* 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.
**
L
lihui 已提交
168 169 170
**   N between YY_MIN_REDUCE            Reduce by rule N-YY_MIN_REDUCE
**     and YY_MAX_REDUCE

H
hzcheng 已提交
171 172 173 174 175 176 177 178
**   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.
**
** The action table is constructed as a single large table named yy_action[].
L
lihui 已提交
179
** Given state S and lookahead X, the action is computed as
H
hzcheng 已提交
180
**
L
lihui 已提交
181
**      yy_action[ yy_shift_ofst[S] + X ]
H
hzcheng 已提交
182
**
L
lihui 已提交
183 184 185 186
** If the index value yy_shift_ofst[S]+X is out of range or if the value
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
** and that yy_default[S] should be used instead.  
H
hzcheng 已提交
187
**
L
lihui 已提交
188
** The formula above is 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
L
lihui 已提交
191 192
** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
** YY_SHIFT_USE_DFLT.
H
hzcheng 已提交
193 194 195 196 197 198 199 200 201 202 203 204 205
**
** 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 **********************************************/
L
lihui 已提交
206
#define YY_ACTTAB_COUNT (531)
H
hzcheng 已提交
207
static const YYACTIONTYPE yy_action[] = {
L
lihui 已提交
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
 /*     0 */   443,   74,   78,  244,   85,   77,  153,  249,  444,  836,
 /*    10 */   251,   80,   43,   45,    7,   37,   38,   62,  111,  171,
 /*    20 */    31,  443,  443,  205,   41,   39,   42,   40,  241,  444,
 /*    30 */   444,  135,   36,   35,   10,  101,   34,   33,   32,   43,
 /*    40 */    45,  600,   37,   38,  156,  524,  135,   31,  135,  133,
 /*    50 */   205,   41,   39,   42,   40,  159,  601,  158,  601,   36,
 /*    60 */    35,  154,  514,   34,   33,   32,  404,  405,  406,  407,
 /*    70 */   408,  409,  410,  411,  412,  413,  414,  415,  250,   21,
 /*    80 */    43,   45,  172,   37,   38,  227,  226,  202,   31,   59,
 /*    90 */    21,  205,   41,   39,   42,   40,   34,   33,   32,   57,
 /*   100 */    36,   35,  550,  551,   34,   33,   32,   45,  232,   37,
 /*   110 */    38,  167,  132,  511,   31,   21,   21,  205,   41,   39,
 /*   120 */    42,   40,  168,  569,  511,  502,   36,   35,  134,  178,
 /*   130 */    34,   33,   32,  243,   37,   38,  186,  512,  183,   31,
 /*   140 */   532,  101,  205,   41,   39,   42,   40,  228,  233,  511,
 /*   150 */   511,   36,   35,  230,  229,   34,   33,   32,   17,  219,
 /*   160 */   242,  218,  217,  216,  215,  214,  213,  212,  211,  496,
 /*   170 */   139,  485,  486,  487,  488,  489,  490,  491,  492,  493,
 /*   180 */   494,  495,  163,  582,   11,   97,  573,  133,  576,  529,
 /*   190 */   579,  597,  163,  582,  166,  556,  573,  200,  576,  155,
 /*   200 */   579,   36,   35,  148,  220,   34,   33,   32,   21,   87,
 /*   210 */    86,  142,  514,  243,  160,  161,  101,  147,  204,  248,
 /*   220 */   247,  426,  514,   76,  160,  161,  163,  582,  530,  241,
 /*   230 */   573,  101,  576,  513,  579,  193,   41,   39,   42,   40,
 /*   240 */   242,  596,  510,   27,   36,   35,   49,  571,   34,   33,
 /*   250 */    32,  114,  115,  224,   65,   68,  505,  441,  160,  161,
 /*   260 */   124,  192,  518,   50,  188,  515,  499,  516,  498,  517,
 /*   270 */   555,  150,  128,  126,  245,   89,   88,   44,  450,  442,
 /*   280 */    61,  124,  124,  572,  595,   60,  581,   44,  575,  527,
 /*   290 */   578,   28,   18,  169,  170,  605,  581,  162,  606,   29,
 /*   300 */   541,  580,   29,  542,   47,   52,  599,   15,  151,  583,
 /*   310 */    14,  580,  574,   14,  577,  508,   73,   72,  507,   47,
 /*   320 */    53,   44,   22,  209,  522,  152,  523,   22,  140,  520,
 /*   330 */   581,  521,    9,    8,    2,   84,   83,  141,  143,  144,
 /*   340 */   145,  615,  146,  137,  131,  580,  138,  136,  531,  566,
 /*   350 */    98,  565,  164,  562,  561,  165,  231,  548,  547,  189,
 /*   360 */   112,  113,  519,  452,  110,  210,  129,   25,  191,  223,
 /*   370 */   225,  614,   70,  613,  611,  116,  470,   26,   23,  130,
 /*   380 */   439,   91,   79,  437,   81,  435,  434,  537,  194,  198,
 /*   390 */   173,   54,  125,  432,  431,  430,  428,  421,  525,  127,
 /*   400 */   425,   51,  423,  102,   46,  203,  103,  104,   95,  199,
 /*   410 */   201,  535,  197,   30,  536,  549,  195,   27,  222,   75,
 /*   420 */   234,  235,  236,  237,  207,   55,  238,  239,  240,  246,
 /*   430 */   149,  618,   63,   66,  175,  433,  174,  176,  177,  617,
 /*   440 */   180,  427,  119,   90,  118,  471,  117,  120,  122,  121,
 /*   450 */   123,   92,  509,    1,   24,  182,  107,  105,  106,  108,
 /*   460 */   109,  179,  181,  616,  184,  185,   12,  609,  190,  187,
 /*   470 */    13,  157,   96,  538,   99,  196,   58,    4,   19,  543,
 /*   480 */   100,    5,  584,    3,   20,   16,  206,    6,  208,   64,
 /*   490 */   483,  482,  481,  480,  479,  478,  477,  476,  474,   47,
 /*   500 */   447,  449,   67,   22,  504,  221,  503,  501,   56,  468,
 /*   510 */   466,   48,  458,  464,   69,  460,  462,  456,  454,  475,
 /*   520 */    71,  473,   82,  429,  445,  419,  417,   93,  619,  621,
 /*   530 */    94,
H
hzcheng 已提交
262 263
};
static const YYCODETYPE yy_lookahead[] = {
L
lihui 已提交
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
 /*     0 */     1,   64,   65,   66,   67,   68,  199,  200,    9,  197,
 /*    10 */   198,   74,   13,   14,   96,   16,   17,   99,  100,   63,
 /*    20 */    21,    1,    1,   24,   25,   26,   27,   28,   78,    9,
 /*    30 */     9,  248,   33,   34,  248,  200,   37,   38,   39,   13,
 /*    40 */    14,  258,   16,   17,  217,  233,  248,   21,  248,  248,
 /*    50 */    24,   25,   26,   27,   28,  257,  258,  257,  258,   33,
 /*    60 */    34,  260,  235,   37,   38,   39,   45,   46,   47,   48,
 /*    70 */    49,   50,   51,   52,   53,   54,   55,   56,   57,  200,
 /*    80 */    13,   14,  126,   16,   17,  129,  130,  252,   21,  254,
 /*    90 */   200,   24,   25,   26,   27,   28,   37,   38,   39,  100,
 /*   100 */    33,   34,  111,  112,   37,   38,   39,   14,  200,   16,
 /*   110 */    17,  232,  248,  234,   21,  200,  200,   24,   25,   26,
 /*   120 */    27,   28,  232,   97,  234,    5,   33,   34,  248,  125,
 /*   130 */    37,   38,   39,   60,   16,   17,  132,  229,  134,   21,
 /*   140 */   200,  200,   24,   25,   26,   27,   28,  232,  232,  234,
 /*   150 */   234,   33,   34,   33,   34,   37,   38,   39,   85,   86,
 /*   160 */    87,   88,   89,   90,   91,   92,   93,   94,   95,  216,
 /*   170 */   248,  218,  219,  220,  221,  222,  223,  224,  225,  226,
 /*   180 */   227,  228,    1,    2,   44,  200,    5,  248,    7,  249,
 /*   190 */     9,  248,    1,    2,  217,  254,    5,  256,    7,  260,
 /*   200 */     9,   33,   34,   63,  217,   37,   38,   39,  200,   69,
 /*   210 */    70,   71,  235,   60,   33,   34,  200,   77,   37,   60,
 /*   220 */    61,   62,  235,   72,   33,   34,    1,    2,   37,   78,
 /*   230 */     5,  200,    7,  235,    9,  250,   25,   26,   27,   28,
 /*   240 */    87,  248,  234,  103,   33,   34,  101,    1,   37,   38,
 /*   250 */    39,   64,   65,   66,   67,   68,  231,  204,   33,   34,
 /*   260 */   207,  121,    2,  118,  124,    5,  218,    7,  220,    9,
 /*   270 */   254,  131,   64,   65,   66,   67,   68,   96,  204,  204,
 /*   280 */   236,  207,  207,   37,  248,  254,  105,   96,    5,  101,
 /*   290 */     7,  247,  104,   33,   34,   97,  105,   59,   97,  101,
 /*   300 */    97,  120,  101,   97,  101,  101,   97,  101,  248,   97,
 /*   310 */   101,  120,    5,  101,    7,   97,  127,  128,   97,  101,
 /*   320 */   116,   96,  101,   97,    5,  248,    7,  101,  248,    5,
 /*   330 */   105,    7,  127,  128,   96,   72,   73,  248,  248,  248,
 /*   340 */   248,  235,  248,  248,  248,  120,  248,  248,  200,  230,
 /*   350 */   200,  230,  230,  230,  230,  230,  230,  255,  255,  123,
 /*   360 */   200,  200,  102,  200,  237,  200,  200,  200,  259,  200,
 /*   370 */   200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
 /*   380 */   200,   59,  200,  200,  200,  200,  200,  105,  251,  251,
 /*   390 */   200,  115,  200,  200,  200,  200,  200,  200,  246,  200,
 /*   400 */   200,  117,  200,  245,  114,  109,  244,  243,  201,  108,
 /*   410 */   113,  201,  107,  119,  201,  201,  106,  103,   75,   84,
 /*   420 */    83,   49,   80,   82,  201,  201,   53,   81,   79,   75,
 /*   430 */   201,    5,  205,  205,    5,  201,  133,  133,   58,    5,
 /*   440 */     5,  201,  209,  202,  213,  215,  214,  212,  211,  210,
 /*   450 */   208,  202,  233,  206,  203,   58,  240,  242,  241,  239,
 /*   460 */   238,  133,  133,    5,  133,   58,   96,   86,  123,  125,
 /*   470 */    96,    1,  122,   97,   96,   96,  101,  110,  101,   97,
 /*   480 */    96,  110,   97,   96,  101,   96,   98,   96,   98,   72,
 /*   490 */     9,    5,    5,    5,    5,    1,    5,    5,    5,  101,
 /*   500 */    76,   58,   72,  101,    5,   15,    5,   97,   96,    5,
 /*   510 */     5,   16,    5,    5,  128,    5,    5,    5,    5,    5,
 /*   520 */   128,    5,   58,   58,   76,   59,   58,   21,    0,  261,
 /*   530 */    21,
H
hzcheng 已提交
318
};
L
lihui 已提交
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349
#define YY_SHIFT_USE_DFLT (-83)
#define YY_SHIFT_COUNT (251)
#define YY_SHIFT_MIN   (-82)
#define YY_SHIFT_MAX   (528)
static const short yy_shift_ofst[] = {
 /*     0 */   140,   73,  181,  225,   20,   20,   20,   20,   20,   20,
 /*    10 */    -1,   21,  225,  225,  225,  260,  260,  260,   20,   20,
 /*    20 */    20,   20,   20,  151,  153,  -50,  -50,  -83,  191,  225,
 /*    30 */   225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
 /*    40 */   225,  225,  225,  225,  225,  225,  225,  260,  260,  120,
 /*    50 */   120,  120,  120,  120,  120,  -82,  120,   20,   20,   -9,
 /*    60 */    -9,  188,   20,   20,   20,   20,   20,   20,   20,   20,
 /*    70 */    20,   20,   20,   20,   20,   20,   20,   20,   20,   20,
 /*    80 */    20,   20,   20,   20,   20,   20,   20,   20,   20,   20,
 /*    90 */    20,   20,   20,   20,   20,  236,  322,  322,  322,  282,
 /*   100 */   282,  322,  276,  284,  290,  296,  297,  301,  305,  310,
 /*   110 */   294,  314,  322,  322,  343,  343,  322,  335,  337,  372,
 /*   120 */   342,  341,  373,  346,  349,  322,  354,  322,  354,  -83,
 /*   130 */   -83,   26,   67,   67,   67,   67,   67,   93,  118,  211,
 /*   140 */   211,  211,  -63,  168,  168,  168,  168,  187,  208,  -44,
 /*   150 */     4,   59,   59,  159,  198,  201,  203,  206,  209,  212,
 /*   160 */   283,  307,  246,  238,  145,  204,  218,  221,  226,  319,
 /*   170 */   324,  189,  205,  263,  426,  303,  429,  304,  380,  434,
 /*   180 */   328,  435,  329,  397,  458,  331,  407,  381,  344,  370,
 /*   190 */   374,  345,  350,  375,  376,  378,  470,  379,  382,  384,
 /*   200 */   377,  367,  383,  371,  385,  387,  389,  388,  391,  390,
 /*   210 */   417,  481,  486,  487,  488,  489,  494,  491,  492,  493,
 /*   220 */   398,  424,  490,  430,  443,  495,  386,  392,  402,  499,
 /*   230 */   501,  410,  412,  402,  504,  505,  507,  508,  510,  511,
 /*   240 */   512,  513,  514,  516,  464,  465,  448,  506,  509,  466,
 /*   250 */   468,  528,
H
hzcheng 已提交
350
};
L
lihui 已提交
351
#define YY_REDUCE_USE_DFLT (-218)
S
slguan 已提交
352
#define YY_REDUCE_COUNT (130)
L
lihui 已提交
353 354
#define YY_REDUCE_MIN   (-217)
#define YY_REDUCE_MAX   (251)
H
hzcheng 已提交
355
static const short yy_reduce_ofst[] = {
L
lihui 已提交
356 357 358 359 360 361 362
 /*     0 */  -188,  -47, -202, -200,  -59, -165, -121, -110,  -85,  -84,
 /*    10 */   -60, -193, -199,  -61, -217, -173,  -23,  -13,  -15,   16,
 /*    20 */    31,  -92,    8,   53,   48,   74,   75,   44, -214, -136,
 /*    30 */  -120,  -78,  -57,   -7,   36,   60,   77,   80,   89,   90,
 /*    40 */    91,   92,   94,   95,   96,   98,   99,   -2,  106,  119,
 /*    50 */   121,  122,  123,  124,  125,   25,  126,  148,  150,  102,
 /*    60 */   103,  127,  160,  161,  163,  165,  166,  167,  169,  170,
H
hjxilinx 已提交
363
 /*    70 */   171,  172,  173,  174,  175,  176,  177,  178,  179,  180,
L
lihui 已提交
364 365 366 367 368 369
 /*    80 */   182,  183,  184,  185,  186,  190,  192,  193,  194,  195,
 /*    90 */   196,  197,  199,  200,  202,  109,  207,  210,  213,  137,
 /*   100 */   138,  214,  152,  158,  162,  164,  215,  217,  216,  220,
 /*   110 */   222,  219,  223,  224,  227,  228,  229,  230,  232,  231,
 /*   120 */   233,  235,  239,  237,  242,  234,  241,  240,  249,  247,
 /*   130 */   251,
H
hzcheng 已提交
370 371
};
static const YYACTIONTYPE yy_default[] = {
L
lihui 已提交
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397
 /*     0 */   835,  667,  819,  819,  835,  835,  835,  835,  835,  835,
 /*    10 */   749,  634,  835,  835,  819,  835,  835,  835,  835,  835,
 /*    20 */   835,  835,  835,  669,  656,  669,  669,  744,  835,  835,
 /*    30 */   835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
 /*    40 */   835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
 /*    50 */   835,  835,  835,  835,  835,  835,  835,  835,  835,  768,
 /*    60 */   768,  742,  835,  835,  835,  835,  835,  835,  835,  835,
 /*    70 */   835,  835,  835,  835,  835,  835,  835,  835,  835,  654,
 /*    80 */   835,  652,  835,  835,  835,  835,  835,  835,  835,  835,
 /*    90 */   835,  835,  835,  835,  835,  835,  636,  636,  636,  835,
 /*   100 */   835,  636,  775,  779,  773,  761,  769,  760,  756,  755,
 /*   110 */   783,  835,  636,  636,  664,  664,  636,  685,  683,  681,
 /*   120 */   673,  679,  675,  677,  671,  636,  662,  636,  662,  700,
 /*   130 */   713,  835,  823,  824,  784,  818,  774,  802,  801,  814,
 /*   140 */   808,  807,  835,  806,  805,  804,  803,  835,  835,  835,
 /*   150 */   835,  810,  809,  835,  835,  835,  835,  835,  835,  835,
 /*   160 */   835,  835,  835,  786,  780,  776,  835,  835,  835,  835,
 /*   170 */   835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
 /*   180 */   835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
 /*   190 */   835,  820,  835,  750,  835,  835,  835,  835,  835,  835,
 /*   200 */   770,  835,  762,  835,  835,  835,  835,  835,  835,  722,
 /*   210 */   835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
 /*   220 */   688,  835,  835,  835,  835,  835,  835,  835,  828,  835,
 /*   230 */   835,  835,  716,  826,  835,  835,  835,  835,  835,  835,
 /*   240 */   835,  835,  835,  835,  835,  835,  835,  640,  638,  835,
 /*   250 */   632,  835,
H
hzcheng 已提交
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
};
/********** 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 已提交
465
    0,  /*   ACCOUNTS => nothing */
H
hzcheng 已提交
466 467 468 469 470 471 472 473
    0,  /*      USERS => nothing */
    0,  /*    MODULES => nothing */
    0,  /*    QUERIES => nothing */
    0,  /* CONNECTIONS => nothing */
    0,  /*    STREAMS => nothing */
    0,  /*    CONFIGS => nothing */
    0,  /*     SCORES => nothing */
    0,  /*     GRANTS => nothing */
L
lihui 已提交
474 475
    0,  /*     VNODES => nothing */
    1,  /*    IPTOKEN => ID */
H
hzcheng 已提交
476 477 478 479 480 481 482
    0,  /*        DOT => nothing */
    0,  /*     TABLES => nothing */
    0,  /*    STABLES => nothing */
    0,  /*    VGROUPS => nothing */
    0,  /*       DROP => nothing */
    0,  /*      TABLE => nothing */
    1,  /*   DATABASE => ID */
S
slguan 已提交
483
    0,  /*      DNODE => nothing */
H
hzcheng 已提交
484
    0,  /*       USER => nothing */
S
slguan 已提交
485
    0,  /*    ACCOUNT => nothing */
H
hzcheng 已提交
486 487 488 489 490 491 492 493 494
    0,  /*        USE => nothing */
    0,  /*   DESCRIBE => nothing */
    0,  /*      ALTER => nothing */
    0,  /*       PASS => nothing */
    0,  /*  PRIVILEGE => nothing */
    0,  /*      LOCAL => nothing */
    0,  /*         IF => nothing */
    0,  /*     EXISTS => nothing */
    0,  /*     CREATE => nothing */
S
slguan 已提交
495 496 497 498 499 500 501
    0,  /*        PPS => nothing */
    0,  /*    TSERIES => nothing */
    0,  /*        DBS => nothing */
    0,  /*    STORAGE => nothing */
    0,  /*      QTIME => nothing */
    0,  /*      CONNS => nothing */
    0,  /*      STATE => nothing */
H
hzcheng 已提交
502
    0,  /*       KEEP => nothing */
503
    0,  /*      CACHE => nothing */
H
hzcheng 已提交
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518
    0,  /*    REPLICA => nothing */
    0,  /*       DAYS => nothing */
    0,  /*       ROWS => nothing */
    0,  /*    ABLOCKS => nothing */
    0,  /*    TBLOCKS => nothing */
    0,  /*      CTIME => nothing */
    0,  /*       CLOG => nothing */
    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 已提交
519
    1,  /*       NULL => ID */
H
hzcheng 已提交
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
    0,  /*     SELECT => nothing */
    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,  /*     INSERT => nothing */
    0,  /*       INTO => nothing */
    0,  /*     VALUES => nothing */
    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,  /*      COLON => nothing */
    0,  /*     STREAM => nothing */
    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,  /*        ALL => 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 已提交
600
    1,  /*        TWA => ID */
H
hzcheng 已提交
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643
    1,  /*     INTERP => ID */
    1,  /*   LAST_ROW => ID */
    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 */
};
#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 {
L
lihui 已提交
644
  int yyidx;                    /* Index of top element in stack */
H
hzcheng 已提交
645
#ifdef YYTRACKMAXSTACKDEPTH
L
lihui 已提交
646
  int yyidxMax;                 /* Maximum value of yyidx */
H
hzcheng 已提交
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690
#endif
  int yyerrcnt;                 /* Shifts left before out of the error */
  ParseARG_SDECL                /* A place to hold %extra_argument */
#if YYSTACKDEPTH<=0
  int yystksz;                  /* Current side of the stack */
  yyStackEntry *yystack;        /* The parser's stack */
#else
  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */
#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 */

L
lihui 已提交
691
#ifndef NDEBUG
H
hzcheng 已提交
692 693 694
/* For tracing shifts, the names of all terminals and nonterminals
** are required.  The following table supplies these names */
static const char *const yyTokenName[] = { 
L
lihui 已提交
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760
  "$",             "ID",            "BOOL",          "TINYINT",     
  "SMALLINT",      "INTEGER",       "BIGINT",        "FLOAT",       
  "DOUBLE",        "STRING",        "TIMESTAMP",     "BINARY",      
  "NCHAR",         "OR",            "AND",           "NOT",         
  "EQ",            "NE",            "ISNULL",        "NOTNULL",     
  "IS",            "LIKE",          "GLOB",          "BETWEEN",     
  "IN",            "GT",            "GE",            "LT",          
  "LE",            "BITAND",        "BITOR",         "LSHIFT",      
  "RSHIFT",        "PLUS",          "MINUS",         "DIVIDE",      
  "TIMES",         "STAR",          "SLASH",         "REM",         
  "CONCAT",        "UMINUS",        "UPLUS",         "BITNOT",      
  "SHOW",          "DATABASES",     "MNODES",        "DNODES",      
  "ACCOUNTS",      "USERS",         "MODULES",       "QUERIES",     
  "CONNECTIONS",   "STREAMS",       "CONFIGS",       "SCORES",      
  "GRANTS",        "VNODES",        "IPTOKEN",       "DOT",         
  "TABLES",        "STABLES",       "VGROUPS",       "DROP",        
  "TABLE",         "DATABASE",      "DNODE",         "USER",        
  "ACCOUNT",       "USE",           "DESCRIBE",      "ALTER",       
  "PASS",          "PRIVILEGE",     "LOCAL",         "IF",          
  "EXISTS",        "CREATE",        "PPS",           "TSERIES",     
  "DBS",           "STORAGE",       "QTIME",         "CONNS",       
  "STATE",         "KEEP",          "CACHE",         "REPLICA",     
  "DAYS",          "ROWS",          "ABLOCKS",       "TBLOCKS",     
  "CTIME",         "CLOG",          "COMP",          "PRECISION",   
  "LP",            "RP",            "TAGS",          "USING",       
  "AS",            "COMMA",         "NULL",          "SELECT",      
  "FROM",          "VARIABLE",      "INTERVAL",      "FILL",        
  "SLIDING",       "ORDER",         "BY",            "ASC",         
  "DESC",          "GROUP",         "HAVING",        "LIMIT",       
  "OFFSET",        "SLIMIT",        "SOFFSET",       "WHERE",       
  "NOW",           "INSERT",        "INTO",          "VALUES",      
  "RESET",         "QUERY",         "ADD",           "COLUMN",      
  "TAG",           "CHANGE",        "SET",           "KILL",        
  "CONNECTION",    "COLON",         "STREAM",        "ABORT",       
  "AFTER",         "ATTACH",        "BEFORE",        "BEGIN",       
  "CASCADE",       "CLUSTER",       "CONFLICT",      "COPY",        
  "DEFERRED",      "DELIMITERS",    "DETACH",        "EACH",        
  "END",           "EXPLAIN",       "FAIL",          "FOR",         
  "IGNORE",        "IMMEDIATE",     "INITIALLY",     "INSTEAD",     
  "MATCH",         "KEY",           "OF",            "RAISE",       
  "REPLACE",       "RESTRICT",      "ROW",           "STATEMENT",   
  "TRIGGER",       "VIEW",          "ALL",           "COUNT",       
  "SUM",           "AVG",           "MIN",           "MAX",         
  "FIRST",         "LAST",          "TOP",           "BOTTOM",      
  "STDDEV",        "PERCENTILE",    "APERCENTILE",   "LEASTSQUARES",
  "HISTOGRAM",     "DIFF",          "SPREAD",        "TWA",         
  "INTERP",        "LAST_ROW",      "SEMI",          "NONE",        
  "PREV",          "LINEAR",        "IMPORT",        "METRIC",      
  "TBNAME",        "JOIN",          "METRICS",       "STABLE",      
  "error",         "program",       "cmd",           "dbPrefix",    
  "ids",           "cpxName",       "ifexists",      "alter_db_optr",
  "acct_optr",     "ifnotexists",   "db_optr",       "pps",         
  "tseries",       "dbs",           "streams",       "storage",     
  "qtime",         "users",         "conns",         "state",       
  "keep",          "tagitemlist",   "tables",        "cache",       
  "replica",       "days",          "rows",          "ablocks",     
  "tblocks",       "ctime",         "clog",          "comp",        
  "prec",          "typename",      "signed",        "create_table_args",
  "columnlist",    "select",        "column",        "tagitem",     
  "selcollist",    "from",          "where_opt",     "interval_opt",
  "fill_opt",      "sliding_opt",   "groupby_opt",   "orderby_opt", 
  "having_opt",    "slimit_opt",    "limit_opt",     "sclp",        
  "expr",          "as",            "tablelist",     "tmvar",       
  "sortlist",      "sortitem",      "item",          "sortorder",   
  "grouplist",     "exprlist",      "expritem",      "insert_value_list",
  "itemlist",    
H
hzcheng 已提交
761
};
L
lihui 已提交
762
#endif /* NDEBUG */
H
hzcheng 已提交
763 764 765 766 767 768 769 770 771

#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 已提交
772 773 774 775 776 777 778 779 780
 /*   4 */ "cmd ::= SHOW ACCOUNTS",
 /*   5 */ "cmd ::= SHOW USERS",
 /*   6 */ "cmd ::= SHOW MODULES",
 /*   7 */ "cmd ::= SHOW QUERIES",
 /*   8 */ "cmd ::= SHOW CONNECTIONS",
 /*   9 */ "cmd ::= SHOW STREAMS",
 /*  10 */ "cmd ::= SHOW CONFIGS",
 /*  11 */ "cmd ::= SHOW SCORES",
 /*  12 */ "cmd ::= SHOW GRANTS",
L
lihui 已提交
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983
 /*  13 */ "cmd ::= SHOW VNODES",
 /*  14 */ "cmd ::= SHOW VNODES IPTOKEN",
 /*  15 */ "dbPrefix ::=",
 /*  16 */ "dbPrefix ::= ids DOT",
 /*  17 */ "cpxName ::=",
 /*  18 */ "cpxName ::= DOT ids",
 /*  19 */ "cmd ::= SHOW dbPrefix TABLES",
 /*  20 */ "cmd ::= SHOW dbPrefix TABLES LIKE ids",
 /*  21 */ "cmd ::= SHOW dbPrefix STABLES",
 /*  22 */ "cmd ::= SHOW dbPrefix STABLES LIKE ids",
 /*  23 */ "cmd ::= SHOW dbPrefix VGROUPS",
 /*  24 */ "cmd ::= DROP TABLE ifexists ids cpxName",
 /*  25 */ "cmd ::= DROP DATABASE ifexists ids",
 /*  26 */ "cmd ::= DROP DNODE IPTOKEN",
 /*  27 */ "cmd ::= DROP USER ids",
 /*  28 */ "cmd ::= DROP ACCOUNT ids",
 /*  29 */ "cmd ::= USE ids",
 /*  30 */ "cmd ::= DESCRIBE ids cpxName",
 /*  31 */ "cmd ::= ALTER USER ids PASS ids",
 /*  32 */ "cmd ::= ALTER USER ids PRIVILEGE ids",
 /*  33 */ "cmd ::= ALTER DNODE IPTOKEN ids",
 /*  34 */ "cmd ::= ALTER DNODE IPTOKEN ids ids",
 /*  35 */ "cmd ::= ALTER LOCAL ids",
 /*  36 */ "cmd ::= ALTER LOCAL ids ids",
 /*  37 */ "cmd ::= ALTER DATABASE ids alter_db_optr",
 /*  38 */ "cmd ::= ALTER ACCOUNT ids acct_optr",
 /*  39 */ "cmd ::= ALTER ACCOUNT ids PASS ids acct_optr",
 /*  40 */ "ids ::= ID",
 /*  41 */ "ids ::= STRING",
 /*  42 */ "ifexists ::= IF EXISTS",
 /*  43 */ "ifexists ::=",
 /*  44 */ "ifnotexists ::= IF NOT EXISTS",
 /*  45 */ "ifnotexists ::=",
 /*  46 */ "cmd ::= CREATE DNODE IPTOKEN",
 /*  47 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr",
 /*  48 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr",
 /*  49 */ "cmd ::= CREATE USER ids PASS ids",
 /*  50 */ "pps ::=",
 /*  51 */ "pps ::= PPS INTEGER",
 /*  52 */ "tseries ::=",
 /*  53 */ "tseries ::= TSERIES INTEGER",
 /*  54 */ "dbs ::=",
 /*  55 */ "dbs ::= DBS INTEGER",
 /*  56 */ "streams ::=",
 /*  57 */ "streams ::= STREAMS INTEGER",
 /*  58 */ "storage ::=",
 /*  59 */ "storage ::= STORAGE INTEGER",
 /*  60 */ "qtime ::=",
 /*  61 */ "qtime ::= QTIME INTEGER",
 /*  62 */ "users ::=",
 /*  63 */ "users ::= USERS INTEGER",
 /*  64 */ "conns ::=",
 /*  65 */ "conns ::= CONNS INTEGER",
 /*  66 */ "state ::=",
 /*  67 */ "state ::= STATE ids",
 /*  68 */ "acct_optr ::= pps tseries storage streams qtime dbs users conns state",
 /*  69 */ "keep ::= KEEP tagitemlist",
 /*  70 */ "tables ::= TABLES INTEGER",
 /*  71 */ "cache ::= CACHE INTEGER",
 /*  72 */ "replica ::= REPLICA INTEGER",
 /*  73 */ "days ::= DAYS INTEGER",
 /*  74 */ "rows ::= ROWS INTEGER",
 /*  75 */ "ablocks ::= ABLOCKS ID",
 /*  76 */ "tblocks ::= TBLOCKS INTEGER",
 /*  77 */ "ctime ::= CTIME INTEGER",
 /*  78 */ "clog ::= CLOG INTEGER",
 /*  79 */ "comp ::= COMP INTEGER",
 /*  80 */ "prec ::= PRECISION STRING",
 /*  81 */ "db_optr ::=",
 /*  82 */ "db_optr ::= db_optr tables",
 /*  83 */ "db_optr ::= db_optr cache",
 /*  84 */ "db_optr ::= db_optr replica",
 /*  85 */ "db_optr ::= db_optr days",
 /*  86 */ "db_optr ::= db_optr rows",
 /*  87 */ "db_optr ::= db_optr ablocks",
 /*  88 */ "db_optr ::= db_optr tblocks",
 /*  89 */ "db_optr ::= db_optr ctime",
 /*  90 */ "db_optr ::= db_optr clog",
 /*  91 */ "db_optr ::= db_optr comp",
 /*  92 */ "db_optr ::= db_optr prec",
 /*  93 */ "db_optr ::= db_optr keep",
 /*  94 */ "alter_db_optr ::=",
 /*  95 */ "alter_db_optr ::= alter_db_optr replica",
 /*  96 */ "alter_db_optr ::= alter_db_optr tables",
 /*  97 */ "typename ::= ids",
 /*  98 */ "typename ::= ids LP signed RP",
 /*  99 */ "signed ::= INTEGER",
 /* 100 */ "signed ::= PLUS INTEGER",
 /* 101 */ "signed ::= MINUS INTEGER",
 /* 102 */ "cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args",
 /* 103 */ "create_table_args ::= LP columnlist RP",
 /* 104 */ "create_table_args ::= LP columnlist RP TAGS LP columnlist RP",
 /* 105 */ "create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP",
 /* 106 */ "create_table_args ::= AS select",
 /* 107 */ "columnlist ::= columnlist COMMA column",
 /* 108 */ "columnlist ::= column",
 /* 109 */ "column ::= ids typename",
 /* 110 */ "tagitemlist ::= tagitemlist COMMA tagitem",
 /* 111 */ "tagitemlist ::= tagitem",
 /* 112 */ "tagitem ::= INTEGER",
 /* 113 */ "tagitem ::= FLOAT",
 /* 114 */ "tagitem ::= STRING",
 /* 115 */ "tagitem ::= BOOL",
 /* 116 */ "tagitem ::= NULL",
 /* 117 */ "tagitem ::= MINUS INTEGER",
 /* 118 */ "tagitem ::= MINUS FLOAT",
 /* 119 */ "tagitem ::= PLUS INTEGER",
 /* 120 */ "tagitem ::= PLUS FLOAT",
 /* 121 */ "cmd ::= select",
 /* 122 */ "select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt",
 /* 123 */ "select ::= SELECT selcollist",
 /* 124 */ "sclp ::= selcollist COMMA",
 /* 125 */ "sclp ::=",
 /* 126 */ "selcollist ::= sclp expr as",
 /* 127 */ "selcollist ::= sclp STAR",
 /* 128 */ "as ::= AS ids",
 /* 129 */ "as ::= ids",
 /* 130 */ "as ::=",
 /* 131 */ "from ::= FROM tablelist",
 /* 132 */ "tablelist ::= ids cpxName",
 /* 133 */ "tablelist ::= tablelist COMMA ids cpxName",
 /* 134 */ "tmvar ::= VARIABLE",
 /* 135 */ "interval_opt ::= INTERVAL LP tmvar RP",
 /* 136 */ "interval_opt ::=",
 /* 137 */ "fill_opt ::=",
 /* 138 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP",
 /* 139 */ "fill_opt ::= FILL LP ID RP",
 /* 140 */ "sliding_opt ::= SLIDING LP tmvar RP",
 /* 141 */ "sliding_opt ::=",
 /* 142 */ "orderby_opt ::=",
 /* 143 */ "orderby_opt ::= ORDER BY sortlist",
 /* 144 */ "sortlist ::= sortlist COMMA item sortorder",
 /* 145 */ "sortlist ::= item sortorder",
 /* 146 */ "item ::= ids cpxName",
 /* 147 */ "sortorder ::= ASC",
 /* 148 */ "sortorder ::= DESC",
 /* 149 */ "sortorder ::=",
 /* 150 */ "groupby_opt ::=",
 /* 151 */ "groupby_opt ::= GROUP BY grouplist",
 /* 152 */ "grouplist ::= grouplist COMMA item",
 /* 153 */ "grouplist ::= item",
 /* 154 */ "having_opt ::=",
 /* 155 */ "having_opt ::= HAVING expr",
 /* 156 */ "limit_opt ::=",
 /* 157 */ "limit_opt ::= LIMIT signed",
 /* 158 */ "limit_opt ::= LIMIT signed OFFSET signed",
 /* 159 */ "limit_opt ::= LIMIT signed COMMA signed",
 /* 160 */ "slimit_opt ::=",
 /* 161 */ "slimit_opt ::= SLIMIT signed",
 /* 162 */ "slimit_opt ::= SLIMIT signed SOFFSET signed",
 /* 163 */ "slimit_opt ::= SLIMIT signed COMMA signed",
 /* 164 */ "where_opt ::=",
 /* 165 */ "where_opt ::= WHERE expr",
 /* 166 */ "expr ::= LP expr RP",
 /* 167 */ "expr ::= ID",
 /* 168 */ "expr ::= ID DOT ID",
 /* 169 */ "expr ::= ID DOT STAR",
 /* 170 */ "expr ::= INTEGER",
 /* 171 */ "expr ::= MINUS INTEGER",
 /* 172 */ "expr ::= PLUS INTEGER",
 /* 173 */ "expr ::= FLOAT",
 /* 174 */ "expr ::= MINUS FLOAT",
 /* 175 */ "expr ::= PLUS FLOAT",
 /* 176 */ "expr ::= STRING",
 /* 177 */ "expr ::= NOW",
 /* 178 */ "expr ::= VARIABLE",
 /* 179 */ "expr ::= BOOL",
 /* 180 */ "expr ::= ID LP exprlist RP",
 /* 181 */ "expr ::= ID LP STAR RP",
 /* 182 */ "expr ::= expr AND expr",
 /* 183 */ "expr ::= expr OR expr",
 /* 184 */ "expr ::= expr LT expr",
 /* 185 */ "expr ::= expr GT expr",
 /* 186 */ "expr ::= expr LE expr",
 /* 187 */ "expr ::= expr GE expr",
 /* 188 */ "expr ::= expr NE expr",
 /* 189 */ "expr ::= expr EQ expr",
 /* 190 */ "expr ::= expr PLUS expr",
 /* 191 */ "expr ::= expr MINUS expr",
 /* 192 */ "expr ::= expr STAR expr",
 /* 193 */ "expr ::= expr SLASH expr",
 /* 194 */ "expr ::= expr REM expr",
 /* 195 */ "expr ::= expr LIKE expr",
 /* 196 */ "expr ::= expr IN LP exprlist RP",
 /* 197 */ "exprlist ::= exprlist COMMA expritem",
 /* 198 */ "exprlist ::= expritem",
 /* 199 */ "expritem ::= expr",
 /* 200 */ "expritem ::=",
 /* 201 */ "cmd ::= INSERT INTO cpxName insert_value_list",
 /* 202 */ "insert_value_list ::= VALUES LP itemlist RP",
 /* 203 */ "insert_value_list ::= insert_value_list VALUES LP itemlist RP",
 /* 204 */ "itemlist ::= itemlist COMMA expr",
 /* 205 */ "itemlist ::= expr",
 /* 206 */ "cmd ::= RESET QUERY CACHE",
 /* 207 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
 /* 208 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
 /* 209 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
 /* 210 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
 /* 211 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
 /* 212 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
 /* 213 */ "cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER",
 /* 214 */ "cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER",
 /* 215 */ "cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER",
H
hzcheng 已提交
984 985 986 987 988 989
};
#endif /* NDEBUG */


#if YYSTACKDEPTH<=0
/*
L
lihui 已提交
990
** Try to increase the size of the parser stack.
H
hzcheng 已提交
991
*/
L
lihui 已提交
992
static void yyGrowStack(yyParser *p){
H
hzcheng 已提交
993 994 995 996
  int newSize;
  yyStackEntry *pNew;

  newSize = p->yystksz*2 + 100;
L
lihui 已提交
997
  pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
H
hzcheng 已提交
998 999
  if( pNew ){
    p->yystack = pNew;
L
lihui 已提交
1000
    p->yystksz = newSize;
H
hzcheng 已提交
1001 1002
#ifndef NDEBUG
    if( yyTraceFILE ){
L
lihui 已提交
1003 1004
      fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
              yyTracePrompt, p->yystksz);
H
hzcheng 已提交
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034
    }
#endif
  }
}
#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

/* 
** 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) );
L
lihui 已提交
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045
  if( pParser ){
    pParser->yyidx = -1;
#ifdef YYTRACKMAXSTACKDEPTH
    pParser->yyidxMax = 0;
#endif
#if YYSTACKDEPTH<=0
    pParser->yystack = NULL;
    pParser->yystksz = 0;
    yyGrowStack(pParser);
#endif
  }
H
hzcheng 已提交
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
  return pParser;
}

/* 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 ***************************************/
L
lihui 已提交
1074 1075 1076 1077 1078 1079 1080
    case 216: /* keep */
    case 217: /* tagitemlist */
    case 240: /* fill_opt */
    case 242: /* groupby_opt */
    case 243: /* orderby_opt */
    case 252: /* sortlist */
    case 256: /* grouplist */
H
hzcheng 已提交
1081
{
L
lihui 已提交
1082
tVariantListDestroy((yypminor->yy480));
H
hjliao 已提交
1083 1084
}
      break;
L
lihui 已提交
1085
    case 232: /* columnlist */
H
hjliao 已提交
1086
{
L
lihui 已提交
1087
tFieldListDestroy((yypminor->yy421));
H
hzcheng 已提交
1088 1089
}
      break;
L
lihui 已提交
1090
    case 233: /* select */
H
hzcheng 已提交
1091
{
L
lihui 已提交
1092
destroyQuerySql((yypminor->yy138));
H
hzcheng 已提交
1093 1094
}
      break;
L
lihui 已提交
1095 1096 1097 1098
    case 236: /* selcollist */
    case 247: /* sclp */
    case 257: /* exprlist */
    case 260: /* itemlist */
H
hzcheng 已提交
1099
{
L
lihui 已提交
1100
tSQLExprListDestroy((yypminor->yy284));
H
hzcheng 已提交
1101 1102
}
      break;
L
lihui 已提交
1103 1104 1105 1106
    case 238: /* where_opt */
    case 244: /* having_opt */
    case 248: /* expr */
    case 258: /* expritem */
H
hzcheng 已提交
1107
{
L
lihui 已提交
1108
tSQLExprDestroy((yypminor->yy244));
H
hzcheng 已提交
1109 1110
}
      break;
L
lihui 已提交
1111
    case 253: /* sortitem */
H
hzcheng 已提交
1112
{
L
lihui 已提交
1113
tVariantDestroy(&(yypminor->yy236));
H
hzcheng 已提交
1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128
}
      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;
L
lihui 已提交
1129 1130
  assert( pParser->yyidx>=0 );
  yytos = &pParser->yystack[pParser->yyidx--];
H
hzcheng 已提交
1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sPopping %s\n",
      yyTracePrompt,
      yyTokenName[yytos->major]);
  }
#endif
  yy_destructor(pParser, yytos->major, &yytos->minor);
}

/* 
** 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 */
){
L
lihui 已提交
1153
  yyParser *pParser = (yyParser*)p;
H
hzcheng 已提交
1154
#ifndef YYPARSEFREENEVERNULL
L
lihui 已提交
1155
  if( pParser==0 ) return;
H
hzcheng 已提交
1156
#endif
L
lihui 已提交
1157 1158 1159 1160 1161
  while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
#if YYSTACKDEPTH<=0
  free(pParser->yystack);
#endif
  (*freeProc)((void*)pParser);
H
hzcheng 已提交
1162 1163 1164 1165 1166 1167 1168 1169
}

/*
** Return the peak depth of the stack for a parser.
*/
#ifdef YYTRACKMAXSTACKDEPTH
int ParseStackPeak(void *p){
  yyParser *pParser = (yyParser*)p;
L
lihui 已提交
1170
  return pParser->yyidxMax;
H
hzcheng 已提交
1171 1172 1173 1174 1175 1176 1177
}
#endif

/*
** Find the appropriate action for a parser given the terminal
** look-ahead token iLookAhead.
*/
L
lihui 已提交
1178
static int yy_find_shift_action(
H
hzcheng 已提交
1179 1180 1181 1182
  yyParser *pParser,        /* The parser */
  YYCODETYPE iLookAhead     /* The look-ahead token */
){
  int i;
L
lihui 已提交
1183
  int stateno = pParser->yystack[pParser->yyidx].stateno;
H
hzcheng 已提交
1184
 
L
lihui 已提交
1185
  if( stateno>=YY_MIN_REDUCE ) return stateno;
H
hzcheng 已提交
1186 1187 1188
  assert( stateno <= YY_SHIFT_COUNT );
  do{
    i = yy_shift_ofst[stateno];
L
lihui 已提交
1189
    if( i==YY_SHIFT_USE_DFLT ) return yy_default[stateno];
H
hzcheng 已提交
1190 1191
    assert( iLookAhead!=YYNOCODE );
    i += iLookAhead;
L
lihui 已提交
1192 1193
    if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
      if( iLookAhead>0 ){
H
hzcheng 已提交
1194
#ifdef YYFALLBACK
L
lihui 已提交
1195 1196 1197
        YYCODETYPE iFallback;            /* Fallback token */
        if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
               && (iFallback = yyFallback[iLookAhead])!=0 ){
H
hzcheng 已提交
1198
#ifndef NDEBUG
L
lihui 已提交
1199 1200 1201 1202
          if( yyTraceFILE ){
            fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
               yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
          }
H
hjxilinx 已提交
1203
#endif
L
lihui 已提交
1204 1205 1206 1207
          assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
          iLookAhead = iFallback;
          continue;
        }
H
hzcheng 已提交
1208 1209
#endif
#ifdef YYWILDCARD
L
lihui 已提交
1210 1211 1212
        {
          int j = i - iLookAhead + YYWILDCARD;
          if( 
H
hzcheng 已提交
1213
#if YY_SHIFT_MIN+YYWILDCARD<0
L
lihui 已提交
1214
            j>=0 &&
H
hzcheng 已提交
1215 1216
#endif
#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
L
lihui 已提交
1217
            j<YY_ACTTAB_COUNT &&
H
hzcheng 已提交
1218
#endif
L
lihui 已提交
1219 1220
            yy_lookahead[j]==YYWILDCARD
          ){
H
hzcheng 已提交
1221
#ifndef NDEBUG
L
lihui 已提交
1222 1223 1224 1225 1226
            if( yyTraceFILE ){
              fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
                 yyTracePrompt, yyTokenName[iLookAhead],
                 yyTokenName[YYWILDCARD]);
            }
H
hjxilinx 已提交
1227
#endif /* NDEBUG */
L
lihui 已提交
1228 1229
            return yy_action[j];
          }
H
hzcheng 已提交
1230
        }
H
hjxilinx 已提交
1231
#endif /* YYWILDCARD */
L
lihui 已提交
1232
      }
H
hzcheng 已提交
1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256
      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];
L
lihui 已提交
1257
  assert( i!=YY_REDUCE_USE_DFLT );
H
hzcheng 已提交
1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273
  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.
*/
L
lihui 已提交
1274
static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
H
hzcheng 已提交
1275
   ParseARG_FETCH;
L
lihui 已提交
1276
   yypParser->yyidx--;
H
hzcheng 已提交
1277 1278 1279 1280 1281
#ifndef NDEBUG
   if( yyTraceFILE ){
     fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
   }
#endif
L
lihui 已提交
1282
   while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
H
hzcheng 已提交
1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293
   /* 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
L
lihui 已提交
1294
static void yyTraceShift(yyParser *yypParser, int yyNewState){
H
hzcheng 已提交
1295 1296
  if( yyTraceFILE ){
    if( yyNewState<YYNSTATE ){
L
lihui 已提交
1297 1298
      fprintf(yyTraceFILE,"%sShift '%s', go to state %d\n",
         yyTracePrompt,yyTokenName[yypParser->yystack[yypParser->yyidx].major],
H
hzcheng 已提交
1299 1300
         yyNewState);
    }else{
L
lihui 已提交
1301 1302
      fprintf(yyTraceFILE,"%sShift '%s'\n",
         yyTracePrompt,yyTokenName[yypParser->yystack[yypParser->yyidx].major]);
H
hzcheng 已提交
1303 1304 1305 1306
    }
  }
}
#else
L
lihui 已提交
1307
# define yyTraceShift(X,Y)
H
hzcheng 已提交
1308 1309 1310 1311 1312 1313 1314 1315 1316
#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 */
L
lihui 已提交
1317
  YYMINORTYPE *yypMinor         /* Pointer to the minor token to shift in */
H
hzcheng 已提交
1318 1319
){
  yyStackEntry *yytos;
L
lihui 已提交
1320
  yypParser->yyidx++;
H
hzcheng 已提交
1321
#ifdef YYTRACKMAXSTACKDEPTH
L
lihui 已提交
1322 1323
  if( yypParser->yyidx>yypParser->yyidxMax ){
    yypParser->yyidxMax = yypParser->yyidx;
H
hzcheng 已提交
1324 1325 1326
  }
#endif
#if YYSTACKDEPTH>0 
L
lihui 已提交
1327 1328
  if( yypParser->yyidx>=YYSTACKDEPTH ){
    yyStackOverflow(yypParser, yypMinor);
H
hzcheng 已提交
1329 1330 1331
    return;
  }
#else
L
lihui 已提交
1332 1333 1334 1335
  if( yypParser->yyidx>=yypParser->yystksz ){
    yyGrowStack(yypParser);
    if( yypParser->yyidx>=yypParser->yystksz ){
      yyStackOverflow(yypParser, yypMinor);
H
hzcheng 已提交
1336 1337 1338 1339
      return;
    }
  }
#endif
L
lihui 已提交
1340
  yytos = &yypParser->yystack[yypParser->yyidx];
H
hzcheng 已提交
1341 1342
  yytos->stateno = (YYACTIONTYPE)yyNewState;
  yytos->major = (YYCODETYPE)yyMajor;
L
lihui 已提交
1343 1344
  yytos->minor = *yypMinor;
  yyTraceShift(yypParser, yyNewState);
H
hzcheng 已提交
1345 1346 1347 1348 1349 1350
}

/* The following table contains information about every rule that
** is used during the reduce.
*/
static const struct {
L
lihui 已提交
1351 1352
  YYCODETYPE lhs;         /* Symbol on the left-hand side of the rule */
  unsigned char nrhs;     /* Number of right-hand side symbols in the rule */
H
hzcheng 已提交
1353
} yyRuleInfo[] = {
L
lihui 已提交
1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 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 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569
  { 197, 1 },
  { 198, 2 },
  { 198, 2 },
  { 198, 2 },
  { 198, 2 },
  { 198, 2 },
  { 198, 2 },
  { 198, 2 },
  { 198, 2 },
  { 198, 2 },
  { 198, 2 },
  { 198, 2 },
  { 198, 2 },
  { 198, 2 },
  { 198, 3 },
  { 199, 0 },
  { 199, 2 },
  { 201, 0 },
  { 201, 2 },
  { 198, 3 },
  { 198, 5 },
  { 198, 3 },
  { 198, 5 },
  { 198, 3 },
  { 198, 5 },
  { 198, 4 },
  { 198, 3 },
  { 198, 3 },
  { 198, 3 },
  { 198, 2 },
  { 198, 3 },
  { 198, 5 },
  { 198, 5 },
  { 198, 4 },
  { 198, 5 },
  { 198, 3 },
  { 198, 4 },
  { 198, 4 },
  { 198, 4 },
  { 198, 6 },
  { 200, 1 },
  { 200, 1 },
  { 202, 2 },
  { 202, 0 },
  { 205, 3 },
  { 205, 0 },
  { 198, 3 },
  { 198, 6 },
  { 198, 5 },
  { 198, 5 },
  { 207, 0 },
  { 207, 2 },
  { 208, 0 },
  { 208, 2 },
  { 209, 0 },
  { 209, 2 },
  { 210, 0 },
  { 210, 2 },
  { 211, 0 },
  { 211, 2 },
  { 212, 0 },
  { 212, 2 },
  { 213, 0 },
  { 213, 2 },
  { 214, 0 },
  { 214, 2 },
  { 215, 0 },
  { 215, 2 },
  { 204, 9 },
  { 216, 2 },
  { 218, 2 },
  { 219, 2 },
  { 220, 2 },
  { 221, 2 },
  { 222, 2 },
  { 223, 2 },
  { 224, 2 },
  { 225, 2 },
  { 226, 2 },
  { 227, 2 },
  { 228, 2 },
  { 206, 0 },
  { 206, 2 },
  { 206, 2 },
  { 206, 2 },
  { 206, 2 },
  { 206, 2 },
  { 206, 2 },
  { 206, 2 },
  { 206, 2 },
  { 206, 2 },
  { 206, 2 },
  { 206, 2 },
  { 206, 2 },
  { 203, 0 },
  { 203, 2 },
  { 203, 2 },
  { 229, 1 },
  { 229, 4 },
  { 230, 1 },
  { 230, 2 },
  { 230, 2 },
  { 198, 6 },
  { 231, 3 },
  { 231, 7 },
  { 231, 7 },
  { 231, 2 },
  { 232, 3 },
  { 232, 1 },
  { 234, 2 },
  { 217, 3 },
  { 217, 1 },
  { 235, 1 },
  { 235, 1 },
  { 235, 1 },
  { 235, 1 },
  { 235, 1 },
  { 235, 2 },
  { 235, 2 },
  { 235, 2 },
  { 235, 2 },
  { 198, 1 },
  { 233, 12 },
  { 233, 2 },
  { 247, 2 },
  { 247, 0 },
  { 236, 3 },
  { 236, 2 },
  { 249, 2 },
  { 249, 1 },
  { 249, 0 },
  { 237, 2 },
  { 250, 2 },
  { 250, 4 },
  { 251, 1 },
  { 239, 4 },
  { 239, 0 },
  { 240, 0 },
  { 240, 6 },
  { 240, 4 },
  { 241, 4 },
  { 241, 0 },
  { 243, 0 },
  { 243, 3 },
  { 252, 4 },
  { 252, 2 },
  { 254, 2 },
  { 255, 1 },
  { 255, 1 },
  { 255, 0 },
  { 242, 0 },
  { 242, 3 },
  { 256, 3 },
  { 256, 1 },
  { 244, 0 },
  { 244, 2 },
  { 246, 0 },
  { 246, 2 },
  { 246, 4 },
  { 246, 4 },
  { 245, 0 },
  { 245, 2 },
  { 245, 4 },
  { 245, 4 },
  { 238, 0 },
  { 238, 2 },
  { 248, 3 },
  { 248, 1 },
  { 248, 3 },
  { 248, 3 },
  { 248, 1 },
  { 248, 2 },
  { 248, 2 },
  { 248, 1 },
  { 248, 2 },
  { 248, 2 },
  { 248, 1 },
  { 248, 1 },
  { 248, 1 },
  { 248, 1 },
  { 248, 4 },
  { 248, 4 },
  { 248, 3 },
  { 248, 3 },
  { 248, 3 },
  { 248, 3 },
  { 248, 3 },
  { 248, 3 },
  { 248, 3 },
  { 248, 3 },
  { 248, 3 },
  { 248, 3 },
  { 248, 3 },
  { 248, 3 },
  { 248, 3 },
  { 248, 3 },
  { 248, 5 },
  { 257, 3 },
  { 257, 1 },
  { 258, 1 },
  { 258, 0 },
  { 198, 4 },
  { 259, 4 },
  { 259, 5 },
  { 260, 3 },
  { 260, 1 },
  { 198, 3 },
  { 198, 7 },
  { 198, 7 },
  { 198, 7 },
  { 198, 7 },
  { 198, 8 },
  { 198, 9 },
  { 198, 5 },
  { 198, 7 },
  { 198, 7 },
H
hzcheng 已提交
1570 1571 1572 1573 1574 1575 1576 1577 1578 1579
};

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

/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
*/
static void yy_reduce(
  yyParser *yypParser,         /* The parser */
L
lihui 已提交
1580
  int yyruleno                 /* Number of the rule by which to reduce */
H
hzcheng 已提交
1581 1582 1583
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
L
lihui 已提交
1584
  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
H
hzcheng 已提交
1585 1586 1587
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  ParseARG_FETCH;
L
lihui 已提交
1588
  yymsp = &yypParser->yystack[yypParser->yyidx];
H
hzcheng 已提交
1589
#ifndef NDEBUG
L
lihui 已提交
1590 1591
  if( yyTraceFILE && yyruleno>=0 
        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
H
hzcheng 已提交
1592
    yysize = yyRuleInfo[yyruleno].nrhs;
L
lihui 已提交
1593 1594
    fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt,
      yyRuleName[yyruleno], yymsp[-yysize].stateno);
H
hzcheng 已提交
1595 1596
  }
#endif /* NDEBUG */
L
lihui 已提交
1597
  yygotominor = yyzerominor;
H
hzcheng 已提交
1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620

  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 **********************************************/
      case 0: /* program ::= cmd */
{}
        break;
      case 1: /* cmd ::= SHOW DATABASES */
{ setDCLSQLElems(pInfo, SHOW_DATABASES, 0);}
        break;
      case 2: /* cmd ::= SHOW MNODES */
{ setDCLSQLElems(pInfo, SHOW_MNODES, 0);}
        break;
      case 3: /* cmd ::= SHOW DNODES */
{ setDCLSQLElems(pInfo, SHOW_DNODES, 0);}
        break;
S
slguan 已提交
1621 1622 1623 1624
      case 4: /* cmd ::= SHOW ACCOUNTS */
{ setDCLSQLElems(pInfo, SHOW_ACCOUNTS, 0);}
        break;
      case 5: /* cmd ::= SHOW USERS */
H
hzcheng 已提交
1625 1626
{ setDCLSQLElems(pInfo, SHOW_USERS, 0);}
        break;
S
slguan 已提交
1627
      case 6: /* cmd ::= SHOW MODULES */
H
hzcheng 已提交
1628 1629
{ setDCLSQLElems(pInfo, SHOW_MODULES, 0);  }
        break;
S
slguan 已提交
1630
      case 7: /* cmd ::= SHOW QUERIES */
H
hzcheng 已提交
1631 1632
{ setDCLSQLElems(pInfo, SHOW_QUERIES, 0);  }
        break;
S
slguan 已提交
1633
      case 8: /* cmd ::= SHOW CONNECTIONS */
H
hzcheng 已提交
1634 1635
{ setDCLSQLElems(pInfo, SHOW_CONNECTIONS, 0);}
        break;
S
slguan 已提交
1636
      case 9: /* cmd ::= SHOW STREAMS */
H
hzcheng 已提交
1637 1638
{ setDCLSQLElems(pInfo, SHOW_STREAMS, 0);  }
        break;
S
slguan 已提交
1639
      case 10: /* cmd ::= SHOW CONFIGS */
H
hzcheng 已提交
1640 1641
{ setDCLSQLElems(pInfo, SHOW_CONFIGS, 0);  }
        break;
S
slguan 已提交
1642
      case 11: /* cmd ::= SHOW SCORES */
H
hzcheng 已提交
1643 1644
{ setDCLSQLElems(pInfo, SHOW_SCORES, 0);   }
        break;
S
slguan 已提交
1645
      case 12: /* cmd ::= SHOW GRANTS */
H
hzcheng 已提交
1646 1647
{ setDCLSQLElems(pInfo, SHOW_GRANTS, 0);   }
        break;
L
lihui 已提交
1648 1649 1650 1651 1652
      case 13: /* cmd ::= SHOW VNODES */
{ setDCLSQLElems(pInfo, SHOW_VNODES, 0); }
        break;
      case 14: /* cmd ::= SHOW VNODES IPTOKEN */
{ setDCLSQLElems(pInfo, SHOW_VNODES, 1, &yymsp[0].minor.yy0); }
H
hzcheng 已提交
1653
        break;
L
lihui 已提交
1654 1655 1656 1657
      case 15: /* dbPrefix ::= */
      case 43: /* ifexists ::= */ yytestcase(yyruleno==43);
      case 45: /* ifnotexists ::= */ yytestcase(yyruleno==45);
{yygotominor.yy0.n = 0;}
H
hzcheng 已提交
1658
        break;
L
lihui 已提交
1659 1660
      case 16: /* dbPrefix ::= ids DOT */
{yygotominor.yy0 = yymsp[-1].minor.yy0;  }
H
hzcheng 已提交
1661
        break;
L
lihui 已提交
1662 1663
      case 17: /* cpxName ::= */
{yygotominor.yy0.n = 0;  }
H
hzcheng 已提交
1664
        break;
L
lihui 已提交
1665 1666 1667 1668
      case 18: /* cpxName ::= DOT ids */
{yygotominor.yy0 = yymsp[0].minor.yy0; yygotominor.yy0.n += 1;    }
        break;
      case 19: /* cmd ::= SHOW dbPrefix TABLES */
H
hzcheng 已提交
1669 1670 1671 1672
{
    setDCLSQLElems(pInfo, SHOW_TABLES, 1, &yymsp[-1].minor.yy0);
}
        break;
L
lihui 已提交
1673
      case 20: /* cmd ::= SHOW dbPrefix TABLES LIKE ids */
H
hzcheng 已提交
1674 1675 1676 1677
{
    setDCLSQLElems(pInfo, SHOW_TABLES, 2, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
}
        break;
L
lihui 已提交
1678
      case 21: /* cmd ::= SHOW dbPrefix STABLES */
H
hzcheng 已提交
1679 1680 1681 1682
{
    setDCLSQLElems(pInfo, SHOW_STABLES, 1, &yymsp[-1].minor.yy0);
}
        break;
L
lihui 已提交
1683
      case 22: /* cmd ::= SHOW dbPrefix STABLES LIKE ids */
H
hzcheng 已提交
1684 1685 1686 1687 1688 1689
{
    SSQLToken token;
    setDBName(&token, &yymsp[-3].minor.yy0);
    setDCLSQLElems(pInfo, SHOW_STABLES, 2, &token, &yymsp[0].minor.yy0);
}
        break;
L
lihui 已提交
1690
      case 23: /* cmd ::= SHOW dbPrefix VGROUPS */
H
hzcheng 已提交
1691 1692 1693 1694 1695 1696
{
    SSQLToken token;
    setDBName(&token, &yymsp[-1].minor.yy0);
    setDCLSQLElems(pInfo, SHOW_VGROUPS, 1, &token);
}
        break;
L
lihui 已提交
1697
      case 24: /* cmd ::= DROP TABLE ifexists ids cpxName */
H
hzcheng 已提交
1698 1699 1700 1701 1702
{
    yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
    setDCLSQLElems(pInfo, DROP_TABLE, 2, &yymsp[-1].minor.yy0, &yymsp[-2].minor.yy0);
}
        break;
L
lihui 已提交
1703
      case 25: /* cmd ::= DROP DATABASE ifexists ids */
H
hzcheng 已提交
1704 1705
{ setDCLSQLElems(pInfo, DROP_DATABASE, 2, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0); }
        break;
L
lihui 已提交
1706
      case 26: /* cmd ::= DROP DNODE IPTOKEN */
S
slguan 已提交
1707 1708
{ setDCLSQLElems(pInfo, DROP_DNODE, 1, &yymsp[0].minor.yy0);    }
        break;
L
lihui 已提交
1709
      case 27: /* cmd ::= DROP USER ids */
H
hzcheng 已提交
1710 1711
{ setDCLSQLElems(pInfo, DROP_USER, 1, &yymsp[0].minor.yy0);     }
        break;
L
lihui 已提交
1712
      case 28: /* cmd ::= DROP ACCOUNT ids */
S
slguan 已提交
1713 1714
{ setDCLSQLElems(pInfo, DROP_ACCOUNT, 1, &yymsp[0].minor.yy0);  }
        break;
L
lihui 已提交
1715
      case 29: /* cmd ::= USE ids */
H
hzcheng 已提交
1716 1717
{ setDCLSQLElems(pInfo, USE_DATABASE, 1, &yymsp[0].minor.yy0);}
        break;
L
lihui 已提交
1718
      case 30: /* cmd ::= DESCRIBE ids cpxName */
H
hzcheng 已提交
1719 1720 1721 1722 1723
{
    yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
    setDCLSQLElems(pInfo, DESCRIBE_TABLE, 1, &yymsp[-1].minor.yy0);
}
        break;
L
lihui 已提交
1724
      case 31: /* cmd ::= ALTER USER ids PASS ids */
H
hzcheng 已提交
1725 1726
{ setDCLSQLElems(pInfo, ALTER_USER_PASSWD, 2, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);    }
        break;
L
lihui 已提交
1727
      case 32: /* cmd ::= ALTER USER ids PRIVILEGE ids */
H
hzcheng 已提交
1728 1729
{ setDCLSQLElems(pInfo, ALTER_USER_PRIVILEGES, 2, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
        break;
L
lihui 已提交
1730
      case 33: /* cmd ::= ALTER DNODE IPTOKEN ids */
H
hzcheng 已提交
1731 1732
{ setDCLSQLElems(pInfo, ALTER_DNODE, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);          }
        break;
L
lihui 已提交
1733
      case 34: /* cmd ::= ALTER DNODE IPTOKEN ids ids */
H
hzcheng 已提交
1734 1735
{ setDCLSQLElems(pInfo, ALTER_DNODE, 3, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);      }
        break;
L
lihui 已提交
1736
      case 35: /* cmd ::= ALTER LOCAL ids */
H
hzcheng 已提交
1737 1738
{ setDCLSQLElems(pInfo, ALTER_LOCAL, 1, &yymsp[0].minor.yy0);              }
        break;
L
lihui 已提交
1739
      case 36: /* cmd ::= ALTER LOCAL ids ids */
S
slguan 已提交
1740 1741
{ setDCLSQLElems(pInfo, ALTER_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);          }
        break;
L
lihui 已提交
1742 1743
      case 37: /* cmd ::= ALTER DATABASE ids alter_db_optr */
{ SSQLToken t = {0};  setCreateDBSQL(pInfo, ALTER_DATABASE, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy262, &t);}
H
hzcheng 已提交
1744
        break;
L
lihui 已提交
1745 1746
      case 38: /* cmd ::= ALTER ACCOUNT ids acct_optr */
{ SSQLToken t = {0};  setCreateAcctSQL(pInfo, ALTER_ACCT, &yymsp[-1].minor.yy0, &t, &yymsp[0].minor.yy155);}
S
slguan 已提交
1747
        break;
L
lihui 已提交
1748 1749
      case 39: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
{ setCreateAcctSQL(pInfo, ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy155);}
H
hzcheng 已提交
1750
        break;
L
lihui 已提交
1751 1752 1753
      case 40: /* ids ::= ID */
      case 41: /* ids ::= STRING */ yytestcase(yyruleno==41);
{yygotominor.yy0 = yymsp[0].minor.yy0; }
H
hjxilinx 已提交
1754
        break;
L
lihui 已提交
1755 1756 1757
      case 42: /* ifexists ::= IF EXISTS */
      case 44: /* ifnotexists ::= IF NOT EXISTS */ yytestcase(yyruleno==44);
{yygotominor.yy0.n = 1;}
H
hzcheng 已提交
1758
        break;
L
lihui 已提交
1759
      case 46: /* cmd ::= CREATE DNODE IPTOKEN */
S
slguan 已提交
1760 1761
{ setDCLSQLElems(pInfo, CREATE_DNODE, 1, &yymsp[0].minor.yy0);}
        break;
L
lihui 已提交
1762 1763
      case 47: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
{ setCreateAcctSQL(pInfo, CREATE_ACCOUNT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy155);}
S
slguan 已提交
1764
        break;
L
lihui 已提交
1765 1766
      case 48: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */
{ setCreateDBSQL(pInfo, CREATE_DATABASE, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy262, &yymsp[-2].minor.yy0);}
H
hzcheng 已提交
1767
        break;
L
lihui 已提交
1768
      case 49: /* cmd ::= CREATE USER ids PASS ids */
H
hzcheng 已提交
1769 1770
{ setDCLSQLElems(pInfo, CREATE_USER, 2, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
        break;
L
lihui 已提交
1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793
      case 50: /* pps ::= */
      case 52: /* tseries ::= */ yytestcase(yyruleno==52);
      case 54: /* dbs ::= */ yytestcase(yyruleno==54);
      case 56: /* streams ::= */ yytestcase(yyruleno==56);
      case 58: /* storage ::= */ yytestcase(yyruleno==58);
      case 60: /* qtime ::= */ yytestcase(yyruleno==60);
      case 62: /* users ::= */ yytestcase(yyruleno==62);
      case 64: /* conns ::= */ yytestcase(yyruleno==64);
      case 66: /* state ::= */ yytestcase(yyruleno==66);
{yygotominor.yy0.n = 0;   }
        break;
      case 51: /* pps ::= PPS INTEGER */
      case 53: /* tseries ::= TSERIES INTEGER */ yytestcase(yyruleno==53);
      case 55: /* dbs ::= DBS INTEGER */ yytestcase(yyruleno==55);
      case 57: /* streams ::= STREAMS INTEGER */ yytestcase(yyruleno==57);
      case 59: /* storage ::= STORAGE INTEGER */ yytestcase(yyruleno==59);
      case 61: /* qtime ::= QTIME INTEGER */ yytestcase(yyruleno==61);
      case 63: /* users ::= USERS INTEGER */ yytestcase(yyruleno==63);
      case 65: /* conns ::= CONNS INTEGER */ yytestcase(yyruleno==65);
      case 67: /* state ::= STATE ids */ yytestcase(yyruleno==67);
{yygotominor.yy0 = yymsp[0].minor.yy0;     }
        break;
      case 68: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
S
slguan 已提交
1794
{
L
lihui 已提交
1795 1796 1797 1798 1799 1800 1801 1802 1803
    yygotominor.yy155.users   = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
    yygotominor.yy155.dbs     = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
    yygotominor.yy155.tseries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
    yygotominor.yy155.streams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
    yygotominor.yy155.pps     = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
    yygotominor.yy155.storage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
    yygotominor.yy155.qtime   = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
    yygotominor.yy155.conns   = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
    yygotominor.yy155.stat    = yymsp[0].minor.yy0;
S
slguan 已提交
1804
}
L
lihui 已提交
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
        break;
      case 69: /* keep ::= KEEP tagitemlist */
{ yygotominor.yy480 = yymsp[0].minor.yy480; }
        break;
      case 70: /* tables ::= TABLES INTEGER */
      case 71: /* cache ::= CACHE INTEGER */ yytestcase(yyruleno==71);
      case 72: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==72);
      case 73: /* days ::= DAYS INTEGER */ yytestcase(yyruleno==73);
      case 74: /* rows ::= ROWS INTEGER */ yytestcase(yyruleno==74);
      case 75: /* ablocks ::= ABLOCKS ID */ yytestcase(yyruleno==75);
      case 76: /* tblocks ::= TBLOCKS INTEGER */ yytestcase(yyruleno==76);
      case 77: /* ctime ::= CTIME INTEGER */ yytestcase(yyruleno==77);
      case 78: /* clog ::= CLOG INTEGER */ yytestcase(yyruleno==78);
      case 79: /* comp ::= COMP INTEGER */ yytestcase(yyruleno==79);
      case 80: /* prec ::= PRECISION STRING */ yytestcase(yyruleno==80);
{ yygotominor.yy0 = yymsp[0].minor.yy0; }
        break;
      case 81: /* db_optr ::= */
{setDefaultCreateDbOption(&yygotominor.yy262);}
        break;
      case 82: /* db_optr ::= db_optr tables */
      case 96: /* alter_db_optr ::= alter_db_optr tables */ yytestcase(yyruleno==96);
{ yygotominor.yy262 = yymsp[-1].minor.yy262; yygotominor.yy262.tablesPerVnode = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
        break;
      case 83: /* db_optr ::= db_optr cache */
{ yygotominor.yy262 = yymsp[-1].minor.yy262; yygotominor.yy262.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
        break;
      case 84: /* db_optr ::= db_optr replica */
      case 95: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==95);
{ yygotominor.yy262 = yymsp[-1].minor.yy262; yygotominor.yy262.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
        break;
      case 85: /* db_optr ::= db_optr days */
{ yygotominor.yy262 = yymsp[-1].minor.yy262; yygotominor.yy262.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
        break;
      case 86: /* db_optr ::= db_optr rows */
{ yygotominor.yy262 = yymsp[-1].minor.yy262; yygotominor.yy262.rowPerFileBlock = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
        break;
      case 87: /* db_optr ::= db_optr ablocks */
{ yygotominor.yy262 = yymsp[-1].minor.yy262; yygotominor.yy262.numOfAvgCacheBlocks = strtod(yymsp[0].minor.yy0.z, NULL); }
        break;
      case 88: /* db_optr ::= db_optr tblocks */
{ yygotominor.yy262 = yymsp[-1].minor.yy262; yygotominor.yy262.numOfBlocksPerTable = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
        break;
      case 89: /* db_optr ::= db_optr ctime */
{ yygotominor.yy262 = yymsp[-1].minor.yy262; yygotominor.yy262.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
        break;
      case 90: /* db_optr ::= db_optr clog */
{ yygotominor.yy262 = yymsp[-1].minor.yy262; yygotominor.yy262.commitLog = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
        break;
      case 91: /* db_optr ::= db_optr comp */
{ yygotominor.yy262 = yymsp[-1].minor.yy262; yygotominor.yy262.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
        break;
      case 92: /* db_optr ::= db_optr prec */
{ yygotominor.yy262 = yymsp[-1].minor.yy262; yygotominor.yy262.precision = yymsp[0].minor.yy0; }
        break;
      case 93: /* db_optr ::= db_optr keep */
{ yygotominor.yy262 = yymsp[-1].minor.yy262; yygotominor.yy262.keep = yymsp[0].minor.yy480; }
        break;
      case 94: /* alter_db_optr ::= */
{ setDefaultCreateDbOption(&yygotominor.yy262);}
        break;
      case 97: /* typename ::= ids */
{ tSQLSetColumnType (&yygotominor.yy397, &yymsp[0].minor.yy0); }
        break;
      case 98: /* typename ::= ids LP signed RP */
H
hzcheng 已提交
1870
{
L
lihui 已提交
1871 1872
    yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy369;          // negative value of name length
    tSQLSetColumnType(&yygotominor.yy397, &yymsp[-3].minor.yy0);
H
hzcheng 已提交
1873 1874
}
        break;
L
lihui 已提交
1875 1876 1877
      case 99: /* signed ::= INTEGER */
      case 100: /* signed ::= PLUS INTEGER */ yytestcase(yyruleno==100);
{ yygotominor.yy369 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
H
hjxilinx 已提交
1878
        break;
L
lihui 已提交
1879 1880
      case 101: /* signed ::= MINUS INTEGER */
{ yygotominor.yy369 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
H
hzcheng 已提交
1881
        break;
L
lihui 已提交
1882
      case 102: /* cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */
H
hzcheng 已提交
1883 1884 1885 1886 1887
{
    yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
    setCreatedMeterName(pInfo, &yymsp[-2].minor.yy0, &yymsp[-3].minor.yy0);
}
        break;
L
lihui 已提交
1888
      case 103: /* create_table_args ::= LP columnlist RP */
H
hzcheng 已提交
1889
{
L
lihui 已提交
1890 1891
    yygotominor.yy344 = tSetCreateSQLElems(yymsp[-1].minor.yy421, NULL, NULL, NULL, NULL, TSQL_CREATE_NORMAL_METER);
    setSQLInfo(pInfo, yygotominor.yy344, NULL, TSQL_CREATE_NORMAL_METER);
H
hzcheng 已提交
1892 1893
}
        break;
L
lihui 已提交
1894
      case 104: /* create_table_args ::= LP columnlist RP TAGS LP columnlist RP */
H
hzcheng 已提交
1895
{
L
lihui 已提交
1896 1897
    yygotominor.yy344 = tSetCreateSQLElems(yymsp[-5].minor.yy421, yymsp[-1].minor.yy421, NULL, NULL, NULL, TSQL_CREATE_NORMAL_METRIC);
    setSQLInfo(pInfo, yygotominor.yy344, NULL, TSQL_CREATE_NORMAL_METRIC);
H
hzcheng 已提交
1898 1899
}
        break;
L
lihui 已提交
1900
      case 105: /* create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */
H
hzcheng 已提交
1901 1902
{
    yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
L
lihui 已提交
1903 1904
    yygotominor.yy344 = tSetCreateSQLElems(NULL, NULL, &yymsp[-5].minor.yy0, yymsp[-1].minor.yy480, NULL, TSQL_CREATE_METER_FROM_METRIC);
    setSQLInfo(pInfo, yygotominor.yy344, NULL, TSQL_CREATE_METER_FROM_METRIC);
H
hzcheng 已提交
1905 1906
}
        break;
L
lihui 已提交
1907
      case 106: /* create_table_args ::= AS select */
H
hzcheng 已提交
1908
{
L
lihui 已提交
1909 1910
    yygotominor.yy344 = tSetCreateSQLElems(NULL, NULL, NULL, NULL, yymsp[0].minor.yy138, TSQL_CREATE_STREAM);
    setSQLInfo(pInfo, yygotominor.yy344, NULL, TSQL_CREATE_STREAM);
H
hzcheng 已提交
1911 1912
}
        break;
L
lihui 已提交
1913 1914
      case 107: /* columnlist ::= columnlist COMMA column */
{yygotominor.yy421 = tFieldListAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy397);   }
H
hzcheng 已提交
1915
        break;
L
lihui 已提交
1916 1917
      case 108: /* columnlist ::= column */
{yygotominor.yy421 = tFieldListAppend(NULL, &yymsp[0].minor.yy397);}
H
hzcheng 已提交
1918
        break;
L
lihui 已提交
1919
      case 109: /* column ::= ids typename */
H
hzcheng 已提交
1920
{
L
lihui 已提交
1921
    tSQLSetColumnInfo(&yygotominor.yy397, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy397);
H
hzcheng 已提交
1922
}
L
lihui 已提交
1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942
        break;
      case 110: /* tagitemlist ::= tagitemlist COMMA tagitem */
{ yygotominor.yy480 = tVariantListAppend(yymsp[-2].minor.yy480, &yymsp[0].minor.yy236, -1);    }
        break;
      case 111: /* tagitemlist ::= tagitem */
{ yygotominor.yy480 = tVariantListAppend(NULL, &yymsp[0].minor.yy236, -1); }
        break;
      case 112: /* tagitem ::= INTEGER */
      case 113: /* tagitem ::= FLOAT */ yytestcase(yyruleno==113);
      case 114: /* tagitem ::= STRING */ yytestcase(yyruleno==114);
      case 115: /* tagitem ::= BOOL */ yytestcase(yyruleno==115);
{toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yygotominor.yy236, &yymsp[0].minor.yy0); }
        break;
      case 116: /* tagitem ::= NULL */
{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yygotominor.yy236, &yymsp[0].minor.yy0); }
        break;
      case 117: /* tagitem ::= MINUS INTEGER */
      case 118: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==118);
      case 119: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==119);
      case 120: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==120);
H
hzcheng 已提交
1943 1944 1945 1946
{
    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);
L
lihui 已提交
1947
    tVariantCreate(&yygotominor.yy236, &yymsp[-1].minor.yy0);
H
hzcheng 已提交
1948 1949
}
        break;
L
lihui 已提交
1950
      case 121: /* cmd ::= select */
H
hzcheng 已提交
1951
{
L
lihui 已提交
1952
    setSQLInfo(pInfo, yymsp[0].minor.yy138, NULL, TSQL_QUERY_METER);
H
hzcheng 已提交
1953 1954
}
        break;
L
lihui 已提交
1955
      case 122: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
H
hzcheng 已提交
1956
{
L
lihui 已提交
1957
  yygotominor.yy138 = tSetQuerySQLElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy284, yymsp[-9].minor.yy480, yymsp[-8].minor.yy244, yymsp[-4].minor.yy480, yymsp[-3].minor.yy480, &yymsp[-7].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy480, &yymsp[0].minor.yy162, &yymsp[-1].minor.yy162);
H
hzcheng 已提交
1958 1959
}
        break;
L
lihui 已提交
1960
      case 123: /* select ::= SELECT selcollist */
H
hjxilinx 已提交
1961
{
L
lihui 已提交
1962
  yygotominor.yy138 = tSetQuerySQLElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy284, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
H
hjxilinx 已提交
1963 1964
}
        break;
L
lihui 已提交
1965 1966
      case 124: /* sclp ::= selcollist COMMA */
{yygotominor.yy284 = yymsp[-1].minor.yy284;}
H
hzcheng 已提交
1967
        break;
L
lihui 已提交
1968 1969
      case 125: /* sclp ::= */
{yygotominor.yy284 = 0;}
H
hzcheng 已提交
1970
        break;
L
lihui 已提交
1971
      case 126: /* selcollist ::= sclp expr as */
H
hzcheng 已提交
1972
{
L
lihui 已提交
1973
   yygotominor.yy284 = tSQLExprListAppend(yymsp[-2].minor.yy284, yymsp[-1].minor.yy244, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
H
hzcheng 已提交
1974 1975
}
        break;
L
lihui 已提交
1976
      case 127: /* selcollist ::= sclp STAR */
H
hzcheng 已提交
1977 1978
{
   tSQLExpr *pNode = tSQLExprIdValueCreate(NULL, TK_ALL);
L
lihui 已提交
1979
   yygotominor.yy284 = tSQLExprListAppend(yymsp[-1].minor.yy284, pNode, 0);
H
hzcheng 已提交
1980
}
H
hjxilinx 已提交
1981
        break;
L
lihui 已提交
1982 1983 1984
      case 128: /* as ::= AS ids */
      case 129: /* as ::= ids */ yytestcase(yyruleno==129);
{ yygotominor.yy0 = yymsp[0].minor.yy0;    }
H
hzcheng 已提交
1985
        break;
L
lihui 已提交
1986 1987
      case 130: /* as ::= */
{ yygotominor.yy0.n = 0;  }
H
hzcheng 已提交
1988
        break;
L
lihui 已提交
1989 1990 1991 1992
      case 131: /* from ::= FROM tablelist */
      case 143: /* orderby_opt ::= ORDER BY sortlist */ yytestcase(yyruleno==143);
      case 151: /* groupby_opt ::= GROUP BY grouplist */ yytestcase(yyruleno==151);
{yygotominor.yy480 = yymsp[0].minor.yy480;}
H
hzcheng 已提交
1993
        break;
L
lihui 已提交
1994 1995
      case 132: /* tablelist ::= ids cpxName */
{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yygotominor.yy480 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);}
S
slguan 已提交
1996
        break;
L
lihui 已提交
1997 1998
      case 133: /* tablelist ::= tablelist COMMA ids cpxName */
{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yygotominor.yy480 = tVariantListAppendToken(yymsp[-3].minor.yy480, &yymsp[-1].minor.yy0, -1);   }
S
slguan 已提交
1999
        break;
L
lihui 已提交
2000 2001
      case 134: /* tmvar ::= VARIABLE */
{yygotominor.yy0 = yymsp[0].minor.yy0;}
H
hzcheng 已提交
2002
        break;
L
lihui 已提交
2003 2004 2005
      case 135: /* interval_opt ::= INTERVAL LP tmvar RP */
      case 140: /* sliding_opt ::= SLIDING LP tmvar RP */ yytestcase(yyruleno==140);
{yygotominor.yy0 = yymsp[-1].minor.yy0;     }
H
hzcheng 已提交
2006
        break;
L
lihui 已提交
2007 2008 2009
      case 136: /* interval_opt ::= */
      case 141: /* sliding_opt ::= */ yytestcase(yyruleno==141);
{yygotominor.yy0.n = 0; yygotominor.yy0.z = NULL; yygotominor.yy0.type = 0;   }
H
hjxilinx 已提交
2010
        break;
L
lihui 已提交
2011 2012
      case 137: /* fill_opt ::= */
{yygotominor.yy480 = 0;     }
2013
        break;
L
lihui 已提交
2014
      case 138: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
H
hzcheng 已提交
2015 2016 2017 2018 2019
{
    tVariant A = {0};
    toTSDBType(yymsp[-3].minor.yy0.type);
    tVariantCreate(&A, &yymsp[-3].minor.yy0);

L
lihui 已提交
2020 2021
    tVariantListInsert(yymsp[-1].minor.yy480, &A, -1, 0);
    yygotominor.yy480 = yymsp[-1].minor.yy480;
H
hzcheng 已提交
2022 2023
}
        break;
L
lihui 已提交
2024
      case 139: /* fill_opt ::= FILL LP ID RP */
H
hzcheng 已提交
2025 2026
{
    toTSDBType(yymsp[-1].minor.yy0.type);
L
lihui 已提交
2027
    yygotominor.yy480 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
H
hzcheng 已提交
2028 2029
}
        break;
L
lihui 已提交
2030 2031 2032
      case 142: /* orderby_opt ::= */
      case 150: /* groupby_opt ::= */ yytestcase(yyruleno==150);
{yygotominor.yy480 = 0;}
H
hjxilinx 已提交
2033
        break;
L
lihui 已提交
2034
      case 144: /* sortlist ::= sortlist COMMA item sortorder */
H
hzcheng 已提交
2035
{
L
lihui 已提交
2036
    yygotominor.yy480 = tVariantListAppend(yymsp[-3].minor.yy480, &yymsp[-1].minor.yy236, yymsp[0].minor.yy220);
H
hzcheng 已提交
2037 2038
}
        break;
L
lihui 已提交
2039
      case 145: /* sortlist ::= item sortorder */
H
hzcheng 已提交
2040
{
L
lihui 已提交
2041
  yygotominor.yy480 = tVariantListAppend(NULL, &yymsp[-1].minor.yy236, yymsp[0].minor.yy220);
H
hzcheng 已提交
2042 2043
}
        break;
L
lihui 已提交
2044
      case 146: /* item ::= ids cpxName */
H
hzcheng 已提交
2045
{
2046 2047 2048
  toTSDBType(yymsp[-1].minor.yy0.type);
  yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;

L
lihui 已提交
2049
  tVariantCreate(&yygotominor.yy236, &yymsp[-1].minor.yy0);
H
hzcheng 已提交
2050 2051
}
        break;
L
lihui 已提交
2052 2053
      case 147: /* sortorder ::= ASC */
{yygotominor.yy220 = TSQL_SO_ASC; }
H
hzcheng 已提交
2054
        break;
L
lihui 已提交
2055 2056
      case 148: /* sortorder ::= DESC */
{yygotominor.yy220 = TSQL_SO_DESC;}
H
hzcheng 已提交
2057
        break;
L
lihui 已提交
2058 2059
      case 149: /* sortorder ::= */
{yygotominor.yy220 = TSQL_SO_ASC;}
H
hzcheng 已提交
2060
        break;
L
lihui 已提交
2061
      case 152: /* grouplist ::= grouplist COMMA item */
H
hzcheng 已提交
2062
{
L
lihui 已提交
2063
  yygotominor.yy480 = tVariantListAppend(yymsp[-2].minor.yy480, &yymsp[0].minor.yy236, -1);
H
hzcheng 已提交
2064 2065
}
        break;
L
lihui 已提交
2066
      case 153: /* grouplist ::= item */
H
hzcheng 已提交
2067
{
L
lihui 已提交
2068
  yygotominor.yy480 = tVariantListAppend(NULL, &yymsp[0].minor.yy236, -1);
H
hzcheng 已提交
2069 2070
}
        break;
L
lihui 已提交
2071 2072 2073 2074
      case 154: /* having_opt ::= */
      case 164: /* where_opt ::= */ yytestcase(yyruleno==164);
      case 200: /* expritem ::= */ yytestcase(yyruleno==200);
{yygotominor.yy244 = 0;}
H
hzcheng 已提交
2075
        break;
L
lihui 已提交
2076 2077 2078 2079
      case 155: /* having_opt ::= HAVING expr */
      case 165: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==165);
      case 199: /* expritem ::= expr */ yytestcase(yyruleno==199);
{yygotominor.yy244 = yymsp[0].minor.yy244;}
H
hzcheng 已提交
2080
        break;
L
lihui 已提交
2081 2082 2083
      case 156: /* limit_opt ::= */
      case 160: /* slimit_opt ::= */ yytestcase(yyruleno==160);
{yygotominor.yy162.limit = -1; yygotominor.yy162.offset = 0;}
H
hzcheng 已提交
2084
        break;
L
lihui 已提交
2085 2086 2087
      case 157: /* limit_opt ::= LIMIT signed */
      case 161: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==161);
{yygotominor.yy162.limit = yymsp[0].minor.yy369;  yygotominor.yy162.offset = 0;}
H
hzcheng 已提交
2088
        break;
L
lihui 已提交
2089 2090 2091
      case 158: /* limit_opt ::= LIMIT signed OFFSET signed */
      case 162: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ yytestcase(yyruleno==162);
{yygotominor.yy162.limit = yymsp[-2].minor.yy369;  yygotominor.yy162.offset = yymsp[0].minor.yy369;}
H
hzcheng 已提交
2092
        break;
L
lihui 已提交
2093 2094 2095
      case 159: /* limit_opt ::= LIMIT signed COMMA signed */
      case 163: /* slimit_opt ::= SLIMIT signed COMMA signed */ yytestcase(yyruleno==163);
{yygotominor.yy162.limit = yymsp[0].minor.yy369;  yygotominor.yy162.offset = yymsp[-2].minor.yy369;}
S
slguan 已提交
2096
        break;
L
lihui 已提交
2097 2098
      case 166: /* expr ::= LP expr RP */
{yygotominor.yy244 = yymsp[-1].minor.yy244; }
H
hzcheng 已提交
2099
        break;
L
lihui 已提交
2100 2101
      case 167: /* expr ::= ID */
{yygotominor.yy244 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);}
H
hzcheng 已提交
2102
        break;
L
lihui 已提交
2103 2104
      case 168: /* expr ::= ID DOT ID */
{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yygotominor.yy244 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);}
H
hzcheng 已提交
2105
        break;
L
lihui 已提交
2106 2107
      case 169: /* expr ::= ID DOT STAR */
{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yygotominor.yy244 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);}
2108
        break;
L
lihui 已提交
2109 2110
      case 170: /* expr ::= INTEGER */
{yygotominor.yy244 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);}
H
hzcheng 已提交
2111
        break;
L
lihui 已提交
2112 2113 2114
      case 171: /* expr ::= MINUS INTEGER */
      case 172: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==172);
{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yygotominor.yy244 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);}
H
hzcheng 已提交
2115
        break;
L
lihui 已提交
2116 2117
      case 173: /* expr ::= FLOAT */
{yygotominor.yy244 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);}
H
hzcheng 已提交
2118
        break;
L
lihui 已提交
2119 2120 2121
      case 174: /* expr ::= MINUS FLOAT */
      case 175: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==175);
{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yygotominor.yy244 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);}
H
hzcheng 已提交
2122
        break;
L
lihui 已提交
2123 2124
      case 176: /* expr ::= STRING */
{yygotominor.yy244 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);}
H
hzcheng 已提交
2125
        break;
L
lihui 已提交
2126 2127
      case 177: /* expr ::= NOW */
{yygotominor.yy244 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); }
H
hzcheng 已提交
2128
        break;
L
lihui 已提交
2129 2130
      case 178: /* expr ::= VARIABLE */
{yygotominor.yy244 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);}
H
hzcheng 已提交
2131
        break;
L
lihui 已提交
2132 2133
      case 179: /* expr ::= BOOL */
{yygotominor.yy244 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);}
H
hzcheng 已提交
2134
        break;
L
lihui 已提交
2135
      case 180: /* expr ::= ID LP exprlist RP */
H
hzcheng 已提交
2136
{
L
lihui 已提交
2137
  yygotominor.yy244 = tSQLExprCreateFunction(yymsp[-1].minor.yy284, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type);
H
hzcheng 已提交
2138 2139
}
        break;
L
lihui 已提交
2140
      case 181: /* expr ::= ID LP STAR RP */
H
hzcheng 已提交
2141
{
L
lihui 已提交
2142
  yygotominor.yy244 = tSQLExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type);
H
hzcheng 已提交
2143 2144
}
        break;
L
lihui 已提交
2145 2146
      case 182: /* expr ::= expr AND expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_AND);}
H
hzcheng 已提交
2147
        break;
L
lihui 已提交
2148 2149
      case 183: /* expr ::= expr OR expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_OR); }
H
hzcheng 已提交
2150
        break;
L
lihui 已提交
2151 2152
      case 184: /* expr ::= expr LT expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_LT);}
H
hzcheng 已提交
2153
        break;
L
lihui 已提交
2154 2155
      case 185: /* expr ::= expr GT expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_GT);}
H
hzcheng 已提交
2156
        break;
L
lihui 已提交
2157 2158
      case 186: /* expr ::= expr LE expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_LE);}
H
hzcheng 已提交
2159
        break;
L
lihui 已提交
2160 2161
      case 187: /* expr ::= expr GE expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_GE);}
H
hzcheng 已提交
2162
        break;
L
lihui 已提交
2163 2164
      case 188: /* expr ::= expr NE expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_NE);}
H
hzcheng 已提交
2165
        break;
L
lihui 已提交
2166 2167
      case 189: /* expr ::= expr EQ expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_EQ);}
H
hzcheng 已提交
2168
        break;
L
lihui 已提交
2169 2170
      case 190: /* expr ::= expr PLUS expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_PLUS);  }
H
hzcheng 已提交
2171
        break;
L
lihui 已提交
2172 2173
      case 191: /* expr ::= expr MINUS expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_MINUS); }
H
hzcheng 已提交
2174
        break;
L
lihui 已提交
2175 2176
      case 192: /* expr ::= expr STAR expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_STAR);  }
H
hzcheng 已提交
2177
        break;
L
lihui 已提交
2178 2179
      case 193: /* expr ::= expr SLASH expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_DIVIDE);}
H
hzcheng 已提交
2180
        break;
L
lihui 已提交
2181 2182
      case 194: /* expr ::= expr REM expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_REM);   }
H
hzcheng 已提交
2183
        break;
L
lihui 已提交
2184 2185
      case 195: /* expr ::= expr LIKE expr */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-2].minor.yy244, yymsp[0].minor.yy244, TK_LIKE);  }
H
hzcheng 已提交
2186
        break;
L
lihui 已提交
2187 2188
      case 196: /* expr ::= expr IN LP exprlist RP */
{yygotominor.yy244 = tSQLExprCreate(yymsp[-4].minor.yy244, (tSQLExpr*)yymsp[-1].minor.yy284, TK_IN); }
H
hzcheng 已提交
2189
        break;
L
lihui 已提交
2190 2191 2192
      case 197: /* exprlist ::= exprlist COMMA expritem */
      case 204: /* itemlist ::= itemlist COMMA expr */ yytestcase(yyruleno==204);
{yygotominor.yy284 = tSQLExprListAppend(yymsp[-2].minor.yy284,yymsp[0].minor.yy244,0);}
H
hjxilinx 已提交
2193
        break;
L
lihui 已提交
2194 2195 2196
      case 198: /* exprlist ::= expritem */
      case 205: /* itemlist ::= expr */ yytestcase(yyruleno==205);
{yygotominor.yy284 = tSQLExprListAppend(0,yymsp[0].minor.yy244,0);}
H
hzcheng 已提交
2197
        break;
L
lihui 已提交
2198
      case 201: /* cmd ::= INSERT INTO cpxName insert_value_list */
H
hzcheng 已提交
2199
{
L
lihui 已提交
2200
    tSetInsertSQLElems(pInfo, &yymsp[-1].minor.yy0, yymsp[0].minor.yy237);
H
hzcheng 已提交
2201 2202
}
        break;
L
lihui 已提交
2203 2204
      case 202: /* insert_value_list ::= VALUES LP itemlist RP */
{yygotominor.yy237 = tSQLListListAppend(NULL, yymsp[-1].minor.yy284);}
H
hzcheng 已提交
2205
        break;
L
lihui 已提交
2206 2207
      case 203: /* insert_value_list ::= insert_value_list VALUES LP itemlist RP */
{yygotominor.yy237 = tSQLListListAppend(yymsp[-4].minor.yy237, yymsp[-1].minor.yy284);}
H
hzcheng 已提交
2208
        break;
L
lihui 已提交
2209
      case 206: /* cmd ::= RESET QUERY CACHE */
H
hzcheng 已提交
2210 2211
{ setDCLSQLElems(pInfo, RESET_QUERY_CACHE, 0);}
        break;
L
lihui 已提交
2212
      case 207: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
H
hzcheng 已提交
2213 2214
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
L
lihui 已提交
2215
    SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, ALTER_TABLE_ADD_COLUMN);
H
hzcheng 已提交
2216 2217 2218
    setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_ADD_COLUMN);
}
        break;
L
lihui 已提交
2219
      case 208: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
H
hzcheng 已提交
2220 2221 2222 2223
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;

    toTSDBType(yymsp[0].minor.yy0.type);
2224
    tVariantList* K = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1);
H
hzcheng 已提交
2225 2226 2227 2228 2229

    SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, NULL, K, ALTER_TABLE_DROP_COLUMN);
    setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_DROP_COLUMN);
}
        break;
L
lihui 已提交
2230
      case 209: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
H
hzcheng 已提交
2231 2232
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
L
lihui 已提交
2233
    SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, ALTER_TABLE_TAGS_ADD);
H
hzcheng 已提交
2234 2235 2236
    setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_TAGS_ADD);
}
        break;
L
lihui 已提交
2237
      case 210: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
H
hzcheng 已提交
2238 2239 2240 2241
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;

    toTSDBType(yymsp[0].minor.yy0.type);
2242
    tVariantList* A = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1);
H
hzcheng 已提交
2243 2244 2245 2246 2247

    SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, NULL, A, ALTER_TABLE_TAGS_DROP);
    setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_TAGS_DROP);
}
        break;
L
lihui 已提交
2248
      case 211: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
H
hzcheng 已提交
2249 2250 2251 2252
{
    yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;

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

    toTSDBType(yymsp[0].minor.yy0.type);
2256
    A = tVariantListAppendToken(A, &yymsp[0].minor.yy0, -1);
H
hzcheng 已提交
2257 2258 2259 2260 2261

    SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-5].minor.yy0, NULL, A, ALTER_TABLE_TAGS_CHG);
    setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_TAGS_CHG);
}
        break;
L
lihui 已提交
2262
      case 212: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
H
hzcheng 已提交
2263
{
2264
    yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;
H
hzcheng 已提交
2265 2266

    toTSDBType(yymsp[-2].minor.yy0.type);
2267
    tVariantList* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
L
lihui 已提交
2268
    A = tVariantListAppend(A, &yymsp[0].minor.yy236, -1);
H
hzcheng 已提交
2269

2270
    SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-6].minor.yy0, NULL, A, ALTER_TABLE_TAGS_SET);
H
hzcheng 已提交
2271 2272 2273
    setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_TAGS_SET);
}
        break;
L
lihui 已提交
2274
      case 213: /* cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER */
H
hzcheng 已提交
2275 2276
{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setDCLSQLElems(pInfo, KILL_CONNECTION, 1, &yymsp[-2].minor.yy0);}
        break;
L
lihui 已提交
2277
      case 214: /* cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER */
H
hzcheng 已提交
2278 2279
{yymsp[-4].minor.yy0.n += (yymsp[-3].minor.yy0.n + yymsp[-2].minor.yy0.n + yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setDCLSQLElems(pInfo, KILL_STREAM, 1, &yymsp[-4].minor.yy0);}
        break;
L
lihui 已提交
2280
      case 215: /* cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER */
H
hzcheng 已提交
2281 2282 2283 2284 2285 2286
{yymsp[-4].minor.yy0.n += (yymsp[-3].minor.yy0.n + yymsp[-2].minor.yy0.n + yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setDCLSQLElems(pInfo, KILL_QUERY, 1, &yymsp[-4].minor.yy0);}
        break;
      default:
        break;
/********** End reduce actions ************************************************/
  };
L
lihui 已提交
2287
  assert( yyruleno>=0 && yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
H
hzcheng 已提交
2288 2289
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
L
lihui 已提交
2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
  if( yyact <= YY_MAX_SHIFTREDUCE ){
    if( yyact>YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
    /* If the reduce action popped at least
    ** one element off the stack, then we can push the new element back
    ** onto the stack here, and skip the stack overflow test in yy_shift().
    ** That gives a significant speed improvement. */
    if( yysize ){
      yypParser->yyidx++;
      yymsp -= yysize-1;
      yymsp->stateno = (YYACTIONTYPE)yyact;
      yymsp->major = (YYCODETYPE)yygoto;
      yymsp->minor = yygotominor;
      yyTraceShift(yypParser, yyact);
    }else{
      yy_shift(yypParser,yyact,yygoto,&yygotominor);
    }
  }else{
    assert( yyact == YY_ACCEPT_ACTION );
    yy_accept(yypParser);
  }
H
hzcheng 已提交
2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326
}

/*
** 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
L
lihui 已提交
2327
  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
H
hzcheng 已提交
2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341
  /* 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 */
L
lihui 已提交
2342
  YYMINORTYPE yyminor            /* The minor type of the error token */
H
hzcheng 已提交
2343 2344
){
  ParseARG_FETCH;
L
lihui 已提交
2345
#define TOKEN (yyminor.yy0)
H
hzcheng 已提交
2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384
/************ Begin %syntax_error code ****************************************/

  pInfo->validSql = false;
  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
L
lihui 已提交
2385
  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
H
hzcheng 已提交
2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419
  /* 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;
L
lihui 已提交
2420
  int yyact;            /* The parser action. */
H
hzcheng 已提交
2421 2422 2423 2424 2425 2426 2427 2428
#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 */

L
lihui 已提交
2429
  /* (re)initialize the parser, if necessary */
H
hzcheng 已提交
2430
  yypParser = (yyParser*)yyp;
L
lihui 已提交
2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451
  if( yypParser->yyidx<0 ){
#if YYSTACKDEPTH<=0
    if( yypParser->yystksz <=0 ){
      /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
      yyminorunion = yyzerominor;
      yyStackOverflow(yypParser, &yyminorunion);
      return;
    }
#endif
    yypParser->yyidx = 0;
    yypParser->yyerrcnt = -1;
    yypParser->yystack[0].stateno = 0;
    yypParser->yystack[0].major = 0;
#ifndef NDEBUG
    if( yyTraceFILE ){
      fprintf(yyTraceFILE,"%sInitialize. Empty stack. State 0\n",
              yyTracePrompt);
    }
#endif
  }
  yyminorunion.yy0 = yyminor;
H
hzcheng 已提交
2452 2453 2454 2455 2456 2457 2458
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
  yyendofinput = (yymajor==0);
#endif
  ParseARG_STORE;

#ifndef NDEBUG
  if( yyTraceFILE ){
L
lihui 已提交
2459
    fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]);
H
hzcheng 已提交
2460 2461 2462 2463 2464
  }
#endif

  do{
    yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
L
lihui 已提交
2465 2466 2467
    if( yyact <= YY_MAX_SHIFTREDUCE ){
      if( yyact > YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
      yy_shift(yypParser,yyact,yymajor,&yyminorunion);
H
hzcheng 已提交
2468 2469
      yypParser->yyerrcnt--;
      yymajor = YYNOCODE;
L
lihui 已提交
2470 2471
    }else if( yyact <= YY_MAX_REDUCE ){
      yy_reduce(yypParser,yyact-YY_MIN_REDUCE);
H
hzcheng 已提交
2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502
    }else{
      assert( yyact == YY_ERROR_ACTION );
#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 ){
L
lihui 已提交
2503
        yy_syntax_error(yypParser,yymajor,yyminorunion);
H
hzcheng 已提交
2504
      }
L
lihui 已提交
2505
      yymx = yypParser->yystack[yypParser->yyidx].major;
H
hzcheng 已提交
2506 2507 2508 2509 2510 2511 2512
      if( yymx==YYERRORSYMBOL || yyerrorhit ){
#ifndef NDEBUG
        if( yyTraceFILE ){
          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
             yyTracePrompt,yyTokenName[yymajor]);
        }
#endif
L
lihui 已提交
2513
        yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion);
H
hzcheng 已提交
2514 2515
        yymajor = YYNOCODE;
      }else{
L
lihui 已提交
2516 2517 2518 2519 2520
         while(
          yypParser->yyidx >= 0 &&
          yymx != YYERRORSYMBOL &&
          (yyact = yy_find_reduce_action(
                        yypParser->yystack[yypParser->yyidx].stateno,
H
hzcheng 已提交
2521 2522 2523 2524
                        YYERRORSYMBOL)) >= YY_MIN_REDUCE
        ){
          yy_pop_parser_stack(yypParser);
        }
L
lihui 已提交
2525
        if( yypParser->yyidx < 0 || yymajor==0 ){
H
hzcheng 已提交
2526 2527 2528 2529
          yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
          yy_parse_failed(yypParser);
          yymajor = YYNOCODE;
        }else if( yymx!=YYERRORSYMBOL ){
L
lihui 已提交
2530 2531 2532
          YYMINORTYPE u2;
          u2.YYERRSYMDT = 0;
          yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
H
hzcheng 已提交
2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544
        }
      }
      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.
      */
L
lihui 已提交
2545
      yy_syntax_error(yypParser,yymajor,yyminorunion);
H
hzcheng 已提交
2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559
      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 ){
L
lihui 已提交
2560
        yy_syntax_error(yypParser,yymajor,yyminorunion);
H
hzcheng 已提交
2561 2562 2563 2564 2565 2566 2567 2568 2569
      }
      yypParser->yyerrcnt = 3;
      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
      if( yyendofinput ){
        yy_parse_failed(yypParser);
      }
      yymajor = YYNOCODE;
#endif
    }
L
lihui 已提交
2570
  }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
H
hzcheng 已提交
2571 2572
#ifndef NDEBUG
  if( yyTraceFILE ){
L
lihui 已提交
2573
    int i;
H
hzcheng 已提交
2574
    fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
L
lihui 已提交
2575 2576 2577
    for(i=1; i<=yypParser->yyidx; i++)
      fprintf(yyTraceFILE,"%c%s", i==1 ? '[' : ' ', 
              yyTokenName[yypParser->yystack[i].major]);
H
hzcheng 已提交
2578 2579 2580 2581 2582
    fprintf(yyTraceFILE,"]\n");
  }
#endif
  return;
}