new_sql.c 129.4 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 36 37 38
/*
** 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"
#include "ttoken.h"
#include "ttokendef.h"
#include "astCreateFuncs.h"
39

40
#if 0
41 42
#define PARSER_TRACE printf("lemon rule = %s\n", yyRuleName[yyruleno])
#define PARSER_DESTRUCTOR_TRACE printf("lemon destroy token = %s\n", yyTokenName[yymajor])
43 44 45 46 47 48
#define PARSER_COMPLETE printf("parsing complete!\n" )
#else
#define PARSER_TRACE
#define PARSER_DESTRUCTOR_TRACE
#define PARSER_COMPLETE
#endif
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
/**************** 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.
**    NewParseTOKENTYPE     is the data type used for minor type for terminal
**                       symbols.  Background: A "minor type" is a semantic
**                       value associated with a terminal or non-terminal
**                       symbols.  For example, for an "ID" terminal symbol,
**                       the minor type might be the name of the identifier.
**                       Each non-terminal can have a different minor type.
**                       Terminal symbols all have the same minor type, though.
**                       This macros defines the minor type for terminal 
**                       symbols.
**    YYMINORTYPE        is the data type used for all minor types.
**                       This is typically a union of many types, one of
**                       which is NewParseTOKENTYPE.  The entry in the union
**                       for terminal symbols is called "yy0".
**    YYSTACKDEPTH       is the maximum depth of the parser's stack.  If
**                       zero the stack is dynamically sized using realloc()
**    NewParseARG_SDECL     A static variable declaration for the %extra_argument
**    NewParseARG_PDECL     A parameter declaration for the %extra_argument
**    NewParseARG_PARAM     Code to pass %extra_argument as a subroutine parameter
**    NewParseARG_STORE     Code to store %extra_argument into yypParser
**    NewParseARG_FETCH     Code to extract %extra_argument from yypParser
**    NewParseCTX_*         As NewParseARG_ except for %extra_context
**    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
112
#define YYNOCODE 180
113
#define YYACTIONTYPE unsigned short int
114
#define NewParseTOKENTYPE  SToken 
115 116 117
typedef union {
  int yyinit;
  NewParseTOKENTYPE yy0;
118 119 120 121 122 123 124 125 126 127 128 129 130
  EOperatorType yy20;
  STableOptions* yy46;
  EFillMode yy54;
  STokenPair yy57;
  SNodeList* yy64;
  bool yy137;
  SDatabaseOptions* yy199;
  SToken yy209;
  ENullOrder yy217;
  EOrder yy218;
  EJoinType yy252;
  SNode* yy272;
  SDataType yy304;
131 132 133 134
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
#endif
135 136
#define NewParseARG_SDECL  SAstCreateContext* pCxt ;
#define NewParseARG_PDECL , SAstCreateContext* pCxt 
137
#define NewParseARG_PARAM ,pCxt 
138
#define NewParseARG_FETCH  SAstCreateContext* pCxt =yypParser->pCxt ;
139 140 141 142 143 144
#define NewParseARG_STORE yypParser->pCxt =pCxt ;
#define NewParseCTX_SDECL
#define NewParseCTX_PDECL
#define NewParseCTX_PARAM
#define NewParseCTX_FETCH
#define NewParseCTX_STORE
145 146 147 148 149 150 151 152 153 154 155
#define YYNSTATE             212
#define YYNRULE              197
#define YYNTOKEN             119
#define YY_MAX_SHIFT         211
#define YY_MIN_SHIFTREDUCE   353
#define YY_MAX_SHIFTREDUCE   549
#define YY_ERROR_ACTION      550
#define YY_ACCEPT_ACTION     551
#define YY_NO_ACTION         552
#define YY_MIN_REDUCE        553
#define YY_MAX_REDUCE        749
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 211 212 213 214 215 216 217 218 219 220 221
/************* 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 **********************************************/
222
#define YY_ACTTAB_COUNT (871)
223
static const YYACTIONTYPE yy_action[] = {
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
 /*     0 */   619,  617,  105,  188,  117,  728,  578,   48,   23,   75,
 /*    10 */    76,  642,   30,   28,   26,   25,   24,  158,  126,  727,
 /*    20 */   681,  100,  129,  726,  681,   30,   28,   26,   25,   24,
 /*    30 */   553,  620,  617,  642,  100,   68,  627,  617,  678,  158,
 /*    40 */   159,  499,  677,   42,  628,  432,  631,  667,   26,   25,
 /*    50 */    24,  666,  663,  211,  681,  210,  209,  208,  207,  206,
 /*    60 */   205,  204,  203,  202,  697,  201,  200,  199,  198,  197,
 /*    70 */   196,  195,  676,  423,   22,  109,  141,  450,  451,  452,
 /*    80 */   453,  454,  455,  456,  458,  459,  460,   22,  109,  134,
 /*    90 */   450,  451,  452,  453,  454,  455,  456,  458,  459,  460,
 /*   100 */    10,   10,  143,  143,  382,  186,  185,  184,  386,  183,
 /*   110 */   388,  389,  182,  391,  179,  118,  397,  176,  399,  400,
 /*   120 */   173,  170,  642,  575,  148,  627,  617,   84,  158,  159,
 /*   130 */     9,    8,   40,  628,   58,  631,  667,    6,  487,   80,
 /*   140 */    99,  663,  423,  642,  579,   48,  627,  617,   58,  144,
 /*   150 */   159,   82,  728,   41,  628,  190,  631,  667,  642,   20,
 /*   160 */   189,  107,  663,   52,  158,  115,   57,  643,  457,  133,
 /*   170 */   726,  461,  191,  642,  468,   74,  627,  617,  151,  144,
 /*   180 */   159,  119,  694,   41,  628,  491,  631,  667,  426,   58,
 /*   190 */   551,  107,  663,   52,   78,  642,  425,  426,  627,  617,
 /*   200 */   161,  158,  159,  155,  513,   41,  628,   43,  631,  667,
 /*   210 */     9,    8,  695,  107,  663,  740,  642,    2,   65,  627,
 /*   220 */   617,   62,  158,  159,  701,  152,   41,  628,  728,  631,
 /*   230 */   667,  135,  130,  128,  107,  663,  740,  642,   73,   59,
 /*   240 */   627,  617,   57,  158,  159,  724,  726,   41,  628,  698,
 /*   250 */   631,  667,  146,   29,   27,  107,  663,  740,   29,   27,
 /*   260 */   492,  686,   11,  487,  127,  412,  685,   11,  156,  462,
 /*   270 */   412,  708,   31,  429,  490,  414,   31,  548,  549,  624,
 /*   280 */   414,   60,  622,  403,  150,    1,  168,  114,  153,  124,
 /*   290 */     1,  642,  114,  148,  627,  617,  122,  158,  159,  418,
 /*   300 */   160,   90,  628,   85,  631,  160,   47,  447,   29,   27,
 /*   310 */   123,  707,  413,  415,  418,   29,   27,  413,  415,  418,
 /*   320 */   412,  728,  163,  162,   11,   64,  106,  412,    5,  137,
 /*   330 */   414,  688,   67,   58,  121,   57,    4,  414,   69,  726,
 /*   340 */     7,   51,  114,  422,   45,  487,  425,    1,  682,  114,
 /*   350 */   642,   32,   70,  627,  617,  160,  158,  159,   16,  649,
 /*   360 */    49,  628,  160,  631,  110,  743,  725,  413,  415,  418,
 /*   370 */   154,  157,  140,   77,  413,  415,  418,  421,  164,  642,
 /*   380 */   148,  166,  627,  617,   46,  158,  159,  194,   58,   42,
 /*   390 */   628,   44,  631,  667,  192,   29,   27,  145,  663,  149,
 /*   400 */   741,   71,  674,  139,   81,  138,   86,  412,  728,   83,
 /*   410 */    87,   29,   27,  147,  412,   98,    3,  414,   31,   14,
 /*   420 */    61,  510,   57,  412,  414,   63,  726,    1,  642,  114,
 /*   430 */    35,  627,  617,  414,  158,  159,  512,   50,   96,  628,
 /*   440 */   113,  631,  160,    7,   66,  114,  506,  505,   36,  160,
 /*   450 */   131,   37,   15,  132,  413,  415,  418,  622,  160,   18,
 /*   460 */   484,  413,  415,  418,  483,   34,   33,   72,   29,   27,
 /*   470 */   413,  415,  418,    8,  621,  642,   56,  534,  627,  617,
 /*   480 */   412,  158,  159,  430,  448,   42,  628,  539,  631,  667,
 /*   490 */   414,   17,   12,   38,  664,   30,   28,   26,   25,   24,
 /*   500 */     7,  533,  114,  111,  538,  537,  112,  642,   79,   13,
 /*   510 */   627,  617,  416,  158,  159,  160,  611,   96,  628,  120,
 /*   520 */   631,  610,  609,  574,  167,  396,  116,  413,  415,  418,
 /*   530 */   642,  377,  171,  627,  617,  165,  158,  159,  404,  169,
 /*   540 */    92,  628,  401,  631,  398,  642,  381,  172,  627,  617,
 /*   550 */   175,  158,  159,  178,  174,   96,  628,  108,  631,  642,
 /*   560 */   177,  180,  627,  617,  392,  158,  159,  408,  181,   49,
 /*   570 */   628,  642,  631,  136,  627,  617,  390,  158,  159,  395,
 /*   580 */   407,   91,  628,  187,  631,  406,  642,  394,  393,  627,
 /*   590 */   617,   39,  158,  159,  354,  193,   93,  628,  366,  631,
 /*   600 */   642,  373,  372,  627,  617,  371,  158,  159,  370,  742,
 /*   610 */    88,  628,  369,  631,  642,  552,  368,  627,  617,  367,
 /*   620 */   158,  159,  365,  364,   94,  628,  363,  631,  642,  552,
 /*   630 */   362,  627,  617,  361,  158,  159,  360,  359,   89,  628,
 /*   640 */   552,  631,  642,  552,  358,  627,  617,  357,  158,  159,
 /*   650 */   552,  552,   95,  628,  552,  631,  642,  552,  552,  627,
 /*   660 */   617,  552,  158,  159,  552,  552,  639,  628,  642,  631,
 /*   670 */   552,  627,  617,  552,  158,  159,  552,  552,  638,  628,
 /*   680 */   642,  631,  552,  627,  617,  552,  158,  159,  552,  552,
 /*   690 */   637,  628,  552,  631,  642,  552,  552,  627,  617,  552,
 /*   700 */   158,  159,  552,  552,  103,  628,  642,  631,  552,  627,
 /*   710 */   617,  552,  158,  159,  552,  552,  102,  628,  642,  631,
 /*   720 */   552,  627,  617,  552,  158,  159,  552,  552,  104,  628,
 /*   730 */   552,  631,  642,  552,  552,  627,  617,  552,  158,  159,
 /*   740 */   552,  552,  101,  628,  552,  631,  642,  552,  516,  627,
 /*   750 */   617,   19,  158,  159,  140,  552,   97,  628,  552,  631,
 /*   760 */   140,   30,   28,   26,   25,   24,   46,   30,   28,   26,
 /*   770 */    25,   24,   46,   44,  125,  514,  515,  517,  518,   44,
 /*   780 */   552,  552,  142,   53,  674,  675,  552,  679,  140,   54,
 /*   790 */   674,  675,   21,  679,  552,   30,   28,   26,   25,   24,
 /*   800 */    46,  552,   30,   28,   26,   25,   24,   44,  552,  552,
 /*   810 */   552,  552,  552,  552,  552,  552,  552,   55,  674,  675,
 /*   820 */   552,  679,  552,  552,  552,  552,  552,  552,  432,  552,
 /*   830 */   552,  552,  552,  552,  552,  552,  552,  552,  552,  552,
 /*   840 */   552,  552,  552,  552,  552,  552,  552,  552,  552,  552,
 /*   850 */   552,  552,  552,  552,  552,  552,  552,  552,  552,  552,
 /*   860 */   552,  552,  552,  552,  552,  552,  552,  552,  552,  545,
 /*   870 */   546,
312 313
};
static const YYCODETYPE yy_lookahead[] = {
314 315 316 317 318 319 320 321 322 323 324
 /*     0 */   130,  131,  132,  128,  124,  157,  126,  127,  142,  143,
 /*    10 */   178,  127,   12,   13,   14,   15,   16,  133,  169,  171,
 /*    20 */   135,   21,  138,  175,  135,   12,   13,   14,   15,   16,
 /*    30 */     0,  130,  131,  127,   21,  162,  130,  131,  153,  133,
 /*    40 */   134,   14,  153,  137,  138,   45,  140,  141,   14,   15,
 /*    50 */    16,  145,  146,   23,  135,   25,   26,   27,   28,   29,
 /*    60 */    30,   31,   32,   33,  136,   35,   36,   37,   38,   39,
 /*    70 */    40,   41,  153,   46,   74,   75,  155,   77,   78,   79,
 /*    80 */    80,   81,   82,   83,   84,   85,   86,   74,   75,   46,
 /*    90 */    77,   78,   79,   80,   81,   82,   83,   84,   85,   86,
 /*   100 */    44,   44,   46,   46,   50,   51,   52,   53,   54,   55,
325
 /*   110 */    56,   57,   58,   59,   60,   18,   62,   63,   64,   65,
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 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
 /*   120 */    66,   67,  127,    0,  129,  130,  131,   19,  133,  134,
 /*   130 */     1,    2,  137,  138,   92,  140,  141,   90,   91,   42,
 /*   140 */   145,  146,   46,  127,  126,  127,  130,  131,   92,  133,
 /*   150 */   134,   43,  157,  137,  138,   32,  140,  141,  127,   74,
 /*   160 */    37,  145,  146,  147,  133,   68,  171,  127,   83,  138,
 /*   170 */   175,   86,   49,  127,   45,  159,  130,  131,    3,  133,
 /*   180 */   134,  165,  166,  137,  138,    4,  140,  141,   46,   92,
 /*   190 */   119,  145,  146,  147,  172,  127,   46,   46,  130,  131,
 /*   200 */   129,  133,  134,   48,   45,  137,  138,   48,  140,  141,
 /*   210 */     1,    2,  166,  145,  146,  147,  127,  158,   45,  130,
 /*   220 */   131,   48,  133,  134,  156,   48,  137,  138,  157,  140,
 /*   230 */   141,   97,   98,   99,  145,  146,  147,  127,   88,   88,
 /*   240 */   130,  131,  171,  133,  134,  156,  175,  137,  138,  136,
 /*   250 */   140,  141,   21,   12,   13,  145,  146,  147,   12,   13,
 /*   260 */    14,   89,   21,   91,  101,   24,  156,   21,  113,   45,
 /*   270 */    24,  168,   48,   45,   93,   34,   48,  117,  118,   44,
 /*   280 */    34,  167,   47,   45,  109,   44,   48,   46,  111,  100,
 /*   290 */    44,  127,   46,  129,  130,  131,  131,  133,  134,   73,
 /*   300 */    59,  137,  138,   45,  140,   59,   48,   76,   12,   13,
 /*   310 */   131,  168,   71,   72,   73,   12,   13,   71,   72,   73,
 /*   320 */    24,  157,   69,   70,   21,  167,  131,   24,  108,  107,
 /*   330 */    34,  164,  163,   92,   95,  171,   94,   34,  160,  175,
 /*   340 */    44,  161,   46,   46,  133,   91,   46,   44,  135,   46,
 /*   350 */   127,   87,  148,  130,  131,   59,  133,  134,   44,  144,
 /*   360 */   137,  138,   59,  140,  116,  179,  174,   71,   72,   73,
 /*   370 */   110,  112,  121,  173,   71,   72,   73,   46,  121,  127,
 /*   380 */   129,   46,  130,  131,  133,  133,  134,   20,   92,  137,
 /*   390 */   138,  140,  140,  141,  123,   12,   13,  145,  146,  176,
 /*   400 */   177,  150,  151,  152,  120,  154,  121,   24,  157,  120,
 /*   410 */   122,   12,   13,   14,   24,  125,   48,   34,   48,   96,
 /*   420 */    45,   45,  171,   24,   34,   44,  175,   44,  127,   46,
 /*   430 */    48,  130,  131,   34,  133,  134,   45,   44,  137,  138,
 /*   440 */   139,  140,   59,   44,   44,   46,   45,   45,   44,   59,
 /*   450 */    24,   44,   96,   48,   71,   72,   73,   47,   59,   48,
 /*   460 */    45,   71,   72,   73,   45,   48,   89,   47,   12,   13,
 /*   470 */    71,   72,   73,    2,   47,  127,   47,   24,  130,  131,
 /*   480 */    24,  133,  134,   45,   76,  137,  138,   45,  140,  141,
 /*   490 */    34,   48,   96,    4,  146,   12,   13,   14,   15,   16,
 /*   500 */    44,   24,   46,   24,   24,   24,   24,  127,   47,   44,
 /*   510 */   130,  131,   34,  133,  134,   59,    0,  137,  138,  139,
 /*   520 */   140,    0,    0,    0,   24,   61,   24,   71,   72,   73,
 /*   530 */   127,   46,   24,  130,  131,   47,  133,  134,   45,   44,
 /*   540 */   137,  138,   45,  140,   45,  127,   34,   44,  130,  131,
 /*   550 */    44,  133,  134,   44,   24,  137,  138,  139,  140,  127,
 /*   560 */    24,   24,  130,  131,   45,  133,  134,   24,   44,  137,
 /*   570 */   138,  127,  140,  170,  130,  131,   45,  133,  134,   61,
 /*   580 */    24,  137,  138,   49,  140,   24,  127,   61,   61,  130,
 /*   590 */   131,   44,  133,  134,   22,   21,  137,  138,   34,  140,
 /*   600 */   127,   24,   24,  130,  131,   24,  133,  134,   24,  177,
 /*   610 */   137,  138,   24,  140,  127,  180,   24,  130,  131,   24,
 /*   620 */   133,  134,   24,   24,  137,  138,   24,  140,  127,  180,
 /*   630 */    24,  130,  131,   24,  133,  134,   24,   24,  137,  138,
 /*   640 */   180,  140,  127,  180,   24,  130,  131,   24,  133,  134,
 /*   650 */   180,  180,  137,  138,  180,  140,  127,  180,  180,  130,
 /*   660 */   131,  180,  133,  134,  180,  180,  137,  138,  127,  140,
 /*   670 */   180,  130,  131,  180,  133,  134,  180,  180,  137,  138,
 /*   680 */   127,  140,  180,  130,  131,  180,  133,  134,  180,  180,
 /*   690 */   137,  138,  180,  140,  127,  180,  180,  130,  131,  180,
 /*   700 */   133,  134,  180,  180,  137,  138,  127,  140,  180,  130,
 /*   710 */   131,  180,  133,  134,  180,  180,  137,  138,  127,  140,
 /*   720 */   180,  130,  131,  180,  133,  134,  180,  180,  137,  138,
 /*   730 */   180,  140,  127,  180,  180,  130,  131,  180,  133,  134,
 /*   740 */   180,  180,  137,  138,  180,  140,  127,  180,   76,  130,
 /*   750 */   131,    2,  133,  134,  121,  180,  137,  138,  180,  140,
 /*   760 */   121,   12,   13,   14,   15,   16,  133,   12,   13,   14,
 /*   770 */    15,   16,  133,  140,  102,  103,  104,  105,  106,  140,
 /*   780 */   180,  180,  149,  150,  151,  152,  180,  154,  121,  150,
 /*   790 */   151,  152,    2,  154,  180,   12,   13,   14,   15,   16,
 /*   800 */   133,  180,   12,   13,   14,   15,   16,  140,  180,  180,
 /*   810 */   180,  180,  180,  180,  180,  180,  180,  150,  151,  152,
 /*   820 */   180,  154,  180,  180,  180,  180,  180,  180,   45,  180,
 /*   830 */   180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
 /*   840 */   180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
 /*   850 */   180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
 /*   860 */   180,  180,  180,  180,  180,  180,  180,  180,  180,  114,
 /*   870 */   115,  180,  180,  180,  180,  180,  180,  180,  180,  180,
 /*   880 */   180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
 /*   890 */   180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
 /*   900 */   180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
 /*   910 */   180,  180,  180,  180,  180,
406
};
407
#define YY_SHIFT_COUNT    (211)
408
#define YY_SHIFT_MIN      (0)
409
#define YY_SHIFT_MAX      (790)
410
static const unsigned short int yy_shift_ofst[] = {
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432
 /*     0 */    97,  241,  246,  303,  303,  303,  303,  296,  303,  303,
 /*    10 */    56,  383,  456,  399,  456,  456,  456,  456,  456,  456,
 /*    20 */   456,  456,  456,  456,  456,  456,  456,  456,  456,  456,
 /*    30 */   456,  456,   57,   57,   57,  390,   43,   43,   42,   96,
 /*    40 */     0,   13,   13,  390,  150,  150,  150,   96,   54,  755,
 /*    50 */   672,  134,  151,  172,   47,  172,   27,  175,  181,  142,
 /*    60 */   163,  189,  226,  226,  163,  189,  226,  220,  222,  239,
 /*    70 */   242,  254,  297,  300,  264,  314,  248,  259,  260,   96,
 /*    80 */   331,  335,  367,  331,  367,  871,  871,   30,  749,  790,
 /*    90 */   783,  483,  483,  483,  483,  483,  483,  483,  123,  129,
 /*   100 */    85,   34,   34,   34,   34,  159,  173,  209,  224,  231,
 /*   110 */   160,  177,  155,  228,  235,  253,  238,  258,  108,  368,
 /*   120 */   370,  323,  375,  376,  381,  382,  391,  393,  400,  401,
 /*   130 */   404,  402,  426,  405,  410,  407,  411,  356,  415,  419,
 /*   140 */   420,  377,  417,  427,  429,  471,  408,  438,  442,  443,
 /*   150 */   396,  489,  453,  477,  479,  480,  481,  482,  461,  465,
 /*   160 */   478,  516,  521,  522,  523,  485,  488,  493,  500,  502,
 /*   170 */   495,  497,  508,  503,  499,  530,  506,  519,  536,  509,
 /*   180 */   531,  537,  524,  464,  518,  526,  527,  512,  534,  543,
 /*   190 */   556,  561,  547,  572,  574,  577,  578,  581,  584,  588,
 /*   200 */   592,  595,  564,  598,  599,  602,  606,  609,  612,  613,
 /*   210 */   620,  623,
433
};
434
#define YY_REDUCE_COUNT (86)
435 436
#define YY_REDUCE_MIN   (-168)
#define YY_REDUCE_MAX   (667)
437
static const short yy_reduce_ofst[] = {
438 439 440 441 442 443 444 445 446
 /*     0 */    71,   -5,   16,   46,   68,   89,  110,  164,  -94,  252,
 /*    10 */   251,  348,  223,  301,  380,  403,  418,  432,  444,  459,
 /*    20 */   473,  487,  501,  515,  529,  541,  553,  567,  579,  591,
 /*    30 */   605,  619,  633,  639,  667, -130, -116,   31, -152, -120,
 /*    40 */  -134, -134, -134,  -99, -115, -111,  -81,   18, -125, -168,
 /*    50 */  -151, -127,  -72,  -79,  -79,  -79,   40,   22,   59,  113,
 /*    60 */   103,  114,  165,  179,  143,  158,  195,  167,  169,  180,
 /*    70 */   178,  -79,  211,  213,  204,  215,  186,  192,  200,   40,
 /*    80 */   257,  271,  284,  285,  289,  290,  288,
447 448
};
static const YYACTIONTYPE yy_default[] = {
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470
 /*     0 */   550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
 /*    10 */   550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
 /*    20 */   550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
 /*    30 */   550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
 /*    40 */   550,  669,  550,  550,  680,  680,  680,  550,  550,  744,
 /*    50 */   550,  704,  696,  672,  686,  673,  550,  729,  689,  550,
 /*    60 */   711,  709,  550,  550,  711,  709,  550,  723,  719,  702,
 /*    70 */   700,  686,  550,  550,  550,  550,  747,  735,  731,  550,
 /*    80 */   550,  550,  555,  550,  555,  605,  556,  550,  550,  550,
 /*    90 */   550,  722,  721,  646,  645,  644,  640,  641,  550,  550,
 /*   100 */   550,  635,  636,  634,  633,  550,  550,  670,  550,  550,
 /*   110 */   550,  732,  736,  550,  623,  550,  550,  550,  550,  693,
 /*   120 */   703,  550,  550,  550,  550,  550,  550,  550,  550,  550,
 /*   130 */   550,  550,  550,  550,  623,  550,  720,  550,  679,  675,
 /*   140 */   550,  550,  671,  622,  550,  665,  550,  550,  550,  730,
 /*   150 */   550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
 /*   160 */   550,  550,  550,  550,  550,  550,  576,  550,  550,  550,
 /*   170 */   602,  550,  550,  550,  550,  550,  550,  550,  550,  550,
 /*   180 */   550,  550,  550,  587,  585,  584,  583,  550,  580,  550,
 /*   190 */   550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
 /*   200 */   550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
 /*   210 */   550,  550,
471 472 473 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 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577
};
/********** 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
  NewParseARG_SDECL                /* A place to hold %extra_argument */
  NewParseCTX_SDECL                /* A place to hold %extra_context */
#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.
*/
void NewParseTrace(FILE *TraceFILE, char *zTracePrompt){
  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 */ "$",
578 579
  /*    1 */ "OR",
  /*    2 */ "AND",
580 581 582 583 584
  /*    3 */ "UNION",
  /*    4 */ "ALL",
  /*    5 */ "MINUS",
  /*    6 */ "EXCEPT",
  /*    7 */ "INTERSECT",
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
  /*    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",
  /*   18 */ "CREATE",
  /*   19 */ "DATABASE",
  /*   20 */ "IF",
  /*   21 */ "NOT",
  /*   22 */ "EXISTS",
  /*   23 */ "BLOCKS",
  /*   24 */ "NK_INTEGER",
  /*   25 */ "CACHE",
  /*   26 */ "CACHELAST",
  /*   27 */ "COMP",
  /*   28 */ "DAYS",
  /*   29 */ "FSYNC",
  /*   30 */ "MAXROWS",
  /*   31 */ "MINROWS",
  /*   32 */ "KEEP",
  /*   33 */ "PRECISION",
  /*   34 */ "NK_STRING",
  /*   35 */ "QUORUM",
  /*   36 */ "REPLICA",
  /*   37 */ "TTL",
  /*   38 */ "WAL",
  /*   39 */ "VGROUPS",
  /*   40 */ "SINGLESTABLE",
  /*   41 */ "STREAMMODE",
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646
  /*   42 */ "USE",
  /*   43 */ "TABLE",
  /*   44 */ "NK_LP",
  /*   45 */ "NK_RP",
  /*   46 */ "NK_ID",
  /*   47 */ "NK_DOT",
  /*   48 */ "NK_COMMA",
  /*   49 */ "COMMENT",
  /*   50 */ "BOOL",
  /*   51 */ "TINYINT",
  /*   52 */ "SMALLINT",
  /*   53 */ "INT",
  /*   54 */ "INTEGER",
  /*   55 */ "BIGINT",
  /*   56 */ "FLOAT",
  /*   57 */ "DOUBLE",
  /*   58 */ "BINARY",
  /*   59 */ "TIMESTAMP",
  /*   60 */ "NCHAR",
  /*   61 */ "UNSIGNED",
  /*   62 */ "JSON",
  /*   63 */ "VARCHAR",
  /*   64 */ "MEDIUMBLOB",
  /*   65 */ "BLOB",
  /*   66 */ "VARBINARY",
  /*   67 */ "DECIMAL",
  /*   68 */ "SHOW",
  /*   69 */ "DATABASES",
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 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
  /*   70 */ "TABLES",
  /*   71 */ "NK_FLOAT",
  /*   72 */ "NK_BOOL",
  /*   73 */ "NK_VARIABLE",
  /*   74 */ "BETWEEN",
  /*   75 */ "IS",
  /*   76 */ "NULL",
  /*   77 */ "NK_LT",
  /*   78 */ "NK_GT",
  /*   79 */ "NK_LE",
  /*   80 */ "NK_GE",
  /*   81 */ "NK_NE",
  /*   82 */ "NK_EQ",
  /*   83 */ "LIKE",
  /*   84 */ "MATCH",
  /*   85 */ "NMATCH",
  /*   86 */ "IN",
  /*   87 */ "FROM",
  /*   88 */ "AS",
  /*   89 */ "JOIN",
  /*   90 */ "ON",
  /*   91 */ "INNER",
  /*   92 */ "SELECT",
  /*   93 */ "DISTINCT",
  /*   94 */ "WHERE",
  /*   95 */ "PARTITION",
  /*   96 */ "BY",
  /*   97 */ "SESSION",
  /*   98 */ "STATE_WINDOW",
  /*   99 */ "INTERVAL",
  /*  100 */ "SLIDING",
  /*  101 */ "FILL",
  /*  102 */ "VALUE",
  /*  103 */ "NONE",
  /*  104 */ "PREV",
  /*  105 */ "LINEAR",
  /*  106 */ "NEXT",
  /*  107 */ "GROUP",
  /*  108 */ "HAVING",
  /*  109 */ "ORDER",
  /*  110 */ "SLIMIT",
  /*  111 */ "SOFFSET",
  /*  112 */ "LIMIT",
  /*  113 */ "OFFSET",
  /*  114 */ "ASC",
  /*  115 */ "DESC",
  /*  116 */ "NULLS",
  /*  117 */ "FIRST",
  /*  118 */ "LAST",
  /*  119 */ "cmd",
  /*  120 */ "exists_opt",
  /*  121 */ "db_name",
  /*  122 */ "db_options",
  /*  123 */ "full_table_name",
  /*  124 */ "column_def_list",
  /*  125 */ "table_options",
  /*  126 */ "column_def",
  /*  127 */ "column_name",
  /*  128 */ "type_name",
  /*  129 */ "query_expression",
  /*  130 */ "literal",
  /*  131 */ "duration_literal",
  /*  132 */ "literal_list",
  /*  133 */ "table_name",
  /*  134 */ "function_name",
  /*  135 */ "table_alias",
  /*  136 */ "column_alias",
  /*  137 */ "expression",
  /*  138 */ "column_reference",
  /*  139 */ "expression_list",
  /*  140 */ "subquery",
  /*  141 */ "predicate",
  /*  142 */ "compare_op",
  /*  143 */ "in_op",
  /*  144 */ "in_predicate_value",
  /*  145 */ "boolean_value_expression",
  /*  146 */ "boolean_primary",
  /*  147 */ "common_expression",
  /*  148 */ "from_clause",
  /*  149 */ "table_reference_list",
  /*  150 */ "table_reference",
  /*  151 */ "table_primary",
  /*  152 */ "joined_table",
  /*  153 */ "alias_opt",
  /*  154 */ "parenthesized_joined_table",
  /*  155 */ "join_type",
  /*  156 */ "search_condition",
  /*  157 */ "query_specification",
  /*  158 */ "set_quantifier_opt",
  /*  159 */ "select_list",
  /*  160 */ "where_clause_opt",
  /*  161 */ "partition_by_clause_opt",
  /*  162 */ "twindow_clause_opt",
  /*  163 */ "group_by_clause_opt",
  /*  164 */ "having_clause_opt",
  /*  165 */ "select_sublist",
  /*  166 */ "select_item",
  /*  167 */ "sliding_opt",
  /*  168 */ "fill_opt",
  /*  169 */ "fill_mode",
  /*  170 */ "group_by_list",
  /*  171 */ "query_expression_body",
  /*  172 */ "order_by_clause_opt",
  /*  173 */ "slimit_clause_opt",
  /*  174 */ "limit_clause_opt",
  /*  175 */ "query_primary",
  /*  176 */ "sort_specification_list",
  /*  177 */ "sort_specification",
  /*  178 */ "ordering_specification_opt",
  /*  179 */ "null_ordering_opt",
757 758 759 760 761 762 763
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */

#ifndef NDEBUG
/* For tracing reduce actions, the names of all rules are required.
*/
static const char *const yyRuleName[] = {
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784
 /*   0 */ "cmd ::= CREATE DATABASE exists_opt db_name db_options",
 /*   1 */ "exists_opt ::= IF NOT EXISTS",
 /*   2 */ "exists_opt ::=",
 /*   3 */ "db_options ::=",
 /*   4 */ "db_options ::= db_options BLOCKS NK_INTEGER",
 /*   5 */ "db_options ::= db_options CACHE NK_INTEGER",
 /*   6 */ "db_options ::= db_options CACHELAST NK_INTEGER",
 /*   7 */ "db_options ::= db_options COMP NK_INTEGER",
 /*   8 */ "db_options ::= db_options DAYS NK_INTEGER",
 /*   9 */ "db_options ::= db_options FSYNC NK_INTEGER",
 /*  10 */ "db_options ::= db_options MAXROWS NK_INTEGER",
 /*  11 */ "db_options ::= db_options MINROWS NK_INTEGER",
 /*  12 */ "db_options ::= db_options KEEP NK_INTEGER",
 /*  13 */ "db_options ::= db_options PRECISION NK_STRING",
 /*  14 */ "db_options ::= db_options QUORUM NK_INTEGER",
 /*  15 */ "db_options ::= db_options REPLICA NK_INTEGER",
 /*  16 */ "db_options ::= db_options TTL NK_INTEGER",
 /*  17 */ "db_options ::= db_options WAL NK_INTEGER",
 /*  18 */ "db_options ::= db_options VGROUPS NK_INTEGER",
 /*  19 */ "db_options ::= db_options SINGLESTABLE NK_INTEGER",
 /*  20 */ "db_options ::= db_options STREAMMODE NK_INTEGER",
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
 /*  21 */ "cmd ::= USE db_name",
 /*  22 */ "cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP table_options",
 /*  23 */ "full_table_name ::= NK_ID",
 /*  24 */ "full_table_name ::= NK_ID NK_DOT NK_ID",
 /*  25 */ "column_def_list ::= column_def",
 /*  26 */ "column_def_list ::= column_def_list NK_COMMA column_def",
 /*  27 */ "column_def ::= column_name type_name",
 /*  28 */ "column_def ::= column_name type_name COMMENT NK_STRING",
 /*  29 */ "type_name ::= BOOL",
 /*  30 */ "type_name ::= TINYINT",
 /*  31 */ "type_name ::= SMALLINT",
 /*  32 */ "type_name ::= INT",
 /*  33 */ "type_name ::= INTEGER",
 /*  34 */ "type_name ::= BIGINT",
 /*  35 */ "type_name ::= FLOAT",
 /*  36 */ "type_name ::= DOUBLE",
 /*  37 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
 /*  38 */ "type_name ::= TIMESTAMP",
 /*  39 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
 /*  40 */ "type_name ::= TINYINT UNSIGNED",
 /*  41 */ "type_name ::= SMALLINT UNSIGNED",
 /*  42 */ "type_name ::= INT UNSIGNED",
 /*  43 */ "type_name ::= BIGINT UNSIGNED",
 /*  44 */ "type_name ::= JSON",
 /*  45 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
 /*  46 */ "type_name ::= MEDIUMBLOB",
 /*  47 */ "type_name ::= BLOB",
 /*  48 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
 /*  49 */ "type_name ::= DECIMAL",
 /*  50 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
 /*  51 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
 /*  52 */ "table_options ::=",
 /*  53 */ "table_options ::= table_options COMMENT NK_INTEGER",
 /*  54 */ "table_options ::= table_options KEEP NK_INTEGER",
 /*  55 */ "table_options ::= table_options TTL NK_INTEGER",
 /*  56 */ "cmd ::= SHOW DATABASES",
821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960
 /*  57 */ "cmd ::= SHOW TABLES",
 /*  58 */ "cmd ::= query_expression",
 /*  59 */ "literal ::= NK_INTEGER",
 /*  60 */ "literal ::= NK_FLOAT",
 /*  61 */ "literal ::= NK_STRING",
 /*  62 */ "literal ::= NK_BOOL",
 /*  63 */ "literal ::= TIMESTAMP NK_STRING",
 /*  64 */ "literal ::= duration_literal",
 /*  65 */ "duration_literal ::= NK_VARIABLE",
 /*  66 */ "literal_list ::= literal",
 /*  67 */ "literal_list ::= literal_list NK_COMMA literal",
 /*  68 */ "db_name ::= NK_ID",
 /*  69 */ "table_name ::= NK_ID",
 /*  70 */ "column_name ::= NK_ID",
 /*  71 */ "function_name ::= NK_ID",
 /*  72 */ "table_alias ::= NK_ID",
 /*  73 */ "column_alias ::= NK_ID",
 /*  74 */ "expression ::= literal",
 /*  75 */ "expression ::= column_reference",
 /*  76 */ "expression ::= function_name NK_LP expression_list NK_RP",
 /*  77 */ "expression ::= function_name NK_LP NK_STAR NK_RP",
 /*  78 */ "expression ::= subquery",
 /*  79 */ "expression ::= NK_LP expression NK_RP",
 /*  80 */ "expression ::= NK_PLUS expression",
 /*  81 */ "expression ::= NK_MINUS expression",
 /*  82 */ "expression ::= expression NK_PLUS expression",
 /*  83 */ "expression ::= expression NK_MINUS expression",
 /*  84 */ "expression ::= expression NK_STAR expression",
 /*  85 */ "expression ::= expression NK_SLASH expression",
 /*  86 */ "expression ::= expression NK_REM expression",
 /*  87 */ "expression_list ::= expression",
 /*  88 */ "expression_list ::= expression_list NK_COMMA expression",
 /*  89 */ "column_reference ::= column_name",
 /*  90 */ "column_reference ::= table_name NK_DOT column_name",
 /*  91 */ "predicate ::= expression compare_op expression",
 /*  92 */ "predicate ::= expression BETWEEN expression AND expression",
 /*  93 */ "predicate ::= expression NOT BETWEEN expression AND expression",
 /*  94 */ "predicate ::= expression IS NULL",
 /*  95 */ "predicate ::= expression IS NOT NULL",
 /*  96 */ "predicate ::= expression in_op in_predicate_value",
 /*  97 */ "compare_op ::= NK_LT",
 /*  98 */ "compare_op ::= NK_GT",
 /*  99 */ "compare_op ::= NK_LE",
 /* 100 */ "compare_op ::= NK_GE",
 /* 101 */ "compare_op ::= NK_NE",
 /* 102 */ "compare_op ::= NK_EQ",
 /* 103 */ "compare_op ::= LIKE",
 /* 104 */ "compare_op ::= NOT LIKE",
 /* 105 */ "compare_op ::= MATCH",
 /* 106 */ "compare_op ::= NMATCH",
 /* 107 */ "in_op ::= IN",
 /* 108 */ "in_op ::= NOT IN",
 /* 109 */ "in_predicate_value ::= NK_LP expression_list NK_RP",
 /* 110 */ "boolean_value_expression ::= boolean_primary",
 /* 111 */ "boolean_value_expression ::= NOT boolean_primary",
 /* 112 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
 /* 113 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
 /* 114 */ "boolean_primary ::= predicate",
 /* 115 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
 /* 116 */ "common_expression ::= expression",
 /* 117 */ "common_expression ::= boolean_value_expression",
 /* 118 */ "from_clause ::= FROM table_reference_list",
 /* 119 */ "table_reference_list ::= table_reference",
 /* 120 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
 /* 121 */ "table_reference ::= table_primary",
 /* 122 */ "table_reference ::= joined_table",
 /* 123 */ "table_primary ::= table_name alias_opt",
 /* 124 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
 /* 125 */ "table_primary ::= subquery alias_opt",
 /* 126 */ "table_primary ::= parenthesized_joined_table",
 /* 127 */ "alias_opt ::=",
 /* 128 */ "alias_opt ::= table_alias",
 /* 129 */ "alias_opt ::= AS table_alias",
 /* 130 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
 /* 131 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
 /* 132 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
 /* 133 */ "join_type ::=",
 /* 134 */ "join_type ::= INNER",
 /* 135 */ "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",
 /* 136 */ "set_quantifier_opt ::=",
 /* 137 */ "set_quantifier_opt ::= DISTINCT",
 /* 138 */ "set_quantifier_opt ::= ALL",
 /* 139 */ "select_list ::= NK_STAR",
 /* 140 */ "select_list ::= select_sublist",
 /* 141 */ "select_sublist ::= select_item",
 /* 142 */ "select_sublist ::= select_sublist NK_COMMA select_item",
 /* 143 */ "select_item ::= common_expression",
 /* 144 */ "select_item ::= common_expression column_alias",
 /* 145 */ "select_item ::= common_expression AS column_alias",
 /* 146 */ "select_item ::= table_name NK_DOT NK_STAR",
 /* 147 */ "where_clause_opt ::=",
 /* 148 */ "where_clause_opt ::= WHERE search_condition",
 /* 149 */ "partition_by_clause_opt ::=",
 /* 150 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
 /* 151 */ "twindow_clause_opt ::=",
 /* 152 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP",
 /* 153 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP",
 /* 154 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
 /* 155 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
 /* 156 */ "sliding_opt ::=",
 /* 157 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
 /* 158 */ "fill_opt ::=",
 /* 159 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
 /* 160 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
 /* 161 */ "fill_mode ::= NONE",
 /* 162 */ "fill_mode ::= PREV",
 /* 163 */ "fill_mode ::= NULL",
 /* 164 */ "fill_mode ::= LINEAR",
 /* 165 */ "fill_mode ::= NEXT",
 /* 166 */ "group_by_clause_opt ::=",
 /* 167 */ "group_by_clause_opt ::= GROUP BY group_by_list",
 /* 168 */ "group_by_list ::= expression",
 /* 169 */ "group_by_list ::= group_by_list NK_COMMA expression",
 /* 170 */ "having_clause_opt ::=",
 /* 171 */ "having_clause_opt ::= HAVING search_condition",
 /* 172 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
 /* 173 */ "query_expression_body ::= query_primary",
 /* 174 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
 /* 175 */ "query_primary ::= query_specification",
 /* 176 */ "order_by_clause_opt ::=",
 /* 177 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
 /* 178 */ "slimit_clause_opt ::=",
 /* 179 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
 /* 180 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
 /* 181 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
 /* 182 */ "limit_clause_opt ::=",
 /* 183 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
 /* 184 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
 /* 185 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
 /* 186 */ "subquery ::= NK_LP query_expression NK_RP",
 /* 187 */ "search_condition ::= common_expression",
 /* 188 */ "sort_specification_list ::= sort_specification",
 /* 189 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
 /* 190 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
 /* 191 */ "ordering_specification_opt ::=",
 /* 192 */ "ordering_specification_opt ::= ASC",
 /* 193 */ "ordering_specification_opt ::= DESC",
 /* 194 */ "null_ordering_opt ::=",
 /* 195 */ "null_ordering_opt ::= NULLS FIRST",
 /* 196 */ "null_ordering_opt ::= NULLS LAST",
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
};
#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
** second argument to NewParseAlloc() below.  This can be changed by
** putting an appropriate #define in the %include section of the input
** grammar.
*/
#ifndef YYMALLOCARGTYPE
# define YYMALLOCARGTYPE size_t
#endif

/* Initialize a new parser that has already been allocated.
*/
void NewParseInit(void *yypRawParser NewParseCTX_PDECL){
  yyParser *yypParser = (yyParser*)yypRawParser;
  NewParseCTX_STORE
#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
}

#ifndef NewParse_ENGINEALWAYSONSTACK
/* 
** This function allocates a new parser.
** The only argument is a pointer to a function which works like
** malloc.
**
** Inputs:
** A pointer to the function used to allocate memory.
**
** Outputs:
** A pointer to a parser.  This pointer is used in subsequent calls
** to NewParse and NewParseFree.
*/
void *NewParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) NewParseCTX_PDECL){
  yyParser *yypParser;
  yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
  if( yypParser ){
    NewParseCTX_STORE
    NewParseInit(yypParser NewParseCTX_PARAM);
  }
  return (void*)yypParser;
}
#endif /* NewParse_ENGINEALWAYSONSTACK */


/* 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 */
){
  NewParseARG_FETCH
  NewParseCTX_FETCH
  switch( yymajor ){
    /* Here is inserted the actions which take place when a
    ** terminal or non-terminal is destroyed.  This can happen
    ** when the symbol is popped from the stack during a
    ** reduce or during error processing or when a parser is 
    ** being destroyed before it is finished parsing.
    **
    ** Note: during a reduce, the only symbols destroyed are those
    ** which appear on the RHS of the rule, but which are *not* used
    ** inside the C code.
    */
/********* Begin destructor definitions ***************************************/
      /* Default NON-TERMINAL Destructor */
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
    case 119: /* cmd */
    case 120: /* exists_opt */
    case 126: /* column_def */
    case 129: /* query_expression */
    case 130: /* literal */
    case 131: /* duration_literal */
    case 137: /* expression */
    case 138: /* column_reference */
    case 140: /* subquery */
    case 141: /* predicate */
    case 144: /* in_predicate_value */
    case 145: /* boolean_value_expression */
    case 146: /* boolean_primary */
    case 147: /* common_expression */
    case 148: /* from_clause */
    case 149: /* table_reference_list */
    case 150: /* table_reference */
    case 151: /* table_primary */
    case 152: /* joined_table */
    case 154: /* parenthesized_joined_table */
    case 156: /* search_condition */
    case 157: /* query_specification */
    case 160: /* where_clause_opt */
    case 162: /* twindow_clause_opt */
    case 164: /* having_clause_opt */
    case 166: /* select_item */
    case 167: /* sliding_opt */
    case 168: /* fill_opt */
    case 171: /* query_expression_body */
    case 173: /* slimit_clause_opt */
    case 174: /* limit_clause_opt */
    case 175: /* query_primary */
    case 177: /* sort_specification */
1120
{
1121
 PARSER_DESTRUCTOR_TRACE; nodesDestroyNode((yypminor->yy272)); 
1122 1123
}
      break;
1124 1125 1126 1127 1128 1129 1130
    case 121: /* db_name */
    case 127: /* column_name */
    case 133: /* table_name */
    case 134: /* function_name */
    case 135: /* table_alias */
    case 136: /* column_alias */
    case 153: /* alias_opt */
1131
{
1132
 PARSER_DESTRUCTOR_TRACE; 
1133 1134
}
      break;
1135
    case 122: /* db_options */
1136
{
1137
 tfree((yypminor->yy199)); 
1138 1139
}
      break;
1140
    case 123: /* full_table_name */
1141
{
1142
 
1143 1144
}
      break;
1145
    case 124: /* column_def_list */
1146
{
1147
 nodesDestroyList((yypminor->yy64)); 
1148 1149
}
      break;
1150
    case 125: /* table_options */
1151
{
1152
 tfree((yypminor->yy46)); 
1153 1154
}
      break;
1155
    case 128: /* type_name */
1156 1157 1158 1159
{
 
}
      break;
1160 1161 1162 1163 1164 1165 1166 1167 1168
    case 132: /* literal_list */
    case 139: /* expression_list */
    case 159: /* select_list */
    case 161: /* partition_by_clause_opt */
    case 163: /* group_by_clause_opt */
    case 165: /* select_sublist */
    case 170: /* group_by_list */
    case 172: /* order_by_clause_opt */
    case 176: /* sort_specification_list */
1169
{
1170
 PARSER_DESTRUCTOR_TRACE; nodesDestroyList((yypminor->yy64)); 
1171 1172
}
      break;
1173 1174
    case 142: /* compare_op */
    case 143: /* in_op */
1175
{
1176
 PARSER_DESTRUCTOR_TRACE; 
1177 1178
}
      break;
1179
    case 155: /* join_type */
1180
{
1181
 PARSER_DESTRUCTOR_TRACE; 
1182 1183
}
      break;
1184
    case 158: /* set_quantifier_opt */
1185
{
1186
 PARSER_DESTRUCTOR_TRACE; 
1187 1188
}
      break;
1189
    case 169: /* fill_mode */
1190 1191 1192 1193
{
 PARSER_DESTRUCTOR_TRACE; 
}
      break;
1194
    case 178: /* ordering_specification_opt */
1195 1196 1197 1198
{
 PARSER_DESTRUCTOR_TRACE; 
}
      break;
1199
    case 179: /* null_ordering_opt */
1200 1201
{
 PARSER_DESTRUCTOR_TRACE; 
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 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 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497
}
      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
*/
void NewParseFinalize(void *p){
  yyParser *pParser = (yyParser*)p;
  while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
#if YYSTACKDEPTH<=0
  if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
#endif
}

#ifndef NewParse_ENGINEALWAYSONSTACK
/* 
** Deallocate and destroy a parser.  Destructors are called for
** all stack elements before shutting the parser down.
**
** If the YYPARSEFREENEVERNULL macro exists (for example because it
** is defined in a %include section of the input grammar) then it is
** assumed that the input pointer is never NULL.
*/
void NewParseFree(
  void *p,                    /* The parser to be deleted */
  void (*freeProc)(void*)     /* Function used to reclaim memory */
){
#ifndef YYPARSEFREENEVERNULL
  if( p==0 ) return;
#endif
  NewParseFinalize(p);
  (*freeProc)(p);
}
#endif /* NewParse_ENGINEALWAYSONSTACK */

/*
** Return the peak depth of the stack for a parser.
*/
#ifdef YYTRACKMAXSTACKDEPTH
int NewParseStackPeak(void *p){
  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)
int NewParseCoverage(FILE *out){
  int stateno, iLookAhead, i;
  int nMissed = 0;
  for(stateno=0; stateno<YYNSTATE; stateno++){
    i = yy_shift_ofst[stateno];
    for(iLookAhead=0; iLookAhead<YYNTOKEN; iLookAhead++){
      if( yy_lookahead[i+iLookAhead]!=iLookAhead ) continue;
      if( yycoverage[stateno][iLookAhead]==0 ) nMissed++;
      if( out ){
        fprintf(out,"State %d lookahead %s %s\n", stateno,
                yyTokenName[iLookAhead],
                yycoverage[stateno][iLookAhead] ? "ok" : "missed");
      }
    }
  }
  return nMissed;
}
#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){
   NewParseARG_FETCH
   NewParseCTX_FETCH
#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 ********************************************/
   NewParseARG_STORE /* Suppress warning about unused %extra_argument var */
   NewParseCTX_STORE
}

/*
** 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 */
  NewParseTOKENTYPE yyMinor        /* The minor token to shift in */
){
  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[] = {
1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 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
  {  119,   -5 }, /* (0) cmd ::= CREATE DATABASE exists_opt db_name db_options */
  {  120,   -3 }, /* (1) exists_opt ::= IF NOT EXISTS */
  {  120,    0 }, /* (2) exists_opt ::= */
  {  122,    0 }, /* (3) db_options ::= */
  {  122,   -3 }, /* (4) db_options ::= db_options BLOCKS NK_INTEGER */
  {  122,   -3 }, /* (5) db_options ::= db_options CACHE NK_INTEGER */
  {  122,   -3 }, /* (6) db_options ::= db_options CACHELAST NK_INTEGER */
  {  122,   -3 }, /* (7) db_options ::= db_options COMP NK_INTEGER */
  {  122,   -3 }, /* (8) db_options ::= db_options DAYS NK_INTEGER */
  {  122,   -3 }, /* (9) db_options ::= db_options FSYNC NK_INTEGER */
  {  122,   -3 }, /* (10) db_options ::= db_options MAXROWS NK_INTEGER */
  {  122,   -3 }, /* (11) db_options ::= db_options MINROWS NK_INTEGER */
  {  122,   -3 }, /* (12) db_options ::= db_options KEEP NK_INTEGER */
  {  122,   -3 }, /* (13) db_options ::= db_options PRECISION NK_STRING */
  {  122,   -3 }, /* (14) db_options ::= db_options QUORUM NK_INTEGER */
  {  122,   -3 }, /* (15) db_options ::= db_options REPLICA NK_INTEGER */
  {  122,   -3 }, /* (16) db_options ::= db_options TTL NK_INTEGER */
  {  122,   -3 }, /* (17) db_options ::= db_options WAL NK_INTEGER */
  {  122,   -3 }, /* (18) db_options ::= db_options VGROUPS NK_INTEGER */
  {  122,   -3 }, /* (19) db_options ::= db_options SINGLESTABLE NK_INTEGER */
  {  122,   -3 }, /* (20) db_options ::= db_options STREAMMODE NK_INTEGER */
  {  119,   -2 }, /* (21) cmd ::= USE db_name */
  {  119,   -8 }, /* (22) cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP table_options */
  {  123,   -1 }, /* (23) full_table_name ::= NK_ID */
  {  123,   -3 }, /* (24) full_table_name ::= NK_ID NK_DOT NK_ID */
  {  124,   -1 }, /* (25) column_def_list ::= column_def */
  {  124,   -3 }, /* (26) column_def_list ::= column_def_list NK_COMMA column_def */
  {  126,   -2 }, /* (27) column_def ::= column_name type_name */
  {  126,   -4 }, /* (28) column_def ::= column_name type_name COMMENT NK_STRING */
  {  128,   -1 }, /* (29) type_name ::= BOOL */
  {  128,   -1 }, /* (30) type_name ::= TINYINT */
  {  128,   -1 }, /* (31) type_name ::= SMALLINT */
  {  128,   -1 }, /* (32) type_name ::= INT */
  {  128,   -1 }, /* (33) type_name ::= INTEGER */
  {  128,   -1 }, /* (34) type_name ::= BIGINT */
  {  128,   -1 }, /* (35) type_name ::= FLOAT */
  {  128,   -1 }, /* (36) type_name ::= DOUBLE */
  {  128,   -4 }, /* (37) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
  {  128,   -1 }, /* (38) type_name ::= TIMESTAMP */
  {  128,   -4 }, /* (39) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
  {  128,   -2 }, /* (40) type_name ::= TINYINT UNSIGNED */
  {  128,   -2 }, /* (41) type_name ::= SMALLINT UNSIGNED */
  {  128,   -2 }, /* (42) type_name ::= INT UNSIGNED */
  {  128,   -2 }, /* (43) type_name ::= BIGINT UNSIGNED */
  {  128,   -1 }, /* (44) type_name ::= JSON */
  {  128,   -4 }, /* (45) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
  {  128,   -1 }, /* (46) type_name ::= MEDIUMBLOB */
  {  128,   -1 }, /* (47) type_name ::= BLOB */
  {  128,   -4 }, /* (48) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
  {  128,   -1 }, /* (49) type_name ::= DECIMAL */
  {  128,   -4 }, /* (50) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
  {  128,   -6 }, /* (51) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
  {  125,    0 }, /* (52) table_options ::= */
  {  125,   -3 }, /* (53) table_options ::= table_options COMMENT NK_INTEGER */
  {  125,   -3 }, /* (54) table_options ::= table_options KEEP NK_INTEGER */
  {  125,   -3 }, /* (55) table_options ::= table_options TTL NK_INTEGER */
  {  119,   -2 }, /* (56) cmd ::= SHOW DATABASES */
  {  119,   -2 }, /* (57) cmd ::= SHOW TABLES */
  {  119,   -1 }, /* (58) cmd ::= query_expression */
  {  130,   -1 }, /* (59) literal ::= NK_INTEGER */
  {  130,   -1 }, /* (60) literal ::= NK_FLOAT */
  {  130,   -1 }, /* (61) literal ::= NK_STRING */
  {  130,   -1 }, /* (62) literal ::= NK_BOOL */
  {  130,   -2 }, /* (63) literal ::= TIMESTAMP NK_STRING */
  {  130,   -1 }, /* (64) literal ::= duration_literal */
  {  131,   -1 }, /* (65) duration_literal ::= NK_VARIABLE */
  {  132,   -1 }, /* (66) literal_list ::= literal */
  {  132,   -3 }, /* (67) literal_list ::= literal_list NK_COMMA literal */
  {  121,   -1 }, /* (68) db_name ::= NK_ID */
  {  133,   -1 }, /* (69) table_name ::= NK_ID */
  {  127,   -1 }, /* (70) column_name ::= NK_ID */
  {  134,   -1 }, /* (71) function_name ::= NK_ID */
  {  135,   -1 }, /* (72) table_alias ::= NK_ID */
  {  136,   -1 }, /* (73) column_alias ::= NK_ID */
  {  137,   -1 }, /* (74) expression ::= literal */
  {  137,   -1 }, /* (75) expression ::= column_reference */
  {  137,   -4 }, /* (76) expression ::= function_name NK_LP expression_list NK_RP */
  {  137,   -4 }, /* (77) expression ::= function_name NK_LP NK_STAR NK_RP */
  {  137,   -1 }, /* (78) expression ::= subquery */
  {  137,   -3 }, /* (79) expression ::= NK_LP expression NK_RP */
  {  137,   -2 }, /* (80) expression ::= NK_PLUS expression */
  {  137,   -2 }, /* (81) expression ::= NK_MINUS expression */
  {  137,   -3 }, /* (82) expression ::= expression NK_PLUS expression */
  {  137,   -3 }, /* (83) expression ::= expression NK_MINUS expression */
  {  137,   -3 }, /* (84) expression ::= expression NK_STAR expression */
  {  137,   -3 }, /* (85) expression ::= expression NK_SLASH expression */
  {  137,   -3 }, /* (86) expression ::= expression NK_REM expression */
  {  139,   -1 }, /* (87) expression_list ::= expression */
  {  139,   -3 }, /* (88) expression_list ::= expression_list NK_COMMA expression */
  {  138,   -1 }, /* (89) column_reference ::= column_name */
  {  138,   -3 }, /* (90) column_reference ::= table_name NK_DOT column_name */
  {  141,   -3 }, /* (91) predicate ::= expression compare_op expression */
  {  141,   -5 }, /* (92) predicate ::= expression BETWEEN expression AND expression */
  {  141,   -6 }, /* (93) predicate ::= expression NOT BETWEEN expression AND expression */
  {  141,   -3 }, /* (94) predicate ::= expression IS NULL */
  {  141,   -4 }, /* (95) predicate ::= expression IS NOT NULL */
  {  141,   -3 }, /* (96) predicate ::= expression in_op in_predicate_value */
  {  142,   -1 }, /* (97) compare_op ::= NK_LT */
  {  142,   -1 }, /* (98) compare_op ::= NK_GT */
  {  142,   -1 }, /* (99) compare_op ::= NK_LE */
  {  142,   -1 }, /* (100) compare_op ::= NK_GE */
  {  142,   -1 }, /* (101) compare_op ::= NK_NE */
  {  142,   -1 }, /* (102) compare_op ::= NK_EQ */
  {  142,   -1 }, /* (103) compare_op ::= LIKE */
  {  142,   -2 }, /* (104) compare_op ::= NOT LIKE */
  {  142,   -1 }, /* (105) compare_op ::= MATCH */
  {  142,   -1 }, /* (106) compare_op ::= NMATCH */
  {  143,   -1 }, /* (107) in_op ::= IN */
  {  143,   -2 }, /* (108) in_op ::= NOT IN */
  {  144,   -3 }, /* (109) in_predicate_value ::= NK_LP expression_list NK_RP */
  {  145,   -1 }, /* (110) boolean_value_expression ::= boolean_primary */
  {  145,   -2 }, /* (111) boolean_value_expression ::= NOT boolean_primary */
  {  145,   -3 }, /* (112) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
  {  145,   -3 }, /* (113) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
  {  146,   -1 }, /* (114) boolean_primary ::= predicate */
  {  146,   -3 }, /* (115) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
  {  147,   -1 }, /* (116) common_expression ::= expression */
  {  147,   -1 }, /* (117) common_expression ::= boolean_value_expression */
  {  148,   -2 }, /* (118) from_clause ::= FROM table_reference_list */
  {  149,   -1 }, /* (119) table_reference_list ::= table_reference */
  {  149,   -3 }, /* (120) table_reference_list ::= table_reference_list NK_COMMA table_reference */
  {  150,   -1 }, /* (121) table_reference ::= table_primary */
  {  150,   -1 }, /* (122) table_reference ::= joined_table */
  {  151,   -2 }, /* (123) table_primary ::= table_name alias_opt */
  {  151,   -4 }, /* (124) table_primary ::= db_name NK_DOT table_name alias_opt */
  {  151,   -2 }, /* (125) table_primary ::= subquery alias_opt */
  {  151,   -1 }, /* (126) table_primary ::= parenthesized_joined_table */
  {  153,    0 }, /* (127) alias_opt ::= */
  {  153,   -1 }, /* (128) alias_opt ::= table_alias */
  {  153,   -2 }, /* (129) alias_opt ::= AS table_alias */
  {  154,   -3 }, /* (130) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
  {  154,   -3 }, /* (131) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
  {  152,   -6 }, /* (132) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
  {  155,    0 }, /* (133) join_type ::= */
  {  155,   -1 }, /* (134) join_type ::= INNER */
  {  157,   -9 }, /* (135) 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 */
  {  158,    0 }, /* (136) set_quantifier_opt ::= */
  {  158,   -1 }, /* (137) set_quantifier_opt ::= DISTINCT */
  {  158,   -1 }, /* (138) set_quantifier_opt ::= ALL */
  {  159,   -1 }, /* (139) select_list ::= NK_STAR */
  {  159,   -1 }, /* (140) select_list ::= select_sublist */
  {  165,   -1 }, /* (141) select_sublist ::= select_item */
  {  165,   -3 }, /* (142) select_sublist ::= select_sublist NK_COMMA select_item */
  {  166,   -1 }, /* (143) select_item ::= common_expression */
  {  166,   -2 }, /* (144) select_item ::= common_expression column_alias */
  {  166,   -3 }, /* (145) select_item ::= common_expression AS column_alias */
  {  166,   -3 }, /* (146) select_item ::= table_name NK_DOT NK_STAR */
  {  160,    0 }, /* (147) where_clause_opt ::= */
  {  160,   -2 }, /* (148) where_clause_opt ::= WHERE search_condition */
  {  161,    0 }, /* (149) partition_by_clause_opt ::= */
  {  161,   -3 }, /* (150) partition_by_clause_opt ::= PARTITION BY expression_list */
  {  162,    0 }, /* (151) twindow_clause_opt ::= */
  {  162,   -6 }, /* (152) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
  {  162,   -4 }, /* (153) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
  {  162,   -6 }, /* (154) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
  {  162,   -8 }, /* (155) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
  {  167,    0 }, /* (156) sliding_opt ::= */
  {  167,   -4 }, /* (157) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
  {  168,    0 }, /* (158) fill_opt ::= */
  {  168,   -4 }, /* (159) fill_opt ::= FILL NK_LP fill_mode NK_RP */
  {  168,   -6 }, /* (160) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
  {  169,   -1 }, /* (161) fill_mode ::= NONE */
  {  169,   -1 }, /* (162) fill_mode ::= PREV */
  {  169,   -1 }, /* (163) fill_mode ::= NULL */
  {  169,   -1 }, /* (164) fill_mode ::= LINEAR */
  {  169,   -1 }, /* (165) fill_mode ::= NEXT */
  {  163,    0 }, /* (166) group_by_clause_opt ::= */
  {  163,   -3 }, /* (167) group_by_clause_opt ::= GROUP BY group_by_list */
  {  170,   -1 }, /* (168) group_by_list ::= expression */
  {  170,   -3 }, /* (169) group_by_list ::= group_by_list NK_COMMA expression */
  {  164,    0 }, /* (170) having_clause_opt ::= */
  {  164,   -2 }, /* (171) having_clause_opt ::= HAVING search_condition */
  {  129,   -4 }, /* (172) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
  {  171,   -1 }, /* (173) query_expression_body ::= query_primary */
  {  171,   -4 }, /* (174) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
  {  175,   -1 }, /* (175) query_primary ::= query_specification */
  {  172,    0 }, /* (176) order_by_clause_opt ::= */
  {  172,   -3 }, /* (177) order_by_clause_opt ::= ORDER BY sort_specification_list */
  {  173,    0 }, /* (178) slimit_clause_opt ::= */
  {  173,   -2 }, /* (179) slimit_clause_opt ::= SLIMIT NK_INTEGER */
  {  173,   -4 }, /* (180) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
  {  173,   -4 }, /* (181) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
  {  174,    0 }, /* (182) limit_clause_opt ::= */
  {  174,   -2 }, /* (183) limit_clause_opt ::= LIMIT NK_INTEGER */
  {  174,   -4 }, /* (184) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
  {  174,   -4 }, /* (185) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
  {  140,   -3 }, /* (186) subquery ::= NK_LP query_expression NK_RP */
  {  156,   -1 }, /* (187) search_condition ::= common_expression */
  {  176,   -1 }, /* (188) sort_specification_list ::= sort_specification */
  {  176,   -3 }, /* (189) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
  {  177,   -3 }, /* (190) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
  {  178,    0 }, /* (191) ordering_specification_opt ::= */
  {  178,   -1 }, /* (192) ordering_specification_opt ::= ASC */
  {  178,   -1 }, /* (193) ordering_specification_opt ::= DESC */
  {  179,    0 }, /* (194) null_ordering_opt ::= */
  {  179,   -2 }, /* (195) null_ordering_opt ::= NULLS FIRST */
  {  179,   -2 }, /* (196) null_ordering_opt ::= NULLS LAST */
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 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780
};

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 */
  NewParseTOKENTYPE yyLookaheadToken  /* Value of the lookahead token */
  NewParseCTX_PDECL                   /* %extra_context */
){
  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 */
  NewParseARG_FETCH
  (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;
1781
      case 0: /* cmd ::= CREATE DATABASE exists_opt db_name db_options */
1782
{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy137, &yymsp[-1].minor.yy209, yymsp[0].minor.yy199);}
1783 1784
        break;
      case 1: /* exists_opt ::= IF NOT EXISTS */
1785
{ yymsp[-2].minor.yy137 = true; }
1786 1787
        break;
      case 2: /* exists_opt ::= */
1788
{ yymsp[1].minor.yy137 = false; }
1789 1790
        break;
      case 3: /* db_options ::= */
1791
{ yymsp[1].minor.yy199 = createDefaultDatabaseOptions(pCxt); }
1792 1793
        break;
      case 4: /* db_options ::= db_options BLOCKS NK_INTEGER */
1794 1795
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1796 1797
        break;
      case 5: /* db_options ::= db_options CACHE NK_INTEGER */
1798 1799
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_CACHE, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1800 1801
        break;
      case 6: /* db_options ::= db_options CACHELAST NK_INTEGER */
1802 1803
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1804 1805
        break;
      case 7: /* db_options ::= db_options COMP NK_INTEGER */
1806 1807
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1808 1809
        break;
      case 8: /* db_options ::= db_options DAYS NK_INTEGER */
1810 1811
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1812 1813
        break;
      case 9: /* db_options ::= db_options FSYNC NK_INTEGER */
1814 1815
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1816 1817
        break;
      case 10: /* db_options ::= db_options MAXROWS NK_INTEGER */
1818 1819
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1820 1821
        break;
      case 11: /* db_options ::= db_options MINROWS NK_INTEGER */
1822 1823
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1824 1825
        break;
      case 12: /* db_options ::= db_options KEEP NK_INTEGER */
1826 1827
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_KEEP, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1828 1829
        break;
      case 13: /* db_options ::= db_options PRECISION NK_STRING */
1830 1831
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1832 1833
        break;
      case 14: /* db_options ::= db_options QUORUM NK_INTEGER */
1834 1835
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1836 1837
        break;
      case 15: /* db_options ::= db_options REPLICA NK_INTEGER */
1838 1839
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1840 1841
        break;
      case 16: /* db_options ::= db_options TTL NK_INTEGER */
1842 1843
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_TTL, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1844 1845
        break;
      case 17: /* db_options ::= db_options WAL NK_INTEGER */
1846 1847
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1848 1849
        break;
      case 18: /* db_options ::= db_options VGROUPS NK_INTEGER */
1850 1851
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1852 1853
        break;
      case 19: /* db_options ::= db_options SINGLESTABLE NK_INTEGER */
1854 1855
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_SINGLESTABLE, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1856 1857
        break;
      case 20: /* db_options ::= db_options STREAMMODE NK_INTEGER */
1858 1859
{ yylhsminor.yy199 = setDatabaseOption(pCxt, yymsp[-2].minor.yy199, DB_OPTION_STREAMMODE, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy199 = yylhsminor.yy199;
1860 1861
        break;
      case 21: /* cmd ::= USE db_name */
1862
{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy209);}
1863 1864
        break;
      case 22: /* cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP table_options */
1865
{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-5].minor.yy137, &yymsp[-4].minor.yy57, yymsp[-2].minor.yy64, yymsp[0].minor.yy46);}
1866 1867
        break;
      case 23: /* full_table_name ::= NK_ID */
1868 1869
{ STokenPair t = { .first = nil_token, .second = yymsp[0].minor.yy0 }; yylhsminor.yy57 = t; }
  yymsp[0].minor.yy57 = yylhsminor.yy57;
1870 1871
        break;
      case 24: /* full_table_name ::= NK_ID NK_DOT NK_ID */
1872 1873
{ STokenPair t = { .first = yymsp[-2].minor.yy0, .second = yymsp[0].minor.yy0 }; yylhsminor.yy57 = t; }
  yymsp[-2].minor.yy57 = yylhsminor.yy57;
1874 1875
        break;
      case 25: /* column_def_list ::= column_def */
1876 1877
{ yylhsminor.yy64 = createNodeList(pCxt, yymsp[0].minor.yy272); }
  yymsp[0].minor.yy64 = yylhsminor.yy64;
1878 1879
        break;
      case 26: /* column_def_list ::= column_def_list NK_COMMA column_def */
1880 1881
{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, yymsp[0].minor.yy272); }
  yymsp[-2].minor.yy64 = yylhsminor.yy64;
1882 1883
        break;
      case 27: /* column_def ::= column_name type_name */
1884 1885
{ yylhsminor.yy272 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy304, NULL); }
  yymsp[-1].minor.yy272 = yylhsminor.yy272;
1886 1887
        break;
      case 28: /* column_def ::= column_name type_name COMMENT NK_STRING */
1888 1889
{ yylhsminor.yy272 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-2].minor.yy304, &yymsp[0].minor.yy0); }
  yymsp[-3].minor.yy272 = yylhsminor.yy272;
1890 1891
        break;
      case 29: /* type_name ::= BOOL */
1892
{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BOOL); }
1893 1894
        break;
      case 30: /* type_name ::= TINYINT */
1895
{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_TINYINT); }
1896 1897
        break;
      case 31: /* type_name ::= SMALLINT */
1898
{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
1899 1900 1901
        break;
      case 32: /* type_name ::= INT */
      case 33: /* type_name ::= INTEGER */ yytestcase(yyruleno==33);
1902
{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_INT); }
1903 1904
        break;
      case 34: /* type_name ::= BIGINT */
1905
{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BIGINT); }
1906 1907
        break;
      case 35: /* type_name ::= FLOAT */
1908
{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_FLOAT); }
1909 1910
        break;
      case 36: /* type_name ::= DOUBLE */
1911
{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
1912 1913
        break;
      case 37: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
1914
{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
1915 1916
        break;
      case 38: /* type_name ::= TIMESTAMP */
1917
{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
1918 1919
        break;
      case 39: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
1920
{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
1921 1922
        break;
      case 40: /* type_name ::= TINYINT UNSIGNED */
1923
{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
1924 1925
        break;
      case 41: /* type_name ::= SMALLINT UNSIGNED */
1926
{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
1927 1928
        break;
      case 42: /* type_name ::= INT UNSIGNED */
1929
{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UINT); }
1930 1931
        break;
      case 43: /* type_name ::= BIGINT UNSIGNED */
1932
{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
1933 1934
        break;
      case 44: /* type_name ::= JSON */
1935
{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_JSON); }
1936 1937
        break;
      case 45: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
1938
{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
1939 1940
        break;
      case 46: /* type_name ::= MEDIUMBLOB */
1941
{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
1942 1943
        break;
      case 47: /* type_name ::= BLOB */
1944
{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BLOB); }
1945 1946
        break;
      case 48: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
1947
{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
1948 1949
        break;
      case 49: /* type_name ::= DECIMAL */
1950
{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
1951 1952
        break;
      case 50: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
1953
{ yymsp[-3].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
1954 1955
        break;
      case 51: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
1956
{ yymsp[-5].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
1957 1958
        break;
      case 52: /* table_options ::= */
1959
{ yymsp[1].minor.yy46 = createDefaultTableOptions(pCxt);}
1960 1961
        break;
      case 53: /* table_options ::= table_options COMMENT NK_INTEGER */
1962 1963
{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy46 = yylhsminor.yy46;
1964 1965
        break;
      case 54: /* table_options ::= table_options KEEP NK_INTEGER */
1966 1967
{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_KEEP, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy46 = yylhsminor.yy46;
1968 1969
        break;
      case 55: /* table_options ::= table_options TTL NK_INTEGER */
1970 1971
{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy46 = yylhsminor.yy46;
1972 1973
        break;
      case 56: /* cmd ::= SHOW DATABASES */
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
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); }
        break;
      case 57: /* cmd ::= SHOW TABLES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT); }
        break;
      case 58: /* cmd ::= query_expression */
{ PARSER_TRACE; pCxt->pRootNode = yymsp[0].minor.yy272; }
        break;
      case 59: /* literal ::= NK_INTEGER */
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
  yymsp[0].minor.yy272 = yylhsminor.yy272;
        break;
      case 60: /* literal ::= NK_FLOAT */
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
  yymsp[0].minor.yy272 = yylhsminor.yy272;
        break;
      case 61: /* literal ::= NK_STRING */
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
  yymsp[0].minor.yy272 = yylhsminor.yy272;
        break;
      case 62: /* literal ::= NK_BOOL */
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
  yymsp[0].minor.yy272 = yylhsminor.yy272;
        break;
      case 63: /* literal ::= TIMESTAMP NK_STRING */
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
  yymsp[-1].minor.yy272 = yylhsminor.yy272;
        break;
      case 64: /* literal ::= duration_literal */
      case 74: /* expression ::= literal */ yytestcase(yyruleno==74);
      case 75: /* expression ::= column_reference */ yytestcase(yyruleno==75);
      case 78: /* expression ::= subquery */ yytestcase(yyruleno==78);
      case 110: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==110);
      case 114: /* boolean_primary ::= predicate */ yytestcase(yyruleno==114);
      case 119: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==119);
      case 121: /* table_reference ::= table_primary */ yytestcase(yyruleno==121);
      case 122: /* table_reference ::= joined_table */ yytestcase(yyruleno==122);
      case 126: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==126);
      case 173: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==173);
      case 175: /* query_primary ::= query_specification */ yytestcase(yyruleno==175);
{ PARSER_TRACE; yylhsminor.yy272 = yymsp[0].minor.yy272; }
  yymsp[0].minor.yy272 = yylhsminor.yy272;
        break;
      case 65: /* duration_literal ::= NK_VARIABLE */
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
  yymsp[0].minor.yy272 = yylhsminor.yy272;
        break;
      case 66: /* literal_list ::= literal */
      case 87: /* expression_list ::= expression */ yytestcase(yyruleno==87);
{ PARSER_TRACE; yylhsminor.yy64 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy272)); }
  yymsp[0].minor.yy64 = yylhsminor.yy64;
        break;
      case 67: /* literal_list ::= literal_list NK_COMMA literal */
      case 88: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==88);
{ PARSER_TRACE; yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, releaseRawExprNode(pCxt, yymsp[0].minor.yy272)); }
  yymsp[-2].minor.yy64 = yylhsminor.yy64;
        break;
      case 68: /* db_name ::= NK_ID */
      case 69: /* table_name ::= NK_ID */ yytestcase(yyruleno==69);
      case 70: /* column_name ::= NK_ID */ yytestcase(yyruleno==70);
      case 71: /* function_name ::= NK_ID */ yytestcase(yyruleno==71);
      case 72: /* table_alias ::= NK_ID */ yytestcase(yyruleno==72);
      case 73: /* column_alias ::= NK_ID */ yytestcase(yyruleno==73);
{ PARSER_TRACE; yylhsminor.yy209 = yymsp[0].minor.yy0; }
  yymsp[0].minor.yy209 = yylhsminor.yy209;
        break;
      case 76: /* expression ::= function_name NK_LP expression_list NK_RP */
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy64)); }
  yymsp[-3].minor.yy272 = yylhsminor.yy272;
        break;
      case 77: /* expression ::= function_name NK_LP NK_STAR NK_RP */
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy209, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); }
  yymsp[-3].minor.yy272 = yylhsminor.yy272;
        break;
      case 79: /* expression ::= NK_LP expression NK_RP */
      case 115: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==115);
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy272)); }
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
        break;
      case 80: /* expression ::= NK_PLUS expression */
2054 2055
{
                                                                                    PARSER_TRACE;
2056 2057
                                                                                    SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy272));
2058
                                                                                  }
2059
  yymsp[-1].minor.yy272 = yylhsminor.yy272;
2060
        break;
2061
      case 81: /* expression ::= NK_MINUS expression */
2062 2063
{
                                                                                    PARSER_TRACE;
2064 2065
                                                                                    SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy272), NULL));
2066
                                                                                  }
2067
  yymsp[-1].minor.yy272 = yylhsminor.yy272;
2068
        break;
2069
      case 82: /* expression ::= expression NK_PLUS expression */
2070 2071
{
                                                                                    PARSER_TRACE; 
2072 2073 2074
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272))); 
2075
                                                                                  }
2076
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2077
        break;
2078
      case 83: /* expression ::= expression NK_MINUS expression */
2079 2080
{
                                                                                    PARSER_TRACE; 
2081 2082 2083
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272))); 
2084
                                                                                  }
2085
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2086
        break;
2087
      case 84: /* expression ::= expression NK_STAR expression */
2088 2089
{
                                                                                    PARSER_TRACE; 
2090 2091 2092
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272))); 
2093
                                                                                  }
2094
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2095
        break;
2096
      case 85: /* expression ::= expression NK_SLASH expression */
2097 2098
{
                                                                                    PARSER_TRACE; 
2099 2100 2101
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272))); 
2102
                                                                                  }
2103
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2104
        break;
2105
      case 86: /* expression ::= expression NK_REM expression */
2106 2107
{
                                                                                    PARSER_TRACE; 
2108 2109 2110
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272))); 
2111
                                                                                  }
2112
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2113
        break;
2114 2115 2116
      case 89: /* column_reference ::= column_name */
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy209, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy209)); }
  yymsp[0].minor.yy272 = yylhsminor.yy272;
2117
        break;
2118 2119 2120
      case 90: /* column_reference ::= table_name NK_DOT column_name */
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209, createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209)); }
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2121
        break;
2122 2123
      case 91: /* predicate ::= expression compare_op expression */
      case 96: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==96);
2124 2125
{
                                                                                    PARSER_TRACE;
2126 2127 2128
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy20, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
2129
                                                                                  }
2130
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2131
        break;
2132
      case 92: /* predicate ::= expression BETWEEN expression AND expression */
2133 2134
{
                                                                                    PARSER_TRACE;
2135 2136 2137
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy272);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy272), releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
2138
                                                                                  }
2139
  yymsp[-4].minor.yy272 = yylhsminor.yy272;
2140
        break;
2141
      case 93: /* predicate ::= expression NOT BETWEEN expression AND expression */
2142 2143
{
                                                                                    PARSER_TRACE;
2144 2145 2146
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy272);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[-5].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
2147
                                                                                  }
2148
  yymsp[-5].minor.yy272 = yylhsminor.yy272;
2149
        break;
2150
      case 94: /* predicate ::= expression IS NULL */
2151 2152
{
                                                                                    PARSER_TRACE;
2153 2154
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), NULL));
2155
                                                                                  }
2156
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2157
        break;
2158
      case 95: /* predicate ::= expression IS NOT NULL */
2159 2160
{
                                                                                    PARSER_TRACE;
2161 2162
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy272), NULL));
2163
                                                                                  }
2164
  yymsp[-3].minor.yy272 = yylhsminor.yy272;
2165
        break;
2166 2167
      case 97: /* compare_op ::= NK_LT */
{ PARSER_TRACE; yymsp[0].minor.yy20 = OP_TYPE_LOWER_THAN; }
2168
        break;
2169 2170
      case 98: /* compare_op ::= NK_GT */
{ PARSER_TRACE; yymsp[0].minor.yy20 = OP_TYPE_GREATER_THAN; }
2171
        break;
2172 2173
      case 99: /* compare_op ::= NK_LE */
{ PARSER_TRACE; yymsp[0].minor.yy20 = OP_TYPE_LOWER_EQUAL; }
2174
        break;
2175 2176
      case 100: /* compare_op ::= NK_GE */
{ PARSER_TRACE; yymsp[0].minor.yy20 = OP_TYPE_GREATER_EQUAL; }
2177
        break;
2178 2179
      case 101: /* compare_op ::= NK_NE */
{ PARSER_TRACE; yymsp[0].minor.yy20 = OP_TYPE_NOT_EQUAL; }
2180
        break;
2181 2182
      case 102: /* compare_op ::= NK_EQ */
{ PARSER_TRACE; yymsp[0].minor.yy20 = OP_TYPE_EQUAL; }
2183
        break;
2184 2185
      case 103: /* compare_op ::= LIKE */
{ PARSER_TRACE; yymsp[0].minor.yy20 = OP_TYPE_LIKE; }
2186
        break;
2187 2188
      case 104: /* compare_op ::= NOT LIKE */
{ PARSER_TRACE; yymsp[-1].minor.yy20 = OP_TYPE_NOT_LIKE; }
2189
        break;
2190 2191
      case 105: /* compare_op ::= MATCH */
{ PARSER_TRACE; yymsp[0].minor.yy20 = OP_TYPE_MATCH; }
2192
        break;
2193 2194
      case 106: /* compare_op ::= NMATCH */
{ PARSER_TRACE; yymsp[0].minor.yy20 = OP_TYPE_NMATCH; }
2195
        break;
2196 2197
      case 107: /* in_op ::= IN */
{ PARSER_TRACE; yymsp[0].minor.yy20 = OP_TYPE_IN; }
2198
        break;
2199 2200
      case 108: /* in_op ::= NOT IN */
{ PARSER_TRACE; yymsp[-1].minor.yy20 = OP_TYPE_NOT_IN; }
2201
        break;
2202 2203 2204
      case 109: /* in_predicate_value ::= NK_LP expression_list NK_RP */
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy64)); }
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2205
        break;
2206
      case 111: /* boolean_value_expression ::= NOT boolean_primary */
2207 2208
{
                                                                                    PARSER_TRACE;
2209 2210
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy272), NULL));
2211
                                                                                  }
2212
  yymsp[-1].minor.yy272 = yylhsminor.yy272;
2213
        break;
2214
      case 112: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
2215 2216
{
                                                                                    PARSER_TRACE;
2217 2218 2219
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
2220
                                                                                  }
2221
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2222
        break;
2223
      case 113: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
2224 2225
{
                                                                                    PARSER_TRACE;
2226 2227 2228
                                                                                    SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
                                                                                    SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
2229
                                                                                  }
2230
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2231
        break;
2232 2233 2234 2235
      case 116: /* common_expression ::= expression */
      case 117: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==117);
{ yylhsminor.yy272 = yymsp[0].minor.yy272; }
  yymsp[0].minor.yy272 = yylhsminor.yy272;
2236
        break;
2237 2238 2239 2240
      case 118: /* from_clause ::= FROM table_reference_list */
      case 148: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==148);
      case 171: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==171);
{ PARSER_TRACE; yymsp[-1].minor.yy272 = yymsp[0].minor.yy272; }
2241
        break;
2242 2243 2244
      case 120: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ PARSER_TRACE; yylhsminor.yy272 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy272, yymsp[0].minor.yy272, NULL); }
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2245
        break;
2246 2247 2248
      case 123: /* table_primary ::= table_name alias_opt */
{ PARSER_TRACE; yylhsminor.yy272 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); }
  yymsp[-1].minor.yy272 = yylhsminor.yy272;
2249
        break;
2250 2251 2252
      case 124: /* table_primary ::= db_name NK_DOT table_name alias_opt */
{ PARSER_TRACE; yylhsminor.yy272 = createRealTableNode(pCxt, &yymsp[-3].minor.yy209, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); }
  yymsp[-3].minor.yy272 = yylhsminor.yy272;
2253
        break;
2254 2255 2256
      case 125: /* table_primary ::= subquery alias_opt */
{ PARSER_TRACE; yylhsminor.yy272 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy272), &yymsp[0].minor.yy209); }
  yymsp[-1].minor.yy272 = yylhsminor.yy272;
2257
        break;
2258 2259
      case 127: /* alias_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy209 = nil_token;  }
2260
        break;
2261 2262 2263
      case 128: /* alias_opt ::= table_alias */
{ PARSER_TRACE; yylhsminor.yy209 = yymsp[0].minor.yy209; }
  yymsp[0].minor.yy209 = yylhsminor.yy209;
2264
        break;
2265 2266
      case 129: /* alias_opt ::= AS table_alias */
{ PARSER_TRACE; yymsp[-1].minor.yy209 = yymsp[0].minor.yy209; }
2267
        break;
2268 2269 2270
      case 130: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
      case 131: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==131);
{ PARSER_TRACE; yymsp[-2].minor.yy272 = yymsp[-1].minor.yy272; }
2271
        break;
2272 2273 2274
      case 132: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ PARSER_TRACE; yylhsminor.yy272 = createJoinTableNode(pCxt, yymsp[-4].minor.yy252, yymsp[-5].minor.yy272, yymsp[-2].minor.yy272, yymsp[0].minor.yy272); }
  yymsp[-5].minor.yy272 = yylhsminor.yy272;
2275
        break;
2276 2277
      case 133: /* join_type ::= */
{ PARSER_TRACE; yymsp[1].minor.yy252 = JOIN_TYPE_INNER; }
2278
        break;
2279 2280
      case 134: /* join_type ::= INNER */
{ PARSER_TRACE; yymsp[0].minor.yy252 = JOIN_TYPE_INNER; }
2281
        break;
2282
      case 135: /* 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 */
2283 2284
{ 
                                                                                    PARSER_TRACE;
2285 2286 2287 2288 2289 2290
                                                                                    yymsp[-8].minor.yy272 = createSelectStmt(pCxt, yymsp[-7].minor.yy137, yymsp[-6].minor.yy64, yymsp[-5].minor.yy272);
                                                                                    yymsp[-8].minor.yy272 = addWhereClause(pCxt, yymsp[-8].minor.yy272, yymsp[-4].minor.yy272);
                                                                                    yymsp[-8].minor.yy272 = addPartitionByClause(pCxt, yymsp[-8].minor.yy272, yymsp[-3].minor.yy64);
                                                                                    yymsp[-8].minor.yy272 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy272, yymsp[-2].minor.yy272);
                                                                                    yymsp[-8].minor.yy272 = addGroupByClause(pCxt, yymsp[-8].minor.yy272, yymsp[-1].minor.yy64);
                                                                                    yymsp[-8].minor.yy272 = addHavingClause(pCxt, yymsp[-8].minor.yy272, yymsp[0].minor.yy272);
2291 2292
                                                                                  }
        break;
2293 2294
      case 136: /* set_quantifier_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy137 = false; }
2295
        break;
2296 2297
      case 137: /* set_quantifier_opt ::= DISTINCT */
{ PARSER_TRACE; yymsp[0].minor.yy137 = true; }
2298
        break;
2299 2300
      case 138: /* set_quantifier_opt ::= ALL */
{ PARSER_TRACE; yymsp[0].minor.yy137 = false; }
2301
        break;
2302 2303
      case 139: /* select_list ::= NK_STAR */
{ PARSER_TRACE; yymsp[0].minor.yy64 = NULL; }
2304
        break;
2305 2306 2307
      case 140: /* select_list ::= select_sublist */
{ PARSER_TRACE; yylhsminor.yy64 = yymsp[0].minor.yy64; }
  yymsp[0].minor.yy64 = yylhsminor.yy64;
2308
        break;
2309 2310 2311 2312
      case 141: /* select_sublist ::= select_item */
      case 188: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==188);
{ PARSER_TRACE; yylhsminor.yy64 = createNodeList(pCxt, yymsp[0].minor.yy272); }
  yymsp[0].minor.yy64 = yylhsminor.yy64;
2313
        break;
2314 2315 2316 2317
      case 142: /* select_sublist ::= select_sublist NK_COMMA select_item */
      case 189: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==189);
{ PARSER_TRACE; yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, yymsp[0].minor.yy272); }
  yymsp[-2].minor.yy64 = yylhsminor.yy64;
2318
        break;
2319
      case 143: /* select_item ::= common_expression */
2320 2321
{
                                                                                    PARSER_TRACE;
2322 2323
                                                                                    SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
                                                                                    yylhsminor.yy272 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy272), &t);
2324
                                                                                  }
2325
  yymsp[0].minor.yy272 = yylhsminor.yy272;
2326
        break;
2327 2328 2329
      case 144: /* select_item ::= common_expression column_alias */
{ PARSER_TRACE; yylhsminor.yy272 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy272), &yymsp[0].minor.yy209); }
  yymsp[-1].minor.yy272 = yylhsminor.yy272;
2330
        break;
2331 2332 2333
      case 145: /* select_item ::= common_expression AS column_alias */
{ PARSER_TRACE; yylhsminor.yy272 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), &yymsp[0].minor.yy209); }
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2334
        break;
2335 2336 2337
      case 146: /* select_item ::= table_name NK_DOT NK_STAR */
{ PARSER_TRACE; yylhsminor.yy272 = createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0); }
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2338
        break;
2339 2340 2341 2342 2343 2344 2345 2346
      case 147: /* where_clause_opt ::= */
      case 151: /* twindow_clause_opt ::= */ yytestcase(yyruleno==151);
      case 156: /* sliding_opt ::= */ yytestcase(yyruleno==156);
      case 158: /* fill_opt ::= */ yytestcase(yyruleno==158);
      case 170: /* having_clause_opt ::= */ yytestcase(yyruleno==170);
      case 178: /* slimit_clause_opt ::= */ yytestcase(yyruleno==178);
      case 182: /* limit_clause_opt ::= */ yytestcase(yyruleno==182);
{ PARSER_TRACE; yymsp[1].minor.yy272 = NULL; }
2347
        break;
2348 2349 2350 2351
      case 149: /* partition_by_clause_opt ::= */
      case 166: /* group_by_clause_opt ::= */ yytestcase(yyruleno==166);
      case 176: /* order_by_clause_opt ::= */ yytestcase(yyruleno==176);
{ PARSER_TRACE; yymsp[1].minor.yy64 = NULL; }
2352
        break;
2353 2354 2355 2356
      case 150: /* partition_by_clause_opt ::= PARTITION BY expression_list */
      case 167: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==167);
      case 177: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==177);
{ PARSER_TRACE; yymsp[-2].minor.yy64 = yymsp[0].minor.yy64; }
2357
        break;
2358 2359
      case 152: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{ PARSER_TRACE; yymsp[-5].minor.yy272 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy272), &yymsp[-1].minor.yy0); }
2360
        break;
2361 2362
      case 153: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy272 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy272)); }
2363
        break;
2364 2365
      case 154: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ PARSER_TRACE; yymsp[-5].minor.yy272 = createIntervalWindowNode(pCxt, yymsp[-3].minor.yy272, NULL, yymsp[-1].minor.yy272, yymsp[0].minor.yy272); }
2366
        break;
2367 2368
      case 155: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ PARSER_TRACE; yymsp[-7].minor.yy272 = createIntervalWindowNode(pCxt, yymsp[-5].minor.yy272, yymsp[-3].minor.yy272, yymsp[-1].minor.yy272, yymsp[0].minor.yy272); }
2369
        break;
2370 2371
      case 157: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy272 = yymsp[-1].minor.yy272; }
2372
        break;
2373 2374
      case 159: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy272 = createFillNode(pCxt, yymsp[-1].minor.yy54, NULL); }
2375
        break;
2376 2377
      case 160: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ PARSER_TRACE; yymsp[-5].minor.yy272 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy64)); }
2378
        break;
2379 2380
      case 161: /* fill_mode ::= NONE */
{ PARSER_TRACE; yymsp[0].minor.yy54 = FILL_MODE_NONE; }
2381
        break;
2382 2383
      case 162: /* fill_mode ::= PREV */
{ PARSER_TRACE; yymsp[0].minor.yy54 = FILL_MODE_PREV; }
2384
        break;
2385 2386
      case 163: /* fill_mode ::= NULL */
{ PARSER_TRACE; yymsp[0].minor.yy54 = FILL_MODE_NULL; }
2387
        break;
2388 2389
      case 164: /* fill_mode ::= LINEAR */
{ PARSER_TRACE; yymsp[0].minor.yy54 = FILL_MODE_LINEAR; }
2390
        break;
2391 2392
      case 165: /* fill_mode ::= NEXT */
{ PARSER_TRACE; yymsp[0].minor.yy54 = FILL_MODE_NEXT; }
2393
        break;
2394 2395 2396
      case 168: /* group_by_list ::= expression */
{ PARSER_TRACE; yylhsminor.yy64 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy272))); }
  yymsp[0].minor.yy64 = yylhsminor.yy64;
2397
        break;
2398 2399 2400
      case 169: /* group_by_list ::= group_by_list NK_COMMA expression */
{ PARSER_TRACE; yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy272))); }
  yymsp[-2].minor.yy64 = yylhsminor.yy64;
2401
        break;
2402
      case 172: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
2403 2404
{ 
                                                                                    PARSER_TRACE;
2405 2406 2407
                                                                                    yylhsminor.yy272 = addOrderByClause(pCxt, yymsp[-3].minor.yy272, yymsp[-2].minor.yy64);
                                                                                    yylhsminor.yy272 = addSlimitClause(pCxt, yylhsminor.yy272, yymsp[-1].minor.yy272);
                                                                                    yylhsminor.yy272 = addLimitClause(pCxt, yylhsminor.yy272, yymsp[0].minor.yy272);
2408
                                                                                  }
2409
  yymsp[-3].minor.yy272 = yylhsminor.yy272;
2410
        break;
2411 2412 2413
      case 174: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ PARSER_TRACE; yylhsminor.yy272 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy272, yymsp[0].minor.yy272); }
  yymsp[-3].minor.yy272 = yylhsminor.yy272;
2414
        break;
2415 2416 2417
      case 179: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
      case 183: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==183);
{ PARSER_TRACE; yymsp[-1].minor.yy272 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
2418
        break;
2419 2420 2421
      case 180: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
      case 184: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==184);
{ PARSER_TRACE; yymsp[-3].minor.yy272 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
2422
        break;
2423 2424 2425
      case 181: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
      case 185: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==185);
{ PARSER_TRACE; yymsp[-3].minor.yy272 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
2426
        break;
2427 2428 2429
      case 186: /* subquery ::= NK_LP query_expression NK_RP */
{ PARSER_TRACE; yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy272); }
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2430
        break;
2431 2432 2433
      case 187: /* search_condition ::= common_expression */
{ PARSER_TRACE; yylhsminor.yy272 = releaseRawExprNode(pCxt, yymsp[0].minor.yy272); }
  yymsp[0].minor.yy272 = yylhsminor.yy272;
2434
        break;
2435 2436 2437
      case 190: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ PARSER_TRACE; yylhsminor.yy272 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), yymsp[-1].minor.yy218, yymsp[0].minor.yy217); }
  yymsp[-2].minor.yy272 = yylhsminor.yy272;
2438
        break;
2439 2440
      case 191: /* ordering_specification_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy218 = ORDER_ASC; }
2441
        break;
2442 2443
      case 192: /* ordering_specification_opt ::= ASC */
{ PARSER_TRACE; yymsp[0].minor.yy218 = ORDER_ASC; }
2444
        break;
2445 2446
      case 193: /* ordering_specification_opt ::= DESC */
{ PARSER_TRACE; yymsp[0].minor.yy218 = ORDER_DESC; }
2447
        break;
2448 2449
      case 194: /* null_ordering_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy217 = NULL_ORDER_DEFAULT; }
2450
        break;
2451 2452
      case 195: /* null_ordering_opt ::= NULLS FIRST */
{ PARSER_TRACE; yymsp[-1].minor.yy217 = NULL_ORDER_FIRST; }
2453
        break;
2454 2455
      case 196: /* null_ordering_opt ::= NULLS LAST */
{ PARSER_TRACE; yymsp[-1].minor.yy217 = NULL_ORDER_LAST; }
2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517
        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 */
){
  NewParseARG_FETCH
  NewParseCTX_FETCH
#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 *****************************************/
  NewParseARG_STORE /* Suppress warning about unused %extra_argument variable */
  NewParseCTX_STORE
}
#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 */
  NewParseTOKENTYPE yyminor         /* The minor type of the error token */
){
  NewParseARG_FETCH
  NewParseCTX_FETCH
#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/
  
2518
  if(TOKEN.z) {
2519
    char msg[] = "syntax error near \"%s\"";
2520
    int32_t sqlLen = strlen(&TOKEN.z[0]);
2521 2522 2523

    if (sqlLen + sizeof(msg)/sizeof(msg[0]) + 1 > pCxt->pQueryCxt->msgLen) {
        char tmpstr[128] = {0};
2524
        memcpy(tmpstr, &TOKEN.z[0], sizeof(tmpstr)/sizeof(tmpstr[0]) - 1);
2525 2526
        sprintf(pCxt->pQueryCxt->pMsg, msg, tmpstr);
    } else {
2527
        sprintf(pCxt->pQueryCxt->pMsg, msg, &TOKEN.z[0]);
2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557
    }
  } else {
    sprintf(pCxt->pQueryCxt->pMsg, "Incomplete SQL statement");
  }
  pCxt->valid = false;
/************ End %syntax_error code ******************************************/
  NewParseARG_STORE /* Suppress warning about unused %extra_argument variable */
  NewParseCTX_STORE
}

/*
** The following is executed when the parser accepts
*/
static void yy_accept(
  yyParser *yypParser           /* The parser */
){
  NewParseARG_FETCH
  NewParseCTX_FETCH
#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 *****************************************/
2558
 PARSER_COMPLETE; 
2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766
/*********** End %parse_accept code *******************************************/
  NewParseARG_STORE /* Suppress warning about unused %extra_argument variable */
  NewParseCTX_STORE
}

/* The main parser program.
** The first argument is a pointer to a structure obtained from
** "NewParseAlloc" which describes the current state of the parser.
** The second argument is the major token number.  The third is
** the minor token.  The fourth optional argument is whatever the
** user wants (and specified in the grammar) and is available for
** use by the action routines.
**
** Inputs:
** <ul>
** <li> A pointer to the parser (an opaque structure.)
** <li> The major token number.
** <li> The minor token number.
** <li> An option argument of a grammar-specified type.
** </ul>
**
** Outputs:
** None.
*/
void NewParse(
  void *yyp,                   /* The parser */
  int yymajor,                 /* The major token code number */
  NewParseTOKENTYPE yyminor       /* The value for the token */
  NewParseARG_PDECL               /* Optional %extra_argument parameter */
){
  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 */
  NewParseCTX_FETCH
  NewParseARG_STORE

  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,
                        yyminor NewParseCTX_PARAM);
    }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.
*/
int NewParseFallback(int iToken){
#ifdef YYFALLBACK
  if( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ){
    return yyFallback[iToken];
  }
#else
  (void)iToken;
#endif
  return 0;
}