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