1 /* A Bison parser, made by GNU Bison 3.3.2.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
6    Inc.
7 
8    This program is free software: you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation, either version 3 of the License, or
11    (at your option) any later version.
12 
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20 
21 /* As a special exception, you may create a larger work that contains
22    part or all of the Bison parser skeleton and distribute that work
23    under terms of your choice, so long as that work isn't itself a
24    parser generator using the skeleton or a modified version thereof
25    as a parser skeleton.  Alternatively, if you modify or redistribute
26    the parser skeleton itself, you may (at your option) remove this
27    special exception, which will cause the skeleton and the resulting
28    Bison output files to be licensed under the GNU General Public
29    License without this special exception.
30 
31    This special exception was added by the Free Software Foundation in
32    version 2.2 of Bison.  */
33 
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35    simplifying the original so-called "semantic" parser.  */
36 
37 /* All symbols defined below should begin with yy or YY, to avoid
38    infringing on user name space.  This should be done even for local
39    variables, as they might otherwise be expanded by user macros.
40    There are some unavoidable exceptions within include files to
41    define necessary library symbols; they are noted "INFRINGES ON
42    USER NAME SPACE" below.  */
43 
44 /* Undocumented macros, especially those whose name start with YY_,
45    are private implementation details.  Do not rely on them.  */
46 
47 /* Identify Bison output.  */
48 #define YYBISON 1
49 
50 /* Bison version.  */
51 #define YYBISON_VERSION "3.3.2"
52 
53 /* Skeleton name.  */
54 #define YYSKELETON_NAME "yacc.c"
55 
56 /* Pure parsers.  */
57 #define YYPURE 0
58 
59 /* Push parsers.  */
60 #define YYPUSH 0
61 
62 /* Pull parsers.  */
63 #define YYPULL 1
64 
65 
66 /* Substitute the variable and function names.  */
67 #define yyparse         replication_yyparse
68 #define yylex           replication_yylex
69 #define yyerror         replication_yyerror
70 #define yydebug         replication_yydebug
71 #define yynerrs         replication_yynerrs
72 
73 #define yylval          replication_yylval
74 #define yychar          replication_yychar
75 
76 /* First part of user prologue.  */
77 #line 1 "repl_gram.y" /* yacc.c:337  */
78 
79 /*-------------------------------------------------------------------------
80  *
81  * repl_gram.y				- Parser for the replication commands
82  *
83  * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
84  * Portions Copyright (c) 1994, Regents of the University of California
85  *
86  *
87  * IDENTIFICATION
88  *	  src/backend/replication/repl_gram.y
89  *
90  *-------------------------------------------------------------------------
91  */
92 
93 #include "postgres.h"
94 
95 #include "access/xlogdefs.h"
96 #include "nodes/makefuncs.h"
97 #include "nodes/replnodes.h"
98 #include "replication/walsender.h"
99 #include "replication/walsender_private.h"
100 
101 
102 /* Result of the parsing is returned here */
103 Node *replication_parse_result;
104 
105 static SQLCmd *make_sqlcmd(void);
106 
107 
108 /*
109  * Bison doesn't allocate anything that needs to live across parser calls,
110  * so we can easily have it use palloc instead of malloc.  This prevents
111  * memory leaks if we error out during parsing.  Note this only works with
112  * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
113  * if possible, so there's not really much problem anyhow, at least if
114  * you're building with gcc.
115  */
116 #define YYMALLOC palloc
117 #define YYFREE   pfree
118 
119 
120 #line 121 "repl_gram.c" /* yacc.c:337  */
121 # ifndef YY_NULLPTR
122 #  if defined __cplusplus
123 #   if 201103L <= __cplusplus
124 #    define YY_NULLPTR nullptr
125 #   else
126 #    define YY_NULLPTR 0
127 #   endif
128 #  else
129 #   define YY_NULLPTR ((void*)0)
130 #  endif
131 # endif
132 
133 /* Enabling verbose error messages.  */
134 #ifdef YYERROR_VERBOSE
135 # undef YYERROR_VERBOSE
136 # define YYERROR_VERBOSE 1
137 #else
138 # define YYERROR_VERBOSE 0
139 #endif
140 
141 
142 /* Debug traces.  */
143 #ifndef YYDEBUG
144 # define YYDEBUG 0
145 #endif
146 #if YYDEBUG
147 extern int replication_yydebug;
148 #endif
149 
150 /* Token type.  */
151 #ifndef YYTOKENTYPE
152 # define YYTOKENTYPE
153   enum yytokentype
154   {
155     SCONST = 258,
156     IDENT = 259,
157     UCONST = 260,
158     RECPTR = 261,
159     T_WORD = 262,
160     K_BASE_BACKUP = 263,
161     K_IDENTIFY_SYSTEM = 264,
162     K_SHOW = 265,
163     K_START_REPLICATION = 266,
164     K_CREATE_REPLICATION_SLOT = 267,
165     K_DROP_REPLICATION_SLOT = 268,
166     K_TIMELINE_HISTORY = 269,
167     K_LABEL = 270,
168     K_PROGRESS = 271,
169     K_FAST = 272,
170     K_WAIT = 273,
171     K_NOWAIT = 274,
172     K_MAX_RATE = 275,
173     K_WAL = 276,
174     K_TABLESPACE_MAP = 277,
175     K_NOVERIFY_CHECKSUMS = 278,
176     K_TIMELINE = 279,
177     K_PHYSICAL = 280,
178     K_LOGICAL = 281,
179     K_SLOT = 282,
180     K_RESERVE_WAL = 283,
181     K_TEMPORARY = 284,
182     K_EXPORT_SNAPSHOT = 285,
183     K_NOEXPORT_SNAPSHOT = 286,
184     K_USE_SNAPSHOT = 287
185   };
186 #endif
187 
188 /* Value type.  */
189 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
190 
191 union YYSTYPE
192 {
193 #line 47 "repl_gram.y" /* yacc.c:352  */
194 
195 		char					*str;
196 		bool					boolval;
197 		uint32					uintval;
198 
199 		XLogRecPtr				recptr;
200 		Node					*node;
201 		List					*list;
202 		DefElem					*defelt;
203 
204 #line 205 "repl_gram.c" /* yacc.c:352  */
205 };
206 
207 typedef union YYSTYPE YYSTYPE;
208 # define YYSTYPE_IS_TRIVIAL 1
209 # define YYSTYPE_IS_DECLARED 1
210 #endif
211 
212 
213 extern YYSTYPE replication_yylval;
214 
215 int replication_yyparse (void);
216 
217 
218 
219 
220 
221 #ifdef short
222 # undef short
223 #endif
224 
225 #ifdef YYTYPE_UINT8
226 typedef YYTYPE_UINT8 yytype_uint8;
227 #else
228 typedef unsigned char yytype_uint8;
229 #endif
230 
231 #ifdef YYTYPE_INT8
232 typedef YYTYPE_INT8 yytype_int8;
233 #else
234 typedef signed char yytype_int8;
235 #endif
236 
237 #ifdef YYTYPE_UINT16
238 typedef YYTYPE_UINT16 yytype_uint16;
239 #else
240 typedef unsigned short yytype_uint16;
241 #endif
242 
243 #ifdef YYTYPE_INT16
244 typedef YYTYPE_INT16 yytype_int16;
245 #else
246 typedef short yytype_int16;
247 #endif
248 
249 #ifndef YYSIZE_T
250 # ifdef __SIZE_TYPE__
251 #  define YYSIZE_T __SIZE_TYPE__
252 # elif defined size_t
253 #  define YYSIZE_T size_t
254 # elif ! defined YYSIZE_T
255 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
256 #  define YYSIZE_T size_t
257 # else
258 #  define YYSIZE_T unsigned
259 # endif
260 #endif
261 
262 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
263 
264 #ifndef YY_
265 # if defined YYENABLE_NLS && YYENABLE_NLS
266 #  if ENABLE_NLS
267 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
268 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
269 #  endif
270 # endif
271 # ifndef YY_
272 #  define YY_(Msgid) Msgid
273 # endif
274 #endif
275 
276 #ifndef YY_ATTRIBUTE
277 # if (defined __GNUC__                                               \
278       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
279      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
280 #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
281 # else
282 #  define YY_ATTRIBUTE(Spec) /* empty */
283 # endif
284 #endif
285 
286 #ifndef YY_ATTRIBUTE_PURE
287 # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
288 #endif
289 
290 #ifndef YY_ATTRIBUTE_UNUSED
291 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
292 #endif
293 
294 /* Suppress unused-variable warnings by "using" E.  */
295 #if ! defined lint || defined __GNUC__
296 # define YYUSE(E) ((void) (E))
297 #else
298 # define YYUSE(E) /* empty */
299 #endif
300 
301 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
302 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
303 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
304     _Pragma ("GCC diagnostic push") \
305     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
306     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
307 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
308     _Pragma ("GCC diagnostic pop")
309 #else
310 # define YY_INITIAL_VALUE(Value) Value
311 #endif
312 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
313 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
314 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
315 #endif
316 #ifndef YY_INITIAL_VALUE
317 # define YY_INITIAL_VALUE(Value) /* Nothing. */
318 #endif
319 
320 
321 #if ! defined yyoverflow || YYERROR_VERBOSE
322 
323 /* The parser invokes alloca or malloc; define the necessary symbols.  */
324 
325 # ifdef YYSTACK_USE_ALLOCA
326 #  if YYSTACK_USE_ALLOCA
327 #   ifdef __GNUC__
328 #    define YYSTACK_ALLOC __builtin_alloca
329 #   elif defined __BUILTIN_VA_ARG_INCR
330 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
331 #   elif defined _AIX
332 #    define YYSTACK_ALLOC __alloca
333 #   elif defined _MSC_VER
334 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
335 #    define alloca _alloca
336 #   else
337 #    define YYSTACK_ALLOC alloca
338 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
339 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
340       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
341 #     ifndef EXIT_SUCCESS
342 #      define EXIT_SUCCESS 0
343 #     endif
344 #    endif
345 #   endif
346 #  endif
347 # endif
348 
349 # ifdef YYSTACK_ALLOC
350    /* Pacify GCC's 'empty if-body' warning.  */
351 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
352 #  ifndef YYSTACK_ALLOC_MAXIMUM
353     /* The OS might guarantee only one guard page at the bottom of the stack,
354        and a page size can be as small as 4096 bytes.  So we cannot safely
355        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
356        to allow for a few compiler-allocated temporary stack slots.  */
357 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
358 #  endif
359 # else
360 #  define YYSTACK_ALLOC YYMALLOC
361 #  define YYSTACK_FREE YYFREE
362 #  ifndef YYSTACK_ALLOC_MAXIMUM
363 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
364 #  endif
365 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
366        && ! ((defined YYMALLOC || defined malloc) \
367              && (defined YYFREE || defined free)))
368 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
369 #   ifndef EXIT_SUCCESS
370 #    define EXIT_SUCCESS 0
371 #   endif
372 #  endif
373 #  ifndef YYMALLOC
374 #   define YYMALLOC malloc
375 #   if ! defined malloc && ! defined EXIT_SUCCESS
376 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
377 #   endif
378 #  endif
379 #  ifndef YYFREE
380 #   define YYFREE free
381 #   if ! defined free && ! defined EXIT_SUCCESS
382 void free (void *); /* INFRINGES ON USER NAME SPACE */
383 #   endif
384 #  endif
385 # endif
386 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
387 
388 
389 #if (! defined yyoverflow \
390      && (! defined __cplusplus \
391          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
392 
393 /* A type that is properly aligned for any stack member.  */
394 union yyalloc
395 {
396   yytype_int16 yyss_alloc;
397   YYSTYPE yyvs_alloc;
398 };
399 
400 /* The size of the maximum gap between one aligned stack and the next.  */
401 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
402 
403 /* The size of an array large to enough to hold all stacks, each with
404    N elements.  */
405 # define YYSTACK_BYTES(N) \
406      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
407       + YYSTACK_GAP_MAXIMUM)
408 
409 # define YYCOPY_NEEDED 1
410 
411 /* Relocate STACK from its old location to the new one.  The
412    local variables YYSIZE and YYSTACKSIZE give the old and new number of
413    elements in the stack, and YYPTR gives the new location of the
414    stack.  Advance YYPTR to a properly aligned location for the next
415    stack.  */
416 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
417     do                                                                  \
418       {                                                                 \
419         YYSIZE_T yynewbytes;                                            \
420         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
421         Stack = &yyptr->Stack_alloc;                                    \
422         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
423         yyptr += yynewbytes / sizeof (*yyptr);                          \
424       }                                                                 \
425     while (0)
426 
427 #endif
428 
429 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
430 /* Copy COUNT objects from SRC to DST.  The source and destination do
431    not overlap.  */
432 # ifndef YYCOPY
433 #  if defined __GNUC__ && 1 < __GNUC__
434 #   define YYCOPY(Dst, Src, Count) \
435       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
436 #  else
437 #   define YYCOPY(Dst, Src, Count)              \
438       do                                        \
439         {                                       \
440           YYSIZE_T yyi;                         \
441           for (yyi = 0; yyi < (Count); yyi++)   \
442             (Dst)[yyi] = (Src)[yyi];            \
443         }                                       \
444       while (0)
445 #  endif
446 # endif
447 #endif /* !YYCOPY_NEEDED */
448 
449 /* YYFINAL -- State number of the termination state.  */
450 #define YYFINAL  28
451 /* YYLAST -- Last index in YYTABLE.  */
452 #define YYLAST   49
453 
454 /* YYNTOKENS -- Number of terminals.  */
455 #define YYNTOKENS  38
456 /* YYNNTS -- Number of nonterminals.  */
457 #define YYNNTS  26
458 /* YYNRULES -- Number of rules.  */
459 #define YYNRULES  57
460 /* YYNSTATES -- Number of states.  */
461 #define YYNSTATES  76
462 
463 #define YYUNDEFTOK  2
464 #define YYMAXUTOK   287
465 
466 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
467    as returned by yylex, with out-of-bounds checking.  */
468 #define YYTRANSLATE(YYX)                                                \
469   ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
470 
471 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
472    as returned by yylex.  */
473 static const yytype_uint8 yytranslate[] =
474 {
475        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
476        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
477        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
478        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
479       35,    36,     2,     2,    37,     2,    34,     2,     2,     2,
480        2,     2,     2,     2,     2,     2,     2,     2,     2,    33,
481        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
482        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
483        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
484        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
485        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
486        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
487        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
488        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
489        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
490        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
491        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
492        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
493        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
494        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
495        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
496        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
497        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
498        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
499        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
500        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
501        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
502       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
503       25,    26,    27,    28,    29,    30,    31,    32
504 };
505 
506 #if YYDEBUG
507   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
508 static const yytype_uint16 yyrline[] =
509 {
510        0,   108,   108,   114,   115,   119,   120,   121,   122,   123,
511      124,   125,   126,   127,   134,   144,   151,   152,   161,   170,
512      173,   177,   182,   187,   192,   197,   202,   207,   212,   221,
513      232,   246,   249,   253,   258,   263,   268,   277,   285,   299,
514      314,   329,   346,   347,   351,   352,   356,   359,   363,   371,
515      376,   377,   381,   385,   392,   399,   400,   404
516 };
517 #endif
518 
519 #if YYDEBUG || YYERROR_VERBOSE || 0
520 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
521    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
522 static const char *const yytname[] =
523 {
524   "$end", "error", "$undefined", "SCONST", "IDENT", "UCONST", "RECPTR",
525   "T_WORD", "K_BASE_BACKUP", "K_IDENTIFY_SYSTEM", "K_SHOW",
526   "K_START_REPLICATION", "K_CREATE_REPLICATION_SLOT",
527   "K_DROP_REPLICATION_SLOT", "K_TIMELINE_HISTORY", "K_LABEL", "K_PROGRESS",
528   "K_FAST", "K_WAIT", "K_NOWAIT", "K_MAX_RATE", "K_WAL",
529   "K_TABLESPACE_MAP", "K_NOVERIFY_CHECKSUMS", "K_TIMELINE", "K_PHYSICAL",
530   "K_LOGICAL", "K_SLOT", "K_RESERVE_WAL", "K_TEMPORARY",
531   "K_EXPORT_SNAPSHOT", "K_NOEXPORT_SNAPSHOT", "K_USE_SNAPSHOT", "';'",
532   "'.'", "'('", "')'", "','", "$accept", "firstcmd", "opt_semicolon",
533   "command", "identify_system", "show", "var_name", "base_backup",
534   "base_backup_opt_list", "base_backup_opt", "create_replication_slot",
535   "create_slot_opt_list", "create_slot_opt", "drop_replication_slot",
536   "start_replication", "start_logical_replication", "timeline_history",
537   "opt_physical", "opt_temporary", "opt_slot", "opt_timeline",
538   "plugin_options", "plugin_opt_list", "plugin_opt_elem", "plugin_opt_arg",
539   "sql_cmd", YY_NULLPTR
540 };
541 #endif
542 
543 # ifdef YYPRINT
544 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
545    (internal) symbol number NUM (which must be that of a token).  */
546 static const yytype_uint16 yytoknum[] =
547 {
548        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
549      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
550      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
551      285,   286,   287,    59,    46,    40,    41,    44
552 };
553 # endif
554 
555 #define YYPACT_NINF -27
556 
557 #define yypact_value_is_default(Yystate) \
558   (!!((Yystate) == (-27)))
559 
560 #define YYTABLE_NINF -1
561 
562 #define yytable_value_is_error(Yytable_value) \
563   0
564 
565   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
566      STATE-NUM.  */
567 static const yytype_int8 yypact[] =
568 {
569       -4,   -27,   -27,   -27,    -1,   -16,    11,    18,    23,    29,
570       -2,   -27,   -27,   -27,   -27,   -27,   -27,   -27,   -27,   -27,
571       -3,   -27,     0,    26,     7,     4,    17,   -27,   -27,   -27,
572      -27,    33,   -27,   -27,   -27,    32,   -27,   -27,   -27,   -27,
573       34,    13,   -27,    35,   -27,   -24,   -27,   -27,   -27,   -27,
574       36,    16,   -27,    39,     9,    40,   -27,    -7,   -27,    42,
575      -27,   -27,   -27,   -27,   -27,   -27,   -27,    -7,    44,   -10,
576      -27,   -27,   -27,   -27,    42,   -27
577 };
578 
579   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
580      Performed when YYTABLE does not specify something else to do.  Zero
581      means the default is an error.  */
582 static const yytype_uint8 yydefact[] =
583 {
584        0,    57,    20,    14,     0,    47,     0,     0,     0,     0,
585        4,     5,    12,     6,     9,    10,     7,     8,    11,    13,
586       18,    16,    15,     0,    43,    45,    37,    41,     1,     3,
587        2,     0,    22,    23,    25,     0,    24,    27,    28,    19,
588        0,    46,    42,     0,    44,     0,    38,    21,    26,    17,
589        0,    49,    32,     0,    51,     0,    39,    29,    32,     0,
590       40,    48,    36,    33,    34,    35,    31,    30,    56,     0,
591       52,    55,    54,    50,     0,    53
592 };
593 
594   /* YYPGOTO[NTERM-NUM].  */
595 static const yytype_int8 yypgoto[] =
596 {
597      -27,   -27,   -27,   -27,   -27,   -27,   -27,   -27,   -27,   -27,
598      -27,    -9,   -27,   -27,   -27,   -27,   -27,   -27,   -27,   -27,
599      -27,   -27,   -27,   -26,   -27,   -27
600 };
601 
602   /* YYDEFGOTO[NTERM-NUM].  */
603 static const yytype_int8 yydefgoto[] =
604 {
605       -1,     9,    30,    10,    11,    12,    22,    13,    20,    39,
606       14,    57,    66,    15,    16,    17,    18,    43,    45,    24,
607       56,    60,    69,    70,    72,    19
608 };
609 
610   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
611      positive, shift that token.  If negative, reduce the rule whose
612      number is the opposite.  If YYTABLE_NINF, syntax error.  */
613 static const yytype_uint8 yytable[] =
614 {
615        1,    52,    53,    21,     2,     3,     4,     5,     6,     7,
616        8,    23,    31,    32,    33,    25,    34,    35,    36,    37,
617       38,    62,    26,    63,    64,    65,    73,    74,    27,    28,
618       41,    29,    42,    44,    40,    46,    47,    48,    49,    50,
619       55,    51,    54,    58,    59,    61,    68,    71,    75,    67
620 };
621 
622 static const yytype_uint8 yycheck[] =
623 {
624        4,    25,    26,     4,     8,     9,    10,    11,    12,    13,
625       14,    27,    15,    16,    17,     4,    19,    20,    21,    22,
626       23,    28,     4,    30,    31,    32,    36,    37,     5,     0,
627        4,    33,    25,    29,    34,    18,     3,     5,     4,    26,
628       24,     6,     6,     4,    35,     5,     4,     3,    74,    58
629 };
630 
631   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
632      symbol of state STATE-NUM.  */
633 static const yytype_uint8 yystos[] =
634 {
635        0,     4,     8,     9,    10,    11,    12,    13,    14,    39,
636       41,    42,    43,    45,    48,    51,    52,    53,    54,    63,
637       46,     4,    44,    27,    57,     4,     4,     5,     0,    33,
638       40,    15,    16,    17,    19,    20,    21,    22,    23,    47,
639       34,     4,    25,    55,    29,    56,    18,     3,     5,     4,
640       26,     6,    25,    26,     6,    24,    58,    49,     4,    35,
641       59,     5,    28,    30,    31,    32,    50,    49,     4,    60,
642       61,     3,    62,    36,    37,    61
643 };
644 
645   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
646 static const yytype_uint8 yyr1[] =
647 {
648        0,    38,    39,    40,    40,    41,    41,    41,    41,    41,
649       41,    41,    41,    41,    42,    43,    44,    44,    45,    46,
650       46,    47,    47,    47,    47,    47,    47,    47,    47,    48,
651       48,    49,    49,    50,    50,    50,    50,    51,    51,    52,
652       53,    54,    55,    55,    56,    56,    57,    57,    58,    58,
653       59,    59,    60,    60,    61,    62,    62,    63
654 };
655 
656   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
657 static const yytype_uint8 yyr2[] =
658 {
659        0,     2,     2,     1,     0,     1,     1,     1,     1,     1,
660        1,     1,     1,     1,     1,     2,     1,     3,     2,     2,
661        0,     2,     1,     1,     1,     1,     2,     1,     1,     5,
662        6,     2,     0,     1,     1,     1,     1,     2,     3,     5,
663        6,     2,     1,     0,     1,     0,     2,     0,     2,     0,
664        3,     0,     1,     3,     2,     1,     0,     1
665 };
666 
667 
668 #define yyerrok         (yyerrstatus = 0)
669 #define yyclearin       (yychar = YYEMPTY)
670 #define YYEMPTY         (-2)
671 #define YYEOF           0
672 
673 #define YYACCEPT        goto yyacceptlab
674 #define YYABORT         goto yyabortlab
675 #define YYERROR         goto yyerrorlab
676 
677 
678 #define YYRECOVERING()  (!!yyerrstatus)
679 
680 #define YYBACKUP(Token, Value)                                    \
681   do                                                              \
682     if (yychar == YYEMPTY)                                        \
683       {                                                           \
684         yychar = (Token);                                         \
685         yylval = (Value);                                         \
686         YYPOPSTACK (yylen);                                       \
687         yystate = *yyssp;                                         \
688         goto yybackup;                                            \
689       }                                                           \
690     else                                                          \
691       {                                                           \
692         yyerror (YY_("syntax error: cannot back up")); \
693         YYERROR;                                                  \
694       }                                                           \
695   while (0)
696 
697 /* Error token number */
698 #define YYTERROR        1
699 #define YYERRCODE       256
700 
701 
702 
703 /* Enable debugging if requested.  */
704 #if YYDEBUG
705 
706 # ifndef YYFPRINTF
707 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
708 #  define YYFPRINTF fprintf
709 # endif
710 
711 # define YYDPRINTF(Args)                        \
712 do {                                            \
713   if (yydebug)                                  \
714     YYFPRINTF Args;                             \
715 } while (0)
716 
717 /* This macro is provided for backward compatibility. */
718 #ifndef YY_LOCATION_PRINT
719 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
720 #endif
721 
722 
723 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
724 do {                                                                      \
725   if (yydebug)                                                            \
726     {                                                                     \
727       YYFPRINTF (stderr, "%s ", Title);                                   \
728       yy_symbol_print (stderr,                                            \
729                   Type, Value); \
730       YYFPRINTF (stderr, "\n");                                           \
731     }                                                                     \
732 } while (0)
733 
734 
735 /*-----------------------------------.
736 | Print this symbol's value on YYO.  |
737 `-----------------------------------*/
738 
739 static void
yy_symbol_value_print(FILE * yyo,int yytype,YYSTYPE const * const yyvaluep)740 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
741 {
742   FILE *yyoutput = yyo;
743   YYUSE (yyoutput);
744   if (!yyvaluep)
745     return;
746 # ifdef YYPRINT
747   if (yytype < YYNTOKENS)
748     YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
749 # endif
750   YYUSE (yytype);
751 }
752 
753 
754 /*---------------------------.
755 | Print this symbol on YYO.  |
756 `---------------------------*/
757 
758 static void
yy_symbol_print(FILE * yyo,int yytype,YYSTYPE const * const yyvaluep)759 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
760 {
761   YYFPRINTF (yyo, "%s %s (",
762              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
763 
764   yy_symbol_value_print (yyo, yytype, yyvaluep);
765   YYFPRINTF (yyo, ")");
766 }
767 
768 /*------------------------------------------------------------------.
769 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
770 | TOP (included).                                                   |
771 `------------------------------------------------------------------*/
772 
773 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)774 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
775 {
776   YYFPRINTF (stderr, "Stack now");
777   for (; yybottom <= yytop; yybottom++)
778     {
779       int yybot = *yybottom;
780       YYFPRINTF (stderr, " %d", yybot);
781     }
782   YYFPRINTF (stderr, "\n");
783 }
784 
785 # define YY_STACK_PRINT(Bottom, Top)                            \
786 do {                                                            \
787   if (yydebug)                                                  \
788     yy_stack_print ((Bottom), (Top));                           \
789 } while (0)
790 
791 
792 /*------------------------------------------------.
793 | Report that the YYRULE is going to be reduced.  |
794 `------------------------------------------------*/
795 
796 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule)797 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
798 {
799   unsigned long yylno = yyrline[yyrule];
800   int yynrhs = yyr2[yyrule];
801   int yyi;
802   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
803              yyrule - 1, yylno);
804   /* The symbols being reduced.  */
805   for (yyi = 0; yyi < yynrhs; yyi++)
806     {
807       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
808       yy_symbol_print (stderr,
809                        yystos[yyssp[yyi + 1 - yynrhs]],
810                        &yyvsp[(yyi + 1) - (yynrhs)]
811                                               );
812       YYFPRINTF (stderr, "\n");
813     }
814 }
815 
816 # define YY_REDUCE_PRINT(Rule)          \
817 do {                                    \
818   if (yydebug)                          \
819     yy_reduce_print (yyssp, yyvsp, Rule); \
820 } while (0)
821 
822 /* Nonzero means print parse trace.  It is left uninitialized so that
823    multiple parsers can coexist.  */
824 int yydebug;
825 #else /* !YYDEBUG */
826 # define YYDPRINTF(Args)
827 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
828 # define YY_STACK_PRINT(Bottom, Top)
829 # define YY_REDUCE_PRINT(Rule)
830 #endif /* !YYDEBUG */
831 
832 
833 /* YYINITDEPTH -- initial size of the parser's stacks.  */
834 #ifndef YYINITDEPTH
835 # define YYINITDEPTH 200
836 #endif
837 
838 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
839    if the built-in stack extension method is used).
840 
841    Do not make this value too large; the results are undefined if
842    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
843    evaluated with infinite-precision integer arithmetic.  */
844 
845 #ifndef YYMAXDEPTH
846 # define YYMAXDEPTH 10000
847 #endif
848 
849 
850 #if YYERROR_VERBOSE
851 
852 # ifndef yystrlen
853 #  if defined __GLIBC__ && defined _STRING_H
854 #   define yystrlen strlen
855 #  else
856 /* Return the length of YYSTR.  */
857 static YYSIZE_T
yystrlen(const char * yystr)858 yystrlen (const char *yystr)
859 {
860   YYSIZE_T yylen;
861   for (yylen = 0; yystr[yylen]; yylen++)
862     continue;
863   return yylen;
864 }
865 #  endif
866 # endif
867 
868 # ifndef yystpcpy
869 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
870 #   define yystpcpy stpcpy
871 #  else
872 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
873    YYDEST.  */
874 static char *
yystpcpy(char * yydest,const char * yysrc)875 yystpcpy (char *yydest, const char *yysrc)
876 {
877   char *yyd = yydest;
878   const char *yys = yysrc;
879 
880   while ((*yyd++ = *yys++) != '\0')
881     continue;
882 
883   return yyd - 1;
884 }
885 #  endif
886 # endif
887 
888 # ifndef yytnamerr
889 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
890    quotes and backslashes, so that it's suitable for yyerror.  The
891    heuristic is that double-quoting is unnecessary unless the string
892    contains an apostrophe, a comma, or backslash (other than
893    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
894    null, do not copy; instead, return the length of what the result
895    would have been.  */
896 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)897 yytnamerr (char *yyres, const char *yystr)
898 {
899   if (*yystr == '"')
900     {
901       YYSIZE_T yyn = 0;
902       char const *yyp = yystr;
903 
904       for (;;)
905         switch (*++yyp)
906           {
907           case '\'':
908           case ',':
909             goto do_not_strip_quotes;
910 
911           case '\\':
912             if (*++yyp != '\\')
913               goto do_not_strip_quotes;
914             else
915               goto append;
916 
917           append:
918           default:
919             if (yyres)
920               yyres[yyn] = *yyp;
921             yyn++;
922             break;
923 
924           case '"':
925             if (yyres)
926               yyres[yyn] = '\0';
927             return yyn;
928           }
929     do_not_strip_quotes: ;
930     }
931 
932   if (! yyres)
933     return yystrlen (yystr);
934 
935   return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
936 }
937 # endif
938 
939 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
940    about the unexpected token YYTOKEN for the state stack whose top is
941    YYSSP.
942 
943    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
944    not large enough to hold the message.  In that case, also set
945    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
946    required number of bytes is too large to store.  */
947 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)948 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
949                 yytype_int16 *yyssp, int yytoken)
950 {
951   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
952   YYSIZE_T yysize = yysize0;
953   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
954   /* Internationalized format string. */
955   const char *yyformat = YY_NULLPTR;
956   /* Arguments of yyformat. */
957   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
958   /* Number of reported tokens (one for the "unexpected", one per
959      "expected"). */
960   int yycount = 0;
961 
962   /* There are many possibilities here to consider:
963      - If this state is a consistent state with a default action, then
964        the only way this function was invoked is if the default action
965        is an error action.  In that case, don't check for expected
966        tokens because there are none.
967      - The only way there can be no lookahead present (in yychar) is if
968        this state is a consistent state with a default action.  Thus,
969        detecting the absence of a lookahead is sufficient to determine
970        that there is no unexpected or expected token to report.  In that
971        case, just report a simple "syntax error".
972      - Don't assume there isn't a lookahead just because this state is a
973        consistent state with a default action.  There might have been a
974        previous inconsistent state, consistent state with a non-default
975        action, or user semantic action that manipulated yychar.
976      - Of course, the expected token list depends on states to have
977        correct lookahead information, and it depends on the parser not
978        to perform extra reductions after fetching a lookahead from the
979        scanner and before detecting a syntax error.  Thus, state merging
980        (from LALR or IELR) and default reductions corrupt the expected
981        token list.  However, the list is correct for canonical LR with
982        one exception: it will still contain any token that will not be
983        accepted due to an error action in a later state.
984   */
985   if (yytoken != YYEMPTY)
986     {
987       int yyn = yypact[*yyssp];
988       yyarg[yycount++] = yytname[yytoken];
989       if (!yypact_value_is_default (yyn))
990         {
991           /* Start YYX at -YYN if negative to avoid negative indexes in
992              YYCHECK.  In other words, skip the first -YYN actions for
993              this state because they are default actions.  */
994           int yyxbegin = yyn < 0 ? -yyn : 0;
995           /* Stay within bounds of both yycheck and yytname.  */
996           int yychecklim = YYLAST - yyn + 1;
997           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
998           int yyx;
999 
1000           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1001             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1002                 && !yytable_value_is_error (yytable[yyx + yyn]))
1003               {
1004                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1005                   {
1006                     yycount = 1;
1007                     yysize = yysize0;
1008                     break;
1009                   }
1010                 yyarg[yycount++] = yytname[yyx];
1011                 {
1012                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1013                   if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1014                     yysize = yysize1;
1015                   else
1016                     return 2;
1017                 }
1018               }
1019         }
1020     }
1021 
1022   switch (yycount)
1023     {
1024 # define YYCASE_(N, S)                      \
1025       case N:                               \
1026         yyformat = S;                       \
1027       break
1028     default: /* Avoid compiler warnings. */
1029       YYCASE_(0, YY_("syntax error"));
1030       YYCASE_(1, YY_("syntax error, unexpected %s"));
1031       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1032       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1033       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1034       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1035 # undef YYCASE_
1036     }
1037 
1038   {
1039     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1040     if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1041       yysize = yysize1;
1042     else
1043       return 2;
1044   }
1045 
1046   if (*yymsg_alloc < yysize)
1047     {
1048       *yymsg_alloc = 2 * yysize;
1049       if (! (yysize <= *yymsg_alloc
1050              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1051         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1052       return 1;
1053     }
1054 
1055   /* Avoid sprintf, as that infringes on the user's name space.
1056      Don't have undefined behavior even if the translation
1057      produced a string with the wrong number of "%s"s.  */
1058   {
1059     char *yyp = *yymsg;
1060     int yyi = 0;
1061     while ((*yyp = *yyformat) != '\0')
1062       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1063         {
1064           yyp += yytnamerr (yyp, yyarg[yyi++]);
1065           yyformat += 2;
1066         }
1067       else
1068         {
1069           yyp++;
1070           yyformat++;
1071         }
1072   }
1073   return 0;
1074 }
1075 #endif /* YYERROR_VERBOSE */
1076 
1077 /*-----------------------------------------------.
1078 | Release the memory associated to this symbol.  |
1079 `-----------------------------------------------*/
1080 
1081 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1082 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1083 {
1084   YYUSE (yyvaluep);
1085   if (!yymsg)
1086     yymsg = "Deleting";
1087   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1088 
1089   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1090   YYUSE (yytype);
1091   YY_IGNORE_MAYBE_UNINITIALIZED_END
1092 }
1093 
1094 
1095 
1096 
1097 /* The lookahead symbol.  */
1098 int yychar;
1099 
1100 /* The semantic value of the lookahead symbol.  */
1101 YYSTYPE yylval;
1102 /* Number of syntax errors so far.  */
1103 int yynerrs;
1104 
1105 
1106 /*----------.
1107 | yyparse.  |
1108 `----------*/
1109 
1110 int
yyparse(void)1111 yyparse (void)
1112 {
1113     int yystate;
1114     /* Number of tokens to shift before error messages enabled.  */
1115     int yyerrstatus;
1116 
1117     /* The stacks and their tools:
1118        'yyss': related to states.
1119        'yyvs': related to semantic values.
1120 
1121        Refer to the stacks through separate pointers, to allow yyoverflow
1122        to reallocate them elsewhere.  */
1123 
1124     /* The state stack.  */
1125     yytype_int16 yyssa[YYINITDEPTH];
1126     yytype_int16 *yyss;
1127     yytype_int16 *yyssp;
1128 
1129     /* The semantic value stack.  */
1130     YYSTYPE yyvsa[YYINITDEPTH];
1131     YYSTYPE *yyvs;
1132     YYSTYPE *yyvsp;
1133 
1134     YYSIZE_T yystacksize;
1135 
1136   int yyn;
1137   int yyresult;
1138   /* Lookahead token as an internal (translated) token number.  */
1139   int yytoken = 0;
1140   /* The variables used to return semantic value and location from the
1141      action routines.  */
1142   YYSTYPE yyval;
1143 
1144 #if YYERROR_VERBOSE
1145   /* Buffer for error messages, and its allocated size.  */
1146   char yymsgbuf[128];
1147   char *yymsg = yymsgbuf;
1148   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1149 #endif
1150 
1151 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1152 
1153   /* The number of symbols on the RHS of the reduced rule.
1154      Keep to zero when no symbol should be popped.  */
1155   int yylen = 0;
1156 
1157   yyssp = yyss = yyssa;
1158   yyvsp = yyvs = yyvsa;
1159   yystacksize = YYINITDEPTH;
1160 
1161   YYDPRINTF ((stderr, "Starting parse\n"));
1162 
1163   yystate = 0;
1164   yyerrstatus = 0;
1165   yynerrs = 0;
1166   yychar = YYEMPTY; /* Cause a token to be read.  */
1167   goto yysetstate;
1168 
1169 
1170 /*------------------------------------------------------------.
1171 | yynewstate -- push a new state, which is found in yystate.  |
1172 `------------------------------------------------------------*/
1173 yynewstate:
1174   /* In all cases, when you get here, the value and location stacks
1175      have just been pushed.  So pushing a state here evens the stacks.  */
1176   yyssp++;
1177 
1178 
1179 /*--------------------------------------------------------------------.
1180 | yynewstate -- set current state (the top of the stack) to yystate.  |
1181 `--------------------------------------------------------------------*/
1182 yysetstate:
1183   *yyssp = (yytype_int16) yystate;
1184 
1185   if (yyss + yystacksize - 1 <= yyssp)
1186 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1187     goto yyexhaustedlab;
1188 #else
1189     {
1190       /* Get the current used size of the three stacks, in elements.  */
1191       YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
1192 
1193 # if defined yyoverflow
1194       {
1195         /* Give user a chance to reallocate the stack.  Use copies of
1196            these so that the &'s don't force the real ones into
1197            memory.  */
1198         YYSTYPE *yyvs1 = yyvs;
1199         yytype_int16 *yyss1 = yyss;
1200 
1201         /* Each stack pointer address is followed by the size of the
1202            data in use in that stack, in bytes.  This used to be a
1203            conditional around just the two extra args, but that might
1204            be undefined if yyoverflow is a macro.  */
1205         yyoverflow (YY_("memory exhausted"),
1206                     &yyss1, yysize * sizeof (*yyssp),
1207                     &yyvs1, yysize * sizeof (*yyvsp),
1208                     &yystacksize);
1209         yyss = yyss1;
1210         yyvs = yyvs1;
1211       }
1212 # else /* defined YYSTACK_RELOCATE */
1213       /* Extend the stack our own way.  */
1214       if (YYMAXDEPTH <= yystacksize)
1215         goto yyexhaustedlab;
1216       yystacksize *= 2;
1217       if (YYMAXDEPTH < yystacksize)
1218         yystacksize = YYMAXDEPTH;
1219 
1220       {
1221         yytype_int16 *yyss1 = yyss;
1222         union yyalloc *yyptr =
1223           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1224         if (! yyptr)
1225           goto yyexhaustedlab;
1226         YYSTACK_RELOCATE (yyss_alloc, yyss);
1227         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1228 # undef YYSTACK_RELOCATE
1229         if (yyss1 != yyssa)
1230           YYSTACK_FREE (yyss1);
1231       }
1232 # endif
1233 
1234       yyssp = yyss + yysize - 1;
1235       yyvsp = yyvs + yysize - 1;
1236 
1237       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1238                   (unsigned long) yystacksize));
1239 
1240       if (yyss + yystacksize - 1 <= yyssp)
1241         YYABORT;
1242     }
1243 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1244 
1245   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1246 
1247   if (yystate == YYFINAL)
1248     YYACCEPT;
1249 
1250   goto yybackup;
1251 
1252 
1253 /*-----------.
1254 | yybackup.  |
1255 `-----------*/
1256 yybackup:
1257   /* Do appropriate processing given the current state.  Read a
1258      lookahead token if we need one and don't already have one.  */
1259 
1260   /* First try to decide what to do without reference to lookahead token.  */
1261   yyn = yypact[yystate];
1262   if (yypact_value_is_default (yyn))
1263     goto yydefault;
1264 
1265   /* Not known => get a lookahead token if don't already have one.  */
1266 
1267   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1268   if (yychar == YYEMPTY)
1269     {
1270       YYDPRINTF ((stderr, "Reading a token: "));
1271       yychar = yylex ();
1272     }
1273 
1274   if (yychar <= YYEOF)
1275     {
1276       yychar = yytoken = YYEOF;
1277       YYDPRINTF ((stderr, "Now at end of input.\n"));
1278     }
1279   else
1280     {
1281       yytoken = YYTRANSLATE (yychar);
1282       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1283     }
1284 
1285   /* If the proper action on seeing token YYTOKEN is to reduce or to
1286      detect an error, take that action.  */
1287   yyn += yytoken;
1288   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1289     goto yydefault;
1290   yyn = yytable[yyn];
1291   if (yyn <= 0)
1292     {
1293       if (yytable_value_is_error (yyn))
1294         goto yyerrlab;
1295       yyn = -yyn;
1296       goto yyreduce;
1297     }
1298 
1299   /* Count tokens shifted since error; after three, turn off error
1300      status.  */
1301   if (yyerrstatus)
1302     yyerrstatus--;
1303 
1304   /* Shift the lookahead token.  */
1305   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1306 
1307   /* Discard the shifted token.  */
1308   yychar = YYEMPTY;
1309 
1310   yystate = yyn;
1311   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1312   *++yyvsp = yylval;
1313   YY_IGNORE_MAYBE_UNINITIALIZED_END
1314 
1315   goto yynewstate;
1316 
1317 
1318 /*-----------------------------------------------------------.
1319 | yydefault -- do the default action for the current state.  |
1320 `-----------------------------------------------------------*/
1321 yydefault:
1322   yyn = yydefact[yystate];
1323   if (yyn == 0)
1324     goto yyerrlab;
1325   goto yyreduce;
1326 
1327 
1328 /*-----------------------------.
1329 | yyreduce -- do a reduction.  |
1330 `-----------------------------*/
1331 yyreduce:
1332   /* yyn is the number of a rule to reduce with.  */
1333   yylen = yyr2[yyn];
1334 
1335   /* If YYLEN is nonzero, implement the default value of the action:
1336      '$$ = $1'.
1337 
1338      Otherwise, the following line sets YYVAL to garbage.
1339      This behavior is undocumented and Bison
1340      users should not rely upon it.  Assigning to YYVAL
1341      unconditionally makes the parser a bit smaller, and it avoids a
1342      GCC warning that YYVAL may be used uninitialized.  */
1343   yyval = yyvsp[1-yylen];
1344 
1345 
1346   YY_REDUCE_PRINT (yyn);
1347   switch (yyn)
1348     {
1349         case 2:
1350 #line 109 "repl_gram.y" /* yacc.c:1652  */
1351     {
1352 					replication_parse_result = (yyvsp[-1].node);
1353 				}
1354 #line 1355 "repl_gram.c" /* yacc.c:1652  */
1355     break;
1356 
1357   case 14:
1358 #line 135 "repl_gram.y" /* yacc.c:1652  */
1359     {
1360 					(yyval.node) = (Node *) makeNode(IdentifySystemCmd);
1361 				}
1362 #line 1363 "repl_gram.c" /* yacc.c:1652  */
1363     break;
1364 
1365   case 15:
1366 #line 145 "repl_gram.y" /* yacc.c:1652  */
1367     {
1368 					VariableShowStmt *n = makeNode(VariableShowStmt);
1369 					n->name = (yyvsp[0].str);
1370 					(yyval.node) = (Node *) n;
1371 				}
1372 #line 1373 "repl_gram.c" /* yacc.c:1652  */
1373     break;
1374 
1375   case 16:
1376 #line 151 "repl_gram.y" /* yacc.c:1652  */
1377     { (yyval.str) = (yyvsp[0].str); }
1378 #line 1379 "repl_gram.c" /* yacc.c:1652  */
1379     break;
1380 
1381   case 17:
1382 #line 153 "repl_gram.y" /* yacc.c:1652  */
1383     { (yyval.str) = psprintf("%s.%s", (yyvsp[-2].str), (yyvsp[0].str)); }
1384 #line 1385 "repl_gram.c" /* yacc.c:1652  */
1385     break;
1386 
1387   case 18:
1388 #line 162 "repl_gram.y" /* yacc.c:1652  */
1389     {
1390 					BaseBackupCmd *cmd = makeNode(BaseBackupCmd);
1391 					cmd->options = (yyvsp[0].list);
1392 					(yyval.node) = (Node *) cmd;
1393 				}
1394 #line 1395 "repl_gram.c" /* yacc.c:1652  */
1395     break;
1396 
1397   case 19:
1398 #line 171 "repl_gram.y" /* yacc.c:1652  */
1399     { (yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].defelt)); }
1400 #line 1401 "repl_gram.c" /* yacc.c:1652  */
1401     break;
1402 
1403   case 20:
1404 #line 173 "repl_gram.y" /* yacc.c:1652  */
1405     { (yyval.list) = NIL; }
1406 #line 1407 "repl_gram.c" /* yacc.c:1652  */
1407     break;
1408 
1409   case 21:
1410 #line 178 "repl_gram.y" /* yacc.c:1652  */
1411     {
1412 				  (yyval.defelt) = makeDefElem("label",
1413 								   (Node *)makeString((yyvsp[0].str)), -1);
1414 				}
1415 #line 1416 "repl_gram.c" /* yacc.c:1652  */
1416     break;
1417 
1418   case 22:
1419 #line 183 "repl_gram.y" /* yacc.c:1652  */
1420     {
1421 				  (yyval.defelt) = makeDefElem("progress",
1422 								   (Node *)makeInteger(true), -1);
1423 				}
1424 #line 1425 "repl_gram.c" /* yacc.c:1652  */
1425     break;
1426 
1427   case 23:
1428 #line 188 "repl_gram.y" /* yacc.c:1652  */
1429     {
1430 				  (yyval.defelt) = makeDefElem("fast",
1431 								   (Node *)makeInteger(true), -1);
1432 				}
1433 #line 1434 "repl_gram.c" /* yacc.c:1652  */
1434     break;
1435 
1436   case 24:
1437 #line 193 "repl_gram.y" /* yacc.c:1652  */
1438     {
1439 				  (yyval.defelt) = makeDefElem("wal",
1440 								   (Node *)makeInteger(true), -1);
1441 				}
1442 #line 1443 "repl_gram.c" /* yacc.c:1652  */
1443     break;
1444 
1445   case 25:
1446 #line 198 "repl_gram.y" /* yacc.c:1652  */
1447     {
1448 				  (yyval.defelt) = makeDefElem("nowait",
1449 								   (Node *)makeInteger(true), -1);
1450 				}
1451 #line 1452 "repl_gram.c" /* yacc.c:1652  */
1452     break;
1453 
1454   case 26:
1455 #line 203 "repl_gram.y" /* yacc.c:1652  */
1456     {
1457 				  (yyval.defelt) = makeDefElem("max_rate",
1458 								   (Node *)makeInteger((yyvsp[0].uintval)), -1);
1459 				}
1460 #line 1461 "repl_gram.c" /* yacc.c:1652  */
1461     break;
1462 
1463   case 27:
1464 #line 208 "repl_gram.y" /* yacc.c:1652  */
1465     {
1466 				  (yyval.defelt) = makeDefElem("tablespace_map",
1467 								   (Node *)makeInteger(true), -1);
1468 				}
1469 #line 1470 "repl_gram.c" /* yacc.c:1652  */
1470     break;
1471 
1472   case 28:
1473 #line 213 "repl_gram.y" /* yacc.c:1652  */
1474     {
1475 				  (yyval.defelt) = makeDefElem("noverify_checksums",
1476 								   (Node *)makeInteger(true), -1);
1477 				}
1478 #line 1479 "repl_gram.c" /* yacc.c:1652  */
1479     break;
1480 
1481   case 29:
1482 #line 222 "repl_gram.y" /* yacc.c:1652  */
1483     {
1484 					CreateReplicationSlotCmd *cmd;
1485 					cmd = makeNode(CreateReplicationSlotCmd);
1486 					cmd->kind = REPLICATION_KIND_PHYSICAL;
1487 					cmd->slotname = (yyvsp[-3].str);
1488 					cmd->temporary = (yyvsp[-2].boolval);
1489 					cmd->options = (yyvsp[0].list);
1490 					(yyval.node) = (Node *) cmd;
1491 				}
1492 #line 1493 "repl_gram.c" /* yacc.c:1652  */
1493     break;
1494 
1495   case 30:
1496 #line 233 "repl_gram.y" /* yacc.c:1652  */
1497     {
1498 					CreateReplicationSlotCmd *cmd;
1499 					cmd = makeNode(CreateReplicationSlotCmd);
1500 					cmd->kind = REPLICATION_KIND_LOGICAL;
1501 					cmd->slotname = (yyvsp[-4].str);
1502 					cmd->temporary = (yyvsp[-3].boolval);
1503 					cmd->plugin = (yyvsp[-1].str);
1504 					cmd->options = (yyvsp[0].list);
1505 					(yyval.node) = (Node *) cmd;
1506 				}
1507 #line 1508 "repl_gram.c" /* yacc.c:1652  */
1508     break;
1509 
1510   case 31:
1511 #line 247 "repl_gram.y" /* yacc.c:1652  */
1512     { (yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].defelt)); }
1513 #line 1514 "repl_gram.c" /* yacc.c:1652  */
1514     break;
1515 
1516   case 32:
1517 #line 249 "repl_gram.y" /* yacc.c:1652  */
1518     { (yyval.list) = NIL; }
1519 #line 1520 "repl_gram.c" /* yacc.c:1652  */
1520     break;
1521 
1522   case 33:
1523 #line 254 "repl_gram.y" /* yacc.c:1652  */
1524     {
1525 				  (yyval.defelt) = makeDefElem("export_snapshot",
1526 								   (Node *)makeInteger(true), -1);
1527 				}
1528 #line 1529 "repl_gram.c" /* yacc.c:1652  */
1529     break;
1530 
1531   case 34:
1532 #line 259 "repl_gram.y" /* yacc.c:1652  */
1533     {
1534 				  (yyval.defelt) = makeDefElem("export_snapshot",
1535 								   (Node *)makeInteger(false), -1);
1536 				}
1537 #line 1538 "repl_gram.c" /* yacc.c:1652  */
1538     break;
1539 
1540   case 35:
1541 #line 264 "repl_gram.y" /* yacc.c:1652  */
1542     {
1543 				  (yyval.defelt) = makeDefElem("use_snapshot",
1544 								   (Node *)makeInteger(true), -1);
1545 				}
1546 #line 1547 "repl_gram.c" /* yacc.c:1652  */
1547     break;
1548 
1549   case 36:
1550 #line 269 "repl_gram.y" /* yacc.c:1652  */
1551     {
1552 				  (yyval.defelt) = makeDefElem("reserve_wal",
1553 								   (Node *)makeInteger(true), -1);
1554 				}
1555 #line 1556 "repl_gram.c" /* yacc.c:1652  */
1556     break;
1557 
1558   case 37:
1559 #line 278 "repl_gram.y" /* yacc.c:1652  */
1560     {
1561 					DropReplicationSlotCmd *cmd;
1562 					cmd = makeNode(DropReplicationSlotCmd);
1563 					cmd->slotname = (yyvsp[0].str);
1564 					cmd->wait = false;
1565 					(yyval.node) = (Node *) cmd;
1566 				}
1567 #line 1568 "repl_gram.c" /* yacc.c:1652  */
1568     break;
1569 
1570   case 38:
1571 #line 286 "repl_gram.y" /* yacc.c:1652  */
1572     {
1573 					DropReplicationSlotCmd *cmd;
1574 					cmd = makeNode(DropReplicationSlotCmd);
1575 					cmd->slotname = (yyvsp[-1].str);
1576 					cmd->wait = true;
1577 					(yyval.node) = (Node *) cmd;
1578 				}
1579 #line 1580 "repl_gram.c" /* yacc.c:1652  */
1580     break;
1581 
1582   case 39:
1583 #line 300 "repl_gram.y" /* yacc.c:1652  */
1584     {
1585 					StartReplicationCmd *cmd;
1586 
1587 					cmd = makeNode(StartReplicationCmd);
1588 					cmd->kind = REPLICATION_KIND_PHYSICAL;
1589 					cmd->slotname = (yyvsp[-3].str);
1590 					cmd->startpoint = (yyvsp[-1].recptr);
1591 					cmd->timeline = (yyvsp[0].uintval);
1592 					(yyval.node) = (Node *) cmd;
1593 				}
1594 #line 1595 "repl_gram.c" /* yacc.c:1652  */
1595     break;
1596 
1597   case 40:
1598 #line 315 "repl_gram.y" /* yacc.c:1652  */
1599     {
1600 					StartReplicationCmd *cmd;
1601 					cmd = makeNode(StartReplicationCmd);
1602 					cmd->kind = REPLICATION_KIND_LOGICAL;
1603 					cmd->slotname = (yyvsp[-3].str);
1604 					cmd->startpoint = (yyvsp[-1].recptr);
1605 					cmd->options = (yyvsp[0].list);
1606 					(yyval.node) = (Node *) cmd;
1607 				}
1608 #line 1609 "repl_gram.c" /* yacc.c:1652  */
1609     break;
1610 
1611   case 41:
1612 #line 330 "repl_gram.y" /* yacc.c:1652  */
1613     {
1614 					TimeLineHistoryCmd *cmd;
1615 
1616 					if ((yyvsp[0].uintval) <= 0)
1617 						ereport(ERROR,
1618 								(errcode(ERRCODE_SYNTAX_ERROR),
1619 								 (errmsg("invalid timeline %u", (yyvsp[0].uintval)))));
1620 
1621 					cmd = makeNode(TimeLineHistoryCmd);
1622 					cmd->timeline = (yyvsp[0].uintval);
1623 
1624 					(yyval.node) = (Node *) cmd;
1625 				}
1626 #line 1627 "repl_gram.c" /* yacc.c:1652  */
1627     break;
1628 
1629   case 44:
1630 #line 351 "repl_gram.y" /* yacc.c:1652  */
1631     { (yyval.boolval) = true; }
1632 #line 1633 "repl_gram.c" /* yacc.c:1652  */
1633     break;
1634 
1635   case 45:
1636 #line 352 "repl_gram.y" /* yacc.c:1652  */
1637     { (yyval.boolval) = false; }
1638 #line 1639 "repl_gram.c" /* yacc.c:1652  */
1639     break;
1640 
1641   case 46:
1642 #line 357 "repl_gram.y" /* yacc.c:1652  */
1643     { (yyval.str) = (yyvsp[0].str); }
1644 #line 1645 "repl_gram.c" /* yacc.c:1652  */
1645     break;
1646 
1647   case 47:
1648 #line 359 "repl_gram.y" /* yacc.c:1652  */
1649     { (yyval.str) = NULL; }
1650 #line 1651 "repl_gram.c" /* yacc.c:1652  */
1651     break;
1652 
1653   case 48:
1654 #line 364 "repl_gram.y" /* yacc.c:1652  */
1655     {
1656 					if ((yyvsp[0].uintval) <= 0)
1657 						ereport(ERROR,
1658 								(errcode(ERRCODE_SYNTAX_ERROR),
1659 								 (errmsg("invalid timeline %u", (yyvsp[0].uintval)))));
1660 					(yyval.uintval) = (yyvsp[0].uintval);
1661 				}
1662 #line 1663 "repl_gram.c" /* yacc.c:1652  */
1663     break;
1664 
1665   case 49:
1666 #line 371 "repl_gram.y" /* yacc.c:1652  */
1667     { (yyval.uintval) = 0; }
1668 #line 1669 "repl_gram.c" /* yacc.c:1652  */
1669     break;
1670 
1671   case 50:
1672 #line 376 "repl_gram.y" /* yacc.c:1652  */
1673     { (yyval.list) = (yyvsp[-1].list); }
1674 #line 1675 "repl_gram.c" /* yacc.c:1652  */
1675     break;
1676 
1677   case 51:
1678 #line 377 "repl_gram.y" /* yacc.c:1652  */
1679     { (yyval.list) = NIL; }
1680 #line 1681 "repl_gram.c" /* yacc.c:1652  */
1681     break;
1682 
1683   case 52:
1684 #line 382 "repl_gram.y" /* yacc.c:1652  */
1685     {
1686 					(yyval.list) = list_make1((yyvsp[0].defelt));
1687 				}
1688 #line 1689 "repl_gram.c" /* yacc.c:1652  */
1689     break;
1690 
1691   case 53:
1692 #line 386 "repl_gram.y" /* yacc.c:1652  */
1693     {
1694 					(yyval.list) = lappend((yyvsp[-2].list), (yyvsp[0].defelt));
1695 				}
1696 #line 1697 "repl_gram.c" /* yacc.c:1652  */
1697     break;
1698 
1699   case 54:
1700 #line 393 "repl_gram.y" /* yacc.c:1652  */
1701     {
1702 					(yyval.defelt) = makeDefElem((yyvsp[-1].str), (yyvsp[0].node), -1);
1703 				}
1704 #line 1705 "repl_gram.c" /* yacc.c:1652  */
1705     break;
1706 
1707   case 55:
1708 #line 399 "repl_gram.y" /* yacc.c:1652  */
1709     { (yyval.node) = (Node *) makeString((yyvsp[0].str)); }
1710 #line 1711 "repl_gram.c" /* yacc.c:1652  */
1711     break;
1712 
1713   case 56:
1714 #line 400 "repl_gram.y" /* yacc.c:1652  */
1715     { (yyval.node) = NULL; }
1716 #line 1717 "repl_gram.c" /* yacc.c:1652  */
1717     break;
1718 
1719   case 57:
1720 #line 404 "repl_gram.y" /* yacc.c:1652  */
1721     { (yyval.node) = (Node *) make_sqlcmd(); }
1722 #line 1723 "repl_gram.c" /* yacc.c:1652  */
1723     break;
1724 
1725 
1726 #line 1727 "repl_gram.c" /* yacc.c:1652  */
1727       default: break;
1728     }
1729   /* User semantic actions sometimes alter yychar, and that requires
1730      that yytoken be updated with the new translation.  We take the
1731      approach of translating immediately before every use of yytoken.
1732      One alternative is translating here after every semantic action,
1733      but that translation would be missed if the semantic action invokes
1734      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1735      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1736      incorrect destructor might then be invoked immediately.  In the
1737      case of YYERROR or YYBACKUP, subsequent parser actions might lead
1738      to an incorrect destructor call or verbose syntax error message
1739      before the lookahead is translated.  */
1740   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1741 
1742   YYPOPSTACK (yylen);
1743   yylen = 0;
1744   YY_STACK_PRINT (yyss, yyssp);
1745 
1746   *++yyvsp = yyval;
1747 
1748   /* Now 'shift' the result of the reduction.  Determine what state
1749      that goes to, based on the state we popped back to and the rule
1750      number reduced by.  */
1751   {
1752     const int yylhs = yyr1[yyn] - YYNTOKENS;
1753     const int yyi = yypgoto[yylhs] + *yyssp;
1754     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1755                ? yytable[yyi]
1756                : yydefgoto[yylhs]);
1757   }
1758 
1759   goto yynewstate;
1760 
1761 
1762 /*--------------------------------------.
1763 | yyerrlab -- here on detecting error.  |
1764 `--------------------------------------*/
1765 yyerrlab:
1766   /* Make sure we have latest lookahead translation.  See comments at
1767      user semantic actions for why this is necessary.  */
1768   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1769 
1770   /* If not already recovering from an error, report this error.  */
1771   if (!yyerrstatus)
1772     {
1773       ++yynerrs;
1774 #if ! YYERROR_VERBOSE
1775       yyerror (YY_("syntax error"));
1776 #else
1777 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1778                                         yyssp, yytoken)
1779       {
1780         char const *yymsgp = YY_("syntax error");
1781         int yysyntax_error_status;
1782         yysyntax_error_status = YYSYNTAX_ERROR;
1783         if (yysyntax_error_status == 0)
1784           yymsgp = yymsg;
1785         else if (yysyntax_error_status == 1)
1786           {
1787             if (yymsg != yymsgbuf)
1788               YYSTACK_FREE (yymsg);
1789             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1790             if (!yymsg)
1791               {
1792                 yymsg = yymsgbuf;
1793                 yymsg_alloc = sizeof yymsgbuf;
1794                 yysyntax_error_status = 2;
1795               }
1796             else
1797               {
1798                 yysyntax_error_status = YYSYNTAX_ERROR;
1799                 yymsgp = yymsg;
1800               }
1801           }
1802         yyerror (yymsgp);
1803         if (yysyntax_error_status == 2)
1804           goto yyexhaustedlab;
1805       }
1806 # undef YYSYNTAX_ERROR
1807 #endif
1808     }
1809 
1810 
1811 
1812   if (yyerrstatus == 3)
1813     {
1814       /* If just tried and failed to reuse lookahead token after an
1815          error, discard it.  */
1816 
1817       if (yychar <= YYEOF)
1818         {
1819           /* Return failure if at end of input.  */
1820           if (yychar == YYEOF)
1821             YYABORT;
1822         }
1823       else
1824         {
1825           yydestruct ("Error: discarding",
1826                       yytoken, &yylval);
1827           yychar = YYEMPTY;
1828         }
1829     }
1830 
1831   /* Else will try to reuse lookahead token after shifting the error
1832      token.  */
1833   goto yyerrlab1;
1834 
1835 
1836 /*---------------------------------------------------.
1837 | yyerrorlab -- error raised explicitly by YYERROR.  |
1838 `---------------------------------------------------*/
1839 yyerrorlab:
1840   /* Pacify compilers when the user code never invokes YYERROR and the
1841      label yyerrorlab therefore never appears in user code.  */
1842   if (0)
1843     YYERROR;
1844 
1845   /* Do not reclaim the symbols of the rule whose action triggered
1846      this YYERROR.  */
1847   YYPOPSTACK (yylen);
1848   yylen = 0;
1849   YY_STACK_PRINT (yyss, yyssp);
1850   yystate = *yyssp;
1851   goto yyerrlab1;
1852 
1853 
1854 /*-------------------------------------------------------------.
1855 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1856 `-------------------------------------------------------------*/
1857 yyerrlab1:
1858   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1859 
1860   for (;;)
1861     {
1862       yyn = yypact[yystate];
1863       if (!yypact_value_is_default (yyn))
1864         {
1865           yyn += YYTERROR;
1866           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1867             {
1868               yyn = yytable[yyn];
1869               if (0 < yyn)
1870                 break;
1871             }
1872         }
1873 
1874       /* Pop the current state because it cannot handle the error token.  */
1875       if (yyssp == yyss)
1876         YYABORT;
1877 
1878 
1879       yydestruct ("Error: popping",
1880                   yystos[yystate], yyvsp);
1881       YYPOPSTACK (1);
1882       yystate = *yyssp;
1883       YY_STACK_PRINT (yyss, yyssp);
1884     }
1885 
1886   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1887   *++yyvsp = yylval;
1888   YY_IGNORE_MAYBE_UNINITIALIZED_END
1889 
1890 
1891   /* Shift the error token.  */
1892   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1893 
1894   yystate = yyn;
1895   goto yynewstate;
1896 
1897 
1898 /*-------------------------------------.
1899 | yyacceptlab -- YYACCEPT comes here.  |
1900 `-------------------------------------*/
1901 yyacceptlab:
1902   yyresult = 0;
1903   goto yyreturn;
1904 
1905 
1906 /*-----------------------------------.
1907 | yyabortlab -- YYABORT comes here.  |
1908 `-----------------------------------*/
1909 yyabortlab:
1910   yyresult = 1;
1911   goto yyreturn;
1912 
1913 
1914 #if !defined yyoverflow || YYERROR_VERBOSE
1915 /*-------------------------------------------------.
1916 | yyexhaustedlab -- memory exhaustion comes here.  |
1917 `-------------------------------------------------*/
1918 yyexhaustedlab:
1919   yyerror (YY_("memory exhausted"));
1920   yyresult = 2;
1921   /* Fall through.  */
1922 #endif
1923 
1924 
1925 /*-----------------------------------------------------.
1926 | yyreturn -- parsing is finished, return the result.  |
1927 `-----------------------------------------------------*/
1928 yyreturn:
1929   if (yychar != YYEMPTY)
1930     {
1931       /* Make sure we have latest lookahead translation.  See comments at
1932          user semantic actions for why this is necessary.  */
1933       yytoken = YYTRANSLATE (yychar);
1934       yydestruct ("Cleanup: discarding lookahead",
1935                   yytoken, &yylval);
1936     }
1937   /* Do not reclaim the symbols of the rule whose action triggered
1938      this YYABORT or YYACCEPT.  */
1939   YYPOPSTACK (yylen);
1940   YY_STACK_PRINT (yyss, yyssp);
1941   while (yyssp != yyss)
1942     {
1943       yydestruct ("Cleanup: popping",
1944                   yystos[*yyssp], yyvsp);
1945       YYPOPSTACK (1);
1946     }
1947 #ifndef yyoverflow
1948   if (yyss != yyssa)
1949     YYSTACK_FREE (yyss);
1950 #endif
1951 #if YYERROR_VERBOSE
1952   if (yymsg != yymsgbuf)
1953     YYSTACK_FREE (yymsg);
1954 #endif
1955   return yyresult;
1956 }
1957 #line 406 "repl_gram.y" /* yacc.c:1918  */
1958 
1959 
1960 static SQLCmd *
make_sqlcmd(void)1961 make_sqlcmd(void)
1962 {
1963 	SQLCmd *cmd = makeNode(SQLCmd);
1964 	int tok;
1965 
1966 	/* Just move lexer to the end of command. */
1967 	for (;;)
1968 	{
1969 		tok = yylex();
1970 		if (tok == ';' || tok == 0)
1971 			break;
1972 	}
1973 	return cmd;
1974 }
1975 
1976 #include "repl_scanner.c"
1977