/* This file is automatically generated by Lemon from input grammar ** source file "pgbench_expr.lime". */ /* ** 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 lime 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" identifier 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 generated parser ** source file. ** ** The following is the concatenation of all %include directives from the ** input grammar file: */ /************ Begin %include sections from the grammar ************************/ #line 16 "pgbench_expr.lime" #include #include #include #include #include #include #include "pgbench_expr.h" /* generated header */ /* * Forward declarations for AST construction helpers. * In a full integration these would come from pgbench.h; * here we provide standalone implementations. */ /* Expression node types */ typedef enum { EXPR_NULL, EXPR_BOOLEAN, EXPR_INTEGER, EXPR_DOUBLE, EXPR_VARIABLE, EXPR_OP, EXPR_FUNC } ExprType; /* A simple expression AST node */ typedef struct Expr { ExprType type; union { bool bval; int64_t ival; double dval; char *varname; struct { char *name; struct Expr *left; struct Expr *right; } op; struct { int fnumber; struct ExprList *args; } func; } u; } Expr; /* Expression list (linked list) */ typedef struct ExprLink { Expr *expr; struct ExprLink *next; } ExprLink; typedef struct ExprList { ExprLink *head; ExprLink *tail; } ExprList; /* Parse state passed via %extra_argument */ typedef struct ParseState { Expr *result; /* output: root of parsed expression tree */ int errors; /* error count */ } ParseState; /* --- AST constructor helpers --- */ static Expr *make_null_constant(void) { Expr *e = (Expr *)calloc(1, sizeof(Expr)); e->type = EXPR_NULL; return e; } static Expr *make_boolean_constant(bool bval) { Expr *e = (Expr *)calloc(1, sizeof(Expr)); e->type = EXPR_BOOLEAN; e->u.bval = bval; return e; } static Expr *make_integer_constant(int64_t ival) { Expr *e = (Expr *)calloc(1, sizeof(Expr)); e->type = EXPR_INTEGER; e->u.ival = ival; return e; } static Expr *make_double_constant(double dval) { Expr *e = (Expr *)calloc(1, sizeof(Expr)); e->type = EXPR_DOUBLE; e->u.dval = dval; return e; } static Expr *make_variable(char *varname) { Expr *e = (Expr *)calloc(1, sizeof(Expr)); e->type = EXPR_VARIABLE; e->u.varname = varname; return e; } static ExprList *make_elist(Expr *expr, ExprList *list) { if (list == NULL) { list = (ExprList *)calloc(1, sizeof(ExprList)); } ExprLink *link = (ExprLink *)calloc(1, sizeof(ExprLink)); link->expr = expr; link->next = NULL; if (list->head == NULL) list->head = link; else list->tail->next = link; list->tail = link; return list; } static Expr *make_op(const char *opname, Expr *left, Expr *right) { Expr *e = (Expr *)calloc(1, sizeof(Expr)); e->type = EXPR_OP; e->u.op.name = strdup(opname); e->u.op.left = left; e->u.op.right = right; return e; } static Expr *make_uop(const char *opname, Expr *operand) { Expr *e = (Expr *)calloc(1, sizeof(Expr)); e->type = EXPR_OP; e->u.op.name = strdup(opname); e->u.op.left = operand; e->u.op.right = NULL; return e; } static Expr *make_func(int fnumber, ExprList *args) { Expr *e = (Expr *)calloc(1, sizeof(Expr)); e->type = EXPR_FUNC; e->u.func.fnumber = fnumber; e->u.func.args = args; return e; } /* --- Free helpers for memory cleanup --- */ static void free_expr(Expr *e); static void free_elist(ExprList *list) { if (!list) return; ExprLink *link = list->head; while (link) { ExprLink *next = link->next; free_expr(link->expr); free(link); link = next; } free(list); } static void free_expr(Expr *e) { if (!e) return; switch (e->type) { case EXPR_VARIABLE: free(e->u.varname); break; case EXPR_OP: free(e->u.op.name); free_expr(e->u.op.left); free_expr(e->u.op.right); break; case EXPR_FUNC: free_elist(e->u.func.args); break; default: break; } free(e); } /* --- Expression printing (for test/debug) --- */ static void print_expr(Expr *e, int depth); static void print_indent(int depth) { for (int i = 0; i < depth; i++) printf(" "); } static void print_elist(ExprList *list, int depth) { if (!list) return; ExprLink *link = list->head; while (link) { print_expr(link->expr, depth); link = link->next; } } static void print_expr(Expr *e, int depth) { if (!e) { print_indent(depth); printf("(null)\n"); return; } print_indent(depth); switch (e->type) { case EXPR_NULL: printf("NULL\n"); break; case EXPR_BOOLEAN: printf("BOOLEAN: %s\n", e->u.bval ? "true" : "false"); break; case EXPR_INTEGER: printf("INTEGER: %ld\n", (long)e->u.ival); break; case EXPR_DOUBLE: printf("DOUBLE: %g\n", e->u.dval); break; case EXPR_VARIABLE: printf("VARIABLE: %s\n", e->u.varname); break; case EXPR_OP: printf("OP: %s\n", e->u.op.name); print_expr(e->u.op.left, depth + 1); if (e->u.op.right) print_expr(e->u.op.right, depth + 1); break; case EXPR_FUNC: printf("FUNC: #%d\n", e->u.func.fnumber); print_elist(e->u.func.args, depth + 1); break; } } #line 255 "pgbench_expr.c" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ #ifndef NULL_CONST #define NULL_CONST 1 #define INTEGER_CONST 2 #define MAXINT_PLUS_ONE_CONST 3 #define DOUBLE_CONST 4 #define BOOLEAN_CONST 5 #define VARIABLE 6 #define FUNCTION 7 #define AND_OP 8 #define OR_OP 9 #define NOT_OP 10 #define NE_OP 11 #define LE_OP 12 #define GE_OP 13 #define LS_OP 14 #define RS_OP 15 #define IS_OP 16 #define ISNULL_OP 17 #define NOTNULL_OP 18 #define CASE_KW 19 #define WHEN_KW 20 #define THEN_KW 21 #define ELSE_KW 22 #define END_KW 23 #define PLUS 24 #define MINUS 25 #define STAR 26 #define SLASH 27 #define PERCENT 28 #define LT 29 #define GT 30 #define EQ 31 #define AMP 32 #define PIPE 33 #define HASH 34 #define TILDE 35 #define LPAREN 36 #define RPAREN 37 #define COMMA 38 #define UNARY 39 #endif /**************** End 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. ** pgbenchExprTOKENTYPE 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 pgbenchExprTOKENTYPE. 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() ** pgbenchExprARG_SDECL A static variable declaration for the %extra_argument ** pgbenchExprARG_PDECL A parameter declaration for the %extra_argument ** pgbenchExprARG_PARAM Code to pass %extra_argument as a subroutine parameter ** pgbenchExprARG_STORE Code to store %extra_argument into yypParser ** pgbenchExprARG_FETCH Code to extract %extra_argument from yypParser ** pgbenchExprCTX_* As pgbenchExprARG_ except for %extra_context ** YYREALLOC Name of the realloc() function to use ** YYFREE Name of the free() function to use ** YYDYNSTACK True if stack space should be extended on heap ** 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 ** YY_MIN_DSTRCTR Minimum symbol value that has a destructor ** YY_MAX_DSTRCTR Maximum symbol value that has a destructor */ #ifndef INTERFACE # define INTERFACE 1 #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned char #define YYNOCODE 46 #define YYACTIONTYPE unsigned char #define pgbenchExprTOKENTYPE TokenValue typedef union { int yyinit; pgbenchExprTOKENTYPE yy0; Expr * yy30; int yy52; ExprList * yy74; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif #define pgbenchExprARG_SDECL ParseState *pstate; #define pgbenchExprARG_PDECL ,ParseState *pstate #define pgbenchExprARG_PARAM ,pstate #define pgbenchExprARG_FETCH ParseState *pstate=yypParser->pstate; #define pgbenchExprARG_STORE yypParser->pstate=pstate; #undef YYREALLOC #define YYREALLOC realloc #undef YYFREE #define YYFREE free #undef YYDYNSTACK #define YYDYNSTACK 0 #undef YYSIZELIMIT #define pgbenchExprCTX(P) 0 #define pgbenchExprCTX_SDECL #define pgbenchExprCTX_PDECL #define pgbenchExprCTX_PARAM #define pgbenchExprCTX_FETCH #define pgbenchExprCTX_STORE #undef YYERRORSYMBOL #undef YYERRSYMDT #undef YYFALLBACK #define YYNSTATE 63 #define YYNRULE 46 #define YYNRULE_WITH_ACTION 46 #define YYNTOKEN 40 #define YY_MAX_SHIFT 62 #define YY_MIN_SHIFTREDUCE 86 #define YY_MAX_SHIFTREDUCE 131 #define YY_ERROR_ACTION 132 #define YY_ACCEPT_ACTION 133 #define YY_NO_ACTION 134 #define YY_MIN_REDUCE 135 #define YY_MAX_REDUCE 180 #define YY_MIN_DSTRCTR 0 #define YY_MAX_DSTRCTR 0 /************* 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 /* Macro to determine if stack space has the ability to grow using ** heap memory. */ #if YYSTACKDEPTH<=0 || YYDYNSTACK # define YYGROWABLESTACK 1 #else # define YYGROWABLESTACK 0 #endif /* Guarantee a minimum number of initial stack slots. */ #if YYSTACKDEPTH<=0 # undef YYSTACKDEPTH # define YYSTACKDEPTH 2 /* Need a minimum stack size */ #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 **********************************************/ #define YY_ACTTAB_COUNT (373) static const YYACTIONTYPE yy_action[] = { /* 0 */ 133, 36, 175, 141, 175, 62, 117, 62, 10, 9, /* 10 */ 119, 16, 20, 18, 12, 11, 59, 114, 115, 37, /* 20 */ 175, 3, 4, 62, 30, 28, 26, 25, 23, 21, /* 30 */ 19, 17, 15, 14, 13, 10, 9, 58, 16, 20, /* 40 */ 18, 12, 11, 59, 114, 115, 26, 25, 23, 1, /* 50 */ 130, 30, 28, 26, 25, 23, 21, 19, 17, 15, /* 60 */ 14, 13, 10, 9, 134, 16, 20, 18, 12, 11, /* 70 */ 59, 114, 115, 32, 175, 6, 134, 62, 30, 28, /* 80 */ 26, 25, 23, 21, 19, 17, 15, 14, 13, 10, /* 90 */ 9, 134, 16, 20, 18, 12, 11, 59, 114, 115, /* 100 */ 30, 28, 26, 25, 23, 30, 28, 26, 25, 23, /* 110 */ 21, 19, 17, 15, 14, 13, 135, 134, 90, 33, /* 120 */ 175, 125, 8, 62, 10, 9, 134, 16, 20, 18, /* 130 */ 12, 11, 59, 114, 115, 40, 175, 60, 134, 62, /* 140 */ 30, 28, 26, 25, 23, 21, 19, 17, 15, 14, /* 150 */ 13, 10, 9, 134, 16, 20, 18, 12, 11, 59, /* 160 */ 114, 115, 38, 175, 134, 134, 62, 30, 28, 26, /* 170 */ 25, 23, 21, 19, 17, 15, 14, 13, 10, 134, /* 180 */ 134, 16, 20, 18, 12, 11, 59, 114, 115, 34, /* 190 */ 175, 134, 134, 62, 30, 28, 26, 25, 23, 21, /* 200 */ 19, 17, 15, 14, 13, 134, 16, 20, 18, 12, /* 210 */ 11, 59, 114, 115, 39, 175, 134, 134, 62, 30, /* 220 */ 28, 26, 25, 23, 21, 19, 17, 15, 14, 13, /* 230 */ 134, 132, 132, 132, 12, 11, 134, 41, 175, 42, /* 240 */ 175, 62, 134, 62, 30, 28, 26, 25, 23, 132, /* 250 */ 132, 132, 15, 14, 13, 120, 122, 93, 123, 121, /* 260 */ 124, 131, 120, 122, 22, 123, 121, 124, 131, 134, /* 270 */ 134, 22, 7, 31, 5, 129, 134, 134, 27, 2, /* 280 */ 31, 134, 134, 50, 175, 27, 2, 62, 134, 24, /* 290 */ 29, 51, 175, 134, 134, 62, 24, 29, 52, 175, /* 300 */ 53, 175, 62, 134, 62, 54, 175, 44, 175, 62, /* 310 */ 134, 62, 134, 45, 175, 46, 175, 62, 134, 62, /* 320 */ 47, 175, 48, 175, 62, 134, 62, 49, 175, 43, /* 330 */ 175, 62, 134, 62, 149, 175, 134, 134, 62, 55, /* 340 */ 175, 148, 175, 62, 134, 62, 147, 175, 140, 175, /* 350 */ 62, 134, 62, 57, 175, 35, 175, 62, 134, 62, /* 360 */ 134, 56, 175, 116, 134, 62, 134, 118, 134, 134, /* 370 */ 134, 134, 61, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 40, 41, 42, 41, 42, 45, 1, 45, 8, 9, /* 10 */ 5, 11, 12, 13, 14, 15, 16, 17, 18, 41, /* 20 */ 42, 21, 20, 45, 24, 25, 26, 27, 28, 29, /* 30 */ 30, 31, 32, 33, 34, 8, 9, 44, 11, 12, /* 40 */ 13, 14, 15, 16, 17, 18, 26, 27, 28, 36, /* 50 */ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, /* 60 */ 33, 34, 8, 9, 46, 11, 12, 13, 14, 15, /* 70 */ 16, 17, 18, 41, 42, 21, 46, 45, 24, 25, /* 80 */ 26, 27, 28, 29, 30, 31, 32, 33, 34, 8, /* 90 */ 9, 46, 11, 12, 13, 14, 15, 16, 17, 18, /* 100 */ 24, 25, 26, 27, 28, 24, 25, 26, 27, 28, /* 110 */ 29, 30, 31, 32, 33, 34, 0, 46, 37, 41, /* 120 */ 42, 37, 38, 45, 8, 9, 46, 11, 12, 13, /* 130 */ 14, 15, 16, 17, 18, 41, 42, 43, 46, 45, /* 140 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, /* 150 */ 34, 8, 9, 46, 11, 12, 13, 14, 15, 16, /* 160 */ 17, 18, 41, 42, 46, 46, 45, 24, 25, 26, /* 170 */ 27, 28, 29, 30, 31, 32, 33, 34, 8, 46, /* 180 */ 46, 11, 12, 13, 14, 15, 16, 17, 18, 41, /* 190 */ 42, 46, 46, 45, 24, 25, 26, 27, 28, 29, /* 200 */ 30, 31, 32, 33, 34, 46, 11, 12, 13, 14, /* 210 */ 15, 16, 17, 18, 41, 42, 46, 46, 45, 24, /* 220 */ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, /* 230 */ 46, 11, 12, 13, 14, 15, 46, 41, 42, 41, /* 240 */ 42, 45, 46, 45, 24, 25, 26, 27, 28, 29, /* 250 */ 30, 31, 32, 33, 34, 1, 2, 3, 4, 5, /* 260 */ 6, 7, 1, 2, 10, 4, 5, 6, 7, 46, /* 270 */ 46, 10, 20, 19, 22, 23, 46, 46, 24, 25, /* 280 */ 19, 46, 46, 41, 42, 24, 25, 45, 46, 35, /* 290 */ 36, 41, 42, 46, 46, 45, 35, 36, 41, 42, /* 300 */ 41, 42, 45, 46, 45, 41, 42, 41, 42, 45, /* 310 */ 46, 45, 46, 41, 42, 41, 42, 45, 46, 45, /* 320 */ 41, 42, 41, 42, 45, 46, 45, 41, 42, 41, /* 330 */ 42, 45, 46, 45, 41, 42, 46, 46, 45, 41, /* 340 */ 42, 41, 42, 45, 46, 45, 41, 42, 41, 42, /* 350 */ 45, 46, 45, 41, 42, 41, 42, 45, 46, 45, /* 360 */ 46, 41, 42, 1, 46, 45, 46, 5, 46, 46, /* 370 */ 46, 46, 10, 46, 46, 46, 46, 46, 46, 46, /* 380 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 390 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 400 */ 46, 46, 46, 46, 40, 40, 40, 40, 40, 40, /* 410 */ 40, 40, 40, }; #define YY_SHIFT_COUNT (62) #define YY_SHIFT_MIN (0) #define YY_SHIFT_MAX (362) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 261, 261, 254, 261, 261, 261, 261, 261, 261, 261, /* 10 */ 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, /* 20 */ 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, /* 30 */ 261, 2, 0, 27, 54, 81, 116, 143, 143, 143, /* 40 */ 143, 170, 195, 195, 220, 220, 220, 220, 220, 220, /* 50 */ 76, 76, 76, 76, 76, 76, 20, 20, 252, 362, /* 60 */ 84, 5, 13, }; #define YY_REDUCE_COUNT (31) #define YY_REDUCE_MIN (-40) #define YY_REDUCE_MAX (320) static const short yy_reduce_ofst[] = { /* 0 */ -40, 94, -38, -22, 32, 78, 121, 148, 173, 196, /* 10 */ 198, 242, 250, 257, 259, 264, 266, 272, 274, 279, /* 20 */ 281, 286, 288, 293, 298, 300, 305, 307, 312, 314, /* 30 */ 320, -7, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 132, 136, 132, 132, 132, 132, 132, 132, 132, 132, /* 10 */ 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, /* 20 */ 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, /* 30 */ 132, 132, 132, 132, 132, 132, 132, 177, 176, 138, /* 40 */ 137, 162, 161, 144, 155, 154, 153, 152, 151, 150, /* 50 */ 160, 159, 158, 157, 156, 143, 145, 146, 132, 132, /* 60 */ 132, 132, 132, }; /********** 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 pgbenchExprARG_SDECL /* A place to hold %extra_argument */ pgbenchExprCTX_SDECL /* A place to hold %extra_context */ yyStackEntry *yystackEnd; /* Last entry in the stack */ yyStackEntry *yystack; /* The parser stack */ yyStackEntry yystk0[YYSTACKDEPTH]; /* Initial stack space */ }; typedef struct yyParser yyParser; #include #ifndef NDEBUG #include 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: **
    **
  • A FILE* to which trace output should be written. ** If NULL, then tracing is turned off. **
  • A prefix string written at the beginning of every ** line of trace output. If NULL, then tracing is ** turned off. **
** ** Outputs: ** None. */ void pgbenchExprTrace(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 */ "$", /* 1 */ "NULL_CONST", /* 2 */ "INTEGER_CONST", /* 3 */ "MAXINT_PLUS_ONE_CONST", /* 4 */ "DOUBLE_CONST", /* 5 */ "BOOLEAN_CONST", /* 6 */ "VARIABLE", /* 7 */ "FUNCTION", /* 8 */ "AND_OP", /* 9 */ "OR_OP", /* 10 */ "NOT_OP", /* 11 */ "NE_OP", /* 12 */ "LE_OP", /* 13 */ "GE_OP", /* 14 */ "LS_OP", /* 15 */ "RS_OP", /* 16 */ "IS_OP", /* 17 */ "ISNULL_OP", /* 18 */ "NOTNULL_OP", /* 19 */ "CASE_KW", /* 20 */ "WHEN_KW", /* 21 */ "THEN_KW", /* 22 */ "ELSE_KW", /* 23 */ "END_KW", /* 24 */ "PLUS", /* 25 */ "MINUS", /* 26 */ "STAR", /* 27 */ "SLASH", /* 28 */ "PERCENT", /* 29 */ "LT", /* 30 */ "GT", /* 31 */ "EQ", /* 32 */ "AMP", /* 33 */ "PIPE", /* 34 */ "HASH", /* 35 */ "TILDE", /* 36 */ "LPAREN", /* 37 */ "RPAREN", /* 38 */ "COMMA", /* 39 */ "UNARY", /* 40 */ "result", /* 41 */ "expr", /* 42 */ "case_control", /* 43 */ "elist", /* 44 */ "when_then_list", /* 45 */ "function", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ static const char *const yyRuleName[] = { /* 0 */ "result ::= expr", /* 1 */ "elist ::=", /* 2 */ "elist ::= expr", /* 3 */ "elist ::= elist COMMA expr", /* 4 */ "expr ::= LPAREN expr RPAREN", /* 5 */ "expr ::= PLUS expr", /* 6 */ "expr ::= MINUS expr", /* 7 */ "expr ::= MINUS MAXINT_PLUS_ONE_CONST", /* 8 */ "expr ::= TILDE expr", /* 9 */ "expr ::= NOT_OP expr", /* 10 */ "expr ::= expr PLUS expr", /* 11 */ "expr ::= expr MINUS expr", /* 12 */ "expr ::= expr STAR expr", /* 13 */ "expr ::= expr SLASH expr", /* 14 */ "expr ::= expr PERCENT expr", /* 15 */ "expr ::= expr LT expr", /* 16 */ "expr ::= expr LE_OP expr", /* 17 */ "expr ::= expr GT expr", /* 18 */ "expr ::= expr GE_OP expr", /* 19 */ "expr ::= expr EQ expr", /* 20 */ "expr ::= expr NE_OP expr", /* 21 */ "expr ::= expr AMP expr", /* 22 */ "expr ::= expr PIPE expr", /* 23 */ "expr ::= expr HASH expr", /* 24 */ "expr ::= expr LS_OP expr", /* 25 */ "expr ::= expr RS_OP expr", /* 26 */ "expr ::= expr AND_OP expr", /* 27 */ "expr ::= expr OR_OP expr", /* 28 */ "expr ::= expr ISNULL_OP", /* 29 */ "expr ::= expr NOTNULL_OP", /* 30 */ "expr ::= expr IS_OP NULL_CONST", /* 31 */ "expr ::= expr IS_OP NOT_OP NULL_CONST", /* 32 */ "expr ::= expr IS_OP BOOLEAN_CONST", /* 33 */ "expr ::= expr IS_OP NOT_OP BOOLEAN_CONST", /* 34 */ "expr ::= NULL_CONST", /* 35 */ "expr ::= BOOLEAN_CONST", /* 36 */ "expr ::= INTEGER_CONST", /* 37 */ "expr ::= DOUBLE_CONST", /* 38 */ "expr ::= VARIABLE", /* 39 */ "expr ::= function LPAREN elist RPAREN", /* 40 */ "expr ::= case_control", /* 41 */ "when_then_list ::= when_then_list WHEN_KW expr THEN_KW expr", /* 42 */ "when_then_list ::= WHEN_KW expr THEN_KW expr", /* 43 */ "case_control ::= CASE_KW when_then_list END_KW", /* 44 */ "case_control ::= CASE_KW when_then_list ELSE_KW expr END_KW", /* 45 */ "function ::= FUNCTION", }; #endif /* NDEBUG */ #if YYGROWABLESTACK /* ** Try to increase the size of the parser stack. Return the number ** of errors. Return 0 on success. */ static int yyGrowStack(yyParser *p){ int oldSize = 1 + (int)(p->yystackEnd - p->yystack); int newSize; int idx; yyStackEntry *pNew; #ifdef YYSIZELIMIT int nLimit = YYSIZELIMIT(pgbenchExprCTX(p)); #endif newSize = oldSize*2 + 100; #ifdef YYSIZELIMIT if( newSize>nLimit ){ newSize = nLimit; if( newSize<=oldSize ) return 1; } #endif idx = (int)(p->yytos - p->yystack); if( p->yystack==p->yystk0 ){ pNew = YYREALLOC(0, newSize*sizeof(pNew[0]), pgbenchExprCTX(p)); if( pNew==0 ) return 1; memcpy(pNew, p->yystack, oldSize*sizeof(pNew[0])); }else{ pNew = YYREALLOC(p->yystack, newSize*sizeof(pNew[0]), pgbenchExprCTX(p)); if( pNew==0 ) return 1; } p->yystack = pNew; p->yytos = &p->yystack[idx]; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", yyTracePrompt, oldSize, newSize); } #endif p->yystackEnd = &p->yystack[newSize-1]; return 0; } #endif /* YYGROWABLESTACK */ #if !YYGROWABLESTACK /* For builds that do no have a growable stack, yyGrowStack always ** returns an error. */ # define yyGrowStack(X) 1 #endif /* Datatype of the argument to the memory allocated passed as the ** second argument to pgbenchExprAlloc() 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 pgbenchExprInit(void *yypRawParser pgbenchExprCTX_PDECL){ yyParser *yypParser = (yyParser*)yypRawParser; pgbenchExprCTX_STORE #ifdef YYTRACKMAXSTACKDEPTH yypParser->yyhwm = 0; #endif yypParser->yystack = yypParser->yystk0; yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; #endif yypParser->yytos = yypParser->yystack; yypParser->yystack[0].stateno = 0; yypParser->yystack[0].major = 0; } #ifndef pgbenchExpr_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 pgbenchExpr and pgbenchExprFree. */ void *pgbenchExprAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) pgbenchExprCTX_PDECL){ yyParser *yypParser; yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); if( yypParser ){ pgbenchExprCTX_STORE pgbenchExprInit(yypParser pgbenchExprCTX_PARAM); } return (void*)yypParser; } #endif /* pgbenchExpr_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 */ ){ pgbenchExprARG_FETCH pgbenchExprCTX_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 ***************************************/ /********* 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 pgbenchExprFinalize(void *p){ yyParser *pParser = (yyParser*)p; /* In-lined version of calling yy_pop_parser_stack() for each ** element left in the stack */ yyStackEntry *yytos = pParser->yytos; while( yytos>pParser->yystack ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sPopping %s\n", yyTracePrompt, yyTokenName[yytos->major]); } #endif if( yytos->major>=YY_MIN_DSTRCTR ){ yy_destructor(pParser, yytos->major, &yytos->minor); } yytos--; } #if YYGROWABLESTACK if( pParser->yystack!=pParser->yystk0 ){ YYFREE(pParser->yystack, pgbenchExprCTX(pParser)); } #endif } #ifndef pgbenchExpr_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 pgbenchExprFree( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ #ifndef YYPARSEFREENEVERNULL if( p==0 ) return; #endif pgbenchExprFinalize(p); (*freeProc)(p); } #endif /* pgbenchExpr_ENGINEALWAYSONSTACK */ /* ** Return the peak depth of the stack for a parser. */ #ifdef YYTRACKMAXSTACKDEPTH int pgbenchExprStackPeak(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 pgbenchExprCoverage(FILE *out){ int stateno, iLookAhead, i; int nMissed = 0; for(stateno=0; statenoYY_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<=YY_ACTTAB_COUNT ); assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); assert( iLookAhead!=YYNOCODE ); assert( iLookAhead < YYNTOKEN ); i += iLookAhead; assert( i<(int)YY_NLOOKAHEAD ); if( yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ assert( iLookAhead %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; assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); if( 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{ assert( i>=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) ); 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 && iyytos>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 ********************************************/ pgbenchExprARG_STORE /* Suppress warning about unused %extra_argument var */ pgbenchExprCTX_STORE } /* ** Print tracing information for a SHIFT action */ #ifndef NDEBUG static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){ if( yyTraceFILE ){ if( yyNewStateyytos->major], yyNewState); }else{ fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n", yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major], yyNewState - YY_MIN_REDUCE); } } } #else # define yyTraceShift(X,Y,Z) #endif /* ** Perform a shift action. */ 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 */ pgbenchExprTOKENTYPE 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 yytos = yypParser->yytos; if( yytos>yypParser->yystackEnd ){ if( yyGrowStack(yypParser) ){ yypParser->yytos--; yyStackOverflow(yypParser); return; } yytos = yypParser->yytos; assert( yytos <= yypParser->yystackEnd ); } if( yyNewState > YY_MAX_SHIFT ){ yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; } yytos->stateno = yyNewState; yytos->major = yyMajor; yytos->minor.yy0 = yyMinor; yyTraceShift(yypParser, yyNewState, "Shift"); } /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { 40, /* (0) result ::= expr */ 43, /* (1) elist ::= */ 43, /* (2) elist ::= expr */ 43, /* (3) elist ::= elist COMMA expr */ 41, /* (4) expr ::= LPAREN expr RPAREN */ 41, /* (5) expr ::= PLUS expr */ 41, /* (6) expr ::= MINUS expr */ 41, /* (7) expr ::= MINUS MAXINT_PLUS_ONE_CONST */ 41, /* (8) expr ::= TILDE expr */ 41, /* (9) expr ::= NOT_OP expr */ 41, /* (10) expr ::= expr PLUS expr */ 41, /* (11) expr ::= expr MINUS expr */ 41, /* (12) expr ::= expr STAR expr */ 41, /* (13) expr ::= expr SLASH expr */ 41, /* (14) expr ::= expr PERCENT expr */ 41, /* (15) expr ::= expr LT expr */ 41, /* (16) expr ::= expr LE_OP expr */ 41, /* (17) expr ::= expr GT expr */ 41, /* (18) expr ::= expr GE_OP expr */ 41, /* (19) expr ::= expr EQ expr */ 41, /* (20) expr ::= expr NE_OP expr */ 41, /* (21) expr ::= expr AMP expr */ 41, /* (22) expr ::= expr PIPE expr */ 41, /* (23) expr ::= expr HASH expr */ 41, /* (24) expr ::= expr LS_OP expr */ 41, /* (25) expr ::= expr RS_OP expr */ 41, /* (26) expr ::= expr AND_OP expr */ 41, /* (27) expr ::= expr OR_OP expr */ 41, /* (28) expr ::= expr ISNULL_OP */ 41, /* (29) expr ::= expr NOTNULL_OP */ 41, /* (30) expr ::= expr IS_OP NULL_CONST */ 41, /* (31) expr ::= expr IS_OP NOT_OP NULL_CONST */ 41, /* (32) expr ::= expr IS_OP BOOLEAN_CONST */ 41, /* (33) expr ::= expr IS_OP NOT_OP BOOLEAN_CONST */ 41, /* (34) expr ::= NULL_CONST */ 41, /* (35) expr ::= BOOLEAN_CONST */ 41, /* (36) expr ::= INTEGER_CONST */ 41, /* (37) expr ::= DOUBLE_CONST */ 41, /* (38) expr ::= VARIABLE */ 41, /* (39) expr ::= function LPAREN elist RPAREN */ 41, /* (40) expr ::= case_control */ 44, /* (41) when_then_list ::= when_then_list WHEN_KW expr THEN_KW expr */ 44, /* (42) when_then_list ::= WHEN_KW expr THEN_KW expr */ 42, /* (43) case_control ::= CASE_KW when_then_list END_KW */ 42, /* (44) case_control ::= CASE_KW when_then_list ELSE_KW expr END_KW */ 45, /* (45) function ::= FUNCTION */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number ** of symbols on the right-hand side of that rule. */ static const signed char yyRuleInfoNRhs[] = { -1, /* (0) result ::= expr */ 0, /* (1) elist ::= */ -1, /* (2) elist ::= expr */ -3, /* (3) elist ::= elist COMMA expr */ -3, /* (4) expr ::= LPAREN expr RPAREN */ -2, /* (5) expr ::= PLUS expr */ -2, /* (6) expr ::= MINUS expr */ -2, /* (7) expr ::= MINUS MAXINT_PLUS_ONE_CONST */ -2, /* (8) expr ::= TILDE expr */ -2, /* (9) expr ::= NOT_OP expr */ -3, /* (10) expr ::= expr PLUS expr */ -3, /* (11) expr ::= expr MINUS expr */ -3, /* (12) expr ::= expr STAR expr */ -3, /* (13) expr ::= expr SLASH expr */ -3, /* (14) expr ::= expr PERCENT expr */ -3, /* (15) expr ::= expr LT expr */ -3, /* (16) expr ::= expr LE_OP expr */ -3, /* (17) expr ::= expr GT expr */ -3, /* (18) expr ::= expr GE_OP expr */ -3, /* (19) expr ::= expr EQ expr */ -3, /* (20) expr ::= expr NE_OP expr */ -3, /* (21) expr ::= expr AMP expr */ -3, /* (22) expr ::= expr PIPE expr */ -3, /* (23) expr ::= expr HASH expr */ -3, /* (24) expr ::= expr LS_OP expr */ -3, /* (25) expr ::= expr RS_OP expr */ -3, /* (26) expr ::= expr AND_OP expr */ -3, /* (27) expr ::= expr OR_OP expr */ -2, /* (28) expr ::= expr ISNULL_OP */ -2, /* (29) expr ::= expr NOTNULL_OP */ -3, /* (30) expr ::= expr IS_OP NULL_CONST */ -4, /* (31) expr ::= expr IS_OP NOT_OP NULL_CONST */ -3, /* (32) expr ::= expr IS_OP BOOLEAN_CONST */ -4, /* (33) expr ::= expr IS_OP NOT_OP BOOLEAN_CONST */ -1, /* (34) expr ::= NULL_CONST */ -1, /* (35) expr ::= BOOLEAN_CONST */ -1, /* (36) expr ::= INTEGER_CONST */ -1, /* (37) expr ::= DOUBLE_CONST */ -1, /* (38) expr ::= VARIABLE */ -4, /* (39) expr ::= function LPAREN elist RPAREN */ -1, /* (40) expr ::= case_control */ -5, /* (41) when_then_list ::= when_then_list WHEN_KW expr THEN_KW expr */ -4, /* (42) when_then_list ::= WHEN_KW expr THEN_KW expr */ -3, /* (43) case_control ::= CASE_KW when_then_list END_KW */ -5, /* (44) case_control ::= CASE_KW when_then_list ELSE_KW expr END_KW */ -1, /* (45) function ::= FUNCTION */ }; 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 */ pgbenchExprTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ pgbenchExprCTX_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 */ pgbenchExprARG_FETCH (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; switch( yyruleno ){ /* Beginning here are the reduction cases. A typical example ** follows: ** case 0: ** #line ** { ... } // User supplied code ** #line ** break; */ /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* result ::= expr */ #line 370 "pgbench_expr.lime" { yylhsminor.yy30 = yymsp[0].minor.yy30; pstate->result = yymsp[0].minor.yy30; } #line 1383 "pgbench_expr.c" yymsp[0].minor.yy30 = yylhsminor.yy30; break; case 1: /* elist ::= */ #line 379 "pgbench_expr.lime" { yymsp[1].minor.yy74 = NULL; } #line 1391 "pgbench_expr.c" break; case 2: /* elist ::= expr */ #line 383 "pgbench_expr.lime" { yylhsminor.yy74 = make_elist(yymsp[0].minor.yy30, NULL); } #line 1398 "pgbench_expr.c" yymsp[0].minor.yy74 = yylhsminor.yy74; break; case 3: /* elist ::= elist COMMA expr */ #line 387 "pgbench_expr.lime" { yylhsminor.yy74 = make_elist(yymsp[0].minor.yy30, yymsp[-2].minor.yy74); } #line 1406 "pgbench_expr.c" yymsp[-2].minor.yy74 = yylhsminor.yy74; break; case 4: /* expr ::= LPAREN expr RPAREN */ #line 396 "pgbench_expr.lime" { yymsp[-2].minor.yy30 = yymsp[-1].minor.yy30; } #line 1414 "pgbench_expr.c" break; case 5: /* expr ::= PLUS expr */ #line 401 "pgbench_expr.lime" { yymsp[-1].minor.yy30 = yymsp[0].minor.yy30; } #line 1421 "pgbench_expr.c" break; case 6: /* expr ::= MINUS expr */ #line 406 "pgbench_expr.lime" { yymsp[-1].minor.yy30 = make_op("-", make_integer_constant(0), yymsp[0].minor.yy30); } #line 1428 "pgbench_expr.c" break; case 7: /* expr ::= MINUS MAXINT_PLUS_ONE_CONST */ #line 411 "pgbench_expr.lime" { yymsp[-1].minor.yy30 = make_integer_constant(INT64_MIN); } #line 1435 "pgbench_expr.c" break; case 8: /* expr ::= TILDE expr */ #line 416 "pgbench_expr.lime" { yymsp[-1].minor.yy30 = make_op("#", make_integer_constant(~(int64_t)0), yymsp[0].minor.yy30); } #line 1442 "pgbench_expr.c" break; case 9: /* expr ::= NOT_OP expr */ #line 421 "pgbench_expr.lime" { yymsp[-1].minor.yy30 = make_uop("!not", yymsp[0].minor.yy30); } #line 1449 "pgbench_expr.c" break; case 10: /* expr ::= expr PLUS expr */ #line 426 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("+", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1456 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 11: /* expr ::= expr MINUS expr */ #line 430 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("-", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1464 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 12: /* expr ::= expr STAR expr */ #line 434 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("*", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1472 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 13: /* expr ::= expr SLASH expr */ #line 438 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("/", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1480 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 14: /* expr ::= expr PERCENT expr */ #line 442 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("mod", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1488 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 15: /* expr ::= expr LT expr */ #line 447 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("<", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1496 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 16: /* expr ::= expr LE_OP expr */ #line 451 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("<=", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1504 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 17: /* expr ::= expr GT expr */ #line 456 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("<", yymsp[0].minor.yy30, yymsp[-2].minor.yy30); } #line 1512 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 18: /* expr ::= expr GE_OP expr */ #line 461 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("<=", yymsp[0].minor.yy30, yymsp[-2].minor.yy30); } #line 1520 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 19: /* expr ::= expr EQ expr */ #line 465 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("=", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1528 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 20: /* expr ::= expr NE_OP expr */ #line 469 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("<>", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1536 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 21: /* expr ::= expr AMP expr */ #line 474 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("&", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1544 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 22: /* expr ::= expr PIPE expr */ #line 478 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("|", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1552 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 23: /* expr ::= expr HASH expr */ #line 482 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("#", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1560 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 24: /* expr ::= expr LS_OP expr */ #line 486 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("<<", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1568 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 25: /* expr ::= expr RS_OP expr */ #line 490 "pgbench_expr.lime" { yylhsminor.yy30 = make_op(">>", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1576 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 26: /* expr ::= expr AND_OP expr */ #line 495 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("!and", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1584 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 27: /* expr ::= expr OR_OP expr */ #line 499 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("!or", yymsp[-2].minor.yy30, yymsp[0].minor.yy30); } #line 1592 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 28: /* expr ::= expr ISNULL_OP */ #line 504 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("!is", yymsp[-1].minor.yy30, make_null_constant()); } #line 1600 "pgbench_expr.c" yymsp[-1].minor.yy30 = yylhsminor.yy30; break; case 29: /* expr ::= expr NOTNULL_OP */ #line 508 "pgbench_expr.lime" { yylhsminor.yy30 = make_uop("!not", make_op("!is", yymsp[-1].minor.yy30, make_null_constant())); } #line 1608 "pgbench_expr.c" yymsp[-1].minor.yy30 = yylhsminor.yy30; break; case 30: /* expr ::= expr IS_OP NULL_CONST */ #line 512 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("!is", yymsp[-2].minor.yy30, make_null_constant()); } #line 1616 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 31: /* expr ::= expr IS_OP NOT_OP NULL_CONST */ #line 516 "pgbench_expr.lime" { yylhsminor.yy30 = make_uop("!not", make_op("!is", yymsp[-3].minor.yy30, make_null_constant())); } #line 1624 "pgbench_expr.c" yymsp[-3].minor.yy30 = yylhsminor.yy30; break; case 32: /* expr ::= expr IS_OP BOOLEAN_CONST */ #line 520 "pgbench_expr.lime" { yylhsminor.yy30 = make_op("!is", yymsp[-2].minor.yy30, make_boolean_constant(yymsp[0].minor.yy0.bval)); } #line 1632 "pgbench_expr.c" yymsp[-2].minor.yy30 = yylhsminor.yy30; break; case 33: /* expr ::= expr IS_OP NOT_OP BOOLEAN_CONST */ #line 524 "pgbench_expr.lime" { yylhsminor.yy30 = make_uop("!not", make_op("!is", yymsp[-3].minor.yy30, make_boolean_constant(yymsp[0].minor.yy0.bval))); } #line 1640 "pgbench_expr.c" yymsp[-3].minor.yy30 = yylhsminor.yy30; break; case 34: /* expr ::= NULL_CONST */ #line 529 "pgbench_expr.lime" { yymsp[0].minor.yy30 = make_null_constant(); } #line 1648 "pgbench_expr.c" break; case 35: /* expr ::= BOOLEAN_CONST */ #line 533 "pgbench_expr.lime" { yylhsminor.yy30 = make_boolean_constant(yymsp[0].minor.yy0.bval); } #line 1655 "pgbench_expr.c" yymsp[0].minor.yy30 = yylhsminor.yy30; break; case 36: /* expr ::= INTEGER_CONST */ #line 537 "pgbench_expr.lime" { yylhsminor.yy30 = make_integer_constant(yymsp[0].minor.yy0.ival); } #line 1663 "pgbench_expr.c" yymsp[0].minor.yy30 = yylhsminor.yy30; break; case 37: /* expr ::= DOUBLE_CONST */ #line 541 "pgbench_expr.lime" { yylhsminor.yy30 = make_double_constant(yymsp[0].minor.yy0.dval); } #line 1671 "pgbench_expr.c" yymsp[0].minor.yy30 = yylhsminor.yy30; break; case 38: /* expr ::= VARIABLE */ #line 546 "pgbench_expr.lime" { yylhsminor.yy30 = make_variable(yymsp[0].minor.yy0.str); } #line 1679 "pgbench_expr.c" yymsp[0].minor.yy30 = yylhsminor.yy30; break; case 39: /* expr ::= function LPAREN elist RPAREN */ #line 551 "pgbench_expr.lime" { yylhsminor.yy30 = make_func(yymsp[-3].minor.yy52, yymsp[-1].minor.yy74); } #line 1687 "pgbench_expr.c" yymsp[-3].minor.yy30 = yylhsminor.yy30; break; case 40: /* expr ::= case_control */ #line 556 "pgbench_expr.lime" { yylhsminor.yy30 = yymsp[0].minor.yy30; } #line 1695 "pgbench_expr.c" yymsp[0].minor.yy30 = yylhsminor.yy30; break; case 41: /* when_then_list ::= when_then_list WHEN_KW expr THEN_KW expr */ #line 561 "pgbench_expr.lime" { yylhsminor.yy74 = make_elist(yymsp[0].minor.yy30, make_elist(yymsp[-2].minor.yy30, yymsp[-4].minor.yy74)); } #line 1703 "pgbench_expr.c" yymsp[-4].minor.yy74 = yylhsminor.yy74; break; case 42: /* when_then_list ::= WHEN_KW expr THEN_KW expr */ #line 565 "pgbench_expr.lime" { yymsp[-3].minor.yy74 = make_elist(yymsp[0].minor.yy30, make_elist(yymsp[-2].minor.yy30, NULL)); } #line 1711 "pgbench_expr.c" break; case 43: /* case_control ::= CASE_KW when_then_list END_KW */ #line 570 "pgbench_expr.lime" { /* No ELSE clause: default to NULL */ yymsp[-2].minor.yy30 = make_func(-1, make_elist(make_null_constant(), yymsp[-1].minor.yy74)); } #line 1719 "pgbench_expr.c" break; case 44: /* case_control ::= CASE_KW when_then_list ELSE_KW expr END_KW */ #line 575 "pgbench_expr.lime" { yymsp[-4].minor.yy30 = make_func(-1, make_elist(yymsp[-1].minor.yy30, yymsp[-3].minor.yy74)); } #line 1726 "pgbench_expr.c" break; case 45: /* function ::= FUNCTION */ #line 580 "pgbench_expr.lime" { /* In a full integration this would call find_func(). * Here we store the function number from the tokenizer. */ yylhsminor.yy52 = yymsp[0].minor.yy0.ival; free(yymsp[0].minor.yy0.str); } #line 1736 "pgbench_expr.c" yymsp[0].minor.yy52 = yylhsminor.yy52; break; default: break; /********** End reduce actions ************************************************/ }; assert( yyrulenoYY_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 */ ){ pgbenchExprARG_FETCH pgbenchExprCTX_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 ***************************************/ #line 269 "pgbench_expr.lime" pstate->errors++; fprintf(stderr, "pgbench expression: parse failure\n"); #line 1785 "pgbench_expr.c" /************ End %parse_failure code *****************************************/ pgbenchExprARG_STORE /* Suppress warning about unused %extra_argument variable */ pgbenchExprCTX_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 */ pgbenchExprTOKENTYPE yyminor /* The minor type of the error token */ ){ pgbenchExprARG_FETCH pgbenchExprCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ #line 264 "pgbench_expr.lime" pstate->errors++; fprintf(stderr, "pgbench expression: syntax error\n"); #line 1808 "pgbench_expr.c" /************ End %syntax_error code ******************************************/ pgbenchExprARG_STORE /* Suppress warning about unused %extra_argument variable */ pgbenchExprCTX_STORE } /* ** The following is executed when the parser accepts */ static void yy_accept( yyParser *yypParser /* The parser */ ){ pgbenchExprARG_FETCH pgbenchExprCTX_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 *****************************************/ /*********** End %parse_accept code *******************************************/ pgbenchExprARG_STORE /* Suppress warning about unused %extra_argument variable */ pgbenchExprCTX_STORE } /* The main parser program. ** The first argument is a pointer to a structure obtained from ** "pgbenchExprAlloc" 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: **
    **
  • A pointer to the parser (an opaque structure.) **
  • The major token number. **
  • The minor token number. **
  • An option argument of a grammar-specified type. **
** ** Outputs: ** None. */ void pgbenchExpr( void *yyp, /* The parser */ int yymajor, /* The major token code number */ pgbenchExprTOKENTYPE yyminor /* The value for the token */ pgbenchExprARG_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 */ pgbenchExprCTX_FETCH pgbenchExprARG_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 while(1){ /* Exit by "break" */ assert( yypParser->yytos>=yypParser->yystack ); assert( yyact==yypParser->yytos->stateno ); yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */ #ifndef NDEBUG assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ); if( yyTraceFILE ){ int yysize = yyRuleInfoNRhs[yyruleno]; if( yysize ){ fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", yyTracePrompt, yyruleno, yyRuleName[yyruleno], yyrulenoyytos[yysize].stateno); }else{ fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n", yyTracePrompt, yyruleno, yyRuleName[yyruleno], yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); } #endif if( yypParser->yytos>=yypParser->yystackEnd ){ if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); break; } } } yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor pgbenchExprCTX_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); if( yyact<=YY_MAX_SHIFTREDUCE ) break; 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 } } #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 pgbenchExprFallback(int iToken){ #ifdef YYFALLBACK assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); return yyFallback[iToken]; #else (void)iToken; return 0; #endif }