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