sql.c 171.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
/*
** 2000-05-29
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Driver template for the LEMON parser generator.
**
** The "lemon" program processes an LALR(1) input grammar file, then uses
** this template to construct a parser.  The "lemon" program inserts text
** at each "%%" line.  Also, any "P-a-r-s-e" identifer prefix (without the
** interstitial "-" characters) contained in this template is changed into
** the value of the %name directive from the grammar.  Otherwise, the content
** of this template is copied straight through into the generate parser
** source file.
**
** The following is the concatenation of all %include directives from the
** input grammar file:
*/
#include <stdio.h>
#include <assert.h>
/************ Begin %include sections from the grammar ************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>

#include "nodes.h"
X
Xiaoyu Wang 已提交
36
#include "parToken.h"
37
#include "ttokendef.h"
X
Xiaoyu Wang 已提交
38
#include "parAst.h"
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
/**************** 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.
X
Xiaoyu Wang 已提交
62
**    ParseTOKENTYPE     is the data type used for minor type for terminal
63 64 65 66 67 68 69 70 71 72
**                       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
X
Xiaoyu Wang 已提交
73
**                       which is ParseTOKENTYPE.  The entry in the union
74 75 76
**                       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()
X
Xiaoyu Wang 已提交
77 78 79 80 81 82
**    ParseARG_SDECL     A static variable declaration for the %extra_argument
**    ParseARG_PDECL     A parameter declaration for the %extra_argument
**    ParseARG_PARAM     Code to pass %extra_argument as a subroutine parameter
**    ParseARG_STORE     Code to store %extra_argument into yypParser
**    ParseARG_FETCH     Code to extract %extra_argument from yypParser
**    ParseCTX_*         As ParseARG_ except for %extra_context
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
**    YYERRORSYMBOL      is the code number of the error symbol.  If not
**                       defined, then do no error processing.
**    YYNSTATE           the combined number of states.
**    YYNRULE            the number of rules in the grammar
**    YYNTOKEN           Number of terminal symbols
**    YY_MAX_SHIFT       Maximum value for shift actions
**    YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions
**    YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions
**    YY_ERROR_ACTION    The yy_action[] code for syntax error
**    YY_ACCEPT_ACTION   The yy_action[] code for accept
**    YY_NO_ACTION       The yy_action[] code for no-op
**    YY_MIN_REDUCE      Minimum value for reduce actions
**    YY_MAX_REDUCE      Maximum value for reduce actions
*/
#ifndef INTERFACE
# define INTERFACE 1
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned char
102
#define YYNOCODE 249
103
#define YYACTIONTYPE unsigned short int
X
Xiaoyu Wang 已提交
104
#define ParseTOKENTYPE  SToken 
105 106
typedef union {
  int yyinit;
X
Xiaoyu Wang 已提交
107
  ParseTOKENTYPE yy0;
108 109 110 111 112 113 114 115 116 117 118 119
  SNode* yy26;
  EOrder yy32;
  SNodeList* yy64;
  EOperatorType yy80;
  bool yy107;
  EFillMode yy192;
  SToken yy353;
  SDataType yy370;
  EJoinType yy372;
  ENullOrder yy391;
  SAlterOption yy443;
  int32_t yy448;
120 121 122 123
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
#endif
X
Xiaoyu Wang 已提交
124 125 126 127 128 129 130 131 132 133
#define ParseARG_SDECL  SAstCreateContext* pCxt ;
#define ParseARG_PDECL , SAstCreateContext* pCxt 
#define ParseARG_PARAM ,pCxt 
#define ParseARG_FETCH  SAstCreateContext* pCxt =yypParser->pCxt ;
#define ParseARG_STORE yypParser->pCxt =pCxt ;
#define ParseCTX_SDECL
#define ParseCTX_PDECL
#define ParseCTX_PARAM
#define ParseCTX_FETCH
#define ParseCTX_STORE
134 135
#define YYNSTATE             414
#define YYNRULE              316
136
#define YYNTOKEN             160
137 138 139 140 141 142 143 144
#define YY_MAX_SHIFT         413
#define YY_MIN_SHIFTREDUCE   631
#define YY_MAX_SHIFTREDUCE   946
#define YY_ERROR_ACTION      947
#define YY_ACCEPT_ACTION     948
#define YY_NO_ACTION         949
#define YY_MIN_REDUCE        950
#define YY_MAX_REDUCE        1265
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))

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


/* Next are the tables used to determine what action to take based on the
** current state and lookahead token.  These tables are used to implement
** functions that take a state number and lookahead value and return an
** action integer.  
**
** Suppose the action integer is N.  Then the action is determined as
** follows
**
**   0 <= N <= YY_MAX_SHIFT             Shift N.  That is, push the lookahead
**                                      token onto the stack and goto state N.
**
**   N between YY_MIN_SHIFTREDUCE       Shift to an arbitrary state then
**     and YY_MAX_SHIFTREDUCE           reduce by rule N-YY_MIN_SHIFTREDUCE.
**
**   N == YY_ERROR_ACTION               A syntax error has occurred.
**
**   N == YY_ACCEPT_ACTION              The parser accepts its input.
**
**   N == YY_NO_ACTION                  No such action.  Denotes unused
**                                      slots in the yy_action[] table.
**
**   N between YY_MIN_REDUCE            Reduce by rule N-YY_MIN_REDUCE
**     and YY_MAX_REDUCE
**
** The action table is constructed as a single large table named yy_action[].
** Given state S and lookahead X, the action is computed as either:
**
**    (A)   N = yy_action[ yy_shift_ofst[S] + X ]
**    (B)   N = yy_default[S]
**
** The (A) formula is preferred.  The B formula is used instead if
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X.
**
** The formulas above are for computing the action when the lookahead is
** a terminal symbol.  If the lookahead is a non-terminal (as occurs after
** a reduce action) then the yy_reduce_ofst[] array is used in place of
** the yy_shift_ofst[] array.
**
** 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 **********************************************/
211
#define YY_ACTTAB_COUNT (1182)
212
static const YYACTIONTYPE yy_action[] = {
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 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 318 319 320 321 322 323 324 325 326 327 328 329 330 331
 /*     0 */   996,  347,  347,   24,  162,  334,  253, 1057,  227, 1049,
 /*    10 */   108, 1115, 1158,   31,   29,   27,   26,   25,  951,  331,
 /*    20 */   347, 1098, 1060, 1060,  103,   64,  962,   31,   29,   27,
 /*    30 */    26,   25,  263,  233, 1051,  973, 1106, 1108,  304,   76,
 /*    40 */   346, 1060,   75,   74,   73,   72,   71,   70,   69,   68,
 /*    50 */    67,  201,  398,  397,  396,  395,  394,  393,  392,  391,
 /*    60 */   390,  389,  388,  387,  386,  385,  384,  383,  382,  381,
 /*    70 */   380, 1130, 1130,   30,   28,  829,   31,   29,   27,   26,
 /*    80 */    25,  224,  346,  808,   76,  852,   42,   75,   74,   73,
 /*    90 */    72,   71,   70,   69,   68,   67,  275,  102,  270,   42,
 /*   100 */   806,  274, 1244, 1056,  273, 1063,  271, 1105,   88,  272,
 /*   110 */   289,   12,  950,  214,  201, 1243, 1055,  815, 1103, 1242,
 /*   120 */    23,  222,  346,  847,  848,  849,  850,  851,  853,  855,
 /*   130 */   856,  857,  807,  254,    1,   10,   86,   85,   84,   83,
 /*   140 */    82,   81,   80,   79,   78, 1132,  290,  303,  852,  747,
 /*   150 */   369,  368,  367,  751,  366,  753,  754,  365,  756,  362,
 /*   160 */   410,  762,  359,  764,  765,  356,  353,  287, 1244,  215,
 /*   170 */   942,  943,  817,  310,  305,   10,  913, 1143,  809,  812,
 /*   180 */   285,  116, 1130,   23,  222, 1242,  847,  848,  849,  850,
 /*   190 */   851,  853,  855,  856,  857,  117,  117, 1158,  300,  911,
 /*   200 */   912,  914,  915, 1132,  331,   31,   29,   27,   26,   25,
 /*   210 */   333,  347,  347,  888, 1130, 1143,  344,  345,  815,  319,
 /*   220 */   105, 1025,   60, 1144, 1147, 1183,  948,  230,  249,  200,
 /*   230 */  1179,  117, 1060, 1060,  347, 1158,  972,  292,  248,   64,
 /*   240 */  1130, 1244,  318,  247,  315,  246,  269,  309,  333,  379,
 /*   250 */  1158,   96, 1130, 1197,  116, 1060,  180,  331, 1242, 1090,
 /*   260 */    61, 1144, 1147, 1183,  243,   91, 1105,  217, 1179,  111,
 /*   270 */  1194,  237,  229, 1130,  245,  244,  308, 1103, 1143,  406,
 /*   280 */   405,  158,   30,   28,  889,   89,  347,  296, 1210,  819,
 /*   290 */   224,  175,  808, 1244,  317,  112, 1190, 1191, 1158, 1195,
 /*   300 */   228,  315,   27,   26,   25,  318,  116, 1060,  102,  806,
 /*   310 */  1242,  333,   51, 1143,  239, 1130, 1062,   58, 1202,  884,
 /*   320 */    12,  818,   91,   61, 1144, 1147, 1183,   92, 1036, 1053,
 /*   330 */   217, 1179,  111, 1158, 1052,   31,   29,   27,   26,   25,
 /*   340 */   331,  807,   89,    1,  887,  267,  333,  232, 1143,  266,
 /*   350 */  1130, 1211,  113, 1190, 1191,  102, 1195,  910,   61, 1144,
 /*   360 */  1147, 1183,  235, 1062,  117,  217, 1179, 1256, 1158,  410,
 /*   370 */   102,   77,  372,  971,  268,  331, 1217,  254, 1062, 1143,
 /*   380 */  1105,  333,   30,   28,  157, 1130,  234,  809,  812, 1035,
 /*   390 */   224, 1103,  808,   61, 1144, 1147, 1183,  829,  347, 1158,
 /*   400 */   217, 1179, 1256,  236,    9,    8,  331,   30,   28,  806,
 /*   410 */  1130, 1240,  333,   30,   28,  224, 1130,  808, 1143, 1060,
 /*   420 */    12,  224,  334,  808,   61, 1144, 1147, 1183, 1116, 1197,
 /*   430 */   808,  217, 1179, 1256,  806,  669,  970,  670, 1158,  669,
 /*   440 */   806,  807, 1201,    1, 1045,  331, 1193,  806, 1047,  376,
 /*   450 */  1105,  333,  261,  375,  969, 1130, 1143, 1034,  671,   21,
 /*   460 */   319, 1107,  322,  190, 1144, 1147,  807,  854,    7,  410,
 /*   470 */   858,  149,  807, 1130,    7, 1105, 1158,  865,  377,  807,
 /*   480 */    57,    6, 1244,  331,  968,  147, 1104,  809,  812,  333,
 /*   490 */  1143, 1130,   53, 1130,  410,  116,  967,  374,  373, 1242,
 /*   500 */   410,   62, 1144, 1147, 1183,  820,  379,  410, 1182, 1179,
 /*   510 */  1158,  315,  809,  812,   30,   28,  332,  331,  809,  812,
 /*   520 */   966, 1130,  224,  333,  808,  809,  812, 1130,  896,  117,
 /*   530 */   965,  964,   91, 1130,  817,   62, 1144, 1147, 1183, 1133,
 /*   540 */   961,  806,  329, 1179,  960,   30,   28,  319,  945,  946,
 /*   550 */   959, 1143,   89,  224,  958,  808,  957, 1130,  131,    9,
 /*   560 */     8,  129,  155, 1190,  314,  413,  313, 1130, 1130, 1244,
 /*   570 */   884, 1158,  806,  807,  956,    7, 1130, 1130,  331,  178,
 /*   580 */  1043, 1130,  116,   87,  333,  955, 1242, 1130, 1130,  402,
 /*   590 */  1143, 1130,  177, 1130,  954,  323,  106, 1144, 1147,  330,
 /*   600 */   144,  410,  953,  126,  807,  326,    1,  110, 1197,  321,
 /*   610 */  1158, 1130,  371,  259,  963,  242,  125,  331,   59,  809,
 /*   620 */   812,  173, 1130,  333, 1026, 1192,  133, 1130, 1143,  132,
 /*   630 */   159, 1130,  410,  320, 1257,   62, 1144, 1147, 1183, 1130,
 /*   640 */   991,  135,   43, 1180,  134,  123,  137,  301, 1158,  136,
 /*   650 */   809,  812, 1143,  859,  343,  331,  986,  295,  152,  324,
 /*   660 */   141,  333,  276, 1143,  185, 1130,  984,   32,  223,  187,
 /*   670 */   844,  327, 1158,  196, 1144, 1147, 1099,  826,  278,  331,
 /*   680 */   122,  186,  104, 1158,  120,  333, 1143,  260,  281, 1130,
 /*   690 */   331,   32,  297, 1137,  118, 1213,  333,  196, 1144, 1147,
 /*   700 */  1130, 1143,  316,  798,  167, 1159, 1158, 1135,  195, 1144,
 /*   710 */  1147, 1033,  339,  331,  161,  172, 1143,   32,  165,  333,
 /*   720 */     2, 1158,  250, 1130,  238,  815,   93,  823,  331,   94,
 /*   730 */   119,  106, 1144, 1147,  333,  816, 1158, 1143, 1130,  311,
 /*   740 */   251,  221,  252,  331,  740,  735,  196, 1144, 1147,  333,
 /*   750 */   822,   41, 1143, 1130,  255,  124,  225, 1158,   96,   77,
 /*   760 */   821,  196, 1144, 1147,  331,  262,  264,  768, 1143, 1258,
 /*   770 */   333,  376, 1158,  772, 1130,  375,  778, 1050,  777,  331,
 /*   780 */   117,  351,  194, 1144, 1147,  333,   66,   94, 1158, 1130,
 /*   790 */    95, 1143,   96,  128,   97,  331, 1143,  197, 1144, 1147,
 /*   800 */   377,  333, 1046,  291,  130, 1130,   98, 1143,   94,   99,
 /*   810 */  1048, 1158, 1143,  188, 1144, 1147, 1158, 1044,  331,  374,
 /*   820 */   373,  140,  100,  331,  333,  101,  213, 1158, 1130,  333,
 /*   830 */   820, 1214, 1158, 1130,  331,  293,  198, 1144, 1147,  331,
 /*   840 */   333,  189, 1144, 1147, 1130,  333, 1224, 1143,  294, 1130,
 /*   850 */  1143,  302,  199, 1144, 1147,  337,  145, 1155, 1144, 1147,
 /*   860 */   812,  148,  299,  216,  298,    5, 1204, 1158, 1223,  312,
 /*   870 */  1158,    4,  884,   90,  331,  819,  151,  331,  109, 1198,
 /*   880 */   333,   33,  153,  333, 1130, 1143,  154, 1130,  218,  328,
 /*   890 */    17, 1241, 1154, 1144, 1147, 1153, 1144, 1147, 1259,  325,
 /*   900 */  1143,  160, 1165,  340, 1114, 1158,  335,  169,  336,   50,
 /*   910 */   341, 1113,  331,  226, 1061,  342, 1143,  179,  333,   52,
 /*   920 */  1158, 1143, 1130,  315,  181,  176,  409,  331,  191,  349,
 /*   930 */   204, 1144, 1147,  333,  183,  184, 1158, 1130, 1124,  192,
 /*   940 */   999, 1158, 1123,  331,   91,  203, 1144, 1147,  331,  333,
 /*   950 */  1122,  240, 1143, 1130,  333,  241, 1121,  208, 1130, 1039,
 /*   960 */  1038,  205, 1144, 1147,   89,  998,  202, 1144, 1147, 1000,
 /*   970 */   995,  983, 1158,  121,  114, 1190, 1191,  280, 1195,  331,
 /*   980 */   978, 1120,  267, 1111, 1037,  333,  266,  684,  997, 1130,
 /*   990 */   994,  256,  288,  258,  257,  982,  981,  193, 1144, 1147,
 /*  1000 */   209,  977,  207,  206, 1041,  265,  139,   65,  127,  781,
 /*  1010 */   283,  268, 1040,  783,  782,  277,  713,  712,  711,  138,
 /*  1020 */   992,  275,  210,  270,  710,  709,  274,  987,  708,  273,
 /*  1030 */   211,  271,  279,  985,  272,  212,  282,  976,  284,  975,
 /*  1040 */   286,   63, 1119, 1118, 1110,   38,   36,  142,   37,   44,
 /*  1050 */     3,   20,   32,  143,   14,   39,  146,   15,  306,   34,
 /*  1060 */   307,   31,   29,   27,   26,   25,   22,  909,  903,   47,
 /*  1070 */    11,  107,  150,  931,  930,   45,   31,   29,   27,   26,
 /*  1080 */    25,  902,   46,    8,  881,  880,  219,  935, 1109,  934,
 /*  1090 */   220,  993, 1135,  980,   19,  949,  936,  170,  827,  164,
 /*  1100 */   350,  156,   13,   35,  115,   18,  231,  354,  357,  360,
 /*  1110 */   907,   16,  845,  163,  166,  363,   53,  746,  168,   48,
 /*  1120 */   774,  704,  776,  775,  348,   49,  400, 1134,  769,   40,
 /*  1130 */   352,  399,  766,  355,  401,  378,  763,  757,  682,  358,
 /*  1140 */   171,  338,  174,  703,  361,  702,  755,  364,  701,  700,
 /*  1150 */   699,  698,   54,   55,  697,   56,  696,  705,  695,  694,
 /*  1160 */   761,  693,  692,  691,  690,  689,  403,  370,  688,  687,
 /*  1170 */   404,  979,  974,  407,  760,  408,  759,  810,  758,  182,
 /*  1180 */   411,  412,
332 333
};
static const YYCODETYPE yy_lookahead[] = {
334 335 336 337 338 339
 /*     0 */     0,  169,  169,  212,  213,  196,  174,  174,  199,  184,
 /*    10 */   182,  202,  183,   12,   13,   14,   15,   16,    0,  190,
 /*    20 */   169,  193,  190,  190,  162,  174,  164,   12,   13,   14,
 /*    30 */    15,   16,  181,  192,  163,  163,  195,  196,  209,   21,
 /*    40 */    20,  190,   24,   25,   26,   27,   28,   29,   30,   31,
 /*    50 */    32,   50,   52,   53,   54,   55,   56,   57,   58,   59,
340
 /*    60 */    60,   61,   62,   63,   64,   65,   66,   67,   68,   69,
341 342 343 344 345 346 347 348
 /*    70 */    70,  200,  200,   12,   13,   74,   12,   13,   14,   15,
 /*    80 */    16,   20,   20,   22,   21,   84,  171,   24,   25,   26,
 /*    90 */    27,   28,   29,   30,   31,   32,   52,  183,   54,  171,
 /*   100 */    39,   57,  227,  188,   60,  191,   62,  183,  180,   65,
 /*   110 */   169,   50,    0,  189,   50,  240,  188,   20,  194,  244,
 /*   120 */   119,  120,   20,  122,  123,  124,  125,  126,  127,  128,
 /*   130 */   129,  130,   71,   49,   73,   73,   24,   25,   26,   27,
 /*   140 */    28,   29,   30,   31,   32,  163,  205,  113,   84,   90,
349
 /*   150 */    91,   92,   93,   94,   95,   96,   97,   98,   99,  100,
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 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 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 465 466 467 468
 /*   160 */    99,  102,  103,  104,  105,  106,  107,   21,  227,  187,
 /*   170 */   155,  156,   20,  139,  140,   73,  121,  163,  117,  118,
 /*   180 */    34,  240,  200,  119,  120,  244,  122,  123,  124,  125,
 /*   190 */   126,  127,  128,  129,  130,  134,  134,  183,  143,  144,
 /*   200 */   145,  146,  147,  163,  190,   12,   13,   14,   15,   16,
 /*   210 */   196,  169,  169,    4,  200,  163,  174,  174,   20,  205,
 /*   220 */   172,  173,  208,  209,  210,  211,  160,  187,   30,  215,
 /*   230 */   216,  134,  190,  190,  169,  183,  163,   74,   40,  174,
 /*   240 */   200,  227,  190,   45,  169,   47,  181,   20,  196,   49,
 /*   250 */   183,   88,  200,  206,  240,  190,  176,  190,  244,  179,
 /*   260 */   208,  209,  210,  211,   66,  190,  183,  215,  216,  217,
 /*   270 */   223,  205,  189,  200,   76,   77,  209,  194,  163,  166,
 /*   280 */   167,  229,   12,   13,   14,  210,  169,  235,  236,   20,
 /*   290 */    20,  174,   22,  227,  219,  220,  221,  222,  183,  224,
 /*   300 */   175,  169,   14,   15,   16,  190,  240,  190,  183,   39,
 /*   310 */   244,  196,  168,  163,  116,  200,  191,  168,  132,  133,
 /*   320 */    50,   20,  190,  208,  209,  210,  211,  178,    0,  185,
 /*   330 */   215,  216,  217,  183,  185,   12,   13,   14,   15,   16,
 /*   340 */   190,   71,  210,   73,  135,   60,  196,  175,  163,   64,
 /*   350 */   200,  236,  220,  221,  222,  183,  224,   74,  208,  209,
 /*   360 */   210,  211,  175,  191,  134,  215,  216,  217,  183,   99,
 /*   370 */   183,   88,   86,  163,   89,  190,  226,   49,  191,  163,
 /*   380 */   183,  196,   12,   13,  115,  200,  189,  117,  118,    0,
 /*   390 */    20,  194,   22,  208,  209,  210,  211,   74,  169,  183,
 /*   400 */   215,  216,  217,  174,    1,    2,  190,   12,   13,   39,
 /*   410 */   200,  226,  196,   12,   13,   20,  200,   22,  163,  190,
 /*   420 */    50,   20,  196,   22,  208,  209,  210,  211,  202,  206,
 /*   430 */    22,  215,  216,  217,   39,   22,  163,   20,  183,   22,
 /*   440 */    39,   71,  226,   73,  184,  190,  223,   39,  184,   60,
 /*   450 */   183,  196,   39,   64,  163,  200,  163,    0,   41,  119,
 /*   460 */   205,  194,    3,  208,  209,  210,   71,  127,   73,   99,
 /*   470 */   130,   74,   71,  200,   73,  183,  183,   74,   89,   71,
 /*   480 */    73,   44,  227,  190,  163,   88,  194,  117,  118,  196,
 /*   490 */   163,  200,   85,  200,   99,  240,  163,  108,  109,  244,
 /*   500 */    99,  208,  209,  210,  211,   20,   49,   99,  215,  216,
 /*   510 */   183,  169,  117,  118,   12,   13,   14,  190,  117,  118,
 /*   520 */   163,  200,   20,  196,   22,  117,  118,  200,   14,  134,
 /*   530 */   163,  163,  190,  200,   20,  208,  209,  210,  211,  163,
 /*   540 */   163,   39,  215,  216,  163,   12,   13,  205,  158,  159,
 /*   550 */   163,  163,  210,   20,  163,   22,  163,  200,   79,    1,
 /*   560 */     2,   82,  220,  221,  222,   19,  224,  200,  200,  227,
 /*   570 */   133,  183,   39,   71,  163,   73,  200,  200,  190,   33,
 /*   580 */   184,  200,  240,   37,  196,  163,  244,  200,  200,   43,
 /*   590 */   163,  200,   46,  200,  163,   88,  208,  209,  210,   50,
 /*   600 */   115,   99,  163,   33,   71,   88,   73,   37,  206,  150,
 /*   610 */   183,  200,  184,   43,  164,  169,   46,  190,   72,  117,
 /*   620 */   118,   75,  200,  196,  173,  223,   79,  200,  163,   82,
 /*   630 */   247,  200,   99,  245,  246,  208,  209,  210,  211,  200,
 /*   640 */     0,   79,   72,  216,   82,   75,   79,  238,  183,   82,
 /*   650 */   117,  118,  163,   74,  108,  190,    0,  111,  232,  152,
 /*   660 */   114,  196,   22,  163,   18,  200,    0,   88,  203,   23,
 /*   670 */   121,  154,  183,  208,  209,  210,  193,   74,   22,  190,
 /*   680 */   110,   35,   36,  183,  114,  196,  163,  166,   22,  200,
 /*   690 */   190,   88,  203,   73,   48,  207,  196,  208,  209,  210,
 /*   700 */   200,  163,  225,   74,   74,  183,  183,   87,  208,  209,
 /*   710 */   210,    0,   74,  190,  241,   74,  163,   88,   88,  196,
 /*   720 */   228,  183,  204,  200,  169,   20,   88,   20,  190,   88,
 /*   730 */   171,  208,  209,  210,  196,   20,  183,  163,  200,  239,
 /*   740 */   190,  203,  197,  190,   74,   74,  208,  209,  210,  196,
 /*   750 */    20,  171,  163,  200,  169,  171,  203,  183,   88,   88,
 /*   760 */    20,  208,  209,  210,  190,  165,  183,   74,  163,  246,
 /*   770 */   196,   60,  183,   74,  200,   64,   74,  183,   74,  190,
 /*   780 */   134,   88,  208,  209,  210,  196,  169,   88,  183,  200,
 /*   790 */    88,  163,   88,  183,   74,  190,  163,  208,  209,  210,
 /*   800 */    89,  196,  183,  204,  183,  200,  183,  163,   88,  183,
 /*   810 */   183,  183,  163,  208,  209,  210,  183,  183,  190,  108,
 /*   820 */   109,  168,  183,  190,  196,  183,  165,  183,  200,  196,
 /*   830 */    20,  207,  183,  200,  190,  190,  208,  209,  210,  190,
 /*   840 */   196,  208,  209,  210,  200,  196,  237,  163,  197,  200,
 /*   850 */   163,  142,  208,  209,  210,  141,  201,  208,  209,  210,
 /*   860 */   118,  201,  200,  200,  137,  149,  234,  183,  237,  148,
 /*   870 */   183,  136,  133,  190,  190,   20,  233,  190,  231,  206,
 /*   880 */   196,  131,  230,  196,  200,  163,  218,  200,  157,  153,
 /*   890 */    73,  243,  208,  209,  210,  208,  209,  210,  248,  151,
 /*   900 */   163,  242,  214,  112,  201,  183,  200,  190,  200,  168,
 /*   910 */   198,  201,  190,  200,  190,  197,  163,  179,  196,   73,
 /*   920 */   183,  163,  200,  169,  169,  168,  165,  190,  177,  186,
 /*   930 */   208,  209,  210,  196,  170,  161,  183,  200,    0,  177,
 /*   940 */     0,  183,    0,  190,  190,  208,  209,  210,  190,  196,
 /*   950 */     0,   66,  163,  200,  196,   87,    0,   35,  200,    0,
 /*   960 */     0,  208,  209,  210,  210,    0,  208,  209,  210,    0,
 /*   970 */     0,    0,  183,   44,  220,  221,  222,    4,  224,  190,
 /*   980 */     0,    0,   60,    0,    0,  196,   64,   51,    0,  200,
 /*   990 */     0,   39,   19,   44,   37,    0,    0,  208,  209,  210,
 /*  1000 */    78,    0,   80,   81,    0,   83,   33,   84,   82,   22,
 /*  1010 */    37,   89,    0,   39,   39,   42,   39,   39,   39,   46,
 /*  1020 */     0,   52,   22,   54,   39,   39,   57,    0,   39,   60,
 /*  1030 */    22,   62,   40,    0,   65,   22,   39,    0,   22,    0,
 /*  1040 */    22,   20,    0,    0,    0,   72,  115,   44,   75,   73,
 /*  1050 */    88,    2,   88,  110,  138,   88,   74,  138,   39,  132,
 /*  1060 */    88,   12,   13,   14,   15,   16,    2,   74,   74,    4,
 /*  1070 */   138,   73,   73,   39,   39,   73,   12,   13,   14,   15,
 /*  1080 */    16,   74,   73,    2,   74,   74,   39,   39,    0,   39,
 /*  1090 */    39,    0,   87,    0,   88,  249,   74,   44,   74,   74,
 /*  1100 */    39,   87,   73,   88,   87,   73,   39,   39,   39,   39,
 /*  1110 */    74,   88,  121,   87,   73,   39,   85,   22,   73,   73,
 /*  1120 */    22,   22,   39,   39,   86,   73,   37,   87,   74,   73,
 /*  1130 */    73,   39,   74,   73,   44,   50,   74,   74,   51,   73,
 /*  1140 */   110,  113,   87,   39,   73,   39,   74,   73,   39,   39,
 /*  1150 */    39,   39,   73,   73,   39,   73,   22,   71,   39,   39,
 /*  1160 */   101,   39,   39,   39,   39,   39,   39,   89,   39,   39,
 /*  1170 */    38,    0,    0,   22,  101,   21,  101,   22,  101,   22,
 /*  1180 */    21,   20,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1190 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1200 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1210 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1220 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1230 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1240 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1250 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1260 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1270 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1280 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1290 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1300 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1310 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1320 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1330 */   249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 /*  1340 */   249,  249,
469
};
470
#define YY_SHIFT_COUNT    (413)
471
#define YY_SHIFT_MIN      (0)
472
#define YY_SHIFT_MAX      (1172)
473
static const unsigned short int yy_shift_ofst[] = {
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515
 /*     0 */   646,   61,  270,  370,  370,  370,  370,  395,  370,  370,
 /*    10 */    62,  401,  533,  502,  401,  401,  401,  401,  401,  401,
 /*    20 */   401,  401,  401,  401,  401,  401,  401,  401,  401,  401,
 /*    30 */   401,  401,  401,  102,  102,  102,   97,   20,   20,  408,
 /*    40 */   408,   20,   20,   84,  152,  227,  227,  230,  301,  152,
 /*    50 */    20,   20,  152,   20,  152,  301,  152,  152,   20,  200,
 /*    60 */     1,   64,   64,   63,  922,  408,   44,  408,  408,  408,
 /*    70 */   408,  408,  408,  408,  408,  408,  408,  408,  408,  408,
 /*    80 */   408,  408,  408,  408,  408,  408,  408,  417,  328,  269,
 /*    90 */   269,  269,  457,  301,  152,  152,  152,  286,   59,   59,
 /*   100 */    59,   59,   59,   18,  198,  969,   15,   55,  285,   34,
 /*   110 */   413,  485,  186,  437,  186,  514,  459,  209,  705,  707,
 /*   120 */    84,  715,  730,   84,  705,   84,  740,  152,  152,  152,
 /*   130 */   152,  152,  152,  152,  152,  152,  152,  152,  705,  740,
 /*   140 */   707,  200,  715,  730,  810,  709,  714,  742,  709,  714,
 /*   150 */   742,  716,  721,  727,  735,  739,  715,  855,  750,  731,
 /*   160 */   736,  748,  817,  152,  714,  742,  742,  714,  742,  791,
 /*   170 */   715,  730,  286,  200,  715,  846,  705,  200,  740, 1182,
 /*   180 */  1182, 1182, 1182,    0,  112,  546,  570,  973, 1049, 1064,
 /*   190 */   323,  389,  711,  193,  193,  193,  193,  193,  193,  193,
 /*   200 */   403,  340,  288,  288,  288,  288,  479,  547,  562,  567,
 /*   210 */   640,  656,  666,  146,  163,  283,  397,  558,  390,  507,
 /*   220 */   517,  579,  549,  603,  620,  629,  630,  638,  641,  670,
 /*   230 */   671,  693,  699,  702,  704,  720,  407,  938,  940,  942,
 /*   240 */   950,  885,  868,  956,  959,  960,  965,  970,  971,  980,
 /*   250 */   981,  983,  929,  984,  936,  988,  990,  952,  957,  949,
 /*   260 */   995,  996, 1001, 1004,  923,  926,  974,  975,  987, 1012,
 /*   270 */   977,  978,  979,  985,  986,  989, 1020, 1000, 1027, 1008,
 /*   280 */   992, 1033, 1013,  997, 1037, 1016, 1039, 1018, 1021, 1042,
 /*   290 */  1043,  931, 1044,  976, 1003,  943,  962,  964,  916,  982,
 /*   300 */   967,  993,  998,  999,  994, 1002, 1007, 1019,  972, 1005,
 /*   310 */  1009, 1006,  919, 1010, 1011, 1014,  927, 1015, 1017, 1022,
 /*   320 */  1023,  932, 1065, 1034, 1035, 1047, 1048, 1050, 1051, 1081,
 /*   330 */   991, 1026, 1024, 1029, 1032, 1025, 1036, 1041, 1045, 1028,
 /*   340 */  1046, 1088, 1053, 1030, 1052, 1031, 1040, 1055, 1056, 1038,
 /*   350 */  1054, 1061, 1067, 1057, 1058, 1068, 1060, 1062, 1069, 1066,
 /*   360 */  1063, 1070, 1071, 1072, 1076, 1074, 1059, 1073, 1075, 1077,
 /*   370 */  1095, 1078, 1079, 1080, 1082, 1083, 1084, 1098, 1087, 1085,
 /*   380 */  1086, 1099, 1104, 1106, 1109, 1110, 1111, 1112, 1115, 1134,
 /*   390 */  1119, 1120, 1122, 1123, 1124, 1125, 1126, 1129, 1130, 1091,
 /*   400 */  1092, 1089, 1090, 1093, 1127, 1132, 1171, 1172, 1151, 1154,
 /*   410 */  1155, 1157, 1159, 1161,
516
};
517 518 519
#define YY_REDUCE_COUNT (182)
#define YY_REDUCE_MIN   (-209)
#define YY_REDUCE_MAX   (789)
520
static const short yy_reduce_ofst[] = {
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
 /*     0 */    66,   14,   52,  115,  150,  185,  216,  255,  293,  327,
 /*    10 */   342,  388,  427,  465,  489,  500,  523,  538,  553,  574,
 /*    20 */   589,  605,  628,  633,  644,  649,  684,  687,  722,  737,
 /*    30 */   753,  758,  789,   75,  132,  754,  -59, -149,   65,  -18,
 /*    40 */    40, -168, -167,  -72,  -76, -171,   67, -125, -191,  125,
 /*    50 */    42,   43,   83,  117,  172, -159,  197,  187,  229,  149,
 /*    60 */  -209, -209, -209, -138, -172, -129,   48, -128,   73,  210,
 /*    70 */   273,  291,  321,  333,  357,  367,  368,  376,  377,  381,
 /*    80 */   387,  391,  393,  411,  422,  431,  439,  113,  -85,   47,
 /*    90 */   223,  402,  144,  226,  -86,  267,  292,   80, -175,  260,
 /*   100 */   264,  396,  428,  450,  446,  451,  383,  409,  483,  426,
 /*   110 */   521,  488,  477,  477,  477,  522,  473,  492,  555,  518,
 /*   120 */   559,  550,  545,  580,  585,  584,  600,  583,  594,  610,
 /*   130 */   619,  621,  623,  626,  627,  634,  639,  642,  617,  661,
 /*   140 */   599,  653,  645,  651,  624,  609,  655,  662,  631,  660,
 /*   150 */   663,  632,  643,  647,  652,  477,  683,  673,  668,  650,
 /*   160 */   648,  659,  688,  522,  703,  706,  708,  710,  713,  712,
 /*   170 */   717,  718,  738,  741,  724,  743,  755,  757,  761,  751,
 /*   180 */   762,  764,  774,
540 541
};
static const YYACTIONTYPE yy_default[] = {
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
 /*     0 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*    10 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*    20 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*    30 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*    40 */   947,  947,  947, 1004,  947,  947,  947,  947,  947,  947,
 /*    50 */   947,  947,  947,  947,  947,  947,  947,  947,  947, 1002,
 /*    60 */   947, 1185,  947,  947,  947,  947,  947,  947,  947,  947,
 /*    70 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*    80 */   947,  947,  947,  947,  947,  947,  947,  947, 1004, 1196,
 /*    90 */  1196, 1196, 1002,  947,  947,  947,  947, 1089,  947,  947,
 /*   100 */   947,  947,  947,  947,  947,  947, 1260,  947, 1042, 1220,
 /*   110 */   947, 1212, 1188, 1202, 1189,  947, 1245, 1205,  947,  947,
 /*   120 */  1004,  947,  947, 1004,  947, 1004,  947,  947,  947,  947,
 /*   130 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*   140 */   947, 1002,  947,  947,  947, 1227, 1225,  947, 1227, 1225,
 /*   150 */   947, 1239, 1235, 1218, 1216, 1202,  947,  947,  947, 1263,
 /*   160 */  1251, 1247,  947,  947, 1225,  947,  947, 1225,  947, 1112,
 /*   170 */   947,  947,  947, 1002,  947, 1058,  947, 1002,  947, 1092,
 /*   180 */  1092, 1005,  952,  947,  947,  947,  947,  947,  947,  947,
 /*   190 */   947,  947,  947, 1157, 1238, 1237, 1156, 1162, 1161, 1160,
 /*   200 */   947,  947, 1151, 1152, 1150, 1149,  947,  947,  947,  947,
 /*   210 */   947,  947,  947,  947,  947,  947,  947, 1186,  947, 1248,
 /*   220 */  1252,  947,  947,  947, 1136,  947,  947,  947,  947,  947,
 /*   230 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*   240 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*   250 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*   260 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*   270 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*   280 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*   290 */   947,  947,  947,  947,  947,  947, 1209, 1219,  947,  947,
 /*   300 */   947,  947,  947,  947,  947,  947,  947,  947,  947, 1136,
 /*   310 */   947, 1236,  947, 1195, 1191,  947,  947, 1187,  947,  947,
 /*   320 */  1246,  947,  947,  947,  947,  947,  947,  947,  947, 1181,
 /*   330 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*   340 */   947,  947,  947,  947,  947,  947, 1135,  947,  947,  947,
 /*   350 */   947,  947,  947, 1086,  947,  947,  947,  947,  947,  947,
 /*   360 */   947,  947,  947,  947,  947,  947, 1071, 1069, 1068, 1067,
 /*   370 */   947, 1064,  947,  947,  947,  947,  947,  947,  947,  947,
 /*   380 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*   390 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*   400 */   947,  947,  947,  947,  947,  947,  947,  947,  947,  947,
 /*   410 */   947,  947,  947,  947,
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640
};
/********** 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[] = {
};
#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 {
  yyStackEntry *yytos;          /* Pointer to top element of the stack */
#ifdef YYTRACKMAXSTACKDEPTH
  int yyhwm;                    /* High-water mark of the stack */
#endif
#ifndef YYNOERRORRECOVERY
  int yyerrcnt;                 /* Shifts left before out of the error */
#endif
X
Xiaoyu Wang 已提交
641 642
  ParseARG_SDECL                /* A place to hold %extra_argument */
  ParseCTX_SDECL                /* A place to hold %extra_context */
643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677
#if YYSTACKDEPTH<=0
  int yystksz;                  /* Current side of the stack */
  yyStackEntry *yystack;        /* The parser's stack */
  yyStackEntry yystk0;          /* First stack entry */
#else
  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */
  yyStackEntry *yystackEnd;            /* Last entry in the stack */
#endif
};
typedef struct yyParser yyParser;

#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.
*/
X
Xiaoyu Wang 已提交
678
void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
679 680 681 682 683 684 685 686 687 688 689 690
  yyTraceFILE = TraceFILE;
  yyTracePrompt = zTracePrompt;
  if( yyTraceFILE==0 ) yyTracePrompt = 0;
  else if( yyTracePrompt==0 ) yyTraceFILE = 0;
}
#endif /* NDEBUG */

#if defined(YYCOVERAGE) || !defined(NDEBUG)
/* For tracing shifts, the names of all terminals and nonterminals
** are required.  The following table supplies these names */
static const char *const yyTokenName[] = { 
  /*    0 */ "$",
691 692
  /*    1 */ "OR",
  /*    2 */ "AND",
693 694 695 696 697
  /*    3 */ "UNION",
  /*    4 */ "ALL",
  /*    5 */ "MINUS",
  /*    6 */ "EXCEPT",
  /*    7 */ "INTERSECT",
698 699 700 701 702 703 704 705 706 707
  /*    8 */ "NK_BITAND",
  /*    9 */ "NK_BITOR",
  /*   10 */ "NK_LSHIFT",
  /*   11 */ "NK_RSHIFT",
  /*   12 */ "NK_PLUS",
  /*   13 */ "NK_MINUS",
  /*   14 */ "NK_STAR",
  /*   15 */ "NK_SLASH",
  /*   16 */ "NK_REM",
  /*   17 */ "NK_CONCAT",
708
  /*   18 */ "CREATE",
709 710 711
  /*   19 */ "ACCOUNT",
  /*   20 */ "NK_ID",
  /*   21 */ "PASS",
712 713 714 715 716 717 718 719 720 721 722 723
  /*   22 */ "NK_STRING",
  /*   23 */ "ALTER",
  /*   24 */ "PPS",
  /*   25 */ "TSERIES",
  /*   26 */ "STORAGE",
  /*   27 */ "STREAMS",
  /*   28 */ "QTIME",
  /*   29 */ "DBS",
  /*   30 */ "USERS",
  /*   31 */ "CONNS",
  /*   32 */ "STATE",
  /*   33 */ "USER",
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 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 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
  /*   34 */ "PRIVILEGE",
  /*   35 */ "DROP",
  /*   36 */ "SHOW",
  /*   37 */ "DNODE",
  /*   38 */ "PORT",
  /*   39 */ "NK_INTEGER",
  /*   40 */ "DNODES",
  /*   41 */ "NK_IPTOKEN",
  /*   42 */ "LOCAL",
  /*   43 */ "QNODE",
  /*   44 */ "ON",
  /*   45 */ "QNODES",
  /*   46 */ "DATABASE",
  /*   47 */ "DATABASES",
  /*   48 */ "USE",
  /*   49 */ "IF",
  /*   50 */ "NOT",
  /*   51 */ "EXISTS",
  /*   52 */ "BLOCKS",
  /*   53 */ "CACHE",
  /*   54 */ "CACHELAST",
  /*   55 */ "COMP",
  /*   56 */ "DAYS",
  /*   57 */ "FSYNC",
  /*   58 */ "MAXROWS",
  /*   59 */ "MINROWS",
  /*   60 */ "KEEP",
  /*   61 */ "PRECISION",
  /*   62 */ "QUORUM",
  /*   63 */ "REPLICA",
  /*   64 */ "TTL",
  /*   65 */ "WAL",
  /*   66 */ "VGROUPS",
  /*   67 */ "SINGLE_STABLE",
  /*   68 */ "STREAM_MODE",
  /*   69 */ "RETENTIONS",
  /*   70 */ "FILE_FACTOR",
  /*   71 */ "NK_FLOAT",
  /*   72 */ "TABLE",
  /*   73 */ "NK_LP",
  /*   74 */ "NK_RP",
  /*   75 */ "STABLE",
  /*   76 */ "TABLES",
  /*   77 */ "STABLES",
  /*   78 */ "ADD",
  /*   79 */ "COLUMN",
  /*   80 */ "MODIFY",
  /*   81 */ "RENAME",
  /*   82 */ "TAG",
  /*   83 */ "SET",
  /*   84 */ "NK_EQ",
  /*   85 */ "USING",
  /*   86 */ "TAGS",
  /*   87 */ "NK_DOT",
  /*   88 */ "NK_COMMA",
  /*   89 */ "COMMENT",
  /*   90 */ "BOOL",
  /*   91 */ "TINYINT",
  /*   92 */ "SMALLINT",
  /*   93 */ "INT",
  /*   94 */ "INTEGER",
  /*   95 */ "BIGINT",
  /*   96 */ "FLOAT",
  /*   97 */ "DOUBLE",
  /*   98 */ "BINARY",
  /*   99 */ "TIMESTAMP",
  /*  100 */ "NCHAR",
  /*  101 */ "UNSIGNED",
  /*  102 */ "JSON",
  /*  103 */ "VARCHAR",
  /*  104 */ "MEDIUMBLOB",
  /*  105 */ "BLOB",
  /*  106 */ "VARBINARY",
  /*  107 */ "DECIMAL",
  /*  108 */ "SMA",
  /*  109 */ "ROLLUP",
  /*  110 */ "INDEX",
  /*  111 */ "FULLTEXT",
  /*  112 */ "FUNCTION",
  /*  113 */ "INTERVAL",
  /*  114 */ "TOPIC",
  /*  115 */ "AS",
  /*  116 */ "MNODES",
  /*  117 */ "NK_BOOL",
  /*  118 */ "NK_VARIABLE",
  /*  119 */ "BETWEEN",
  /*  120 */ "IS",
  /*  121 */ "NULL",
  /*  122 */ "NK_LT",
  /*  123 */ "NK_GT",
  /*  124 */ "NK_LE",
  /*  125 */ "NK_GE",
  /*  126 */ "NK_NE",
  /*  127 */ "LIKE",
  /*  128 */ "MATCH",
  /*  129 */ "NMATCH",
  /*  130 */ "IN",
  /*  131 */ "FROM",
  /*  132 */ "JOIN",
  /*  133 */ "INNER",
  /*  134 */ "SELECT",
  /*  135 */ "DISTINCT",
  /*  136 */ "WHERE",
  /*  137 */ "PARTITION",
  /*  138 */ "BY",
  /*  139 */ "SESSION",
  /*  140 */ "STATE_WINDOW",
  /*  141 */ "SLIDING",
  /*  142 */ "FILL",
  /*  143 */ "VALUE",
  /*  144 */ "NONE",
  /*  145 */ "PREV",
  /*  146 */ "LINEAR",
  /*  147 */ "NEXT",
  /*  148 */ "GROUP",
  /*  149 */ "HAVING",
  /*  150 */ "ORDER",
  /*  151 */ "SLIMIT",
  /*  152 */ "SOFFSET",
  /*  153 */ "LIMIT",
  /*  154 */ "OFFSET",
  /*  155 */ "ASC",
  /*  156 */ "DESC",
  /*  157 */ "NULLS",
  /*  158 */ "FIRST",
  /*  159 */ "LAST",
  /*  160 */ "cmd",
  /*  161 */ "account_options",
852
  /*  162 */ "alter_account_options",
853
  /*  163 */ "literal",
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
  /*  164 */ "alter_account_option",
  /*  165 */ "user_name",
  /*  166 */ "dnode_endpoint",
  /*  167 */ "dnode_host_name",
  /*  168 */ "not_exists_opt",
  /*  169 */ "db_name",
  /*  170 */ "db_options",
  /*  171 */ "exists_opt",
  /*  172 */ "alter_db_options",
  /*  173 */ "alter_db_option",
  /*  174 */ "full_table_name",
  /*  175 */ "column_def_list",
  /*  176 */ "tags_def_opt",
  /*  177 */ "table_options",
  /*  178 */ "multi_create_clause",
  /*  179 */ "tags_def",
  /*  180 */ "multi_drop_clause",
  /*  181 */ "alter_table_clause",
  /*  182 */ "alter_table_options",
  /*  183 */ "column_name",
  /*  184 */ "type_name",
  /*  185 */ "create_subtable_clause",
  /*  186 */ "specific_tags_opt",
  /*  187 */ "literal_list",
  /*  188 */ "drop_table_clause",
  /*  189 */ "col_name_list",
  /*  190 */ "table_name",
  /*  191 */ "column_def",
  /*  192 */ "func_name_list",
  /*  193 */ "alter_table_option",
  /*  194 */ "col_name",
  /*  195 */ "func_name",
  /*  196 */ "function_name",
  /*  197 */ "index_name",
  /*  198 */ "index_options",
  /*  199 */ "func_list",
  /*  200 */ "duration_literal",
  /*  201 */ "sliding_opt",
  /*  202 */ "func",
  /*  203 */ "expression_list",
  /*  204 */ "topic_name",
  /*  205 */ "query_expression",
  /*  206 */ "table_alias",
  /*  207 */ "column_alias",
  /*  208 */ "expression",
  /*  209 */ "column_reference",
  /*  210 */ "subquery",
  /*  211 */ "predicate",
  /*  212 */ "compare_op",
  /*  213 */ "in_op",
  /*  214 */ "in_predicate_value",
  /*  215 */ "boolean_value_expression",
  /*  216 */ "boolean_primary",
  /*  217 */ "common_expression",
  /*  218 */ "from_clause",
  /*  219 */ "table_reference_list",
  /*  220 */ "table_reference",
  /*  221 */ "table_primary",
  /*  222 */ "joined_table",
  /*  223 */ "alias_opt",
  /*  224 */ "parenthesized_joined_table",
  /*  225 */ "join_type",
  /*  226 */ "search_condition",
  /*  227 */ "query_specification",
  /*  228 */ "set_quantifier_opt",
  /*  229 */ "select_list",
  /*  230 */ "where_clause_opt",
  /*  231 */ "partition_by_clause_opt",
  /*  232 */ "twindow_clause_opt",
  /*  233 */ "group_by_clause_opt",
  /*  234 */ "having_clause_opt",
  /*  235 */ "select_sublist",
  /*  236 */ "select_item",
  /*  237 */ "fill_opt",
  /*  238 */ "fill_mode",
  /*  239 */ "group_by_list",
  /*  240 */ "query_expression_body",
  /*  241 */ "order_by_clause_opt",
  /*  242 */ "slimit_clause_opt",
  /*  243 */ "limit_clause_opt",
  /*  244 */ "query_primary",
  /*  245 */ "sort_specification_list",
  /*  246 */ "sort_specification",
  /*  247 */ "ordering_specification_opt",
  /*  248 */ "null_ordering_opt",
939 940 941 942 943 944 945
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */

#ifndef NDEBUG
/* For tracing reduce actions, the names of all rules are required.
*/
static const char *const yyRuleName[] = {
946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 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 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261
 /*   0 */ "cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options",
 /*   1 */ "cmd ::= ALTER ACCOUNT NK_ID alter_account_options",
 /*   2 */ "account_options ::=",
 /*   3 */ "account_options ::= account_options PPS literal",
 /*   4 */ "account_options ::= account_options TSERIES literal",
 /*   5 */ "account_options ::= account_options STORAGE literal",
 /*   6 */ "account_options ::= account_options STREAMS literal",
 /*   7 */ "account_options ::= account_options QTIME literal",
 /*   8 */ "account_options ::= account_options DBS literal",
 /*   9 */ "account_options ::= account_options USERS literal",
 /*  10 */ "account_options ::= account_options CONNS literal",
 /*  11 */ "account_options ::= account_options STATE literal",
 /*  12 */ "alter_account_options ::= alter_account_option",
 /*  13 */ "alter_account_options ::= alter_account_options alter_account_option",
 /*  14 */ "alter_account_option ::= PASS literal",
 /*  15 */ "alter_account_option ::= PPS literal",
 /*  16 */ "alter_account_option ::= TSERIES literal",
 /*  17 */ "alter_account_option ::= STORAGE literal",
 /*  18 */ "alter_account_option ::= STREAMS literal",
 /*  19 */ "alter_account_option ::= QTIME literal",
 /*  20 */ "alter_account_option ::= DBS literal",
 /*  21 */ "alter_account_option ::= USERS literal",
 /*  22 */ "alter_account_option ::= CONNS literal",
 /*  23 */ "alter_account_option ::= STATE literal",
 /*  24 */ "cmd ::= CREATE USER user_name PASS NK_STRING",
 /*  25 */ "cmd ::= ALTER USER user_name PASS NK_STRING",
 /*  26 */ "cmd ::= ALTER USER user_name PRIVILEGE NK_STRING",
 /*  27 */ "cmd ::= DROP USER user_name",
 /*  28 */ "cmd ::= SHOW USERS",
 /*  29 */ "cmd ::= CREATE DNODE dnode_endpoint",
 /*  30 */ "cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER",
 /*  31 */ "cmd ::= DROP DNODE NK_INTEGER",
 /*  32 */ "cmd ::= DROP DNODE dnode_endpoint",
 /*  33 */ "cmd ::= SHOW DNODES",
 /*  34 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING",
 /*  35 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING",
 /*  36 */ "cmd ::= ALTER ALL DNODES NK_STRING",
 /*  37 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING",
 /*  38 */ "dnode_endpoint ::= NK_STRING",
 /*  39 */ "dnode_host_name ::= NK_ID",
 /*  40 */ "dnode_host_name ::= NK_IPTOKEN",
 /*  41 */ "cmd ::= ALTER LOCAL NK_STRING",
 /*  42 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING",
 /*  43 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER",
 /*  44 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER",
 /*  45 */ "cmd ::= SHOW QNODES",
 /*  46 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options",
 /*  47 */ "cmd ::= DROP DATABASE exists_opt db_name",
 /*  48 */ "cmd ::= SHOW DATABASES",
 /*  49 */ "cmd ::= USE db_name",
 /*  50 */ "cmd ::= ALTER DATABASE db_name alter_db_options",
 /*  51 */ "not_exists_opt ::= IF NOT EXISTS",
 /*  52 */ "not_exists_opt ::=",
 /*  53 */ "exists_opt ::= IF EXISTS",
 /*  54 */ "exists_opt ::=",
 /*  55 */ "db_options ::=",
 /*  56 */ "db_options ::= db_options BLOCKS NK_INTEGER",
 /*  57 */ "db_options ::= db_options CACHE NK_INTEGER",
 /*  58 */ "db_options ::= db_options CACHELAST NK_INTEGER",
 /*  59 */ "db_options ::= db_options COMP NK_INTEGER",
 /*  60 */ "db_options ::= db_options DAYS NK_INTEGER",
 /*  61 */ "db_options ::= db_options FSYNC NK_INTEGER",
 /*  62 */ "db_options ::= db_options MAXROWS NK_INTEGER",
 /*  63 */ "db_options ::= db_options MINROWS NK_INTEGER",
 /*  64 */ "db_options ::= db_options KEEP NK_INTEGER",
 /*  65 */ "db_options ::= db_options PRECISION NK_STRING",
 /*  66 */ "db_options ::= db_options QUORUM NK_INTEGER",
 /*  67 */ "db_options ::= db_options REPLICA NK_INTEGER",
 /*  68 */ "db_options ::= db_options TTL NK_INTEGER",
 /*  69 */ "db_options ::= db_options WAL NK_INTEGER",
 /*  70 */ "db_options ::= db_options VGROUPS NK_INTEGER",
 /*  71 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER",
 /*  72 */ "db_options ::= db_options STREAM_MODE NK_INTEGER",
 /*  73 */ "db_options ::= db_options RETENTIONS NK_STRING",
 /*  74 */ "db_options ::= db_options FILE_FACTOR NK_FLOAT",
 /*  75 */ "alter_db_options ::= alter_db_option",
 /*  76 */ "alter_db_options ::= alter_db_options alter_db_option",
 /*  77 */ "alter_db_option ::= BLOCKS NK_INTEGER",
 /*  78 */ "alter_db_option ::= FSYNC NK_INTEGER",
 /*  79 */ "alter_db_option ::= KEEP NK_INTEGER",
 /*  80 */ "alter_db_option ::= WAL NK_INTEGER",
 /*  81 */ "alter_db_option ::= QUORUM NK_INTEGER",
 /*  82 */ "alter_db_option ::= CACHELAST NK_INTEGER",
 /*  83 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options",
 /*  84 */ "cmd ::= CREATE TABLE multi_create_clause",
 /*  85 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options",
 /*  86 */ "cmd ::= DROP TABLE multi_drop_clause",
 /*  87 */ "cmd ::= DROP STABLE exists_opt full_table_name",
 /*  88 */ "cmd ::= SHOW TABLES",
 /*  89 */ "cmd ::= SHOW STABLES",
 /*  90 */ "cmd ::= ALTER TABLE alter_table_clause",
 /*  91 */ "cmd ::= ALTER STABLE alter_table_clause",
 /*  92 */ "alter_table_clause ::= full_table_name alter_table_options",
 /*  93 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name",
 /*  94 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name",
 /*  95 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name",
 /*  96 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
 /*  97 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
 /*  98 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
 /*  99 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
 /* 100 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
 /* 101 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal",
 /* 102 */ "multi_create_clause ::= create_subtable_clause",
 /* 103 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
 /* 104 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP",
 /* 105 */ "multi_drop_clause ::= drop_table_clause",
 /* 106 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause",
 /* 107 */ "drop_table_clause ::= exists_opt full_table_name",
 /* 108 */ "specific_tags_opt ::=",
 /* 109 */ "specific_tags_opt ::= NK_LP col_name_list NK_RP",
 /* 110 */ "full_table_name ::= table_name",
 /* 111 */ "full_table_name ::= db_name NK_DOT table_name",
 /* 112 */ "column_def_list ::= column_def",
 /* 113 */ "column_def_list ::= column_def_list NK_COMMA column_def",
 /* 114 */ "column_def ::= column_name type_name",
 /* 115 */ "column_def ::= column_name type_name COMMENT NK_STRING",
 /* 116 */ "type_name ::= BOOL",
 /* 117 */ "type_name ::= TINYINT",
 /* 118 */ "type_name ::= SMALLINT",
 /* 119 */ "type_name ::= INT",
 /* 120 */ "type_name ::= INTEGER",
 /* 121 */ "type_name ::= BIGINT",
 /* 122 */ "type_name ::= FLOAT",
 /* 123 */ "type_name ::= DOUBLE",
 /* 124 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
 /* 125 */ "type_name ::= TIMESTAMP",
 /* 126 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
 /* 127 */ "type_name ::= TINYINT UNSIGNED",
 /* 128 */ "type_name ::= SMALLINT UNSIGNED",
 /* 129 */ "type_name ::= INT UNSIGNED",
 /* 130 */ "type_name ::= BIGINT UNSIGNED",
 /* 131 */ "type_name ::= JSON",
 /* 132 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
 /* 133 */ "type_name ::= MEDIUMBLOB",
 /* 134 */ "type_name ::= BLOB",
 /* 135 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
 /* 136 */ "type_name ::= DECIMAL",
 /* 137 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
 /* 138 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
 /* 139 */ "tags_def_opt ::=",
 /* 140 */ "tags_def_opt ::= tags_def",
 /* 141 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP",
 /* 142 */ "table_options ::=",
 /* 143 */ "table_options ::= table_options COMMENT NK_STRING",
 /* 144 */ "table_options ::= table_options KEEP NK_INTEGER",
 /* 145 */ "table_options ::= table_options TTL NK_INTEGER",
 /* 146 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
 /* 147 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP",
 /* 148 */ "alter_table_options ::= alter_table_option",
 /* 149 */ "alter_table_options ::= alter_table_options alter_table_option",
 /* 150 */ "alter_table_option ::= COMMENT NK_STRING",
 /* 151 */ "alter_table_option ::= KEEP NK_INTEGER",
 /* 152 */ "alter_table_option ::= TTL NK_INTEGER",
 /* 153 */ "col_name_list ::= col_name",
 /* 154 */ "col_name_list ::= col_name_list NK_COMMA col_name",
 /* 155 */ "col_name ::= column_name",
 /* 156 */ "func_name_list ::= func_name",
 /* 157 */ "func_name_list ::= func_name_list NK_COMMA col_name",
 /* 158 */ "func_name ::= function_name",
 /* 159 */ "cmd ::= CREATE SMA INDEX index_name ON table_name index_options",
 /* 160 */ "cmd ::= CREATE FULLTEXT INDEX index_name ON table_name NK_LP col_name_list NK_RP",
 /* 161 */ "cmd ::= DROP INDEX index_name ON table_name",
 /* 162 */ "index_options ::=",
 /* 163 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt",
 /* 164 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt",
 /* 165 */ "func_list ::= func",
 /* 166 */ "func_list ::= func_list NK_COMMA func",
 /* 167 */ "func ::= function_name NK_LP expression_list NK_RP",
 /* 168 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression",
 /* 169 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name",
 /* 170 */ "cmd ::= DROP TOPIC exists_opt topic_name",
 /* 171 */ "cmd ::= SHOW VGROUPS",
 /* 172 */ "cmd ::= SHOW db_name NK_DOT VGROUPS",
 /* 173 */ "cmd ::= SHOW MNODES",
 /* 174 */ "cmd ::= query_expression",
 /* 175 */ "literal ::= NK_INTEGER",
 /* 176 */ "literal ::= NK_FLOAT",
 /* 177 */ "literal ::= NK_STRING",
 /* 178 */ "literal ::= NK_BOOL",
 /* 179 */ "literal ::= TIMESTAMP NK_STRING",
 /* 180 */ "literal ::= duration_literal",
 /* 181 */ "duration_literal ::= NK_VARIABLE",
 /* 182 */ "literal_list ::= literal",
 /* 183 */ "literal_list ::= literal_list NK_COMMA literal",
 /* 184 */ "db_name ::= NK_ID",
 /* 185 */ "table_name ::= NK_ID",
 /* 186 */ "column_name ::= NK_ID",
 /* 187 */ "function_name ::= NK_ID",
 /* 188 */ "table_alias ::= NK_ID",
 /* 189 */ "column_alias ::= NK_ID",
 /* 190 */ "user_name ::= NK_ID",
 /* 191 */ "index_name ::= NK_ID",
 /* 192 */ "topic_name ::= NK_ID",
 /* 193 */ "expression ::= literal",
 /* 194 */ "expression ::= column_reference",
 /* 195 */ "expression ::= function_name NK_LP expression_list NK_RP",
 /* 196 */ "expression ::= function_name NK_LP NK_STAR NK_RP",
 /* 197 */ "expression ::= subquery",
 /* 198 */ "expression ::= NK_LP expression NK_RP",
 /* 199 */ "expression ::= NK_PLUS expression",
 /* 200 */ "expression ::= NK_MINUS expression",
 /* 201 */ "expression ::= expression NK_PLUS expression",
 /* 202 */ "expression ::= expression NK_MINUS expression",
 /* 203 */ "expression ::= expression NK_STAR expression",
 /* 204 */ "expression ::= expression NK_SLASH expression",
 /* 205 */ "expression ::= expression NK_REM expression",
 /* 206 */ "expression_list ::= expression",
 /* 207 */ "expression_list ::= expression_list NK_COMMA expression",
 /* 208 */ "column_reference ::= column_name",
 /* 209 */ "column_reference ::= table_name NK_DOT column_name",
 /* 210 */ "predicate ::= expression compare_op expression",
 /* 211 */ "predicate ::= expression BETWEEN expression AND expression",
 /* 212 */ "predicate ::= expression NOT BETWEEN expression AND expression",
 /* 213 */ "predicate ::= expression IS NULL",
 /* 214 */ "predicate ::= expression IS NOT NULL",
 /* 215 */ "predicate ::= expression in_op in_predicate_value",
 /* 216 */ "compare_op ::= NK_LT",
 /* 217 */ "compare_op ::= NK_GT",
 /* 218 */ "compare_op ::= NK_LE",
 /* 219 */ "compare_op ::= NK_GE",
 /* 220 */ "compare_op ::= NK_NE",
 /* 221 */ "compare_op ::= NK_EQ",
 /* 222 */ "compare_op ::= LIKE",
 /* 223 */ "compare_op ::= NOT LIKE",
 /* 224 */ "compare_op ::= MATCH",
 /* 225 */ "compare_op ::= NMATCH",
 /* 226 */ "in_op ::= IN",
 /* 227 */ "in_op ::= NOT IN",
 /* 228 */ "in_predicate_value ::= NK_LP expression_list NK_RP",
 /* 229 */ "boolean_value_expression ::= boolean_primary",
 /* 230 */ "boolean_value_expression ::= NOT boolean_primary",
 /* 231 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
 /* 232 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
 /* 233 */ "boolean_primary ::= predicate",
 /* 234 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
 /* 235 */ "common_expression ::= expression",
 /* 236 */ "common_expression ::= boolean_value_expression",
 /* 237 */ "from_clause ::= FROM table_reference_list",
 /* 238 */ "table_reference_list ::= table_reference",
 /* 239 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
 /* 240 */ "table_reference ::= table_primary",
 /* 241 */ "table_reference ::= joined_table",
 /* 242 */ "table_primary ::= table_name alias_opt",
 /* 243 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
 /* 244 */ "table_primary ::= subquery alias_opt",
 /* 245 */ "table_primary ::= parenthesized_joined_table",
 /* 246 */ "alias_opt ::=",
 /* 247 */ "alias_opt ::= table_alias",
 /* 248 */ "alias_opt ::= AS table_alias",
 /* 249 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
 /* 250 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
 /* 251 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
 /* 252 */ "join_type ::=",
 /* 253 */ "join_type ::= INNER",
 /* 254 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
 /* 255 */ "set_quantifier_opt ::=",
 /* 256 */ "set_quantifier_opt ::= DISTINCT",
 /* 257 */ "set_quantifier_opt ::= ALL",
 /* 258 */ "select_list ::= NK_STAR",
 /* 259 */ "select_list ::= select_sublist",
 /* 260 */ "select_sublist ::= select_item",
 /* 261 */ "select_sublist ::= select_sublist NK_COMMA select_item",
 /* 262 */ "select_item ::= common_expression",
 /* 263 */ "select_item ::= common_expression column_alias",
 /* 264 */ "select_item ::= common_expression AS column_alias",
 /* 265 */ "select_item ::= table_name NK_DOT NK_STAR",
 /* 266 */ "where_clause_opt ::=",
 /* 267 */ "where_clause_opt ::= WHERE search_condition",
 /* 268 */ "partition_by_clause_opt ::=",
 /* 269 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
 /* 270 */ "twindow_clause_opt ::=",
 /* 271 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP",
 /* 272 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP",
 /* 273 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
 /* 274 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
 /* 275 */ "sliding_opt ::=",
 /* 276 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
 /* 277 */ "fill_opt ::=",
 /* 278 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
 /* 279 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
 /* 280 */ "fill_mode ::= NONE",
 /* 281 */ "fill_mode ::= PREV",
 /* 282 */ "fill_mode ::= NULL",
 /* 283 */ "fill_mode ::= LINEAR",
 /* 284 */ "fill_mode ::= NEXT",
 /* 285 */ "group_by_clause_opt ::=",
 /* 286 */ "group_by_clause_opt ::= GROUP BY group_by_list",
 /* 287 */ "group_by_list ::= expression",
 /* 288 */ "group_by_list ::= group_by_list NK_COMMA expression",
 /* 289 */ "having_clause_opt ::=",
 /* 290 */ "having_clause_opt ::= HAVING search_condition",
 /* 291 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
 /* 292 */ "query_expression_body ::= query_primary",
 /* 293 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
 /* 294 */ "query_primary ::= query_specification",
 /* 295 */ "order_by_clause_opt ::=",
 /* 296 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
 /* 297 */ "slimit_clause_opt ::=",
 /* 298 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
 /* 299 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
 /* 300 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
 /* 301 */ "limit_clause_opt ::=",
 /* 302 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
 /* 303 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
 /* 304 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
 /* 305 */ "subquery ::= NK_LP query_expression NK_RP",
 /* 306 */ "search_condition ::= common_expression",
 /* 307 */ "sort_specification_list ::= sort_specification",
 /* 308 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
 /* 309 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
 /* 310 */ "ordering_specification_opt ::=",
 /* 311 */ "ordering_specification_opt ::= ASC",
 /* 312 */ "ordering_specification_opt ::= DESC",
 /* 313 */ "null_ordering_opt ::=",
 /* 314 */ "null_ordering_opt ::= NULLS FIRST",
 /* 315 */ "null_ordering_opt ::= NULLS LAST",
1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299
};
#endif /* NDEBUG */


#if YYSTACKDEPTH<=0
/*
** Try to increase the size of the parser stack.  Return the number
** of errors.  Return 0 on success.
*/
static int yyGrowStack(yyParser *p){
  int newSize;
  int idx;
  yyStackEntry *pNew;

  newSize = p->yystksz*2 + 100;
  idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
  if( p->yystack==&p->yystk0 ){
    pNew = malloc(newSize*sizeof(pNew[0]));
    if( pNew ) pNew[0] = p->yystk0;
  }else{
    pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
  }
  if( pNew ){
    p->yystack = pNew;
    p->yytos = &p->yystack[idx];
#ifndef NDEBUG
    if( yyTraceFILE ){
      fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
              yyTracePrompt, p->yystksz, newSize);
    }
#endif
    p->yystksz = newSize;
  }
  return pNew==0; 
}
#endif

/* Datatype of the argument to the memory allocated passed as the
X
Xiaoyu Wang 已提交
1300
** second argument to ParseAlloc() below.  This can be changed by
1301 1302 1303 1304 1305 1306 1307 1308 1309
** putting an appropriate #define in the %include section of the input
** grammar.
*/
#ifndef YYMALLOCARGTYPE
# define YYMALLOCARGTYPE size_t
#endif

/* Initialize a new parser that has already been allocated.
*/
X
Xiaoyu Wang 已提交
1310
void ParseInit(void *yypRawParser ParseCTX_PDECL){
1311
  yyParser *yypParser = (yyParser*)yypRawParser;
X
Xiaoyu Wang 已提交
1312
  ParseCTX_STORE
1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335
#ifdef YYTRACKMAXSTACKDEPTH
  yypParser->yyhwm = 0;
#endif
#if YYSTACKDEPTH<=0
  yypParser->yytos = NULL;
  yypParser->yystack = NULL;
  yypParser->yystksz = 0;
  if( yyGrowStack(yypParser) ){
    yypParser->yystack = &yypParser->yystk0;
    yypParser->yystksz = 1;
  }
#endif
#ifndef YYNOERRORRECOVERY
  yypParser->yyerrcnt = -1;
#endif
  yypParser->yytos = yypParser->yystack;
  yypParser->yystack[0].stateno = 0;
  yypParser->yystack[0].major = 0;
#if YYSTACKDEPTH>0
  yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
#endif
}

X
Xiaoyu Wang 已提交
1336
#ifndef Parse_ENGINEALWAYSONSTACK
1337 1338 1339 1340 1341 1342 1343 1344 1345 1346
/* 
** 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
X
Xiaoyu Wang 已提交
1347
** to Parse and ParseFree.
1348
*/
X
Xiaoyu Wang 已提交
1349
void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){
1350 1351 1352
  yyParser *yypParser;
  yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
  if( yypParser ){
X
Xiaoyu Wang 已提交
1353 1354
    ParseCTX_STORE
    ParseInit(yypParser ParseCTX_PARAM);
1355 1356 1357
  }
  return (void*)yypParser;
}
X
Xiaoyu Wang 已提交
1358
#endif /* Parse_ENGINEALWAYSONSTACK */
1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372


/* 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 */
){
X
Xiaoyu Wang 已提交
1373 1374
  ParseARG_FETCH
  ParseCTX_FETCH
1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387
  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 ***************************************/
      /* Default NON-TERMINAL Destructor */
1388 1389
    case 160: /* cmd */
    case 163: /* literal */
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
    case 170: /* db_options */
    case 172: /* alter_db_options */
    case 174: /* full_table_name */
    case 177: /* table_options */
    case 181: /* alter_table_clause */
    case 182: /* alter_table_options */
    case 185: /* create_subtable_clause */
    case 188: /* drop_table_clause */
    case 191: /* column_def */
    case 194: /* col_name */
    case 195: /* func_name */
    case 198: /* index_options */
    case 200: /* duration_literal */
    case 201: /* sliding_opt */
    case 202: /* func */
    case 205: /* query_expression */
    case 208: /* expression */
    case 209: /* column_reference */
    case 210: /* subquery */
    case 211: /* predicate */
    case 214: /* in_predicate_value */
    case 215: /* boolean_value_expression */
    case 216: /* boolean_primary */
    case 217: /* common_expression */
    case 218: /* from_clause */
    case 219: /* table_reference_list */
    case 220: /* table_reference */
    case 221: /* table_primary */
    case 222: /* joined_table */
    case 224: /* parenthesized_joined_table */
    case 226: /* search_condition */
    case 227: /* query_specification */
    case 230: /* where_clause_opt */
    case 232: /* twindow_clause_opt */
    case 234: /* having_clause_opt */
    case 236: /* select_item */
    case 237: /* fill_opt */
    case 240: /* query_expression_body */
    case 242: /* slimit_clause_opt */
    case 243: /* limit_clause_opt */
    case 244: /* query_primary */
    case 246: /* sort_specification */
1432
{
1433
 nodesDestroyNode((yypminor->yy26)); 
1434 1435
}
      break;
1436
    case 161: /* account_options */
1437 1438
    case 162: /* alter_account_options */
    case 164: /* alter_account_option */
1439
{
1440
 
1441 1442
}
      break;
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454
    case 165: /* user_name */
    case 166: /* dnode_endpoint */
    case 167: /* dnode_host_name */
    case 169: /* db_name */
    case 183: /* column_name */
    case 190: /* table_name */
    case 196: /* function_name */
    case 197: /* index_name */
    case 204: /* topic_name */
    case 206: /* table_alias */
    case 207: /* column_alias */
    case 223: /* alias_opt */
1455
{
1456
 
1457 1458
}
      break;
1459 1460 1461
    case 168: /* not_exists_opt */
    case 171: /* exists_opt */
    case 228: /* set_quantifier_opt */
1462
{
1463 1464 1465
 
}
      break;
1466 1467
    case 173: /* alter_db_option */
    case 193: /* alter_table_option */
1468 1469
{
 
1470 1471
}
      break;
1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489
    case 175: /* column_def_list */
    case 176: /* tags_def_opt */
    case 178: /* multi_create_clause */
    case 179: /* tags_def */
    case 180: /* multi_drop_clause */
    case 186: /* specific_tags_opt */
    case 187: /* literal_list */
    case 189: /* col_name_list */
    case 192: /* func_name_list */
    case 199: /* func_list */
    case 203: /* expression_list */
    case 229: /* select_list */
    case 231: /* partition_by_clause_opt */
    case 233: /* group_by_clause_opt */
    case 235: /* select_sublist */
    case 239: /* group_by_list */
    case 241: /* order_by_clause_opt */
    case 245: /* sort_specification_list */
1490
{
1491
 nodesDestroyList((yypminor->yy64)); 
1492 1493
}
      break;
1494
    case 184: /* type_name */
1495
{
1496
 
1497 1498
}
      break;
1499 1500
    case 212: /* compare_op */
    case 213: /* in_op */
1501
{
1502
 
1503 1504
}
      break;
1505
    case 225: /* join_type */
1506
{
1507
 
1508 1509
}
      break;
1510
    case 238: /* fill_mode */
1511
{
1512
 
1513 1514
}
      break;
1515
    case 247: /* ordering_specification_opt */
1516
{
1517
 
1518 1519
}
      break;
1520
    case 248: /* null_ordering_opt */
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
}
      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;
  assert( pParser->yytos!=0 );
  assert( pParser->yytos > pParser->yystack );
  yytos = pParser->yytos--;
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sPopping %s\n",
      yyTracePrompt,
      yyTokenName[yytos->major]);
  }
#endif
  yy_destructor(pParser, yytos->major, &yytos->minor);
}

/*
** Clear all secondary memory allocations from the parser
*/
X
Xiaoyu Wang 已提交
1554
void ParseFinalize(void *p){
1555 1556 1557 1558 1559 1560 1561
  yyParser *pParser = (yyParser*)p;
  while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
#if YYSTACKDEPTH<=0
  if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
#endif
}

X
Xiaoyu Wang 已提交
1562
#ifndef Parse_ENGINEALWAYSONSTACK
1563 1564 1565 1566 1567 1568 1569 1570
/* 
** 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.
*/
X
Xiaoyu Wang 已提交
1571
void ParseFree(
1572 1573 1574 1575 1576 1577
  void *p,                    /* The parser to be deleted */
  void (*freeProc)(void*)     /* Function used to reclaim memory */
){
#ifndef YYPARSEFREENEVERNULL
  if( p==0 ) return;
#endif
X
Xiaoyu Wang 已提交
1578
  ParseFinalize(p);
1579 1580
  (*freeProc)(p);
}
X
Xiaoyu Wang 已提交
1581
#endif /* Parse_ENGINEALWAYSONSTACK */
1582 1583 1584 1585 1586

/*
** Return the peak depth of the stack for a parser.
*/
#ifdef YYTRACKMAXSTACKDEPTH
X
Xiaoyu Wang 已提交
1587
int ParseStackPeak(void *p){
1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610
  yyParser *pParser = (yyParser*)p;
  return pParser->yyhwm;
}
#endif

/* This array of booleans keeps track of the parser statement
** coverage.  The element yycoverage[X][Y] is set when the parser
** is in state X and has a lookahead token Y.  In a well-tested
** systems, every element of this matrix should end up being set.
*/
#if defined(YYCOVERAGE)
static unsigned char yycoverage[YYNSTATE][YYNTOKEN];
#endif

/*
** Write into out a description of every state/lookahead combination that
**
**   (1)  has not been used by the parser, and
**   (2)  is not a syntax error.
**
** Return the number of missed state/lookahead combinations.
*/
#if defined(YYCOVERAGE)
X
Xiaoyu Wang 已提交
1611
int ParseCoverage(FILE *out){
1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732
  int stateno, iLookAhead, i;
  int nMissed = 0;
  for(stateno=0; stateno<YYNSTATE; stateno++){
    i = yy_shift_ofst[stateno];
    for(iLookAhead=0; iLookAhead<YYNTOKEN; iLookAhead++){
      if( yy_lookahead[i+iLookAhead]!=iLookAhead ) continue;
      if( yycoverage[stateno][iLookAhead]==0 ) nMissed++;
      if( out ){
        fprintf(out,"State %d lookahead %s %s\n", stateno,
                yyTokenName[iLookAhead],
                yycoverage[stateno][iLookAhead] ? "ok" : "missed");
      }
    }
  }
  return nMissed;
}
#endif

/*
** Find the appropriate action for a parser given the terminal
** look-ahead token iLookAhead.
*/
static YYACTIONTYPE yy_find_shift_action(
  YYCODETYPE iLookAhead,    /* The look-ahead token */
  YYACTIONTYPE stateno      /* Current state number */
){
  int i;

  if( stateno>YY_MAX_SHIFT ) return stateno;
  assert( stateno <= YY_SHIFT_COUNT );
#if defined(YYCOVERAGE)
  yycoverage[stateno][iLookAhead] = 1;
#endif
  do{
    i = yy_shift_ofst[stateno];
    assert( i>=0 );
    /* assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); */
    assert( iLookAhead!=YYNOCODE );
    assert( iLookAhead < YYNTOKEN );
    i += iLookAhead;
    if( i>=YY_NLOOKAHEAD || yy_lookahead[i]!=iLookAhead ){
#ifdef YYFALLBACK
      YYCODETYPE iFallback;            /* Fallback token */
      if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
             && (iFallback = yyFallback[iLookAhead])!=0 ){
#ifndef NDEBUG
        if( yyTraceFILE ){
          fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
             yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
        }
#endif
        assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
        iLookAhead = iFallback;
        continue;
      }
#endif
#ifdef YYWILDCARD
      {
        int j = i - iLookAhead + YYWILDCARD;
        if( 
#if YY_SHIFT_MIN+YYWILDCARD<0
          j>=0 &&
#endif
#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
          j<YY_ACTTAB_COUNT &&
#endif
          j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) &&
          yy_lookahead[j]==YYWILDCARD && iLookAhead>0
        ){
#ifndef NDEBUG
          if( yyTraceFILE ){
            fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
               yyTracePrompt, yyTokenName[iLookAhead],
               yyTokenName[YYWILDCARD]);
          }
#endif /* NDEBUG */
          return yy_action[j];
        }
      }
#endif /* YYWILDCARD */
      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 YYACTIONTYPE yy_find_reduce_action(
  YYACTIONTYPE stateno,     /* Current state number */
  YYCODETYPE iLookAhead     /* The look-ahead token */
){
  int i;
#ifdef YYERRORSYMBOL
  if( stateno>YY_REDUCE_COUNT ){
    return yy_default[stateno];
  }
#else
  assert( stateno<=YY_REDUCE_COUNT );
#endif
  i = yy_reduce_ofst[stateno];
  assert( iLookAhead!=YYNOCODE );
  i += iLookAhead;
#ifdef YYERRORSYMBOL
  if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
    return yy_default[stateno];
  }
#else
  assert( i>=0 && i<YY_ACTTAB_COUNT );
  assert( yy_lookahead[i]==iLookAhead );
#endif
  return yy_action[i];
}

/*
** The following routine is called if the stack overflows.
*/
static void yyStackOverflow(yyParser *yypParser){
X
Xiaoyu Wang 已提交
1733 1734
   ParseARG_FETCH
   ParseCTX_FETCH
1735 1736 1737 1738 1739 1740 1741 1742 1743 1744
#ifndef NDEBUG
   if( yyTraceFILE ){
     fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
   }
#endif
   while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
   /* Here code is inserted which will execute if the parser
   ** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
/******** End %stack_overflow code ********************************************/
X
Xiaoyu Wang 已提交
1745 1746
   ParseARG_STORE /* Suppress warning about unused %extra_argument var */
   ParseCTX_STORE
1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776
}

/*
** Print tracing information for a SHIFT action
*/
#ifndef NDEBUG
static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){
  if( yyTraceFILE ){
    if( yyNewState<YYNSTATE ){
      fprintf(yyTraceFILE,"%s%s '%s', go to state %d\n",
         yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
         yyNewState);
    }else{
      fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n",
         yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
         yyNewState - YY_MIN_REDUCE);
    }
  }
}
#else
# define yyTraceShift(X,Y,Z)
#endif

/*
** Perform a shift action.
*/
static void yy_shift(
  yyParser *yypParser,          /* The parser to be shifted */
  YYACTIONTYPE yyNewState,      /* The new state to shift in */
  YYCODETYPE yyMajor,           /* The major token to shift in */
X
Xiaoyu Wang 已提交
1777
  ParseTOKENTYPE yyMinor        /* The minor token to shift in */
1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818
){
  yyStackEntry *yytos;
  yypParser->yytos++;
#ifdef YYTRACKMAXSTACKDEPTH
  if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
    yypParser->yyhwm++;
    assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
  }
#endif
#if YYSTACKDEPTH>0 
  if( yypParser->yytos>yypParser->yystackEnd ){
    yypParser->yytos--;
    yyStackOverflow(yypParser);
    return;
  }
#else
  if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
    if( yyGrowStack(yypParser) ){
      yypParser->yytos--;
      yyStackOverflow(yypParser);
      return;
    }
  }
#endif
  if( yyNewState > YY_MAX_SHIFT ){
    yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
  }
  yytos = yypParser->yytos;
  yytos->stateno = yyNewState;
  yytos->major = yyMajor;
  yytos->minor.yy0 = yyMinor;
  yyTraceShift(yypParser, yyNewState, "Shift");
}

/* The following table contains information about every rule that
** is used during the reduce.
*/
static const struct {
  YYCODETYPE lhs;       /* Symbol on the left-hand side of the rule */
  signed char nrhs;     /* Negative of the number of RHS symbols in the rule */
} yyRuleInfo[] = {
1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134
  {  160,   -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
  {  160,   -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
  {  161,    0 }, /* (2) account_options ::= */
  {  161,   -3 }, /* (3) account_options ::= account_options PPS literal */
  {  161,   -3 }, /* (4) account_options ::= account_options TSERIES literal */
  {  161,   -3 }, /* (5) account_options ::= account_options STORAGE literal */
  {  161,   -3 }, /* (6) account_options ::= account_options STREAMS literal */
  {  161,   -3 }, /* (7) account_options ::= account_options QTIME literal */
  {  161,   -3 }, /* (8) account_options ::= account_options DBS literal */
  {  161,   -3 }, /* (9) account_options ::= account_options USERS literal */
  {  161,   -3 }, /* (10) account_options ::= account_options CONNS literal */
  {  161,   -3 }, /* (11) account_options ::= account_options STATE literal */
  {  162,   -1 }, /* (12) alter_account_options ::= alter_account_option */
  {  162,   -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */
  {  164,   -2 }, /* (14) alter_account_option ::= PASS literal */
  {  164,   -2 }, /* (15) alter_account_option ::= PPS literal */
  {  164,   -2 }, /* (16) alter_account_option ::= TSERIES literal */
  {  164,   -2 }, /* (17) alter_account_option ::= STORAGE literal */
  {  164,   -2 }, /* (18) alter_account_option ::= STREAMS literal */
  {  164,   -2 }, /* (19) alter_account_option ::= QTIME literal */
  {  164,   -2 }, /* (20) alter_account_option ::= DBS literal */
  {  164,   -2 }, /* (21) alter_account_option ::= USERS literal */
  {  164,   -2 }, /* (22) alter_account_option ::= CONNS literal */
  {  164,   -2 }, /* (23) alter_account_option ::= STATE literal */
  {  160,   -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */
  {  160,   -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */
  {  160,   -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */
  {  160,   -3 }, /* (27) cmd ::= DROP USER user_name */
  {  160,   -2 }, /* (28) cmd ::= SHOW USERS */
  {  160,   -3 }, /* (29) cmd ::= CREATE DNODE dnode_endpoint */
  {  160,   -5 }, /* (30) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */
  {  160,   -3 }, /* (31) cmd ::= DROP DNODE NK_INTEGER */
  {  160,   -3 }, /* (32) cmd ::= DROP DNODE dnode_endpoint */
  {  160,   -2 }, /* (33) cmd ::= SHOW DNODES */
  {  160,   -4 }, /* (34) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
  {  160,   -5 }, /* (35) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
  {  160,   -4 }, /* (36) cmd ::= ALTER ALL DNODES NK_STRING */
  {  160,   -5 }, /* (37) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
  {  166,   -1 }, /* (38) dnode_endpoint ::= NK_STRING */
  {  167,   -1 }, /* (39) dnode_host_name ::= NK_ID */
  {  167,   -1 }, /* (40) dnode_host_name ::= NK_IPTOKEN */
  {  160,   -3 }, /* (41) cmd ::= ALTER LOCAL NK_STRING */
  {  160,   -4 }, /* (42) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
  {  160,   -5 }, /* (43) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
  {  160,   -5 }, /* (44) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
  {  160,   -2 }, /* (45) cmd ::= SHOW QNODES */
  {  160,   -5 }, /* (46) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
  {  160,   -4 }, /* (47) cmd ::= DROP DATABASE exists_opt db_name */
  {  160,   -2 }, /* (48) cmd ::= SHOW DATABASES */
  {  160,   -2 }, /* (49) cmd ::= USE db_name */
  {  160,   -4 }, /* (50) cmd ::= ALTER DATABASE db_name alter_db_options */
  {  168,   -3 }, /* (51) not_exists_opt ::= IF NOT EXISTS */
  {  168,    0 }, /* (52) not_exists_opt ::= */
  {  171,   -2 }, /* (53) exists_opt ::= IF EXISTS */
  {  171,    0 }, /* (54) exists_opt ::= */
  {  170,    0 }, /* (55) db_options ::= */
  {  170,   -3 }, /* (56) db_options ::= db_options BLOCKS NK_INTEGER */
  {  170,   -3 }, /* (57) db_options ::= db_options CACHE NK_INTEGER */
  {  170,   -3 }, /* (58) db_options ::= db_options CACHELAST NK_INTEGER */
  {  170,   -3 }, /* (59) db_options ::= db_options COMP NK_INTEGER */
  {  170,   -3 }, /* (60) db_options ::= db_options DAYS NK_INTEGER */
  {  170,   -3 }, /* (61) db_options ::= db_options FSYNC NK_INTEGER */
  {  170,   -3 }, /* (62) db_options ::= db_options MAXROWS NK_INTEGER */
  {  170,   -3 }, /* (63) db_options ::= db_options MINROWS NK_INTEGER */
  {  170,   -3 }, /* (64) db_options ::= db_options KEEP NK_INTEGER */
  {  170,   -3 }, /* (65) db_options ::= db_options PRECISION NK_STRING */
  {  170,   -3 }, /* (66) db_options ::= db_options QUORUM NK_INTEGER */
  {  170,   -3 }, /* (67) db_options ::= db_options REPLICA NK_INTEGER */
  {  170,   -3 }, /* (68) db_options ::= db_options TTL NK_INTEGER */
  {  170,   -3 }, /* (69) db_options ::= db_options WAL NK_INTEGER */
  {  170,   -3 }, /* (70) db_options ::= db_options VGROUPS NK_INTEGER */
  {  170,   -3 }, /* (71) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
  {  170,   -3 }, /* (72) db_options ::= db_options STREAM_MODE NK_INTEGER */
  {  170,   -3 }, /* (73) db_options ::= db_options RETENTIONS NK_STRING */
  {  170,   -3 }, /* (74) db_options ::= db_options FILE_FACTOR NK_FLOAT */
  {  172,   -1 }, /* (75) alter_db_options ::= alter_db_option */
  {  172,   -2 }, /* (76) alter_db_options ::= alter_db_options alter_db_option */
  {  173,   -2 }, /* (77) alter_db_option ::= BLOCKS NK_INTEGER */
  {  173,   -2 }, /* (78) alter_db_option ::= FSYNC NK_INTEGER */
  {  173,   -2 }, /* (79) alter_db_option ::= KEEP NK_INTEGER */
  {  173,   -2 }, /* (80) alter_db_option ::= WAL NK_INTEGER */
  {  173,   -2 }, /* (81) alter_db_option ::= QUORUM NK_INTEGER */
  {  173,   -2 }, /* (82) alter_db_option ::= CACHELAST NK_INTEGER */
  {  160,   -9 }, /* (83) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
  {  160,   -3 }, /* (84) cmd ::= CREATE TABLE multi_create_clause */
  {  160,   -9 }, /* (85) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
  {  160,   -3 }, /* (86) cmd ::= DROP TABLE multi_drop_clause */
  {  160,   -4 }, /* (87) cmd ::= DROP STABLE exists_opt full_table_name */
  {  160,   -2 }, /* (88) cmd ::= SHOW TABLES */
  {  160,   -2 }, /* (89) cmd ::= SHOW STABLES */
  {  160,   -3 }, /* (90) cmd ::= ALTER TABLE alter_table_clause */
  {  160,   -3 }, /* (91) cmd ::= ALTER STABLE alter_table_clause */
  {  181,   -2 }, /* (92) alter_table_clause ::= full_table_name alter_table_options */
  {  181,   -5 }, /* (93) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
  {  181,   -4 }, /* (94) alter_table_clause ::= full_table_name DROP COLUMN column_name */
  {  181,   -5 }, /* (95) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
  {  181,   -5 }, /* (96) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
  {  181,   -5 }, /* (97) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
  {  181,   -4 }, /* (98) alter_table_clause ::= full_table_name DROP TAG column_name */
  {  181,   -5 }, /* (99) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
  {  181,   -5 }, /* (100) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
  {  181,   -6 }, /* (101) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */
  {  178,   -1 }, /* (102) multi_create_clause ::= create_subtable_clause */
  {  178,   -2 }, /* (103) multi_create_clause ::= multi_create_clause create_subtable_clause */
  {  185,   -9 }, /* (104) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */
  {  180,   -1 }, /* (105) multi_drop_clause ::= drop_table_clause */
  {  180,   -2 }, /* (106) multi_drop_clause ::= multi_drop_clause drop_table_clause */
  {  188,   -2 }, /* (107) drop_table_clause ::= exists_opt full_table_name */
  {  186,    0 }, /* (108) specific_tags_opt ::= */
  {  186,   -3 }, /* (109) specific_tags_opt ::= NK_LP col_name_list NK_RP */
  {  174,   -1 }, /* (110) full_table_name ::= table_name */
  {  174,   -3 }, /* (111) full_table_name ::= db_name NK_DOT table_name */
  {  175,   -1 }, /* (112) column_def_list ::= column_def */
  {  175,   -3 }, /* (113) column_def_list ::= column_def_list NK_COMMA column_def */
  {  191,   -2 }, /* (114) column_def ::= column_name type_name */
  {  191,   -4 }, /* (115) column_def ::= column_name type_name COMMENT NK_STRING */
  {  184,   -1 }, /* (116) type_name ::= BOOL */
  {  184,   -1 }, /* (117) type_name ::= TINYINT */
  {  184,   -1 }, /* (118) type_name ::= SMALLINT */
  {  184,   -1 }, /* (119) type_name ::= INT */
  {  184,   -1 }, /* (120) type_name ::= INTEGER */
  {  184,   -1 }, /* (121) type_name ::= BIGINT */
  {  184,   -1 }, /* (122) type_name ::= FLOAT */
  {  184,   -1 }, /* (123) type_name ::= DOUBLE */
  {  184,   -4 }, /* (124) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
  {  184,   -1 }, /* (125) type_name ::= TIMESTAMP */
  {  184,   -4 }, /* (126) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
  {  184,   -2 }, /* (127) type_name ::= TINYINT UNSIGNED */
  {  184,   -2 }, /* (128) type_name ::= SMALLINT UNSIGNED */
  {  184,   -2 }, /* (129) type_name ::= INT UNSIGNED */
  {  184,   -2 }, /* (130) type_name ::= BIGINT UNSIGNED */
  {  184,   -1 }, /* (131) type_name ::= JSON */
  {  184,   -4 }, /* (132) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
  {  184,   -1 }, /* (133) type_name ::= MEDIUMBLOB */
  {  184,   -1 }, /* (134) type_name ::= BLOB */
  {  184,   -4 }, /* (135) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
  {  184,   -1 }, /* (136) type_name ::= DECIMAL */
  {  184,   -4 }, /* (137) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
  {  184,   -6 }, /* (138) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
  {  176,    0 }, /* (139) tags_def_opt ::= */
  {  176,   -1 }, /* (140) tags_def_opt ::= tags_def */
  {  179,   -4 }, /* (141) tags_def ::= TAGS NK_LP column_def_list NK_RP */
  {  177,    0 }, /* (142) table_options ::= */
  {  177,   -3 }, /* (143) table_options ::= table_options COMMENT NK_STRING */
  {  177,   -3 }, /* (144) table_options ::= table_options KEEP NK_INTEGER */
  {  177,   -3 }, /* (145) table_options ::= table_options TTL NK_INTEGER */
  {  177,   -5 }, /* (146) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
  {  177,   -5 }, /* (147) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */
  {  182,   -1 }, /* (148) alter_table_options ::= alter_table_option */
  {  182,   -2 }, /* (149) alter_table_options ::= alter_table_options alter_table_option */
  {  193,   -2 }, /* (150) alter_table_option ::= COMMENT NK_STRING */
  {  193,   -2 }, /* (151) alter_table_option ::= KEEP NK_INTEGER */
  {  193,   -2 }, /* (152) alter_table_option ::= TTL NK_INTEGER */
  {  189,   -1 }, /* (153) col_name_list ::= col_name */
  {  189,   -3 }, /* (154) col_name_list ::= col_name_list NK_COMMA col_name */
  {  194,   -1 }, /* (155) col_name ::= column_name */
  {  192,   -1 }, /* (156) func_name_list ::= func_name */
  {  192,   -3 }, /* (157) func_name_list ::= func_name_list NK_COMMA col_name */
  {  195,   -1 }, /* (158) func_name ::= function_name */
  {  160,   -7 }, /* (159) cmd ::= CREATE SMA INDEX index_name ON table_name index_options */
  {  160,   -9 }, /* (160) cmd ::= CREATE FULLTEXT INDEX index_name ON table_name NK_LP col_name_list NK_RP */
  {  160,   -5 }, /* (161) cmd ::= DROP INDEX index_name ON table_name */
  {  198,    0 }, /* (162) index_options ::= */
  {  198,   -9 }, /* (163) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */
  {  198,  -11 }, /* (164) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */
  {  199,   -1 }, /* (165) func_list ::= func */
  {  199,   -3 }, /* (166) func_list ::= func_list NK_COMMA func */
  {  202,   -4 }, /* (167) func ::= function_name NK_LP expression_list NK_RP */
  {  160,   -6 }, /* (168) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */
  {  160,   -6 }, /* (169) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */
  {  160,   -4 }, /* (170) cmd ::= DROP TOPIC exists_opt topic_name */
  {  160,   -2 }, /* (171) cmd ::= SHOW VGROUPS */
  {  160,   -4 }, /* (172) cmd ::= SHOW db_name NK_DOT VGROUPS */
  {  160,   -2 }, /* (173) cmd ::= SHOW MNODES */
  {  160,   -1 }, /* (174) cmd ::= query_expression */
  {  163,   -1 }, /* (175) literal ::= NK_INTEGER */
  {  163,   -1 }, /* (176) literal ::= NK_FLOAT */
  {  163,   -1 }, /* (177) literal ::= NK_STRING */
  {  163,   -1 }, /* (178) literal ::= NK_BOOL */
  {  163,   -2 }, /* (179) literal ::= TIMESTAMP NK_STRING */
  {  163,   -1 }, /* (180) literal ::= duration_literal */
  {  200,   -1 }, /* (181) duration_literal ::= NK_VARIABLE */
  {  187,   -1 }, /* (182) literal_list ::= literal */
  {  187,   -3 }, /* (183) literal_list ::= literal_list NK_COMMA literal */
  {  169,   -1 }, /* (184) db_name ::= NK_ID */
  {  190,   -1 }, /* (185) table_name ::= NK_ID */
  {  183,   -1 }, /* (186) column_name ::= NK_ID */
  {  196,   -1 }, /* (187) function_name ::= NK_ID */
  {  206,   -1 }, /* (188) table_alias ::= NK_ID */
  {  207,   -1 }, /* (189) column_alias ::= NK_ID */
  {  165,   -1 }, /* (190) user_name ::= NK_ID */
  {  197,   -1 }, /* (191) index_name ::= NK_ID */
  {  204,   -1 }, /* (192) topic_name ::= NK_ID */
  {  208,   -1 }, /* (193) expression ::= literal */
  {  208,   -1 }, /* (194) expression ::= column_reference */
  {  208,   -4 }, /* (195) expression ::= function_name NK_LP expression_list NK_RP */
  {  208,   -4 }, /* (196) expression ::= function_name NK_LP NK_STAR NK_RP */
  {  208,   -1 }, /* (197) expression ::= subquery */
  {  208,   -3 }, /* (198) expression ::= NK_LP expression NK_RP */
  {  208,   -2 }, /* (199) expression ::= NK_PLUS expression */
  {  208,   -2 }, /* (200) expression ::= NK_MINUS expression */
  {  208,   -3 }, /* (201) expression ::= expression NK_PLUS expression */
  {  208,   -3 }, /* (202) expression ::= expression NK_MINUS expression */
  {  208,   -3 }, /* (203) expression ::= expression NK_STAR expression */
  {  208,   -3 }, /* (204) expression ::= expression NK_SLASH expression */
  {  208,   -3 }, /* (205) expression ::= expression NK_REM expression */
  {  203,   -1 }, /* (206) expression_list ::= expression */
  {  203,   -3 }, /* (207) expression_list ::= expression_list NK_COMMA expression */
  {  209,   -1 }, /* (208) column_reference ::= column_name */
  {  209,   -3 }, /* (209) column_reference ::= table_name NK_DOT column_name */
  {  211,   -3 }, /* (210) predicate ::= expression compare_op expression */
  {  211,   -5 }, /* (211) predicate ::= expression BETWEEN expression AND expression */
  {  211,   -6 }, /* (212) predicate ::= expression NOT BETWEEN expression AND expression */
  {  211,   -3 }, /* (213) predicate ::= expression IS NULL */
  {  211,   -4 }, /* (214) predicate ::= expression IS NOT NULL */
  {  211,   -3 }, /* (215) predicate ::= expression in_op in_predicate_value */
  {  212,   -1 }, /* (216) compare_op ::= NK_LT */
  {  212,   -1 }, /* (217) compare_op ::= NK_GT */
  {  212,   -1 }, /* (218) compare_op ::= NK_LE */
  {  212,   -1 }, /* (219) compare_op ::= NK_GE */
  {  212,   -1 }, /* (220) compare_op ::= NK_NE */
  {  212,   -1 }, /* (221) compare_op ::= NK_EQ */
  {  212,   -1 }, /* (222) compare_op ::= LIKE */
  {  212,   -2 }, /* (223) compare_op ::= NOT LIKE */
  {  212,   -1 }, /* (224) compare_op ::= MATCH */
  {  212,   -1 }, /* (225) compare_op ::= NMATCH */
  {  213,   -1 }, /* (226) in_op ::= IN */
  {  213,   -2 }, /* (227) in_op ::= NOT IN */
  {  214,   -3 }, /* (228) in_predicate_value ::= NK_LP expression_list NK_RP */
  {  215,   -1 }, /* (229) boolean_value_expression ::= boolean_primary */
  {  215,   -2 }, /* (230) boolean_value_expression ::= NOT boolean_primary */
  {  215,   -3 }, /* (231) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
  {  215,   -3 }, /* (232) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
  {  216,   -1 }, /* (233) boolean_primary ::= predicate */
  {  216,   -3 }, /* (234) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
  {  217,   -1 }, /* (235) common_expression ::= expression */
  {  217,   -1 }, /* (236) common_expression ::= boolean_value_expression */
  {  218,   -2 }, /* (237) from_clause ::= FROM table_reference_list */
  {  219,   -1 }, /* (238) table_reference_list ::= table_reference */
  {  219,   -3 }, /* (239) table_reference_list ::= table_reference_list NK_COMMA table_reference */
  {  220,   -1 }, /* (240) table_reference ::= table_primary */
  {  220,   -1 }, /* (241) table_reference ::= joined_table */
  {  221,   -2 }, /* (242) table_primary ::= table_name alias_opt */
  {  221,   -4 }, /* (243) table_primary ::= db_name NK_DOT table_name alias_opt */
  {  221,   -2 }, /* (244) table_primary ::= subquery alias_opt */
  {  221,   -1 }, /* (245) table_primary ::= parenthesized_joined_table */
  {  223,    0 }, /* (246) alias_opt ::= */
  {  223,   -1 }, /* (247) alias_opt ::= table_alias */
  {  223,   -2 }, /* (248) alias_opt ::= AS table_alias */
  {  224,   -3 }, /* (249) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
  {  224,   -3 }, /* (250) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
  {  222,   -6 }, /* (251) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
  {  225,    0 }, /* (252) join_type ::= */
  {  225,   -1 }, /* (253) join_type ::= INNER */
  {  227,   -9 }, /* (254) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
  {  228,    0 }, /* (255) set_quantifier_opt ::= */
  {  228,   -1 }, /* (256) set_quantifier_opt ::= DISTINCT */
  {  228,   -1 }, /* (257) set_quantifier_opt ::= ALL */
  {  229,   -1 }, /* (258) select_list ::= NK_STAR */
  {  229,   -1 }, /* (259) select_list ::= select_sublist */
  {  235,   -1 }, /* (260) select_sublist ::= select_item */
  {  235,   -3 }, /* (261) select_sublist ::= select_sublist NK_COMMA select_item */
  {  236,   -1 }, /* (262) select_item ::= common_expression */
  {  236,   -2 }, /* (263) select_item ::= common_expression column_alias */
  {  236,   -3 }, /* (264) select_item ::= common_expression AS column_alias */
  {  236,   -3 }, /* (265) select_item ::= table_name NK_DOT NK_STAR */
  {  230,    0 }, /* (266) where_clause_opt ::= */
  {  230,   -2 }, /* (267) where_clause_opt ::= WHERE search_condition */
  {  231,    0 }, /* (268) partition_by_clause_opt ::= */
  {  231,   -3 }, /* (269) partition_by_clause_opt ::= PARTITION BY expression_list */
  {  232,    0 }, /* (270) twindow_clause_opt ::= */
  {  232,   -6 }, /* (271) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
  {  232,   -4 }, /* (272) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
  {  232,   -6 }, /* (273) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
  {  232,   -8 }, /* (274) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
  {  201,    0 }, /* (275) sliding_opt ::= */
  {  201,   -4 }, /* (276) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
  {  237,    0 }, /* (277) fill_opt ::= */
  {  237,   -4 }, /* (278) fill_opt ::= FILL NK_LP fill_mode NK_RP */
  {  237,   -6 }, /* (279) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
  {  238,   -1 }, /* (280) fill_mode ::= NONE */
  {  238,   -1 }, /* (281) fill_mode ::= PREV */
  {  238,   -1 }, /* (282) fill_mode ::= NULL */
  {  238,   -1 }, /* (283) fill_mode ::= LINEAR */
  {  238,   -1 }, /* (284) fill_mode ::= NEXT */
  {  233,    0 }, /* (285) group_by_clause_opt ::= */
  {  233,   -3 }, /* (286) group_by_clause_opt ::= GROUP BY group_by_list */
  {  239,   -1 }, /* (287) group_by_list ::= expression */
  {  239,   -3 }, /* (288) group_by_list ::= group_by_list NK_COMMA expression */
  {  234,    0 }, /* (289) having_clause_opt ::= */
  {  234,   -2 }, /* (290) having_clause_opt ::= HAVING search_condition */
  {  205,   -4 }, /* (291) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
  {  240,   -1 }, /* (292) query_expression_body ::= query_primary */
  {  240,   -4 }, /* (293) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
  {  244,   -1 }, /* (294) query_primary ::= query_specification */
  {  241,    0 }, /* (295) order_by_clause_opt ::= */
  {  241,   -3 }, /* (296) order_by_clause_opt ::= ORDER BY sort_specification_list */
  {  242,    0 }, /* (297) slimit_clause_opt ::= */
  {  242,   -2 }, /* (298) slimit_clause_opt ::= SLIMIT NK_INTEGER */
  {  242,   -4 }, /* (299) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
  {  242,   -4 }, /* (300) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
  {  243,    0 }, /* (301) limit_clause_opt ::= */
  {  243,   -2 }, /* (302) limit_clause_opt ::= LIMIT NK_INTEGER */
  {  243,   -4 }, /* (303) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
  {  243,   -4 }, /* (304) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
  {  210,   -3 }, /* (305) subquery ::= NK_LP query_expression NK_RP */
  {  226,   -1 }, /* (306) search_condition ::= common_expression */
  {  245,   -1 }, /* (307) sort_specification_list ::= sort_specification */
  {  245,   -3 }, /* (308) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
  {  246,   -3 }, /* (309) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
  {  247,    0 }, /* (310) ordering_specification_opt ::= */
  {  247,   -1 }, /* (311) ordering_specification_opt ::= ASC */
  {  247,   -1 }, /* (312) ordering_specification_opt ::= DESC */
  {  248,    0 }, /* (313) null_ordering_opt ::= */
  {  248,   -2 }, /* (314) null_ordering_opt ::= NULLS FIRST */
  {  248,   -2 }, /* (315) null_ordering_opt ::= NULLS LAST */
2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152
};

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

/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
**
** The yyLookahead and yyLookaheadToken parameters provide reduce actions
** access to the lookahead token (if any).  The yyLookahead will be YYNOCODE
** if the lookahead token has already been consumed.  As this procedure is
** only called from one place, optimizing compilers will in-line it, which
** means that the extra parameters have no performance impact.
*/
static YYACTIONTYPE yy_reduce(
  yyParser *yypParser,         /* The parser */
  unsigned int yyruleno,       /* Number of the rule by which to reduce */
  int yyLookahead,             /* Lookahead token, or YYNOCODE if none */
X
Xiaoyu Wang 已提交
2153 2154
  ParseTOKENTYPE yyLookaheadToken  /* Value of the lookahead token */
  ParseCTX_PDECL                   /* %extra_context */
2155 2156 2157 2158 2159
){
  int yygoto;                     /* The next state */
  YYACTIONTYPE yyact;             /* The next action */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
X
Xiaoyu Wang 已提交
2160
  ParseARG_FETCH
2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220
  (void)yyLookahead;
  (void)yyLookaheadToken;
  yymsp = yypParser->yytos;
#ifndef NDEBUG
  if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
    yysize = yyRuleInfo[yyruleno].nrhs;
    if( yysize ){
      fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n",
        yyTracePrompt,
        yyruleno, yyRuleName[yyruleno], yymsp[yysize].stateno);
    }else{
      fprintf(yyTraceFILE, "%sReduce %d [%s].\n",
        yyTracePrompt, yyruleno, yyRuleName[yyruleno]);
    }
  }
#endif /* NDEBUG */

  /* Check that the stack is large enough to grow by a single entry
  ** if the RHS of the rule is empty.  This ensures that there is room
  ** enough on the stack to push the LHS value */
  if( yyRuleInfo[yyruleno].nrhs==0 ){
#ifdef YYTRACKMAXSTACKDEPTH
    if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
      yypParser->yyhwm++;
      assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack));
    }
#endif
#if YYSTACKDEPTH>0 
    if( yypParser->yytos>=yypParser->yystackEnd ){
      yyStackOverflow(yypParser);
      /* The call to yyStackOverflow() above pops the stack until it is
      ** empty, causing the main parser loop to exit.  So the return value
      ** is never used and does not matter. */
      return 0;
    }
#else
    if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
      if( yyGrowStack(yypParser) ){
        yyStackOverflow(yypParser);
        /* The call to yyStackOverflow() above pops the stack until it is
        ** empty, causing the main parser loop to exit.  So the return value
        ** is never used and does not matter. */
        return 0;
      }
      yymsp = yypParser->yytos;
    }
#endif
  }

  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 **********************************************/
        YYMINORTYPE yylhsminor;
2221
      case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
2222 2223 2224
{ pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
  yy_destructor(yypParser,161,&yymsp[0].minor);
        break;
2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241
      case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
{ pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
  yy_destructor(yypParser,162,&yymsp[0].minor);
        break;
      case 2: /* account_options ::= */
{ }
        break;
      case 3: /* account_options ::= account_options PPS literal */
      case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4);
      case 5: /* account_options ::= account_options STORAGE literal */ yytestcase(yyruleno==5);
      case 6: /* account_options ::= account_options STREAMS literal */ yytestcase(yyruleno==6);
      case 7: /* account_options ::= account_options QTIME literal */ yytestcase(yyruleno==7);
      case 8: /* account_options ::= account_options DBS literal */ yytestcase(yyruleno==8);
      case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9);
      case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10);
      case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11);
{  yy_destructor(yypParser,161,&yymsp[-2].minor);
2242
{ }
2243
  yy_destructor(yypParser,163,&yymsp[0].minor);
2244
}
2245
        break;
2246 2247
      case 12: /* alter_account_options ::= alter_account_option */
{  yy_destructor(yypParser,164,&yymsp[0].minor);
2248 2249 2250
{ }
}
        break;
2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266
      case 13: /* alter_account_options ::= alter_account_options alter_account_option */
{  yy_destructor(yypParser,162,&yymsp[-1].minor);
{ }
  yy_destructor(yypParser,164,&yymsp[0].minor);
}
        break;
      case 14: /* alter_account_option ::= PASS literal */
      case 15: /* alter_account_option ::= PPS literal */ yytestcase(yyruleno==15);
      case 16: /* alter_account_option ::= TSERIES literal */ yytestcase(yyruleno==16);
      case 17: /* alter_account_option ::= STORAGE literal */ yytestcase(yyruleno==17);
      case 18: /* alter_account_option ::= STREAMS literal */ yytestcase(yyruleno==18);
      case 19: /* alter_account_option ::= QTIME literal */ yytestcase(yyruleno==19);
      case 20: /* alter_account_option ::= DBS literal */ yytestcase(yyruleno==20);
      case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21);
      case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22);
      case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23);
2267 2268 2269
{ }
  yy_destructor(yypParser,163,&yymsp[0].minor);
        break;
2270 2271
      case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */
{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0); }
2272
        break;
2273 2274
      case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */
{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy353, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
2275
        break;
2276 2277
      case 26: /* cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */
{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy353, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); }
2278
        break;
2279 2280
      case 27: /* cmd ::= DROP USER user_name */
{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy353); }
2281
        break;
2282
      case 28: /* cmd ::= SHOW USERS */
2283
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT, NULL); }
2284
        break;
2285 2286
      case 29: /* cmd ::= CREATE DNODE dnode_endpoint */
{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy353, NULL); }
2287
        break;
2288 2289
      case 30: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */
{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0); }
2290
        break;
2291
      case 31: /* cmd ::= DROP DNODE NK_INTEGER */
2292
{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); }
2293
        break;
2294 2295
      case 32: /* cmd ::= DROP DNODE dnode_endpoint */
{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy353); }
2296
        break;
2297
      case 33: /* cmd ::= SHOW DNODES */
2298
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL); }
2299
        break;
2300
      case 34: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
2301 2302
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
        break;
2303
      case 35: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
2304 2305
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
        break;
2306
      case 36: /* cmd ::= ALTER ALL DNODES NK_STRING */
2307 2308
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); }
        break;
2309
      case 37: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
2310 2311
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
        break;
2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327
      case 38: /* dnode_endpoint ::= NK_STRING */
      case 39: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==39);
      case 40: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==40);
      case 184: /* db_name ::= NK_ID */ yytestcase(yyruleno==184);
      case 185: /* table_name ::= NK_ID */ yytestcase(yyruleno==185);
      case 186: /* column_name ::= NK_ID */ yytestcase(yyruleno==186);
      case 187: /* function_name ::= NK_ID */ yytestcase(yyruleno==187);
      case 188: /* table_alias ::= NK_ID */ yytestcase(yyruleno==188);
      case 189: /* column_alias ::= NK_ID */ yytestcase(yyruleno==189);
      case 190: /* user_name ::= NK_ID */ yytestcase(yyruleno==190);
      case 191: /* index_name ::= NK_ID */ yytestcase(yyruleno==191);
      case 192: /* topic_name ::= NK_ID */ yytestcase(yyruleno==192);
{ yylhsminor.yy353 = yymsp[0].minor.yy0; }
  yymsp[0].minor.yy353 = yylhsminor.yy353;
        break;
      case 41: /* cmd ::= ALTER LOCAL NK_STRING */
2328 2329
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
        break;
2330
      case 42: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */
2331 2332
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
        break;
2333
      case 43: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
X
Xiaoyu Wang 已提交
2334 2335
{ pCxt->pRootNode = createCreateQnodeStmt(pCxt, &yymsp[0].minor.yy0); }
        break;
2336
      case 44: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */
2337 2338
{ pCxt->pRootNode = createDropQnodeStmt(pCxt, &yymsp[0].minor.yy0); }
        break;
2339
      case 45: /* cmd ::= SHOW QNODES */
X
Xiaoyu Wang 已提交
2340 2341
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT, NULL); }
        break;
2342 2343
      case 46: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy107, &yymsp[-1].minor.yy353, yymsp[0].minor.yy26); }
X
Xiaoyu Wang 已提交
2344
        break;
2345 2346
      case 47: /* cmd ::= DROP DATABASE exists_opt db_name */
{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy107, &yymsp[0].minor.yy353); }
X
Xiaoyu Wang 已提交
2347
        break;
2348
      case 48: /* cmd ::= SHOW DATABASES */
2349
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL); }
2350
        break;
2351 2352
      case 49: /* cmd ::= USE db_name */
{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy353); }
2353
        break;
2354 2355
      case 50: /* cmd ::= ALTER DATABASE db_name alter_db_options */
{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy353, yymsp[0].minor.yy26); }
2356
        break;
2357 2358
      case 51: /* not_exists_opt ::= IF NOT EXISTS */
{ yymsp[-2].minor.yy107 = true; }
2359
        break;
2360 2361 2362 2363
      case 52: /* not_exists_opt ::= */
      case 54: /* exists_opt ::= */ yytestcase(yyruleno==54);
      case 255: /* set_quantifier_opt ::= */ yytestcase(yyruleno==255);
{ yymsp[1].minor.yy107 = false; }
2364
        break;
2365 2366
      case 53: /* exists_opt ::= IF EXISTS */
{ yymsp[-1].minor.yy107 = true; }
2367
        break;
2368 2369
      case 55: /* db_options ::= */
{ yymsp[1].minor.yy26 = createDefaultDatabaseOptions(pCxt); }
2370
        break;
2371 2372 2373
      case 56: /* db_options ::= db_options BLOCKS NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2374
        break;
2375 2376 2377
      case 57: /* db_options ::= db_options CACHE NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_CACHE, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2378
        break;
2379 2380 2381
      case 58: /* db_options ::= db_options CACHELAST NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2382
        break;
2383 2384 2385
      case 59: /* db_options ::= db_options COMP NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2386
        break;
2387 2388 2389
      case 60: /* db_options ::= db_options DAYS NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2390
        break;
2391 2392 2393
      case 61: /* db_options ::= db_options FSYNC NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2394
        break;
2395 2396 2397
      case 62: /* db_options ::= db_options MAXROWS NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2398
        break;
2399 2400 2401
      case 63: /* db_options ::= db_options MINROWS NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2402
        break;
2403 2404 2405
      case 64: /* db_options ::= db_options KEEP NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_KEEP, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2406
        break;
2407 2408 2409
      case 65: /* db_options ::= db_options PRECISION NK_STRING */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2410
        break;
2411 2412 2413
      case 66: /* db_options ::= db_options QUORUM NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2414
        break;
2415 2416 2417
      case 67: /* db_options ::= db_options REPLICA NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2418
        break;
2419 2420 2421
      case 68: /* db_options ::= db_options TTL NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_TTL, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2422
        break;
2423 2424 2425
      case 69: /* db_options ::= db_options WAL NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2426
        break;
2427 2428 2429
      case 70: /* db_options ::= db_options VGROUPS NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2430
        break;
2431 2432 2433
      case 71: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2434
        break;
2435 2436 2437
      case 72: /* db_options ::= db_options STREAM_MODE NK_INTEGER */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_STREAM_MODE, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2438
        break;
2439 2440 2441
      case 73: /* db_options ::= db_options RETENTIONS NK_STRING */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_RETENTIONS, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2442
        break;
2443 2444 2445
      case 74: /* db_options ::= db_options FILE_FACTOR NK_FLOAT */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-2].minor.yy26, DB_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2446
        break;
2447 2448 2449
      case 75: /* alter_db_options ::= alter_db_option */
{ yylhsminor.yy26 = createDefaultAlterDatabaseOptions(pCxt); yylhsminor.yy26 = setDatabaseOption(pCxt, yylhsminor.yy26, yymsp[0].minor.yy443.type, &yymsp[0].minor.yy443.val); }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
2450
        break;
2451 2452 2453
      case 76: /* alter_db_options ::= alter_db_options alter_db_option */
{ yylhsminor.yy26 = setDatabaseOption(pCxt, yymsp[-1].minor.yy26, yymsp[0].minor.yy443.type, &yymsp[0].minor.yy443.val); }
  yymsp[-1].minor.yy26 = yylhsminor.yy26;
2454
        break;
2455 2456
      case 77: /* alter_db_option ::= BLOCKS NK_INTEGER */
{ yymsp[-1].minor.yy443.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; }
2457
        break;
2458 2459
      case 78: /* alter_db_option ::= FSYNC NK_INTEGER */
{ yymsp[-1].minor.yy443.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; }
2460
        break;
2461 2462
      case 79: /* alter_db_option ::= KEEP NK_INTEGER */
{ yymsp[-1].minor.yy443.type = DB_OPTION_KEEP; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; }
2463
        break;
2464 2465
      case 80: /* alter_db_option ::= WAL NK_INTEGER */
{ yymsp[-1].minor.yy443.type = DB_OPTION_WAL; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; }
2466
        break;
2467 2468
      case 81: /* alter_db_option ::= QUORUM NK_INTEGER */
{ yymsp[-1].minor.yy443.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; }
2469
        break;
2470 2471
      case 82: /* alter_db_option ::= CACHELAST NK_INTEGER */
{ yymsp[-1].minor.yy443.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; }
2472
        break;
2473 2474 2475
      case 83: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
      case 85: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==85);
{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy107, yymsp[-5].minor.yy26, yymsp[-3].minor.yy64, yymsp[-1].minor.yy64, yymsp[0].minor.yy26); }
2476
        break;
2477 2478
      case 84: /* cmd ::= CREATE TABLE multi_create_clause */
{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy64); }
2479
        break;
2480 2481
      case 86: /* cmd ::= DROP TABLE multi_drop_clause */
{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy64); }
2482
        break;
2483 2484
      case 87: /* cmd ::= DROP STABLE exists_opt full_table_name */
{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy107, yymsp[0].minor.yy26); }
2485
        break;
2486
      case 88: /* cmd ::= SHOW TABLES */
2487
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, NULL); }
2488
        break;
2489
      case 89: /* cmd ::= SHOW STABLES */
2490 2491
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, NULL); }
        break;
2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505
      case 90: /* cmd ::= ALTER TABLE alter_table_clause */
      case 91: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==91);
      case 174: /* cmd ::= query_expression */ yytestcase(yyruleno==174);
{ pCxt->pRootNode = yymsp[0].minor.yy26; }
        break;
      case 92: /* alter_table_clause ::= full_table_name alter_table_options */
{ yylhsminor.yy26 = createAlterTableOption(pCxt, yymsp[-1].minor.yy26, yymsp[0].minor.yy26); }
  yymsp[-1].minor.yy26 = yylhsminor.yy26;
        break;
      case 93: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
{ yylhsminor.yy26 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy26, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy353, yymsp[0].minor.yy370); }
  yymsp[-4].minor.yy26 = yylhsminor.yy26;
        break;
      case 94: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
X
Xiaoyu Wang 已提交
2506
{ yylhsminor.yy26 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy26, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy353); }
2507 2508
  yymsp[-3].minor.yy26 = yylhsminor.yy26;
        break;
X
Xiaoyu Wang 已提交
2509 2510 2511 2512
      case 95: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
{ yylhsminor.yy26 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy26, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy353, yymsp[0].minor.yy370); }
  yymsp[-4].minor.yy26 = yylhsminor.yy26;
        break;
2513
      case 96: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
X
Xiaoyu Wang 已提交
2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530
{ yylhsminor.yy26 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy26, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); }
  yymsp[-4].minor.yy26 = yylhsminor.yy26;
        break;
      case 97: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
{ yylhsminor.yy26 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy26, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy353, yymsp[0].minor.yy370); }
  yymsp[-4].minor.yy26 = yylhsminor.yy26;
        break;
      case 98: /* alter_table_clause ::= full_table_name DROP TAG column_name */
{ yylhsminor.yy26 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy26, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy353); }
  yymsp[-3].minor.yy26 = yylhsminor.yy26;
        break;
      case 99: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
{ yylhsminor.yy26 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy26, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy353, yymsp[0].minor.yy370); }
  yymsp[-4].minor.yy26 = yylhsminor.yy26;
        break;
      case 100: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
{ yylhsminor.yy26 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy26, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); }
2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546
  yymsp[-4].minor.yy26 = yylhsminor.yy26;
        break;
      case 101: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */
{ yylhsminor.yy26 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy26, &yymsp[-2].minor.yy353, yymsp[0].minor.yy26); }
  yymsp[-5].minor.yy26 = yylhsminor.yy26;
        break;
      case 102: /* multi_create_clause ::= create_subtable_clause */
      case 105: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==105);
      case 112: /* column_def_list ::= column_def */ yytestcase(yyruleno==112);
      case 153: /* col_name_list ::= col_name */ yytestcase(yyruleno==153);
      case 156: /* func_name_list ::= func_name */ yytestcase(yyruleno==156);
      case 165: /* func_list ::= func */ yytestcase(yyruleno==165);
      case 260: /* select_sublist ::= select_item */ yytestcase(yyruleno==260);
      case 307: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==307);
{ yylhsminor.yy64 = createNodeList(pCxt, yymsp[0].minor.yy26); }
  yymsp[0].minor.yy64 = yylhsminor.yy64;
2547
        break;
2548 2549 2550 2551
      case 103: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
      case 106: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==106);
{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-1].minor.yy64, yymsp[0].minor.yy26); }
  yymsp[-1].minor.yy64 = yylhsminor.yy64;
2552
        break;
2553 2554 2555
      case 104: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */
{ yylhsminor.yy26 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy107, yymsp[-7].minor.yy26, yymsp[-5].minor.yy26, yymsp[-4].minor.yy64, yymsp[-1].minor.yy64); }
  yymsp[-8].minor.yy26 = yylhsminor.yy26;
2556
        break;
2557 2558 2559
      case 107: /* drop_table_clause ::= exists_opt full_table_name */
{ yylhsminor.yy26 = createDropTableClause(pCxt, yymsp[-1].minor.yy107, yymsp[0].minor.yy26); }
  yymsp[-1].minor.yy26 = yylhsminor.yy26;
2560
        break;
2561 2562 2563 2564 2565 2566
      case 108: /* specific_tags_opt ::= */
      case 139: /* tags_def_opt ::= */ yytestcase(yyruleno==139);
      case 268: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==268);
      case 285: /* group_by_clause_opt ::= */ yytestcase(yyruleno==285);
      case 295: /* order_by_clause_opt ::= */ yytestcase(yyruleno==295);
{ yymsp[1].minor.yy64 = NULL; }
2567
        break;
2568 2569
      case 109: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */
{ yymsp[-2].minor.yy64 = yymsp[-1].minor.yy64; }
2570
        break;
2571 2572 2573
      case 110: /* full_table_name ::= table_name */
{ yylhsminor.yy26 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy353, NULL); }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
2574
        break;
2575 2576 2577
      case 111: /* full_table_name ::= db_name NK_DOT table_name */
{ yylhsminor.yy26 = createRealTableNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353, NULL); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2578
        break;
2579 2580 2581 2582 2583 2584 2585 2586
      case 113: /* column_def_list ::= column_def_list NK_COMMA column_def */
      case 154: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==154);
      case 157: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==157);
      case 166: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==166);
      case 261: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==261);
      case 308: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==308);
{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, yymsp[0].minor.yy26); }
  yymsp[-2].minor.yy64 = yylhsminor.yy64;
2587
        break;
2588 2589 2590
      case 114: /* column_def ::= column_name type_name */
{ yylhsminor.yy26 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy353, yymsp[0].minor.yy370, NULL); }
  yymsp[-1].minor.yy26 = yylhsminor.yy26;
2591
        break;
2592 2593 2594
      case 115: /* column_def ::= column_name type_name COMMENT NK_STRING */
{ yylhsminor.yy26 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy353, yymsp[-2].minor.yy370, &yymsp[0].minor.yy0); }
  yymsp[-3].minor.yy26 = yylhsminor.yy26;
2595
        break;
2596 2597
      case 116: /* type_name ::= BOOL */
{ yymsp[0].minor.yy370 = createDataType(TSDB_DATA_TYPE_BOOL); }
2598
        break;
2599 2600
      case 117: /* type_name ::= TINYINT */
{ yymsp[0].minor.yy370 = createDataType(TSDB_DATA_TYPE_TINYINT); }
2601
        break;
2602 2603
      case 118: /* type_name ::= SMALLINT */
{ yymsp[0].minor.yy370 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
2604
        break;
2605 2606 2607
      case 119: /* type_name ::= INT */
      case 120: /* type_name ::= INTEGER */ yytestcase(yyruleno==120);
{ yymsp[0].minor.yy370 = createDataType(TSDB_DATA_TYPE_INT); }
2608
        break;
2609 2610
      case 121: /* type_name ::= BIGINT */
{ yymsp[0].minor.yy370 = createDataType(TSDB_DATA_TYPE_BIGINT); }
2611
        break;
2612 2613
      case 122: /* type_name ::= FLOAT */
{ yymsp[0].minor.yy370 = createDataType(TSDB_DATA_TYPE_FLOAT); }
2614
        break;
2615 2616
      case 123: /* type_name ::= DOUBLE */
{ yymsp[0].minor.yy370 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
2617
        break;
2618 2619
      case 124: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
{ yymsp[-3].minor.yy370 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
2620
        break;
2621 2622
      case 125: /* type_name ::= TIMESTAMP */
{ yymsp[0].minor.yy370 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
2623
        break;
2624 2625
      case 126: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
{ yymsp[-3].minor.yy370 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
2626
        break;
2627 2628
      case 127: /* type_name ::= TINYINT UNSIGNED */
{ yymsp[-1].minor.yy370 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
2629
        break;
2630 2631
      case 128: /* type_name ::= SMALLINT UNSIGNED */
{ yymsp[-1].minor.yy370 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
2632
        break;
2633 2634
      case 129: /* type_name ::= INT UNSIGNED */
{ yymsp[-1].minor.yy370 = createDataType(TSDB_DATA_TYPE_UINT); }
2635
        break;
2636 2637
      case 130: /* type_name ::= BIGINT UNSIGNED */
{ yymsp[-1].minor.yy370 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
2638
        break;
2639 2640
      case 131: /* type_name ::= JSON */
{ yymsp[0].minor.yy370 = createDataType(TSDB_DATA_TYPE_JSON); }
2641
        break;
2642 2643
      case 132: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
{ yymsp[-3].minor.yy370 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
2644
        break;
2645 2646
      case 133: /* type_name ::= MEDIUMBLOB */
{ yymsp[0].minor.yy370 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
2647
        break;
2648 2649
      case 134: /* type_name ::= BLOB */
{ yymsp[0].minor.yy370 = createDataType(TSDB_DATA_TYPE_BLOB); }
2650
        break;
2651 2652
      case 135: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
{ yymsp[-3].minor.yy370 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
2653
        break;
2654 2655
      case 136: /* type_name ::= DECIMAL */
{ yymsp[0].minor.yy370 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
2656
        break;
2657 2658
      case 137: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
{ yymsp[-3].minor.yy370 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
2659
        break;
2660 2661
      case 138: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
{ yymsp[-5].minor.yy370 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
2662
        break;
2663 2664 2665 2666
      case 140: /* tags_def_opt ::= tags_def */
      case 259: /* select_list ::= select_sublist */ yytestcase(yyruleno==259);
{ yylhsminor.yy64 = yymsp[0].minor.yy64; }
  yymsp[0].minor.yy64 = yylhsminor.yy64;
2667
        break;
2668 2669
      case 141: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
{ yymsp[-3].minor.yy64 = yymsp[-1].minor.yy64; }
2670
        break;
2671 2672
      case 142: /* table_options ::= */
{ yymsp[1].minor.yy26 = createDefaultTableOptions(pCxt); }
2673
        break;
2674 2675 2676
      case 143: /* table_options ::= table_options COMMENT NK_STRING */
{ yylhsminor.yy26 = setTableOption(pCxt, yymsp[-2].minor.yy26, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2677
        break;
2678 2679 2680
      case 144: /* table_options ::= table_options KEEP NK_INTEGER */
{ yylhsminor.yy26 = setTableOption(pCxt, yymsp[-2].minor.yy26, TABLE_OPTION_KEEP, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2681
        break;
2682 2683 2684
      case 145: /* table_options ::= table_options TTL NK_INTEGER */
{ yylhsminor.yy26 = setTableOption(pCxt, yymsp[-2].minor.yy26, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2685
        break;
2686 2687 2688
      case 146: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
{ yylhsminor.yy26 = setTableSmaOption(pCxt, yymsp[-4].minor.yy26, yymsp[-1].minor.yy64); }
  yymsp[-4].minor.yy26 = yylhsminor.yy26;
2689
        break;
2690 2691 2692
      case 147: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */
{ yylhsminor.yy26 = setTableRollupOption(pCxt, yymsp[-4].minor.yy26, yymsp[-1].minor.yy64); }
  yymsp[-4].minor.yy26 = yylhsminor.yy26;
2693
        break;
2694 2695 2696
      case 148: /* alter_table_options ::= alter_table_option */
{ yylhsminor.yy26 = createDefaultAlterTableOptions(pCxt); yylhsminor.yy26 = setTableOption(pCxt, yylhsminor.yy26, yymsp[0].minor.yy443.type, &yymsp[0].minor.yy443.val); }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
2697
        break;
2698 2699 2700
      case 149: /* alter_table_options ::= alter_table_options alter_table_option */
{ yylhsminor.yy26 = setTableOption(pCxt, yymsp[-1].minor.yy26, yymsp[0].minor.yy443.type, &yymsp[0].minor.yy443.val); }
  yymsp[-1].minor.yy26 = yylhsminor.yy26;
2701
        break;
2702 2703
      case 150: /* alter_table_option ::= COMMENT NK_STRING */
{ yymsp[-1].minor.yy443.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; }
2704
        break;
2705 2706
      case 151: /* alter_table_option ::= KEEP NK_INTEGER */
{ yymsp[-1].minor.yy443.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; }
2707
        break;
2708 2709
      case 152: /* alter_table_option ::= TTL NK_INTEGER */
{ yymsp[-1].minor.yy443.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; }
2710
        break;
2711 2712 2713
      case 155: /* col_name ::= column_name */
{ yylhsminor.yy26 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy353); }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
2714
        break;
2715 2716 2717
      case 158: /* func_name ::= function_name */
{ yylhsminor.yy26 = createFunctionNode(pCxt, &yymsp[0].minor.yy353, NULL); }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
2718
        break;
2719 2720
      case 159: /* cmd ::= CREATE SMA INDEX index_name ON table_name index_options */
{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, &yymsp[-3].minor.yy353, &yymsp[-1].minor.yy353, NULL, yymsp[0].minor.yy26); }
X
Xiaoyu Wang 已提交
2721
        break;
2722 2723
      case 160: /* cmd ::= CREATE FULLTEXT INDEX index_name ON table_name NK_LP col_name_list NK_RP */
{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, &yymsp[-5].minor.yy353, &yymsp[-3].minor.yy353, yymsp[-1].minor.yy64, NULL); }
2724
        break;
2725 2726
      case 161: /* cmd ::= DROP INDEX index_name ON table_name */
{ pCxt->pRootNode = createDropIndexStmt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353); }
X
Xiaoyu Wang 已提交
2727
        break;
2728 2729 2730 2731 2732 2733 2734 2735 2736
      case 162: /* index_options ::= */
      case 266: /* where_clause_opt ::= */ yytestcase(yyruleno==266);
      case 270: /* twindow_clause_opt ::= */ yytestcase(yyruleno==270);
      case 275: /* sliding_opt ::= */ yytestcase(yyruleno==275);
      case 277: /* fill_opt ::= */ yytestcase(yyruleno==277);
      case 289: /* having_clause_opt ::= */ yytestcase(yyruleno==289);
      case 297: /* slimit_clause_opt ::= */ yytestcase(yyruleno==297);
      case 301: /* limit_clause_opt ::= */ yytestcase(yyruleno==301);
{ yymsp[1].minor.yy26 = NULL; }
X
Xiaoyu Wang 已提交
2737
        break;
2738 2739
      case 163: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */
{ yymsp[-8].minor.yy26 = createIndexOption(pCxt, yymsp[-6].minor.yy64, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), NULL, yymsp[0].minor.yy26); }
X
Xiaoyu Wang 已提交
2740
        break;
2741 2742
      case 164: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */
{ yymsp[-10].minor.yy26 = createIndexOption(pCxt, yymsp[-8].minor.yy64, releaseRawExprNode(pCxt, yymsp[-4].minor.yy26), releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), yymsp[0].minor.yy26); }
X
Xiaoyu Wang 已提交
2743
        break;
2744 2745 2746
      case 167: /* func ::= function_name NK_LP expression_list NK_RP */
{ yylhsminor.yy26 = createFunctionNode(pCxt, &yymsp[-3].minor.yy353, yymsp[-1].minor.yy64); }
  yymsp[-3].minor.yy26 = yylhsminor.yy26;
X
Xiaoyu Wang 已提交
2747
        break;
2748 2749
      case 168: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */
{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy107, &yymsp[-2].minor.yy353, yymsp[0].minor.yy26, NULL); }
2750
        break;
2751 2752
      case 169: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */
{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy107, &yymsp[-2].minor.yy353, NULL, &yymsp[0].minor.yy353); }
2753
        break;
2754 2755
      case 170: /* cmd ::= DROP TOPIC exists_opt topic_name */
{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy107, &yymsp[0].minor.yy353); }
2756
        break;
2757
      case 171: /* cmd ::= SHOW VGROUPS */
2758 2759
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, NULL); }
        break;
2760 2761
      case 172: /* cmd ::= SHOW db_name NK_DOT VGROUPS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, &yymsp[-2].minor.yy353); }
X
Xiaoyu Wang 已提交
2762
        break;
2763
      case 173: /* cmd ::= SHOW MNODES */
X
Xiaoyu Wang 已提交
2764 2765
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL); }
        break;
2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830
      case 175: /* literal ::= NK_INTEGER */
{ yylhsminor.yy26 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
        break;
      case 176: /* literal ::= NK_FLOAT */
{ yylhsminor.yy26 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
        break;
      case 177: /* literal ::= NK_STRING */
{ yylhsminor.yy26 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
        break;
      case 178: /* literal ::= NK_BOOL */
{ yylhsminor.yy26 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
        break;
      case 179: /* literal ::= TIMESTAMP NK_STRING */
{ yylhsminor.yy26 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
  yymsp[-1].minor.yy26 = yylhsminor.yy26;
        break;
      case 180: /* literal ::= duration_literal */
      case 193: /* expression ::= literal */ yytestcase(yyruleno==193);
      case 194: /* expression ::= column_reference */ yytestcase(yyruleno==194);
      case 197: /* expression ::= subquery */ yytestcase(yyruleno==197);
      case 229: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==229);
      case 233: /* boolean_primary ::= predicate */ yytestcase(yyruleno==233);
      case 235: /* common_expression ::= expression */ yytestcase(yyruleno==235);
      case 236: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==236);
      case 238: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==238);
      case 240: /* table_reference ::= table_primary */ yytestcase(yyruleno==240);
      case 241: /* table_reference ::= joined_table */ yytestcase(yyruleno==241);
      case 245: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==245);
      case 292: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==292);
      case 294: /* query_primary ::= query_specification */ yytestcase(yyruleno==294);
{ yylhsminor.yy26 = yymsp[0].minor.yy26; }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
        break;
      case 181: /* duration_literal ::= NK_VARIABLE */
{ yylhsminor.yy26 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
        break;
      case 182: /* literal_list ::= literal */
      case 206: /* expression_list ::= expression */ yytestcase(yyruleno==206);
{ yylhsminor.yy64 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy26)); }
  yymsp[0].minor.yy64 = yylhsminor.yy64;
        break;
      case 183: /* literal_list ::= literal_list NK_COMMA literal */
      case 207: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==207);
{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, releaseRawExprNode(pCxt, yymsp[0].minor.yy26)); }
  yymsp[-2].minor.yy64 = yylhsminor.yy64;
        break;
      case 195: /* expression ::= function_name NK_LP expression_list NK_RP */
{ yylhsminor.yy26 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy353, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy353, yymsp[-1].minor.yy64)); }
  yymsp[-3].minor.yy26 = yylhsminor.yy26;
        break;
      case 196: /* expression ::= function_name NK_LP NK_STAR NK_RP */
{ yylhsminor.yy26 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy353, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy353, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); }
  yymsp[-3].minor.yy26 = yylhsminor.yy26;
        break;
      case 198: /* expression ::= NK_LP expression NK_RP */
      case 234: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==234);
{ yylhsminor.yy26 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy26)); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
        break;
      case 199: /* expression ::= NK_PLUS expression */
2831
{
2832 2833
                                                                                    SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy26));
2834
                                                                                  }
2835
  yymsp[-1].minor.yy26 = yylhsminor.yy26;
2836
        break;
2837
      case 200: /* expression ::= NK_MINUS expression */
2838
{
2839 2840
                                                                                    SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy26), NULL));
2841
                                                                                  }
2842
  yymsp[-1].minor.yy26 = yylhsminor.yy26;
2843
        break;
2844
      case 201: /* expression ::= expression NK_PLUS expression */
2845
{
2846 2847 2848
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy26);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), releaseRawExprNode(pCxt, yymsp[0].minor.yy26))); 
2849
                                                                                  }
2850
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2851
        break;
2852
      case 202: /* expression ::= expression NK_MINUS expression */
2853
{
2854 2855 2856
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy26);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), releaseRawExprNode(pCxt, yymsp[0].minor.yy26))); 
2857
                                                                                  }
2858
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2859
        break;
2860
      case 203: /* expression ::= expression NK_STAR expression */
2861
{
2862 2863 2864
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy26);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), releaseRawExprNode(pCxt, yymsp[0].minor.yy26))); 
2865
                                                                                  }
2866
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2867
        break;
2868
      case 204: /* expression ::= expression NK_SLASH expression */
2869
{
2870 2871 2872
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy26);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), releaseRawExprNode(pCxt, yymsp[0].minor.yy26))); 
2873
                                                                                  }
2874
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2875
        break;
2876
      case 205: /* expression ::= expression NK_REM expression */
2877
{
2878 2879 2880
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy26);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), releaseRawExprNode(pCxt, yymsp[0].minor.yy26))); 
2881
                                                                                  }
2882
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2883
        break;
2884 2885 2886
      case 208: /* column_reference ::= column_name */
{ yylhsminor.yy26 = createRawExprNode(pCxt, &yymsp[0].minor.yy353, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy353)); }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
2887
        break;
2888 2889 2890
      case 209: /* column_reference ::= table_name NK_DOT column_name */
{ yylhsminor.yy26 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353, createColumnNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353)); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2891
        break;
2892 2893
      case 210: /* predicate ::= expression compare_op expression */
      case 215: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==215);
2894
{
2895 2896 2897
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy26);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy80, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), releaseRawExprNode(pCxt, yymsp[0].minor.yy26)));
2898
                                                                                  }
2899
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2900
        break;
2901
      case 211: /* predicate ::= expression BETWEEN expression AND expression */
2902
{
2903 2904 2905
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy26);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy26), releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), releaseRawExprNode(pCxt, yymsp[0].minor.yy26)));
2906
                                                                                  }
2907
  yymsp[-4].minor.yy26 = yylhsminor.yy26;
2908
        break;
2909
      case 212: /* predicate ::= expression NOT BETWEEN expression AND expression */
2910
{
2911 2912 2913
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy26);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), releaseRawExprNode(pCxt, yymsp[-5].minor.yy26), releaseRawExprNode(pCxt, yymsp[0].minor.yy26)));
2914
                                                                                  }
2915
  yymsp[-5].minor.yy26 = yylhsminor.yy26;
2916
        break;
2917
      case 213: /* predicate ::= expression IS NULL */
2918
{
2919 2920
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), NULL));
2921
                                                                                  }
2922
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2923
        break;
2924
      case 214: /* predicate ::= expression IS NOT NULL */
2925
{
2926 2927
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy26), NULL));
2928
                                                                                  }
2929
  yymsp[-3].minor.yy26 = yylhsminor.yy26;
2930
        break;
2931 2932
      case 216: /* compare_op ::= NK_LT */
{ yymsp[0].minor.yy80 = OP_TYPE_LOWER_THAN; }
2933
        break;
2934 2935
      case 217: /* compare_op ::= NK_GT */
{ yymsp[0].minor.yy80 = OP_TYPE_GREATER_THAN; }
2936
        break;
2937 2938
      case 218: /* compare_op ::= NK_LE */
{ yymsp[0].minor.yy80 = OP_TYPE_LOWER_EQUAL; }
2939
        break;
2940 2941
      case 219: /* compare_op ::= NK_GE */
{ yymsp[0].minor.yy80 = OP_TYPE_GREATER_EQUAL; }
2942
        break;
2943 2944
      case 220: /* compare_op ::= NK_NE */
{ yymsp[0].minor.yy80 = OP_TYPE_NOT_EQUAL; }
2945
        break;
2946 2947
      case 221: /* compare_op ::= NK_EQ */
{ yymsp[0].minor.yy80 = OP_TYPE_EQUAL; }
2948
        break;
2949 2950
      case 222: /* compare_op ::= LIKE */
{ yymsp[0].minor.yy80 = OP_TYPE_LIKE; }
2951
        break;
2952 2953
      case 223: /* compare_op ::= NOT LIKE */
{ yymsp[-1].minor.yy80 = OP_TYPE_NOT_LIKE; }
2954
        break;
2955 2956
      case 224: /* compare_op ::= MATCH */
{ yymsp[0].minor.yy80 = OP_TYPE_MATCH; }
2957
        break;
2958 2959
      case 225: /* compare_op ::= NMATCH */
{ yymsp[0].minor.yy80 = OP_TYPE_NMATCH; }
2960
        break;
2961 2962
      case 226: /* in_op ::= IN */
{ yymsp[0].minor.yy80 = OP_TYPE_IN; }
2963
        break;
2964 2965
      case 227: /* in_op ::= NOT IN */
{ yymsp[-1].minor.yy80 = OP_TYPE_NOT_IN; }
2966
        break;
2967 2968 2969
      case 228: /* in_predicate_value ::= NK_LP expression_list NK_RP */
{ yylhsminor.yy26 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy64)); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2970
        break;
2971
      case 230: /* boolean_value_expression ::= NOT boolean_primary */
2972
{
2973 2974
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy26), NULL));
2975
                                                                                  }
2976
  yymsp[-1].minor.yy26 = yylhsminor.yy26;
2977
        break;
2978
      case 231: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
2979
{
2980 2981 2982
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy26);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), releaseRawExprNode(pCxt, yymsp[0].minor.yy26)));
2983
                                                                                  }
2984
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2985
        break;
2986
      case 232: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
2987
{
2988 2989 2990
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy26);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), releaseRawExprNode(pCxt, yymsp[0].minor.yy26)));
2991
                                                                                  }
2992
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
2993
        break;
2994 2995 2996 2997
      case 237: /* from_clause ::= FROM table_reference_list */
      case 267: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==267);
      case 290: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==290);
{ yymsp[-1].minor.yy26 = yymsp[0].minor.yy26; }
2998
        break;
2999 3000 3001
      case 239: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ yylhsminor.yy26 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy26, yymsp[0].minor.yy26, NULL); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
3002
        break;
3003 3004 3005
      case 242: /* table_primary ::= table_name alias_opt */
{ yylhsminor.yy26 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); }
  yymsp[-1].minor.yy26 = yylhsminor.yy26;
3006
        break;
3007 3008 3009
      case 243: /* table_primary ::= db_name NK_DOT table_name alias_opt */
{ yylhsminor.yy26 = createRealTableNode(pCxt, &yymsp[-3].minor.yy353, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); }
  yymsp[-3].minor.yy26 = yylhsminor.yy26;
3010
        break;
3011 3012 3013
      case 244: /* table_primary ::= subquery alias_opt */
{ yylhsminor.yy26 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy26), &yymsp[0].minor.yy353); }
  yymsp[-1].minor.yy26 = yylhsminor.yy26;
3014
        break;
3015 3016
      case 246: /* alias_opt ::= */
{ yymsp[1].minor.yy353 = nil_token;  }
3017
        break;
3018 3019 3020
      case 247: /* alias_opt ::= table_alias */
{ yylhsminor.yy353 = yymsp[0].minor.yy353; }
  yymsp[0].minor.yy353 = yylhsminor.yy353;
3021
        break;
3022 3023
      case 248: /* alias_opt ::= AS table_alias */
{ yymsp[-1].minor.yy353 = yymsp[0].minor.yy353; }
3024
        break;
3025 3026 3027
      case 249: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
      case 250: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==250);
{ yymsp[-2].minor.yy26 = yymsp[-1].minor.yy26; }
3028
        break;
3029 3030 3031
      case 251: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ yylhsminor.yy26 = createJoinTableNode(pCxt, yymsp[-4].minor.yy372, yymsp[-5].minor.yy26, yymsp[-2].minor.yy26, yymsp[0].minor.yy26); }
  yymsp[-5].minor.yy26 = yylhsminor.yy26;
3032
        break;
3033 3034
      case 252: /* join_type ::= */
{ yymsp[1].minor.yy372 = JOIN_TYPE_INNER; }
3035
        break;
3036 3037
      case 253: /* join_type ::= INNER */
{ yymsp[0].minor.yy372 = JOIN_TYPE_INNER; }
3038
        break;
3039
      case 254: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
3040
{ 
3041 3042 3043 3044 3045 3046
                                                                                    yymsp[-8].minor.yy26 = createSelectStmt(pCxt, yymsp[-7].minor.yy107, yymsp[-6].minor.yy64, yymsp[-5].minor.yy26);
                                                                                    yymsp[-8].minor.yy26 = addWhereClause(pCxt, yymsp[-8].minor.yy26, yymsp[-4].minor.yy26);
                                                                                    yymsp[-8].minor.yy26 = addPartitionByClause(pCxt, yymsp[-8].minor.yy26, yymsp[-3].minor.yy64);
                                                                                    yymsp[-8].minor.yy26 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy26, yymsp[-2].minor.yy26);
                                                                                    yymsp[-8].minor.yy26 = addGroupByClause(pCxt, yymsp[-8].minor.yy26, yymsp[-1].minor.yy64);
                                                                                    yymsp[-8].minor.yy26 = addHavingClause(pCxt, yymsp[-8].minor.yy26, yymsp[0].minor.yy26);
3047 3048
                                                                                  }
        break;
3049 3050
      case 256: /* set_quantifier_opt ::= DISTINCT */
{ yymsp[0].minor.yy107 = true; }
3051
        break;
3052 3053
      case 257: /* set_quantifier_opt ::= ALL */
{ yymsp[0].minor.yy107 = false; }
3054
        break;
3055 3056
      case 258: /* select_list ::= NK_STAR */
{ yymsp[0].minor.yy64 = NULL; }
3057
        break;
3058
      case 262: /* select_item ::= common_expression */
3059
{
3060 3061
                                                                                    SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy26);
                                                                                    yylhsminor.yy26 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy26), &t);
3062
                                                                                  }
3063
  yymsp[0].minor.yy26 = yylhsminor.yy26;
3064
        break;
3065 3066 3067
      case 263: /* select_item ::= common_expression column_alias */
{ yylhsminor.yy26 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy26), &yymsp[0].minor.yy353); }
  yymsp[-1].minor.yy26 = yylhsminor.yy26;
3068
        break;
3069 3070 3071
      case 264: /* select_item ::= common_expression AS column_alias */
{ yylhsminor.yy26 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), &yymsp[0].minor.yy353); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
3072
        break;
3073 3074 3075
      case 265: /* select_item ::= table_name NK_DOT NK_STAR */
{ yylhsminor.yy26 = createColumnNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
3076
        break;
3077 3078 3079 3080
      case 269: /* partition_by_clause_opt ::= PARTITION BY expression_list */
      case 286: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==286);
      case 296: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==296);
{ yymsp[-2].minor.yy64 = yymsp[0].minor.yy64; }
3081
        break;
3082 3083
      case 271: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{ yymsp[-5].minor.yy26 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy26), &yymsp[-1].minor.yy0); }
3084
        break;
3085 3086
      case 272: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{ yymsp[-3].minor.yy26 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy26)); }
3087
        break;
3088 3089
      case 273: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ yymsp[-5].minor.yy26 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy26), NULL, yymsp[-1].minor.yy26, yymsp[0].minor.yy26); }
3090
        break;
3091 3092
      case 274: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ yymsp[-7].minor.yy26 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy26), releaseRawExprNode(pCxt, yymsp[-3].minor.yy26), yymsp[-1].minor.yy26, yymsp[0].minor.yy26); }
3093
        break;
3094 3095
      case 276: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ yymsp[-3].minor.yy26 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy26); }
3096
        break;
3097 3098
      case 278: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ yymsp[-3].minor.yy26 = createFillNode(pCxt, yymsp[-1].minor.yy192, NULL); }
3099
        break;
3100 3101
      case 279: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ yymsp[-5].minor.yy26 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy64)); }
3102
        break;
3103 3104
      case 280: /* fill_mode ::= NONE */
{ yymsp[0].minor.yy192 = FILL_MODE_NONE; }
3105
        break;
3106 3107
      case 281: /* fill_mode ::= PREV */
{ yymsp[0].minor.yy192 = FILL_MODE_PREV; }
3108
        break;
3109 3110
      case 282: /* fill_mode ::= NULL */
{ yymsp[0].minor.yy192 = FILL_MODE_NULL; }
3111
        break;
3112 3113
      case 283: /* fill_mode ::= LINEAR */
{ yymsp[0].minor.yy192 = FILL_MODE_LINEAR; }
3114
        break;
3115 3116
      case 284: /* fill_mode ::= NEXT */
{ yymsp[0].minor.yy192 = FILL_MODE_NEXT; }
3117
        break;
3118 3119 3120
      case 287: /* group_by_list ::= expression */
{ yylhsminor.yy64 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy26))); }
  yymsp[0].minor.yy64 = yylhsminor.yy64;
3121
        break;
3122 3123 3124
      case 288: /* group_by_list ::= group_by_list NK_COMMA expression */
{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy26))); }
  yymsp[-2].minor.yy64 = yylhsminor.yy64;
3125
        break;
3126
      case 291: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
3127
{ 
3128 3129 3130
                                                                                    yylhsminor.yy26 = addOrderByClause(pCxt, yymsp[-3].minor.yy26, yymsp[-2].minor.yy64);
                                                                                    yylhsminor.yy26 = addSlimitClause(pCxt, yylhsminor.yy26, yymsp[-1].minor.yy26);
                                                                                    yylhsminor.yy26 = addLimitClause(pCxt, yylhsminor.yy26, yymsp[0].minor.yy26);
3131
                                                                                  }
3132
  yymsp[-3].minor.yy26 = yylhsminor.yy26;
3133
        break;
3134 3135 3136
      case 293: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ yylhsminor.yy26 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy26, yymsp[0].minor.yy26); }
  yymsp[-3].minor.yy26 = yylhsminor.yy26;
3137
        break;
3138 3139 3140
      case 298: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
      case 302: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==302);
{ yymsp[-1].minor.yy26 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
3141
        break;
3142 3143 3144
      case 299: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
      case 303: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==303);
{ yymsp[-3].minor.yy26 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
3145
        break;
3146 3147 3148
      case 300: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
      case 304: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==304);
{ yymsp[-3].minor.yy26 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
3149
        break;
3150 3151 3152
      case 305: /* subquery ::= NK_LP query_expression NK_RP */
{ yylhsminor.yy26 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy26); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
3153
        break;
3154 3155 3156
      case 306: /* search_condition ::= common_expression */
{ yylhsminor.yy26 = releaseRawExprNode(pCxt, yymsp[0].minor.yy26); }
  yymsp[0].minor.yy26 = yylhsminor.yy26;
3157
        break;
3158 3159 3160
      case 309: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ yylhsminor.yy26 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy26), yymsp[-1].minor.yy32, yymsp[0].minor.yy391); }
  yymsp[-2].minor.yy26 = yylhsminor.yy26;
3161
        break;
3162 3163
      case 310: /* ordering_specification_opt ::= */
{ yymsp[1].minor.yy32 = ORDER_ASC; }
3164
        break;
3165 3166
      case 311: /* ordering_specification_opt ::= ASC */
{ yymsp[0].minor.yy32 = ORDER_ASC; }
3167
        break;
3168 3169
      case 312: /* ordering_specification_opt ::= DESC */
{ yymsp[0].minor.yy32 = ORDER_DESC; }
3170
        break;
3171 3172
      case 313: /* null_ordering_opt ::= */
{ yymsp[1].minor.yy391 = NULL_ORDER_DEFAULT; }
3173
        break;
3174 3175
      case 314: /* null_ordering_opt ::= NULLS FIRST */
{ yymsp[-1].minor.yy391 = NULL_ORDER_FIRST; }
3176
        break;
3177 3178
      case 315: /* null_ordering_opt ::= NULLS LAST */
{ yymsp[-1].minor.yy391 = NULL_ORDER_LAST; }
3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210
        break;
      default:
        break;
/********** End reduce actions ************************************************/
  };
  assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);

  /* There are no SHIFTREDUCE actions on nonterminals because the table
  ** generator has simplified them to pure REDUCE actions. */
  assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) );

  /* It is not possible for a REDUCE to be followed by an error */
  assert( yyact!=YY_ERROR_ACTION );

  yymsp += yysize+1;
  yypParser->yytos = yymsp;
  yymsp->stateno = (YYACTIONTYPE)yyact;
  yymsp->major = (YYCODETYPE)yygoto;
  yyTraceShift(yypParser, yyact, "... then shift");
  return yyact;
}

/*
** The following code executes when the parse fails
*/
#ifndef YYNOERRORRECOVERY
static void yy_parse_failed(
  yyParser *yypParser           /* The parser */
){
X
Xiaoyu Wang 已提交
3211 3212
  ParseARG_FETCH
  ParseCTX_FETCH
3213 3214 3215 3216 3217 3218 3219 3220 3221 3222
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
  }
#endif
  while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
  /* Here code is inserted which will be executed whenever the
  ** parser fails */
/************ Begin %parse_failure code ***************************************/
/************ End %parse_failure code *****************************************/
X
Xiaoyu Wang 已提交
3223 3224
  ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
  ParseCTX_STORE
3225 3226 3227 3228 3229 3230 3231 3232 3233
}
#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 */
X
Xiaoyu Wang 已提交
3234
  ParseTOKENTYPE yyminor         /* The minor type of the error token */
3235
){
X
Xiaoyu Wang 已提交
3236 3237
  ParseARG_FETCH
  ParseCTX_FETCH
3238 3239
#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/
3240 3241 3242 3243 3244 3245 3246 3247

  if (pCxt->valid) {
    if(TOKEN.z) {
      generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z);
    } else {
      generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INCOMPLETE_SQL);
    }
    pCxt->valid = false;
3248 3249
  }
/************ End %syntax_error code ******************************************/
X
Xiaoyu Wang 已提交
3250 3251
  ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
  ParseCTX_STORE
3252 3253 3254 3255 3256 3257 3258 3259
}

/*
** The following is executed when the parser accepts
*/
static void yy_accept(
  yyParser *yypParser           /* The parser */
){
X
Xiaoyu Wang 已提交
3260 3261
  ParseARG_FETCH
  ParseCTX_FETCH
3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
  }
#endif
#ifndef YYNOERRORRECOVERY
  yypParser->yyerrcnt = -1;
#endif
  assert( yypParser->yytos==yypParser->yystack );
  /* Here code is inserted which will be executed whenever the
  ** parser accepts */
/*********** Begin %parse_accept code *****************************************/
/*********** End %parse_accept code *******************************************/
X
Xiaoyu Wang 已提交
3275 3276
  ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
  ParseCTX_STORE
3277 3278 3279 3280
}

/* The main parser program.
** The first argument is a pointer to a structure obtained from
X
Xiaoyu Wang 已提交
3281
** "ParseAlloc" which describes the current state of the parser.
3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297
** 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.
*/
X
Xiaoyu Wang 已提交
3298
void Parse(
3299 3300
  void *yyp,                   /* The parser */
  int yymajor,                 /* The major token code number */
X
Xiaoyu Wang 已提交
3301 3302
  ParseTOKENTYPE yyminor       /* The value for the token */
  ParseARG_PDECL               /* Optional %extra_argument parameter */
3303 3304 3305 3306 3307 3308 3309 3310 3311 3312
){
  YYMINORTYPE yyminorunion;
  YYACTIONTYPE yyact;   /* The parser action. */
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
  int yyendofinput;     /* True if we are at the end of input */
#endif
#ifdef YYERRORSYMBOL
  int yyerrorhit = 0;   /* True if yymajor has invoked an error */
#endif
  yyParser *yypParser = (yyParser*)yyp;  /* The parser */
X
Xiaoyu Wang 已提交
3313 3314
  ParseCTX_FETCH
  ParseARG_STORE
3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338

  assert( yypParser->yytos!=0 );
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
  yyendofinput = (yymajor==0);
#endif

  yyact = yypParser->yytos->stateno;
#ifndef NDEBUG
  if( yyTraceFILE ){
    if( yyact < YY_MIN_REDUCE ){
      fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
              yyTracePrompt,yyTokenName[yymajor],yyact);
    }else{
      fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
              yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
    }
  }
#endif

  do{
    assert( yyact==yypParser->yytos->stateno );
    yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
    if( yyact >= YY_MIN_REDUCE ){
      yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,
X
Xiaoyu Wang 已提交
3339
                        yyminor ParseCTX_PARAM);
3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471
    }else if( yyact <= YY_MAX_SHIFTREDUCE ){
      yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
#ifndef YYNOERRORRECOVERY
      yypParser->yyerrcnt--;
#endif
      break;
    }else if( yyact==YY_ACCEPT_ACTION ){
      yypParser->yytos--;
      yy_accept(yypParser);
      return;
    }else{
      assert( yyact == YY_ERROR_ACTION );
      yyminorunion.yy0 = yyminor;
#ifdef YYERRORSYMBOL
      int yymx;
#endif
#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 ){
        yy_syntax_error(yypParser,yymajor,yyminor);
      }
      yymx = yypParser->yytos->major;
      if( yymx==YYERRORSYMBOL || yyerrorhit ){
#ifndef NDEBUG
        if( yyTraceFILE ){
          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
             yyTracePrompt,yyTokenName[yymajor]);
        }
#endif
        yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
        yymajor = YYNOCODE;
      }else{
        while( yypParser->yytos >= yypParser->yystack
            && (yyact = yy_find_reduce_action(
                        yypParser->yytos->stateno,
                        YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE
        ){
          yy_pop_parser_stack(yypParser);
        }
        if( yypParser->yytos < yypParser->yystack || yymajor==0 ){
          yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
          yy_parse_failed(yypParser);
#ifndef YYNOERRORRECOVERY
          yypParser->yyerrcnt = -1;
#endif
          yymajor = YYNOCODE;
        }else if( yymx!=YYERRORSYMBOL ){
          yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
        }
      }
      yypParser->yyerrcnt = 3;
      yyerrorhit = 1;
      if( yymajor==YYNOCODE ) break;
      yyact = yypParser->yytos->stateno;
#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.
      */
      yy_syntax_error(yypParser,yymajor, yyminor);
      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
      break;
#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 ){
        yy_syntax_error(yypParser,yymajor, yyminor);
      }
      yypParser->yyerrcnt = 3;
      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
      if( yyendofinput ){
        yy_parse_failed(yypParser);
#ifndef YYNOERRORRECOVERY
        yypParser->yyerrcnt = -1;
#endif
      }
      break;
#endif
    }
  }while( yypParser->yytos>yypParser->yystack );
#ifndef NDEBUG
  if( yyTraceFILE ){
    yyStackEntry *i;
    char cDiv = '[';
    fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
    for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){
      fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]);
      cDiv = ' ';
    }
    fprintf(yyTraceFILE,"]\n");
  }
#endif
  return;
}

/*
** Return the fallback token corresponding to canonical token iToken, or
** 0 if iToken has no fallback.
*/
X
Xiaoyu Wang 已提交
3472
int ParseFallback(int iToken){
3473 3474 3475 3476 3477 3478 3479 3480 3481
#ifdef YYFALLBACK
  if( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ){
    return yyFallback[iToken];
  }
#else
  (void)iToken;
#endif
  return 0;
}