/* This file is automatically generated by Lemon from input grammar ** source file "repl_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 40 "repl_gram.lime" #include "repl_defs.h" #include "repl_gram.h" #line 34 "repl_gram.c" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ #ifndef SCONST #define SCONST 1 #define IDENT 2 #define UCONST 3 #define RECPTR 4 #define K_BASE_BACKUP 5 #define K_IDENTIFY_SYSTEM 6 #define K_READ_REPLICATION_SLOT 7 #define K_SHOW 8 #define K_START_REPLICATION 9 #define K_CREATE_REPLICATION_SLOT 10 #define K_DROP_REPLICATION_SLOT 11 #define K_ALTER_REPLICATION_SLOT 12 #define K_TIMELINE_HISTORY 13 #define K_WAIT 14 #define K_TIMELINE 15 #define K_PHYSICAL 16 #define K_LOGICAL 17 #define K_SLOT 18 #define K_RESERVE_WAL 19 #define K_TEMPORARY 20 #define K_TWO_PHASE 21 #define K_EXPORT_SNAPSHOT 22 #define K_NOEXPORT_SNAPSHOT 23 #define K_USE_SNAPSHOT 24 #define K_UPLOAD_MANIFEST 25 #define LPAREN 26 #define RPAREN 27 #define COMMA 28 #define SEMI 29 #define DOT 30 #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. ** replTOKENTYPE 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 replTOKENTYPE. 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() ** replARG_SDECL A static variable declaration for the %extra_argument ** replARG_PDECL A parameter declaration for the %extra_argument ** replARG_PARAM Code to pass %extra_argument as a subroutine parameter ** replARG_STORE Code to store %extra_argument into yypParser ** replARG_FETCH Code to extract %extra_argument from yypParser ** replCTX_* As replARG_ 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 60 #define YYACTIONTYPE unsigned short int #define replTOKENTYPE ReplToken typedef union { int yyinit; replTOKENTYPE yy0; bool yy17; ReplCommand * yy25; ReplOptionList * yy63; ReplDefElem * yy64; char * yy73; uint32 yy110; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif #define replARG_SDECL ReplParseState *pstate; #define replARG_PDECL ,ReplParseState *pstate #define replARG_PARAM ,pstate #define replARG_FETCH ReplParseState *pstate=yypParser->pstate; #define replARG_STORE yypParser->pstate=pstate; #undef YYREALLOC #define YYREALLOC realloc #undef YYFREE #define YYFREE free #undef YYDYNSTACK #define YYDYNSTACK 0 #undef YYSIZELIMIT #define replCTX(P) 0 #define replCTX_SDECL #define replCTX_PDECL #define replCTX_PARAM #define replCTX_FETCH #define replCTX_STORE #undef YYERRORSYMBOL #undef YYERRSYMDT #undef YYFALLBACK #define YYNSTATE 42 #define YYNRULE 81 #define YYNRULE_WITH_ACTION 77 #define YYNTOKEN 31 #define YY_MAX_SHIFT 41 #define YY_MIN_SHIFTREDUCE 107 #define YY_MAX_SHIFTREDUCE 187 #define YY_ERROR_ACTION 188 #define YY_ACCEPT_ACTION 189 #define YY_NO_ACTION 190 #define YY_MIN_REDUCE 191 #define YY_MAX_REDUCE 271 #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 (116) static const YYACTIONTYPE yy_action[] = { /* 0 */ 20, 236, 163, 9, 214, 164, 165, 155, 166, 167, /* 10 */ 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, /* 20 */ 178, 179, 180, 181, 182, 183, 189, 18, 192, 193, /* 30 */ 194, 195, 196, 197, 198, 199, 200, 201, 202, 37, /* 40 */ 119, 17, 16, 14, 36, 34, 32, 25, 135, 2, /* 50 */ 136, 132, 133, 134, 21, 242, 22, 242, 241, 143, /* 60 */ 24, 242, 161, 160, 162, 211, 8, 19, 238, 19, /* 70 */ 19, 210, 8, 19, 150, 10, 139, 4, 128, 4, /* 80 */ 7, 35, 124, 4, 237, 5, 225, 29, 28, 224, /* 90 */ 186, 30, 13, 144, 122, 184, 23, 142, 38, 40, /* 100 */ 11, 26, 41, 27, 12, 148, 1, 31, 33, 138, /* 110 */ 6, 15, 3, 39, 123, 191, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 47, 48, 2, 2, 52, 5, 6, 1, 8, 9, /* 10 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 20 */ 20, 21, 22, 23, 24, 25, 31, 32, 33, 34, /* 30 */ 35, 36, 37, 38, 39, 40, 41, 42, 43, 5, /* 40 */ 6, 7, 8, 9, 10, 11, 12, 13, 19, 26, /* 50 */ 21, 22, 23, 24, 44, 45, 44, 45, 45, 25, /* 60 */ 44, 45, 1, 2, 3, 50, 51, 57, 49, 57, /* 70 */ 57, 50, 51, 57, 27, 28, 27, 28, 27, 28, /* 80 */ 16, 17, 27, 28, 48, 26, 46, 15, 18, 54, /* 90 */ 16, 59, 53, 20, 2, 29, 55, 3, 56, 56, /* 100 */ 4, 17, 58, 2, 4, 3, 26, 2, 2, 14, /* 110 */ 2, 2, 26, 30, 2, 0, 60, 60, 60, 60, /* 120 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 130 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 140 */ 60, 60, 60, 60, 60, 60, 60, }; #define YY_SHIFT_COUNT (41) #define YY_SHIFT_MIN (0) #define YY_SHIFT_MAX (115) static const unsigned char yy_shift_ofst[] = { /* 0 */ 34, 0, 0, 0, 0, 1, 23, 23, 29, 6, /* 10 */ 1, 59, 72, 74, 70, 73, 92, 92, 66, 61, /* 20 */ 47, 49, 51, 64, 55, 94, 96, 84, 101, 102, /* 30 */ 100, 80, 105, 95, 106, 108, 109, 86, 83, 112, /* 40 */ 83, 115, }; #define YY_REDUCE_COUNT (18) #define YY_REDUCE_MIN (-48) #define YY_REDUCE_MAX (44) static const signed char yy_reduce_ofst[] = { /* 0 */ -5, 10, 12, 16, 13, -47, 15, 21, -48, 19, /* 10 */ 36, 40, 35, 32, 39, 41, 42, 43, 44, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 188, 188, 188, 188, 188, 188, 215, 215, 213, 240, /* 10 */ 188, 235, 233, 271, 231, 229, 188, 188, 269, 243, /* 20 */ 188, 188, 188, 188, 188, 188, 188, 230, 188, 188, /* 30 */ 188, 188, 188, 221, 188, 188, 188, 209, 205, 188, /* 40 */ 204, 188, }; /********** 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 replARG_SDECL /* A place to hold %extra_argument */ replCTX_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 replTrace(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 */ "SCONST", /* 2 */ "IDENT", /* 3 */ "UCONST", /* 4 */ "RECPTR", /* 5 */ "K_BASE_BACKUP", /* 6 */ "K_IDENTIFY_SYSTEM", /* 7 */ "K_READ_REPLICATION_SLOT", /* 8 */ "K_SHOW", /* 9 */ "K_START_REPLICATION", /* 10 */ "K_CREATE_REPLICATION_SLOT", /* 11 */ "K_DROP_REPLICATION_SLOT", /* 12 */ "K_ALTER_REPLICATION_SLOT", /* 13 */ "K_TIMELINE_HISTORY", /* 14 */ "K_WAIT", /* 15 */ "K_TIMELINE", /* 16 */ "K_PHYSICAL", /* 17 */ "K_LOGICAL", /* 18 */ "K_SLOT", /* 19 */ "K_RESERVE_WAL", /* 20 */ "K_TEMPORARY", /* 21 */ "K_TWO_PHASE", /* 22 */ "K_EXPORT_SNAPSHOT", /* 23 */ "K_NOEXPORT_SNAPSHOT", /* 24 */ "K_USE_SNAPSHOT", /* 25 */ "K_UPLOAD_MANIFEST", /* 26 */ "LPAREN", /* 27 */ "RPAREN", /* 28 */ "COMMA", /* 29 */ "SEMI", /* 30 */ "DOT", /* 31 */ "firstcmd", /* 32 */ "command", /* 33 */ "identify_system", /* 34 */ "base_backup", /* 35 */ "start_replication", /* 36 */ "start_logical_replication", /* 37 */ "create_replication_slot", /* 38 */ "drop_replication_slot", /* 39 */ "alter_replication_slot", /* 40 */ "read_replication_slot", /* 41 */ "timeline_history", /* 42 */ "show", /* 43 */ "upload_manifest", /* 44 */ "generic_option_list", /* 45 */ "generic_option", /* 46 */ "plugin_options", /* 47 */ "plugin_opt_list", /* 48 */ "plugin_opt_elem", /* 49 */ "plugin_opt_arg", /* 50 */ "create_slot_options", /* 51 */ "create_slot_legacy_opt_list", /* 52 */ "create_slot_legacy_opt", /* 53 */ "opt_slot", /* 54 */ "opt_timeline", /* 55 */ "opt_temporary", /* 56 */ "var_name", /* 57 */ "ident_or_keyword", /* 58 */ "opt_semicolon", /* 59 */ "opt_physical", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ static const char *const yyRuleName[] = { /* 0 */ "firstcmd ::= command opt_semicolon", /* 1 */ "command ::= identify_system", /* 2 */ "command ::= base_backup", /* 3 */ "command ::= start_replication", /* 4 */ "command ::= start_logical_replication", /* 5 */ "command ::= create_replication_slot", /* 6 */ "command ::= drop_replication_slot", /* 7 */ "command ::= alter_replication_slot", /* 8 */ "command ::= read_replication_slot", /* 9 */ "command ::= timeline_history", /* 10 */ "command ::= show", /* 11 */ "command ::= upload_manifest", /* 12 */ "identify_system ::= K_IDENTIFY_SYSTEM", /* 13 */ "read_replication_slot ::= K_READ_REPLICATION_SLOT var_name", /* 14 */ "show ::= K_SHOW var_name", /* 15 */ "var_name ::= IDENT", /* 16 */ "var_name ::= var_name DOT IDENT", /* 17 */ "base_backup ::= K_BASE_BACKUP LPAREN generic_option_list RPAREN", /* 18 */ "base_backup ::= K_BASE_BACKUP", /* 19 */ "create_replication_slot ::= K_CREATE_REPLICATION_SLOT IDENT opt_temporary K_PHYSICAL create_slot_options", /* 20 */ "create_replication_slot ::= K_CREATE_REPLICATION_SLOT IDENT opt_temporary K_LOGICAL IDENT create_slot_options", /* 21 */ "create_slot_options ::= LPAREN generic_option_list RPAREN", /* 22 */ "create_slot_options ::= create_slot_legacy_opt_list", /* 23 */ "create_slot_legacy_opt_list ::= create_slot_legacy_opt_list create_slot_legacy_opt", /* 24 */ "create_slot_legacy_opt_list ::=", /* 25 */ "create_slot_legacy_opt ::= K_EXPORT_SNAPSHOT", /* 26 */ "create_slot_legacy_opt ::= K_NOEXPORT_SNAPSHOT", /* 27 */ "create_slot_legacy_opt ::= K_USE_SNAPSHOT", /* 28 */ "create_slot_legacy_opt ::= K_RESERVE_WAL", /* 29 */ "create_slot_legacy_opt ::= K_TWO_PHASE", /* 30 */ "drop_replication_slot ::= K_DROP_REPLICATION_SLOT IDENT", /* 31 */ "drop_replication_slot ::= K_DROP_REPLICATION_SLOT IDENT K_WAIT", /* 32 */ "alter_replication_slot ::= K_ALTER_REPLICATION_SLOT IDENT LPAREN generic_option_list RPAREN", /* 33 */ "start_replication ::= K_START_REPLICATION opt_slot opt_physical RECPTR opt_timeline", /* 34 */ "start_logical_replication ::= K_START_REPLICATION K_SLOT IDENT K_LOGICAL RECPTR plugin_options", /* 35 */ "timeline_history ::= K_TIMELINE_HISTORY UCONST", /* 36 */ "upload_manifest ::= K_UPLOAD_MANIFEST", /* 37 */ "opt_temporary ::= K_TEMPORARY", /* 38 */ "opt_temporary ::=", /* 39 */ "opt_slot ::= K_SLOT IDENT", /* 40 */ "opt_slot ::=", /* 41 */ "opt_timeline ::= K_TIMELINE UCONST", /* 42 */ "opt_timeline ::=", /* 43 */ "plugin_options ::= LPAREN plugin_opt_list RPAREN", /* 44 */ "plugin_options ::=", /* 45 */ "plugin_opt_list ::= plugin_opt_elem", /* 46 */ "plugin_opt_list ::= plugin_opt_list COMMA plugin_opt_elem", /* 47 */ "plugin_opt_elem ::= IDENT plugin_opt_arg", /* 48 */ "plugin_opt_arg ::= SCONST", /* 49 */ "plugin_opt_arg ::=", /* 50 */ "generic_option_list ::= generic_option_list COMMA generic_option", /* 51 */ "generic_option_list ::= generic_option", /* 52 */ "generic_option ::= ident_or_keyword", /* 53 */ "generic_option ::= ident_or_keyword IDENT", /* 54 */ "generic_option ::= ident_or_keyword SCONST", /* 55 */ "generic_option ::= ident_or_keyword UCONST", /* 56 */ "ident_or_keyword ::= IDENT", /* 57 */ "ident_or_keyword ::= K_BASE_BACKUP", /* 58 */ "ident_or_keyword ::= K_IDENTIFY_SYSTEM", /* 59 */ "ident_or_keyword ::= K_SHOW", /* 60 */ "ident_or_keyword ::= K_START_REPLICATION", /* 61 */ "ident_or_keyword ::= K_CREATE_REPLICATION_SLOT", /* 62 */ "ident_or_keyword ::= K_DROP_REPLICATION_SLOT", /* 63 */ "ident_or_keyword ::= K_ALTER_REPLICATION_SLOT", /* 64 */ "ident_or_keyword ::= K_TIMELINE_HISTORY", /* 65 */ "ident_or_keyword ::= K_WAIT", /* 66 */ "ident_or_keyword ::= K_TIMELINE", /* 67 */ "ident_or_keyword ::= K_PHYSICAL", /* 68 */ "ident_or_keyword ::= K_LOGICAL", /* 69 */ "ident_or_keyword ::= K_SLOT", /* 70 */ "ident_or_keyword ::= K_RESERVE_WAL", /* 71 */ "ident_or_keyword ::= K_TEMPORARY", /* 72 */ "ident_or_keyword ::= K_TWO_PHASE", /* 73 */ "ident_or_keyword ::= K_EXPORT_SNAPSHOT", /* 74 */ "ident_or_keyword ::= K_NOEXPORT_SNAPSHOT", /* 75 */ "ident_or_keyword ::= K_USE_SNAPSHOT", /* 76 */ "ident_or_keyword ::= K_UPLOAD_MANIFEST", /* 77 */ "opt_semicolon ::= SEMI", /* 78 */ "opt_semicolon ::=", /* 79 */ "opt_physical ::= K_PHYSICAL", /* 80 */ "opt_physical ::=", }; #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(replCTX(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]), replCTX(p)); if( pNew==0 ) return 1; memcpy(pNew, p->yystack, oldSize*sizeof(pNew[0])); }else{ pNew = YYREALLOC(p->yystack, newSize*sizeof(pNew[0]), replCTX(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 replAlloc() 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 replInit(void *yypRawParser replCTX_PDECL){ yyParser *yypParser = (yyParser*)yypRawParser; replCTX_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 repl_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 repl and replFree. */ void *replAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) replCTX_PDECL){ yyParser *yypParser; yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); if( yypParser ){ replCTX_STORE replInit(yypParser replCTX_PARAM); } return (void*)yypParser; } #endif /* repl_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 */ ){ replARG_FETCH replCTX_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 replFinalize(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, replCTX(pParser)); } #endif } #ifndef repl_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 replFree( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ #ifndef YYPARSEFREENEVERNULL if( p==0 ) return; #endif replFinalize(p); (*freeProc)(p); } #endif /* repl_ENGINEALWAYSONSTACK */ /* ** Return the peak depth of the stack for a parser. */ #ifdef YYTRACKMAXSTACKDEPTH int replStackPeak(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 replCoverage(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 ********************************************/ replARG_STORE /* Suppress warning about unused %extra_argument var */ replCTX_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 */ replTOKENTYPE 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[] = { 31, /* (0) firstcmd ::= command opt_semicolon */ 32, /* (1) command ::= identify_system */ 32, /* (2) command ::= base_backup */ 32, /* (3) command ::= start_replication */ 32, /* (4) command ::= start_logical_replication */ 32, /* (5) command ::= create_replication_slot */ 32, /* (6) command ::= drop_replication_slot */ 32, /* (7) command ::= alter_replication_slot */ 32, /* (8) command ::= read_replication_slot */ 32, /* (9) command ::= timeline_history */ 32, /* (10) command ::= show */ 32, /* (11) command ::= upload_manifest */ 33, /* (12) identify_system ::= K_IDENTIFY_SYSTEM */ 40, /* (13) read_replication_slot ::= K_READ_REPLICATION_SLOT var_name */ 42, /* (14) show ::= K_SHOW var_name */ 56, /* (15) var_name ::= IDENT */ 56, /* (16) var_name ::= var_name DOT IDENT */ 34, /* (17) base_backup ::= K_BASE_BACKUP LPAREN generic_option_list RPAREN */ 34, /* (18) base_backup ::= K_BASE_BACKUP */ 37, /* (19) create_replication_slot ::= K_CREATE_REPLICATION_SLOT IDENT opt_temporary K_PHYSICAL create_slot_options */ 37, /* (20) create_replication_slot ::= K_CREATE_REPLICATION_SLOT IDENT opt_temporary K_LOGICAL IDENT create_slot_options */ 50, /* (21) create_slot_options ::= LPAREN generic_option_list RPAREN */ 50, /* (22) create_slot_options ::= create_slot_legacy_opt_list */ 51, /* (23) create_slot_legacy_opt_list ::= create_slot_legacy_opt_list create_slot_legacy_opt */ 51, /* (24) create_slot_legacy_opt_list ::= */ 52, /* (25) create_slot_legacy_opt ::= K_EXPORT_SNAPSHOT */ 52, /* (26) create_slot_legacy_opt ::= K_NOEXPORT_SNAPSHOT */ 52, /* (27) create_slot_legacy_opt ::= K_USE_SNAPSHOT */ 52, /* (28) create_slot_legacy_opt ::= K_RESERVE_WAL */ 52, /* (29) create_slot_legacy_opt ::= K_TWO_PHASE */ 38, /* (30) drop_replication_slot ::= K_DROP_REPLICATION_SLOT IDENT */ 38, /* (31) drop_replication_slot ::= K_DROP_REPLICATION_SLOT IDENT K_WAIT */ 39, /* (32) alter_replication_slot ::= K_ALTER_REPLICATION_SLOT IDENT LPAREN generic_option_list RPAREN */ 35, /* (33) start_replication ::= K_START_REPLICATION opt_slot opt_physical RECPTR opt_timeline */ 36, /* (34) start_logical_replication ::= K_START_REPLICATION K_SLOT IDENT K_LOGICAL RECPTR plugin_options */ 41, /* (35) timeline_history ::= K_TIMELINE_HISTORY UCONST */ 43, /* (36) upload_manifest ::= K_UPLOAD_MANIFEST */ 55, /* (37) opt_temporary ::= K_TEMPORARY */ 55, /* (38) opt_temporary ::= */ 53, /* (39) opt_slot ::= K_SLOT IDENT */ 53, /* (40) opt_slot ::= */ 54, /* (41) opt_timeline ::= K_TIMELINE UCONST */ 54, /* (42) opt_timeline ::= */ 46, /* (43) plugin_options ::= LPAREN plugin_opt_list RPAREN */ 46, /* (44) plugin_options ::= */ 47, /* (45) plugin_opt_list ::= plugin_opt_elem */ 47, /* (46) plugin_opt_list ::= plugin_opt_list COMMA plugin_opt_elem */ 48, /* (47) plugin_opt_elem ::= IDENT plugin_opt_arg */ 49, /* (48) plugin_opt_arg ::= SCONST */ 49, /* (49) plugin_opt_arg ::= */ 44, /* (50) generic_option_list ::= generic_option_list COMMA generic_option */ 44, /* (51) generic_option_list ::= generic_option */ 45, /* (52) generic_option ::= ident_or_keyword */ 45, /* (53) generic_option ::= ident_or_keyword IDENT */ 45, /* (54) generic_option ::= ident_or_keyword SCONST */ 45, /* (55) generic_option ::= ident_or_keyword UCONST */ 57, /* (56) ident_or_keyword ::= IDENT */ 57, /* (57) ident_or_keyword ::= K_BASE_BACKUP */ 57, /* (58) ident_or_keyword ::= K_IDENTIFY_SYSTEM */ 57, /* (59) ident_or_keyword ::= K_SHOW */ 57, /* (60) ident_or_keyword ::= K_START_REPLICATION */ 57, /* (61) ident_or_keyword ::= K_CREATE_REPLICATION_SLOT */ 57, /* (62) ident_or_keyword ::= K_DROP_REPLICATION_SLOT */ 57, /* (63) ident_or_keyword ::= K_ALTER_REPLICATION_SLOT */ 57, /* (64) ident_or_keyword ::= K_TIMELINE_HISTORY */ 57, /* (65) ident_or_keyword ::= K_WAIT */ 57, /* (66) ident_or_keyword ::= K_TIMELINE */ 57, /* (67) ident_or_keyword ::= K_PHYSICAL */ 57, /* (68) ident_or_keyword ::= K_LOGICAL */ 57, /* (69) ident_or_keyword ::= K_SLOT */ 57, /* (70) ident_or_keyword ::= K_RESERVE_WAL */ 57, /* (71) ident_or_keyword ::= K_TEMPORARY */ 57, /* (72) ident_or_keyword ::= K_TWO_PHASE */ 57, /* (73) ident_or_keyword ::= K_EXPORT_SNAPSHOT */ 57, /* (74) ident_or_keyword ::= K_NOEXPORT_SNAPSHOT */ 57, /* (75) ident_or_keyword ::= K_USE_SNAPSHOT */ 57, /* (76) ident_or_keyword ::= K_UPLOAD_MANIFEST */ 58, /* (77) opt_semicolon ::= SEMI */ 58, /* (78) opt_semicolon ::= */ 59, /* (79) opt_physical ::= K_PHYSICAL */ 59, /* (80) opt_physical ::= */ }; /* 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[] = { -2, /* (0) firstcmd ::= command opt_semicolon */ -1, /* (1) command ::= identify_system */ -1, /* (2) command ::= base_backup */ -1, /* (3) command ::= start_replication */ -1, /* (4) command ::= start_logical_replication */ -1, /* (5) command ::= create_replication_slot */ -1, /* (6) command ::= drop_replication_slot */ -1, /* (7) command ::= alter_replication_slot */ -1, /* (8) command ::= read_replication_slot */ -1, /* (9) command ::= timeline_history */ -1, /* (10) command ::= show */ -1, /* (11) command ::= upload_manifest */ -1, /* (12) identify_system ::= K_IDENTIFY_SYSTEM */ -2, /* (13) read_replication_slot ::= K_READ_REPLICATION_SLOT var_name */ -2, /* (14) show ::= K_SHOW var_name */ -1, /* (15) var_name ::= IDENT */ -3, /* (16) var_name ::= var_name DOT IDENT */ -4, /* (17) base_backup ::= K_BASE_BACKUP LPAREN generic_option_list RPAREN */ -1, /* (18) base_backup ::= K_BASE_BACKUP */ -5, /* (19) create_replication_slot ::= K_CREATE_REPLICATION_SLOT IDENT opt_temporary K_PHYSICAL create_slot_options */ -6, /* (20) create_replication_slot ::= K_CREATE_REPLICATION_SLOT IDENT opt_temporary K_LOGICAL IDENT create_slot_options */ -3, /* (21) create_slot_options ::= LPAREN generic_option_list RPAREN */ -1, /* (22) create_slot_options ::= create_slot_legacy_opt_list */ -2, /* (23) create_slot_legacy_opt_list ::= create_slot_legacy_opt_list create_slot_legacy_opt */ 0, /* (24) create_slot_legacy_opt_list ::= */ -1, /* (25) create_slot_legacy_opt ::= K_EXPORT_SNAPSHOT */ -1, /* (26) create_slot_legacy_opt ::= K_NOEXPORT_SNAPSHOT */ -1, /* (27) create_slot_legacy_opt ::= K_USE_SNAPSHOT */ -1, /* (28) create_slot_legacy_opt ::= K_RESERVE_WAL */ -1, /* (29) create_slot_legacy_opt ::= K_TWO_PHASE */ -2, /* (30) drop_replication_slot ::= K_DROP_REPLICATION_SLOT IDENT */ -3, /* (31) drop_replication_slot ::= K_DROP_REPLICATION_SLOT IDENT K_WAIT */ -5, /* (32) alter_replication_slot ::= K_ALTER_REPLICATION_SLOT IDENT LPAREN generic_option_list RPAREN */ -5, /* (33) start_replication ::= K_START_REPLICATION opt_slot opt_physical RECPTR opt_timeline */ -6, /* (34) start_logical_replication ::= K_START_REPLICATION K_SLOT IDENT K_LOGICAL RECPTR plugin_options */ -2, /* (35) timeline_history ::= K_TIMELINE_HISTORY UCONST */ -1, /* (36) upload_manifest ::= K_UPLOAD_MANIFEST */ -1, /* (37) opt_temporary ::= K_TEMPORARY */ 0, /* (38) opt_temporary ::= */ -2, /* (39) opt_slot ::= K_SLOT IDENT */ 0, /* (40) opt_slot ::= */ -2, /* (41) opt_timeline ::= K_TIMELINE UCONST */ 0, /* (42) opt_timeline ::= */ -3, /* (43) plugin_options ::= LPAREN plugin_opt_list RPAREN */ 0, /* (44) plugin_options ::= */ -1, /* (45) plugin_opt_list ::= plugin_opt_elem */ -3, /* (46) plugin_opt_list ::= plugin_opt_list COMMA plugin_opt_elem */ -2, /* (47) plugin_opt_elem ::= IDENT plugin_opt_arg */ -1, /* (48) plugin_opt_arg ::= SCONST */ 0, /* (49) plugin_opt_arg ::= */ -3, /* (50) generic_option_list ::= generic_option_list COMMA generic_option */ -1, /* (51) generic_option_list ::= generic_option */ -1, /* (52) generic_option ::= ident_or_keyword */ -2, /* (53) generic_option ::= ident_or_keyword IDENT */ -2, /* (54) generic_option ::= ident_or_keyword SCONST */ -2, /* (55) generic_option ::= ident_or_keyword UCONST */ -1, /* (56) ident_or_keyword ::= IDENT */ -1, /* (57) ident_or_keyword ::= K_BASE_BACKUP */ -1, /* (58) ident_or_keyword ::= K_IDENTIFY_SYSTEM */ -1, /* (59) ident_or_keyword ::= K_SHOW */ -1, /* (60) ident_or_keyword ::= K_START_REPLICATION */ -1, /* (61) ident_or_keyword ::= K_CREATE_REPLICATION_SLOT */ -1, /* (62) ident_or_keyword ::= K_DROP_REPLICATION_SLOT */ -1, /* (63) ident_or_keyword ::= K_ALTER_REPLICATION_SLOT */ -1, /* (64) ident_or_keyword ::= K_TIMELINE_HISTORY */ -1, /* (65) ident_or_keyword ::= K_WAIT */ -1, /* (66) ident_or_keyword ::= K_TIMELINE */ -1, /* (67) ident_or_keyword ::= K_PHYSICAL */ -1, /* (68) ident_or_keyword ::= K_LOGICAL */ -1, /* (69) ident_or_keyword ::= K_SLOT */ -1, /* (70) ident_or_keyword ::= K_RESERVE_WAL */ -1, /* (71) ident_or_keyword ::= K_TEMPORARY */ -1, /* (72) ident_or_keyword ::= K_TWO_PHASE */ -1, /* (73) ident_or_keyword ::= K_EXPORT_SNAPSHOT */ -1, /* (74) ident_or_keyword ::= K_NOEXPORT_SNAPSHOT */ -1, /* (75) ident_or_keyword ::= K_USE_SNAPSHOT */ -1, /* (76) ident_or_keyword ::= K_UPLOAD_MANIFEST */ -1, /* (77) opt_semicolon ::= SEMI */ 0, /* (78) opt_semicolon ::= */ -1, /* (79) opt_physical ::= K_PHYSICAL */ 0, /* (80) opt_physical ::= */ }; 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 */ replTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ replCTX_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 */ replARG_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: /* firstcmd ::= command opt_semicolon */ #line 136 "repl_gram.lime" { yylhsminor.yy25 = yymsp[-1].minor.yy25; pstate->result = yymsp[-1].minor.yy25; } #line 1216 "repl_gram.c" yymsp[-1].minor.yy25 = yylhsminor.yy25; break; case 1: /* command ::= identify_system */ case 2: /* command ::= base_backup */ yytestcase(yyruleno==2); case 3: /* command ::= start_replication */ yytestcase(yyruleno==3); case 4: /* command ::= start_logical_replication */ yytestcase(yyruleno==4); case 5: /* command ::= create_replication_slot */ yytestcase(yyruleno==5); case 6: /* command ::= drop_replication_slot */ yytestcase(yyruleno==6); case 7: /* command ::= alter_replication_slot */ yytestcase(yyruleno==7); case 8: /* command ::= read_replication_slot */ yytestcase(yyruleno==8); case 9: /* command ::= timeline_history */ yytestcase(yyruleno==9); case 10: /* command ::= show */ yytestcase(yyruleno==10); case 11: /* command ::= upload_manifest */ yytestcase(yyruleno==11); #line 147 "repl_gram.lime" { yylhsminor.yy25 = yymsp[0].minor.yy25; } #line 1232 "repl_gram.c" yymsp[0].minor.yy25 = yylhsminor.yy25; break; case 12: /* identify_system ::= K_IDENTIFY_SYSTEM */ #line 162 "repl_gram.lime" { yymsp[0].minor.yy25 = repl_make_command(pstate, REPL_CMD_IDENTIFY_SYSTEM); } #line 1240 "repl_gram.c" break; case 13: /* read_replication_slot ::= K_READ_REPLICATION_SLOT var_name */ #line 169 "repl_gram.lime" { yymsp[-1].minor.yy25 = repl_make_command(pstate, REPL_CMD_READ_REPLICATION_SLOT); yymsp[-1].minor.yy25->u.read_slot.slotname = yymsp[0].minor.yy73; } #line 1248 "repl_gram.c" break; case 14: /* show ::= K_SHOW var_name */ #line 177 "repl_gram.lime" { yymsp[-1].minor.yy25 = repl_make_command(pstate, REPL_CMD_SHOW); yymsp[-1].minor.yy25->u.show.varname = yymsp[0].minor.yy73; } #line 1256 "repl_gram.c" break; case 15: /* var_name ::= IDENT */ #line 183 "repl_gram.lime" { yylhsminor.yy73 = yymsp[0].minor.yy0.str; } #line 1263 "repl_gram.c" yymsp[0].minor.yy73 = yylhsminor.yy73; break; case 16: /* var_name ::= var_name DOT IDENT */ #line 187 "repl_gram.lime" { yylhsminor.yy73 = repl_psprintf(pstate, "%s.%s", yymsp[-2].minor.yy73, yymsp[0].minor.yy0.str); free(yymsp[-2].minor.yy73); free(yymsp[0].minor.yy0.str); } #line 1273 "repl_gram.c" yymsp[-2].minor.yy73 = yylhsminor.yy73; break; case 17: /* base_backup ::= K_BASE_BACKUP LPAREN generic_option_list RPAREN */ #line 196 "repl_gram.lime" { yymsp[-3].minor.yy25 = repl_make_command(pstate, REPL_CMD_BASE_BACKUP); yymsp[-3].minor.yy25->u.base_backup.options = yymsp[-1].minor.yy63; } #line 1282 "repl_gram.c" break; case 18: /* base_backup ::= K_BASE_BACKUP */ #line 201 "repl_gram.lime" { yymsp[0].minor.yy25 = repl_make_command(pstate, REPL_CMD_BASE_BACKUP); yymsp[0].minor.yy25->u.base_backup.options = NULL; } #line 1290 "repl_gram.c" break; case 19: /* create_replication_slot ::= K_CREATE_REPLICATION_SLOT IDENT opt_temporary K_PHYSICAL create_slot_options */ #line 210 "repl_gram.lime" { yymsp[-4].minor.yy25 = repl_make_command(pstate, REPL_CMD_CREATE_REPLICATION_SLOT); yymsp[-4].minor.yy25->u.create_slot.kind = REPLICATION_KIND_PHYSICAL; yymsp[-4].minor.yy25->u.create_slot.slotname = yymsp[-3].minor.yy0.str; yymsp[-4].minor.yy25->u.create_slot.temporary = yymsp[-2].minor.yy17; yymsp[-4].minor.yy25->u.create_slot.options = yymsp[0].minor.yy63; } #line 1301 "repl_gram.c" break; case 20: /* create_replication_slot ::= K_CREATE_REPLICATION_SLOT IDENT opt_temporary K_LOGICAL IDENT create_slot_options */ #line 218 "repl_gram.lime" { yymsp[-5].minor.yy25 = repl_make_command(pstate, REPL_CMD_CREATE_REPLICATION_SLOT); yymsp[-5].minor.yy25->u.create_slot.kind = REPLICATION_KIND_LOGICAL; yymsp[-5].minor.yy25->u.create_slot.slotname = yymsp[-4].minor.yy0.str; yymsp[-5].minor.yy25->u.create_slot.temporary = yymsp[-3].minor.yy17; yymsp[-5].minor.yy25->u.create_slot.plugin = yymsp[-1].minor.yy0.str; yymsp[-5].minor.yy25->u.create_slot.options = yymsp[0].minor.yy63; } #line 1313 "repl_gram.c" break; case 21: /* create_slot_options ::= LPAREN generic_option_list RPAREN */ #line 227 "repl_gram.lime" { yymsp[-2].minor.yy63 = yymsp[-1].minor.yy63; } #line 1320 "repl_gram.c" break; case 22: /* create_slot_options ::= create_slot_legacy_opt_list */ #line 231 "repl_gram.lime" { yylhsminor.yy63 = yymsp[0].minor.yy63; } #line 1327 "repl_gram.c" yymsp[0].minor.yy63 = yylhsminor.yy63; break; case 23: /* create_slot_legacy_opt_list ::= create_slot_legacy_opt_list create_slot_legacy_opt */ #line 235 "repl_gram.lime" { yylhsminor.yy63 = repl_option_list_append(pstate, yymsp[-1].minor.yy63, yymsp[0].minor.yy64); } #line 1335 "repl_gram.c" yymsp[-1].minor.yy63 = yylhsminor.yy63; break; case 24: /* create_slot_legacy_opt_list ::= */ #line 239 "repl_gram.lime" { yymsp[1].minor.yy63 = NULL; } #line 1343 "repl_gram.c" break; case 25: /* create_slot_legacy_opt ::= K_EXPORT_SNAPSHOT */ #line 243 "repl_gram.lime" { yymsp[0].minor.yy64 = repl_make_defelem_str(pstate, "snapshot", "export"); } #line 1350 "repl_gram.c" break; case 26: /* create_slot_legacy_opt ::= K_NOEXPORT_SNAPSHOT */ #line 247 "repl_gram.lime" { yymsp[0].minor.yy64 = repl_make_defelem_str(pstate, "snapshot", "nothing"); } #line 1357 "repl_gram.c" break; case 27: /* create_slot_legacy_opt ::= K_USE_SNAPSHOT */ #line 251 "repl_gram.lime" { yymsp[0].minor.yy64 = repl_make_defelem_str(pstate, "snapshot", "use"); } #line 1364 "repl_gram.c" break; case 28: /* create_slot_legacy_opt ::= K_RESERVE_WAL */ #line 255 "repl_gram.lime" { yymsp[0].minor.yy64 = repl_make_defelem_bool(pstate, "reserve_wal", true); } #line 1371 "repl_gram.c" break; case 29: /* create_slot_legacy_opt ::= K_TWO_PHASE */ #line 259 "repl_gram.lime" { yymsp[0].minor.yy64 = repl_make_defelem_bool(pstate, "two_phase", true); } #line 1378 "repl_gram.c" break; case 30: /* drop_replication_slot ::= K_DROP_REPLICATION_SLOT IDENT */ #line 266 "repl_gram.lime" { yymsp[-1].minor.yy25 = repl_make_command(pstate, REPL_CMD_DROP_REPLICATION_SLOT); yymsp[-1].minor.yy25->u.drop_slot.slotname = yymsp[0].minor.yy0.str; yymsp[-1].minor.yy25->u.drop_slot.wait = false; } #line 1387 "repl_gram.c" break; case 31: /* drop_replication_slot ::= K_DROP_REPLICATION_SLOT IDENT K_WAIT */ #line 272 "repl_gram.lime" { yymsp[-2].minor.yy25 = repl_make_command(pstate, REPL_CMD_DROP_REPLICATION_SLOT); yymsp[-2].minor.yy25->u.drop_slot.slotname = yymsp[-1].minor.yy0.str; yymsp[-2].minor.yy25->u.drop_slot.wait = true; } #line 1396 "repl_gram.c" break; case 32: /* alter_replication_slot ::= K_ALTER_REPLICATION_SLOT IDENT LPAREN generic_option_list RPAREN */ #line 281 "repl_gram.lime" { yymsp[-4].minor.yy25 = repl_make_command(pstate, REPL_CMD_ALTER_REPLICATION_SLOT); yymsp[-4].minor.yy25->u.alter_slot.slotname = yymsp[-3].minor.yy0.str; yymsp[-4].minor.yy25->u.alter_slot.options = yymsp[-1].minor.yy63; } #line 1405 "repl_gram.c" break; case 33: /* start_replication ::= K_START_REPLICATION opt_slot opt_physical RECPTR opt_timeline */ #line 290 "repl_gram.lime" { yymsp[-4].minor.yy25 = repl_make_command(pstate, REPL_CMD_START_REPLICATION); yymsp[-4].minor.yy25->u.start_repl.kind = REPLICATION_KIND_PHYSICAL; yymsp[-4].minor.yy25->u.start_repl.slotname = yymsp[-3].minor.yy73; yymsp[-4].minor.yy25->u.start_repl.startpoint = yymsp[-1].minor.yy0.recptr; yymsp[-4].minor.yy25->u.start_repl.timeline = yymsp[0].minor.yy110; } #line 1416 "repl_gram.c" break; case 34: /* start_logical_replication ::= K_START_REPLICATION K_SLOT IDENT K_LOGICAL RECPTR plugin_options */ #line 301 "repl_gram.lime" { yymsp[-5].minor.yy25 = repl_make_command(pstate, REPL_CMD_START_REPLICATION); yymsp[-5].minor.yy25->u.start_repl.kind = REPLICATION_KIND_LOGICAL; yymsp[-5].minor.yy25->u.start_repl.slotname = yymsp[-3].minor.yy0.str; yymsp[-5].minor.yy25->u.start_repl.startpoint = yymsp[-1].minor.yy0.recptr; yymsp[-5].minor.yy25->u.start_repl.options = yymsp[0].minor.yy63; } #line 1427 "repl_gram.c" break; case 35: /* timeline_history ::= K_TIMELINE_HISTORY UCONST */ #line 312 "repl_gram.lime" { if (yymsp[0].minor.yy0.uintval == 0) { repl_yyerror(pstate, "invalid timeline 0"); } yymsp[-1].minor.yy25 = repl_make_command(pstate, REPL_CMD_TIMELINE_HISTORY); yymsp[-1].minor.yy25->u.timeline_history.timeline = yymsp[0].minor.yy0.uintval; } #line 1438 "repl_gram.c" break; case 36: /* upload_manifest ::= K_UPLOAD_MANIFEST */ #line 323 "repl_gram.lime" { yymsp[0].minor.yy25 = repl_make_command(pstate, REPL_CMD_UPLOAD_MANIFEST); } #line 1445 "repl_gram.c" break; case 37: /* opt_temporary ::= K_TEMPORARY */ #line 333 "repl_gram.lime" { yymsp[0].minor.yy17 = true; } #line 1450 "repl_gram.c" break; case 38: /* opt_temporary ::= */ #line 334 "repl_gram.lime" { yymsp[1].minor.yy17 = false; } #line 1455 "repl_gram.c" break; case 39: /* opt_slot ::= K_SLOT IDENT */ #line 336 "repl_gram.lime" { yymsp[-1].minor.yy73 = yymsp[0].minor.yy0.str; } #line 1460 "repl_gram.c" break; case 40: /* opt_slot ::= */ case 49: /* plugin_opt_arg ::= */ yytestcase(yyruleno==49); #line 337 "repl_gram.lime" { yymsp[1].minor.yy73 = NULL; } #line 1466 "repl_gram.c" break; case 41: /* opt_timeline ::= K_TIMELINE UCONST */ #line 339 "repl_gram.lime" { if (yymsp[0].minor.yy0.uintval == 0) { repl_yyerror(pstate, "invalid timeline 0"); } yymsp[-1].minor.yy110 = yymsp[0].minor.yy0.uintval; } #line 1476 "repl_gram.c" break; case 42: /* opt_timeline ::= */ #line 345 "repl_gram.lime" { yymsp[1].minor.yy110 = 0; } #line 1481 "repl_gram.c" break; case 43: /* plugin_options ::= LPAREN plugin_opt_list RPAREN */ #line 350 "repl_gram.lime" { yymsp[-2].minor.yy63 = yymsp[-1].minor.yy63; } #line 1486 "repl_gram.c" break; case 44: /* plugin_options ::= */ #line 351 "repl_gram.lime" { yymsp[1].minor.yy63 = NULL; } #line 1491 "repl_gram.c" break; case 45: /* plugin_opt_list ::= plugin_opt_elem */ case 51: /* generic_option_list ::= generic_option */ yytestcase(yyruleno==51); #line 353 "repl_gram.lime" { yylhsminor.yy63 = repl_option_list_create(pstate, yymsp[0].minor.yy64); } #line 1499 "repl_gram.c" yymsp[0].minor.yy63 = yylhsminor.yy63; break; case 46: /* plugin_opt_list ::= plugin_opt_list COMMA plugin_opt_elem */ case 50: /* generic_option_list ::= generic_option_list COMMA generic_option */ yytestcase(yyruleno==50); #line 357 "repl_gram.lime" { yylhsminor.yy63 = repl_option_list_append(pstate, yymsp[-2].minor.yy63, yymsp[0].minor.yy64); } #line 1508 "repl_gram.c" yymsp[-2].minor.yy63 = yylhsminor.yy63; break; case 47: /* plugin_opt_elem ::= IDENT plugin_opt_arg */ #line 361 "repl_gram.lime" { if (yymsp[0].minor.yy73) { yylhsminor.yy64 = repl_make_defelem_str(pstate, yymsp[-1].minor.yy0.str, yymsp[0].minor.yy73); free(yymsp[0].minor.yy73); } else { yylhsminor.yy64 = repl_make_defelem(pstate, yymsp[-1].minor.yy0.str); } free(yymsp[-1].minor.yy0.str); } #line 1522 "repl_gram.c" yymsp[-1].minor.yy64 = yylhsminor.yy64; break; case 48: /* plugin_opt_arg ::= SCONST */ case 56: /* ident_or_keyword ::= IDENT */ yytestcase(yyruleno==56); #line 371 "repl_gram.lime" { yylhsminor.yy73 = yymsp[0].minor.yy0.str; } #line 1529 "repl_gram.c" yymsp[0].minor.yy73 = yylhsminor.yy73; break; case 52: /* generic_option ::= ident_or_keyword */ #line 385 "repl_gram.lime" { yylhsminor.yy64 = repl_make_defelem(pstate, yymsp[0].minor.yy73); free(yymsp[0].minor.yy73); } #line 1538 "repl_gram.c" yymsp[0].minor.yy64 = yylhsminor.yy64; break; case 53: /* generic_option ::= ident_or_keyword IDENT */ case 54: /* generic_option ::= ident_or_keyword SCONST */ yytestcase(yyruleno==54); #line 390 "repl_gram.lime" { yylhsminor.yy64 = repl_make_defelem_str(pstate, yymsp[-1].minor.yy73, yymsp[0].minor.yy0.str); free(yymsp[-1].minor.yy73); free(yymsp[0].minor.yy0.str); } #line 1549 "repl_gram.c" yymsp[-1].minor.yy64 = yylhsminor.yy64; break; case 55: /* generic_option ::= ident_or_keyword UCONST */ #line 402 "repl_gram.lime" { yylhsminor.yy64 = repl_make_defelem_int(pstate, yymsp[-1].minor.yy73, (int)yymsp[0].minor.yy0.uintval); free(yymsp[-1].minor.yy73); } #line 1558 "repl_gram.c" yymsp[-1].minor.yy64 = yylhsminor.yy64; break; case 57: /* ident_or_keyword ::= K_BASE_BACKUP */ #line 414 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "base_backup"); } #line 1564 "repl_gram.c" break; case 58: /* ident_or_keyword ::= K_IDENTIFY_SYSTEM */ #line 415 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "identify_system"); } #line 1569 "repl_gram.c" break; case 59: /* ident_or_keyword ::= K_SHOW */ #line 416 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "show"); } #line 1574 "repl_gram.c" break; case 60: /* ident_or_keyword ::= K_START_REPLICATION */ #line 417 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "start_replication"); } #line 1579 "repl_gram.c" break; case 61: /* ident_or_keyword ::= K_CREATE_REPLICATION_SLOT */ #line 418 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "create_replication_slot"); } #line 1584 "repl_gram.c" break; case 62: /* ident_or_keyword ::= K_DROP_REPLICATION_SLOT */ #line 419 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "drop_replication_slot"); } #line 1589 "repl_gram.c" break; case 63: /* ident_or_keyword ::= K_ALTER_REPLICATION_SLOT */ #line 420 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "alter_replication_slot"); } #line 1594 "repl_gram.c" break; case 64: /* ident_or_keyword ::= K_TIMELINE_HISTORY */ #line 421 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "timeline_history"); } #line 1599 "repl_gram.c" break; case 65: /* ident_or_keyword ::= K_WAIT */ #line 422 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "wait"); } #line 1604 "repl_gram.c" break; case 66: /* ident_or_keyword ::= K_TIMELINE */ #line 423 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "timeline"); } #line 1609 "repl_gram.c" break; case 67: /* ident_or_keyword ::= K_PHYSICAL */ #line 424 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "physical"); } #line 1614 "repl_gram.c" break; case 68: /* ident_or_keyword ::= K_LOGICAL */ #line 425 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "logical"); } #line 1619 "repl_gram.c" break; case 69: /* ident_or_keyword ::= K_SLOT */ #line 426 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "slot"); } #line 1624 "repl_gram.c" break; case 70: /* ident_or_keyword ::= K_RESERVE_WAL */ #line 427 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "reserve_wal"); } #line 1629 "repl_gram.c" break; case 71: /* ident_or_keyword ::= K_TEMPORARY */ #line 428 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "temporary"); } #line 1634 "repl_gram.c" break; case 72: /* ident_or_keyword ::= K_TWO_PHASE */ #line 429 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "two_phase"); } #line 1639 "repl_gram.c" break; case 73: /* ident_or_keyword ::= K_EXPORT_SNAPSHOT */ #line 430 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "export_snapshot"); } #line 1644 "repl_gram.c" break; case 74: /* ident_or_keyword ::= K_NOEXPORT_SNAPSHOT */ #line 431 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "noexport_snapshot"); } #line 1649 "repl_gram.c" break; case 75: /* ident_or_keyword ::= K_USE_SNAPSHOT */ #line 432 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "use_snapshot"); } #line 1654 "repl_gram.c" break; case 76: /* ident_or_keyword ::= K_UPLOAD_MANIFEST */ #line 433 "repl_gram.lime" { yymsp[0].minor.yy73 = repl_pstrdup(pstate, "upload_manifest"); } #line 1659 "repl_gram.c" break; default: /* (77) opt_semicolon ::= SEMI */ yytestcase(yyruleno==77); /* (78) opt_semicolon ::= */ yytestcase(yyruleno==78); /* (79) opt_physical ::= K_PHYSICAL */ yytestcase(yyruleno==79); /* (80) opt_physical ::= */ yytestcase(yyruleno==80); 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 */ ){ replARG_FETCH replCTX_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 49 "repl_gram.lime" repl_yyerror(pstate, "replication command parse failure"); #line 1710 "repl_gram.c" /************ End %parse_failure code *****************************************/ replARG_STORE /* Suppress warning about unused %extra_argument variable */ replCTX_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 */ replTOKENTYPE yyminor /* The minor type of the error token */ ){ replARG_FETCH replCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ #line 45 "repl_gram.lime" repl_yyerror(pstate, "syntax error in replication command"); #line 1732 "repl_gram.c" /************ End %syntax_error code ******************************************/ replARG_STORE /* Suppress warning about unused %extra_argument variable */ replCTX_STORE } /* ** The following is executed when the parser accepts */ static void yy_accept( yyParser *yypParser /* The parser */ ){ replARG_FETCH replCTX_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 *******************************************/ replARG_STORE /* Suppress warning about unused %extra_argument variable */ replCTX_STORE } /* The main parser program. ** The first argument is a pointer to a structure obtained from ** "replAlloc" 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 repl( void *yyp, /* The parser */ int yymajor, /* The major token code number */ replTOKENTYPE yyminor /* The value for the token */ replARG_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 */ replCTX_FETCH replARG_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 replCTX_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 replFallback(int iToken){ #ifdef YYFALLBACK assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); return yyFallback[iToken]; #else (void)iToken; return 0; #endif }