/* This file is automatically generated by Lemon from input grammar ** source file "isolation_gram.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 30 "isolation_gram.lime" #include "isolation_defs.h" #line 33 "isolation_gram.c" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ #ifndef SQLBLOCK #define SQLBLOCK 1 #define IDENTIFIER 2 #define INTEGER 3 #define NOTICES 4 #define PERMUTATION 5 #define SESSION 6 #define SETUP 7 #define STEP 8 #define TEARDOWN 9 #define TEST 10 #define COMMA 11 #define LPAREN 12 #define RPAREN 13 #define STAR 14 #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. ** isolTOKENTYPE 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 isolTOKENTYPE. 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() ** isolARG_SDECL A static variable declaration for the %extra_argument ** isolARG_PDECL A parameter declaration for the %extra_argument ** isolARG_PARAM Code to pass %extra_argument as a subroutine parameter ** isolARG_STORE Code to store %extra_argument into yypParser ** isolARG_FETCH Code to extract %extra_argument from yypParser ** isolCTX_* As isolARG_ 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 31 #define YYACTIONTYPE unsigned char #define isolTOKENTYPE IsolToken typedef union { int yyinit; isolTOKENTYPE yy0; IsolPtrList * yy4; int yy6; PermutationStep * yy11; Step * yy15; Session * yy23; PermutationStepBlocker * yy27; char * yy29; Permutation * yy51; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif #define isolARG_SDECL IsolParseState *pstate; #define isolARG_PDECL ,IsolParseState *pstate #define isolARG_PARAM ,pstate #define isolARG_FETCH IsolParseState *pstate=yypParser->pstate; #define isolARG_STORE yypParser->pstate=pstate; #undef YYREALLOC #define YYREALLOC realloc #undef YYFREE #define YYFREE free #undef YYDYNSTACK #define YYDYNSTACK 0 #undef YYSIZELIMIT #define isolCTX(P) 0 #define isolCTX_SDECL #define isolCTX_PDECL #define isolCTX_PARAM #define isolCTX_FETCH #define isolCTX_STORE #undef YYERRORSYMBOL #undef YYERRSYMDT #undef YYFALLBACK #define YYNSTATE 22 #define YYNRULE 28 #define YYNRULE_WITH_ACTION 28 #define YYNTOKEN 15 #define YY_MAX_SHIFT 21 #define YY_MIN_SHIFTREDUCE 41 #define YY_MAX_SHIFTREDUCE 68 #define YY_ERROR_ACTION 69 #define YY_ACCEPT_ACTION 70 #define YY_NO_ACTION 71 #define YY_MIN_REDUCE 72 #define YY_MAX_REDUCE 99 #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 (49) static const YYACTIONTYPE yy_action[] = { /* 0 */ 81, 70, 4, 21, 11, 88, 5, 20, 14, 12, /* 10 */ 95, 17, 18, 82, 19, 15, 18, 84, 74, 8, /* 20 */ 68, 19, 10, 91, 3, 83, 6, 76, 1, 80, /* 30 */ 9, 17, 63, 20, 96, 5, 67, 89, 92, 13, /* 40 */ 2, 54, 71, 16, 7, 48, 71, 46, 72, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 21, 15, 16, 24, 25, 26, 5, 6, 2, 29, /* 10 */ 30, 8, 9, 19, 7, 2, 9, 23, 18, 19, /* 20 */ 14, 7, 27, 28, 22, 23, 17, 18, 20, 21, /* 30 */ 11, 8, 13, 6, 30, 5, 3, 26, 28, 4, /* 40 */ 12, 1, 31, 2, 2, 1, 31, 1, 0, 31, /* 50 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 60 */ 31, 31, 31, 31, }; #define YY_SHIFT_COUNT (21) #define YY_SHIFT_MIN (0) #define YY_SHIFT_MAX (48) static const unsigned char yy_shift_ofst[] = { /* 0 */ 49, 1, 6, 3, 7, 13, 23, 14, 27, 6, /* 10 */ 13, 30, 19, 33, 35, 28, 40, 41, 44, 46, /* 20 */ 42, 48, }; #define YY_REDUCE_COUNT (11) #define YY_REDUCE_MIN (-21) #define YY_REDUCE_MAX (11) static const signed char yy_reduce_ofst[] = { /* 0 */ -14, -21, -20, -6, 0, -5, 2, 9, 8, 4, /* 10 */ 10, 11, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 73, 87, 69, 78, 78, 69, 69, 75, 69, 69, /* 10 */ 90, 86, 69, 69, 97, 93, 69, 69, 69, 69, /* 20 */ 69, 69, }; /********** 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 isolARG_SDECL /* A place to hold %extra_argument */ isolCTX_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: ** ** ** Outputs: ** None. */ void isolTrace(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 */ "SQLBLOCK", /* 2 */ "IDENTIFIER", /* 3 */ "INTEGER", /* 4 */ "NOTICES", /* 5 */ "PERMUTATION", /* 6 */ "SESSION", /* 7 */ "SETUP", /* 8 */ "STEP", /* 9 */ "TEARDOWN", /* 10 */ "TEST", /* 11 */ "COMMA", /* 12 */ "LPAREN", /* 13 */ "RPAREN", /* 14 */ "STAR", /* 15 */ "testSpec", /* 16 */ "setup_list", /* 17 */ "opt_setup", /* 18 */ "setup", /* 19 */ "opt_teardown", /* 20 */ "session_list", /* 21 */ "session", /* 22 */ "step_list", /* 23 */ "step", /* 24 */ "opt_permutation_list", /* 25 */ "permutation_list", /* 26 */ "permutation", /* 27 */ "permutation_step_list", /* 28 */ "permutation_step", /* 29 */ "blocker_list", /* 30 */ "blocker", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ static const char *const yyRuleName[] = { /* 0 */ "testSpec ::= setup_list opt_teardown session_list opt_permutation_list", /* 1 */ "setup_list ::=", /* 2 */ "setup_list ::= setup_list setup", /* 3 */ "opt_setup ::=", /* 4 */ "opt_setup ::= setup", /* 5 */ "setup ::= SETUP SQLBLOCK", /* 6 */ "opt_teardown ::=", /* 7 */ "opt_teardown ::= TEARDOWN SQLBLOCK", /* 8 */ "session_list ::= session", /* 9 */ "session_list ::= session_list session", /* 10 */ "session ::= SESSION IDENTIFIER opt_setup step_list opt_teardown", /* 11 */ "step_list ::= step", /* 12 */ "step_list ::= step_list step", /* 13 */ "step ::= STEP IDENTIFIER SQLBLOCK", /* 14 */ "opt_permutation_list ::= permutation_list", /* 15 */ "opt_permutation_list ::=", /* 16 */ "permutation_list ::= permutation", /* 17 */ "permutation_list ::= permutation_list permutation", /* 18 */ "permutation ::= PERMUTATION permutation_step_list", /* 19 */ "permutation_step_list ::= permutation_step", /* 20 */ "permutation_step_list ::= permutation_step_list permutation_step", /* 21 */ "permutation_step ::= IDENTIFIER", /* 22 */ "permutation_step ::= IDENTIFIER LPAREN blocker_list RPAREN", /* 23 */ "blocker_list ::= blocker", /* 24 */ "blocker_list ::= blocker_list COMMA blocker", /* 25 */ "blocker ::= IDENTIFIER", /* 26 */ "blocker ::= IDENTIFIER NOTICES INTEGER", /* 27 */ "blocker ::= STAR", }; #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(isolCTX(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]), isolCTX(p)); if( pNew==0 ) return 1; memcpy(pNew, p->yystack, oldSize*sizeof(pNew[0])); }else{ pNew = YYREALLOC(p->yystack, newSize*sizeof(pNew[0]), isolCTX(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 isolAlloc() 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 isolInit(void *yypRawParser isolCTX_PDECL){ yyParser *yypParser = (yyParser*)yypRawParser; isolCTX_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 isol_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 isol and isolFree. */ void *isolAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) isolCTX_PDECL){ yyParser *yypParser; yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); if( yypParser ){ isolCTX_STORE isolInit(yypParser isolCTX_PARAM); } return (void*)yypParser; } #endif /* isol_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 */ ){ isolARG_FETCH isolCTX_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 isolFinalize(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, isolCTX(pParser)); } #endif } #ifndef isol_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 isolFree( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ #ifndef YYPARSEFREENEVERNULL if( p==0 ) return; #endif isolFinalize(p); (*freeProc)(p); } #endif /* isol_ENGINEALWAYSONSTACK */ /* ** Return the peak depth of the stack for a parser. */ #ifdef YYTRACKMAXSTACKDEPTH int isolStackPeak(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 isolCoverage(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 ********************************************/ isolARG_STORE /* Suppress warning about unused %extra_argument var */ isolCTX_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 */ isolTOKENTYPE 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[] = { 15, /* (0) testSpec ::= setup_list opt_teardown session_list opt_permutation_list */ 16, /* (1) setup_list ::= */ 16, /* (2) setup_list ::= setup_list setup */ 17, /* (3) opt_setup ::= */ 17, /* (4) opt_setup ::= setup */ 18, /* (5) setup ::= SETUP SQLBLOCK */ 19, /* (6) opt_teardown ::= */ 19, /* (7) opt_teardown ::= TEARDOWN SQLBLOCK */ 20, /* (8) session_list ::= session */ 20, /* (9) session_list ::= session_list session */ 21, /* (10) session ::= SESSION IDENTIFIER opt_setup step_list opt_teardown */ 22, /* (11) step_list ::= step */ 22, /* (12) step_list ::= step_list step */ 23, /* (13) step ::= STEP IDENTIFIER SQLBLOCK */ 24, /* (14) opt_permutation_list ::= permutation_list */ 24, /* (15) opt_permutation_list ::= */ 25, /* (16) permutation_list ::= permutation */ 25, /* (17) permutation_list ::= permutation_list permutation */ 26, /* (18) permutation ::= PERMUTATION permutation_step_list */ 27, /* (19) permutation_step_list ::= permutation_step */ 27, /* (20) permutation_step_list ::= permutation_step_list permutation_step */ 28, /* (21) permutation_step ::= IDENTIFIER */ 28, /* (22) permutation_step ::= IDENTIFIER LPAREN blocker_list RPAREN */ 29, /* (23) blocker_list ::= blocker */ 29, /* (24) blocker_list ::= blocker_list COMMA blocker */ 30, /* (25) blocker ::= IDENTIFIER */ 30, /* (26) blocker ::= IDENTIFIER NOTICES INTEGER */ 30, /* (27) blocker ::= STAR */ }; /* 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[] = { -4, /* (0) testSpec ::= setup_list opt_teardown session_list opt_permutation_list */ 0, /* (1) setup_list ::= */ -2, /* (2) setup_list ::= setup_list setup */ 0, /* (3) opt_setup ::= */ -1, /* (4) opt_setup ::= setup */ -2, /* (5) setup ::= SETUP SQLBLOCK */ 0, /* (6) opt_teardown ::= */ -2, /* (7) opt_teardown ::= TEARDOWN SQLBLOCK */ -1, /* (8) session_list ::= session */ -2, /* (9) session_list ::= session_list session */ -5, /* (10) session ::= SESSION IDENTIFIER opt_setup step_list opt_teardown */ -1, /* (11) step_list ::= step */ -2, /* (12) step_list ::= step_list step */ -3, /* (13) step ::= STEP IDENTIFIER SQLBLOCK */ -1, /* (14) opt_permutation_list ::= permutation_list */ 0, /* (15) opt_permutation_list ::= */ -1, /* (16) permutation_list ::= permutation */ -2, /* (17) permutation_list ::= permutation_list permutation */ -2, /* (18) permutation ::= PERMUTATION permutation_step_list */ -1, /* (19) permutation_step_list ::= permutation_step */ -2, /* (20) permutation_step_list ::= permutation_step_list permutation_step */ -1, /* (21) permutation_step ::= IDENTIFIER */ -4, /* (22) permutation_step ::= IDENTIFIER LPAREN blocker_list RPAREN */ -1, /* (23) blocker_list ::= blocker */ -3, /* (24) blocker_list ::= blocker_list COMMA blocker */ -1, /* (25) blocker ::= IDENTIFIER */ -3, /* (26) blocker ::= IDENTIFIER NOTICES INTEGER */ -1, /* (27) blocker ::= STAR */ }; 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 */ isolTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ isolCTX_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 */ isolARG_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: /* testSpec ::= setup_list opt_teardown session_list opt_permutation_list */ #line 100 "isolation_gram.lime" { pstate->result.setupsqls = (char **)yymsp[-3].minor.yy4->elements; pstate->result.nsetupsqls = yymsp[-3].minor.yy4->nelements; pstate->result.teardownsql = yymsp[-2].minor.yy29; pstate->result.sessions = (Session **)yymsp[-1].minor.yy4->elements; pstate->result.nsessions = yymsp[-1].minor.yy4->nelements; pstate->result.permutations = (Permutation **)yymsp[0].minor.yy4->elements; pstate->result.npermutations = yymsp[0].minor.yy4->nelements; yylhsminor.yy6 = 0; } #line 1000 "isolation_gram.c" yymsp[-3].minor.yy6 = yylhsminor.yy6; break; case 1: /* setup_list ::= */ case 15: /* opt_permutation_list ::= */ yytestcase(yyruleno==15); #line 114 "isolation_gram.lime" { yymsp[1].minor.yy4 = isol_ptr_list_empty(pstate); } #line 1009 "isolation_gram.c" break; case 2: /* setup_list ::= setup_list setup */ #line 118 "isolation_gram.lime" { yylhsminor.yy4 = isol_ptr_list_append(pstate, yymsp[-1].minor.yy4, yymsp[0].minor.yy29); } #line 1016 "isolation_gram.c" yymsp[-1].minor.yy4 = yylhsminor.yy4; break; case 3: /* opt_setup ::= */ case 6: /* opt_teardown ::= */ yytestcase(yyruleno==6); #line 125 "isolation_gram.lime" { yymsp[1].minor.yy29 = NULL; } #line 1025 "isolation_gram.c" break; case 4: /* opt_setup ::= setup */ #line 129 "isolation_gram.lime" { yylhsminor.yy29 = yymsp[0].minor.yy29; } #line 1032 "isolation_gram.c" yymsp[0].minor.yy29 = yylhsminor.yy29; break; case 5: /* setup ::= SETUP SQLBLOCK */ case 7: /* opt_teardown ::= TEARDOWN SQLBLOCK */ yytestcase(yyruleno==7); #line 133 "isolation_gram.lime" { yymsp[-1].minor.yy29 = yymsp[0].minor.yy0.str; } #line 1041 "isolation_gram.c" break; case 8: /* session_list ::= session */ #line 148 "isolation_gram.lime" { yylhsminor.yy4 = isol_ptr_list_create(pstate, yymsp[0].minor.yy23); } #line 1048 "isolation_gram.c" yymsp[0].minor.yy4 = yylhsminor.yy4; break; case 9: /* session_list ::= session_list session */ #line 152 "isolation_gram.lime" { yylhsminor.yy4 = isol_ptr_list_append(pstate, yymsp[-1].minor.yy4, yymsp[0].minor.yy23); } #line 1056 "isolation_gram.c" yymsp[-1].minor.yy4 = yylhsminor.yy4; break; case 10: /* session ::= SESSION IDENTIFIER opt_setup step_list opt_teardown */ #line 159 "isolation_gram.lime" { yymsp[-4].minor.yy23 = isol_make_session(pstate, yymsp[-3].minor.yy0.str, yymsp[-2].minor.yy29, yymsp[-1].minor.yy4, yymsp[0].minor.yy29); } #line 1064 "isolation_gram.c" break; case 11: /* step_list ::= step */ #line 166 "isolation_gram.lime" { yylhsminor.yy4 = isol_ptr_list_create(pstate, yymsp[0].minor.yy15); } #line 1071 "isolation_gram.c" yymsp[0].minor.yy4 = yylhsminor.yy4; break; case 12: /* step_list ::= step_list step */ #line 170 "isolation_gram.lime" { yylhsminor.yy4 = isol_ptr_list_append(pstate, yymsp[-1].minor.yy4, yymsp[0].minor.yy15); } #line 1079 "isolation_gram.c" yymsp[-1].minor.yy4 = yylhsminor.yy4; break; case 13: /* step ::= STEP IDENTIFIER SQLBLOCK */ #line 177 "isolation_gram.lime" { yymsp[-2].minor.yy15 = isol_make_step(pstate, yymsp[-1].minor.yy0.str, yymsp[0].minor.yy0.str); } #line 1087 "isolation_gram.c" break; case 14: /* opt_permutation_list ::= permutation_list */ #line 184 "isolation_gram.lime" { yylhsminor.yy4 = yymsp[0].minor.yy4; } #line 1094 "isolation_gram.c" yymsp[0].minor.yy4 = yylhsminor.yy4; break; case 16: /* permutation_list ::= permutation */ #line 195 "isolation_gram.lime" { yylhsminor.yy4 = isol_ptr_list_create(pstate, yymsp[0].minor.yy51); } #line 1102 "isolation_gram.c" yymsp[0].minor.yy4 = yylhsminor.yy4; break; case 17: /* permutation_list ::= permutation_list permutation */ #line 199 "isolation_gram.lime" { yylhsminor.yy4 = isol_ptr_list_append(pstate, yymsp[-1].minor.yy4, yymsp[0].minor.yy51); } #line 1110 "isolation_gram.c" yymsp[-1].minor.yy4 = yylhsminor.yy4; break; case 18: /* permutation ::= PERMUTATION permutation_step_list */ #line 206 "isolation_gram.lime" { yymsp[-1].minor.yy51 = isol_make_permutation(pstate, yymsp[0].minor.yy4); } #line 1118 "isolation_gram.c" break; case 19: /* permutation_step_list ::= permutation_step */ #line 213 "isolation_gram.lime" { yylhsminor.yy4 = isol_ptr_list_create(pstate, yymsp[0].minor.yy11); } #line 1125 "isolation_gram.c" yymsp[0].minor.yy4 = yylhsminor.yy4; break; case 20: /* permutation_step_list ::= permutation_step_list permutation_step */ #line 217 "isolation_gram.lime" { yylhsminor.yy4 = isol_ptr_list_append(pstate, yymsp[-1].minor.yy4, yymsp[0].minor.yy11); } #line 1133 "isolation_gram.c" yymsp[-1].minor.yy4 = yylhsminor.yy4; break; case 21: /* permutation_step ::= IDENTIFIER */ #line 224 "isolation_gram.lime" { yylhsminor.yy11 = isol_make_perm_step(pstate, yymsp[0].minor.yy0.str, NULL); } #line 1141 "isolation_gram.c" yymsp[0].minor.yy11 = yylhsminor.yy11; break; case 22: /* permutation_step ::= IDENTIFIER LPAREN blocker_list RPAREN */ #line 228 "isolation_gram.lime" { yylhsminor.yy11 = isol_make_perm_step(pstate, yymsp[-3].minor.yy0.str, yymsp[-1].minor.yy4); } #line 1149 "isolation_gram.c" yymsp[-3].minor.yy11 = yylhsminor.yy11; break; case 23: /* blocker_list ::= blocker */ #line 235 "isolation_gram.lime" { yylhsminor.yy4 = isol_ptr_list_create(pstate, yymsp[0].minor.yy27); } #line 1157 "isolation_gram.c" yymsp[0].minor.yy4 = yylhsminor.yy4; break; case 24: /* blocker_list ::= blocker_list COMMA blocker */ #line 239 "isolation_gram.lime" { yylhsminor.yy4 = isol_ptr_list_append(pstate, yymsp[-2].minor.yy4, yymsp[0].minor.yy27); } #line 1165 "isolation_gram.c" yymsp[-2].minor.yy4 = yylhsminor.yy4; break; case 25: /* blocker ::= IDENTIFIER */ #line 250 "isolation_gram.lime" { yylhsminor.yy27 = isol_make_blocker_step(pstate, yymsp[0].minor.yy0.str); } #line 1173 "isolation_gram.c" yymsp[0].minor.yy27 = yylhsminor.yy27; break; case 26: /* blocker ::= IDENTIFIER NOTICES INTEGER */ #line 254 "isolation_gram.lime" { yylhsminor.yy27 = isol_make_blocker_notices(pstate, yymsp[-2].minor.yy0.str, yymsp[0].minor.yy0.ival); } #line 1181 "isolation_gram.c" yymsp[-2].minor.yy27 = yylhsminor.yy27; break; case 27: /* blocker ::= STAR */ #line 258 "isolation_gram.lime" { yymsp[0].minor.yy27 = isol_make_blocker_once(pstate); } #line 1189 "isolation_gram.c" 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 */ ){ isolARG_FETCH isolCTX_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 38 "isolation_gram.lime" isol_yyerror(pstate, "parse failure"); #line 1236 "isolation_gram.c" /************ End %parse_failure code *****************************************/ isolARG_STORE /* Suppress warning about unused %extra_argument variable */ isolCTX_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 */ isolTOKENTYPE yyminor /* The minor type of the error token */ ){ isolARG_FETCH isolCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ #line 34 "isolation_gram.lime" isol_yyerror(pstate, "syntax error"); #line 1258 "isolation_gram.c" /************ End %syntax_error code ******************************************/ isolARG_STORE /* Suppress warning about unused %extra_argument variable */ isolCTX_STORE } /* ** The following is executed when the parser accepts */ static void yy_accept( yyParser *yypParser /* The parser */ ){ isolARG_FETCH isolCTX_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 *******************************************/ isolARG_STORE /* Suppress warning about unused %extra_argument variable */ isolCTX_STORE } /* The main parser program. ** The first argument is a pointer to a structure obtained from ** "isolAlloc" 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 isol( void *yyp, /* The parser */ int yymajor, /* The major token code number */ isolTOKENTYPE yyminor /* The value for the token */ isolARG_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 */ isolCTX_FETCH isolARG_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 isolCTX_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 isolFallback(int iToken){ #ifdef YYFALLBACK assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); return yyFallback[iToken]; #else (void)iToken; return 0; #endif }