Line data Source code
1 : /* A Bison parser, made by GNU Bison 3.7.5. */
2 :
3 : /* Bison implementation for Yacc-like parsers in C
4 :
5 : Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6 : Inc.
7 :
8 : This program is free software: you can redistribute it and/or modify
9 : it under the terms of the GNU General Public License as published by
10 : the Free Software Foundation, either version 3 of the License, or
11 : (at your option) any later version.
12 :
13 : This program is distributed in the hope that it will be useful,
14 : but WITHOUT ANY WARRANTY; without even the implied warranty of
15 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 : GNU General Public License for more details.
17 :
18 : You should have received a copy of the GNU General Public License
19 : along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 :
21 : /* As a special exception, you may create a larger work that contains
22 : part or all of the Bison parser skeleton and distribute that work
23 : under terms of your choice, so long as that work isn't itself a
24 : parser generator using the skeleton or a modified version thereof
25 : as a parser skeleton. Alternatively, if you modify or redistribute
26 : the parser skeleton itself, you may (at your option) remove this
27 : special exception, which will cause the skeleton and the resulting
28 : Bison output files to be licensed under the GNU General Public
29 : License without this special exception.
30 :
31 : This special exception was added by the Free Software Foundation in
32 : version 2.2 of Bison. */
33 :
34 : /* C LALR(1) parser skeleton written by Richard Stallman, by
35 : simplifying the original so-called "semantic" parser. */
36 :
37 : /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 : especially those whose name start with YY_ or yy_. They are
39 : private implementation details that can be changed or removed. */
40 :
41 : /* All symbols defined below should begin with yy or YY, to avoid
42 : infringing on user name space. This should be done even for local
43 : variables, as they might otherwise be expanded by user macros.
44 : There are some unavoidable exceptions within include files to
45 : define necessary library symbols; they are noted "INFRINGES ON
46 : USER NAME SPACE" below. */
47 :
48 : /* Identify Bison output, and Bison version. */
49 : #define YYBISON 30705
50 :
51 : /* Bison version string. */
52 : #define YYBISON_VERSION "3.7.5"
53 :
54 : /* Skeleton name. */
55 : #define YYSKELETON_NAME "yacc.c"
56 :
57 : /* Pure parsers. */
58 : #define YYPURE 0
59 :
60 : /* Push parsers. */
61 : #define YYPUSH 0
62 :
63 : /* Pull parsers. */
64 : #define YYPULL 1
65 :
66 :
67 : /* Substitute the variable and function names. */
68 : #define yyparse syncrep_yyparse
69 : #define yylex syncrep_yylex
70 : #define yyerror syncrep_yyerror
71 : #define yydebug syncrep_yydebug
72 : #define yynerrs syncrep_yynerrs
73 : #define yylval syncrep_yylval
74 : #define yychar syncrep_yychar
75 :
76 : /* First part of user prologue. */
77 : #line 1 "syncrep_gram.y"
78 :
79 : /*-------------------------------------------------------------------------
80 : *
81 : * syncrep_gram.y - Parser for synchronous_standby_names
82 : *
83 : * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
84 : * Portions Copyright (c) 1994, Regents of the University of California
85 : *
86 : *
87 : * IDENTIFICATION
88 : * src/backend/replication/syncrep_gram.y
89 : *
90 : *-------------------------------------------------------------------------
91 : */
92 : #include "postgres.h"
93 :
94 : #include "nodes/pg_list.h"
95 : #include "replication/syncrep.h"
96 :
97 : #include "syncrep_gram.h"
98 :
99 : /* Result of parsing is returned in one of these two variables */
100 : SyncRepConfigData *syncrep_parse_result;
101 : char *syncrep_parse_error_msg;
102 :
103 : static SyncRepConfigData *create_syncrep_config(const char *num_sync,
104 : List *members, uint8 syncrep_method);
105 :
106 : /* silence -Wmissing-variable-declarations */
107 : extern int syncrep_yychar;
108 : extern int syncrep_yynerrs;
109 :
110 : /*
111 : * Bison doesn't allocate anything that needs to live across parser calls,
112 : * so we can easily have it use palloc instead of malloc. This prevents
113 : * memory leaks if we error out during parsing.
114 : */
115 : #define YYMALLOC palloc
116 : #define YYFREE pfree
117 :
118 :
119 : #line 120 "syncrep_gram.c"
120 :
121 : # ifndef YY_CAST
122 : # ifdef __cplusplus
123 : # define YY_CAST(Type, Val) static_cast<Type> (Val)
124 : # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
125 : # else
126 : # define YY_CAST(Type, Val) ((Type) (Val))
127 : # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
128 : # endif
129 : # endif
130 : # ifndef YY_NULLPTR
131 : # if defined __cplusplus
132 : # if 201103L <= __cplusplus
133 : # define YY_NULLPTR nullptr
134 : # else
135 : # define YY_NULLPTR 0
136 : # endif
137 : # else
138 : # define YY_NULLPTR ((void*)0)
139 : # endif
140 : # endif
141 :
142 : #include "syncrep_gram.h"
143 : /* Symbol kind. */
144 : enum yysymbol_kind_t
145 : {
146 : YYSYMBOL_YYEMPTY = -2,
147 : YYSYMBOL_YYEOF = 0, /* "end of file" */
148 : YYSYMBOL_YYerror = 1, /* error */
149 : YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
150 : YYSYMBOL_NAME = 3, /* NAME */
151 : YYSYMBOL_NUM = 4, /* NUM */
152 : YYSYMBOL_JUNK = 5, /* JUNK */
153 : YYSYMBOL_ANY = 6, /* ANY */
154 : YYSYMBOL_FIRST = 7, /* FIRST */
155 : YYSYMBOL_8_ = 8, /* '(' */
156 : YYSYMBOL_9_ = 9, /* ')' */
157 : YYSYMBOL_10_ = 10, /* ',' */
158 : YYSYMBOL_YYACCEPT = 11, /* $accept */
159 : YYSYMBOL_result = 12, /* result */
160 : YYSYMBOL_standby_config = 13, /* standby_config */
161 : YYSYMBOL_standby_list = 14, /* standby_list */
162 : YYSYMBOL_standby_name = 15 /* standby_name */
163 : };
164 : typedef enum yysymbol_kind_t yysymbol_kind_t;
165 :
166 :
167 :
168 :
169 : #ifdef short
170 : # undef short
171 : #endif
172 :
173 : /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
174 : <limits.h> and (if available) <stdint.h> are included
175 : so that the code can choose integer types of a good width. */
176 :
177 : #ifndef __PTRDIFF_MAX__
178 : # include <limits.h> /* INFRINGES ON USER NAME SPACE */
179 : # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
180 : # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
181 : # define YY_STDINT_H
182 : # endif
183 : #endif
184 :
185 : /* Narrow types that promote to a signed type and that can represent a
186 : signed or unsigned integer of at least N bits. In tables they can
187 : save space and decrease cache pressure. Promoting to a signed type
188 : helps avoid bugs in integer arithmetic. */
189 :
190 : #ifdef __INT_LEAST8_MAX__
191 : typedef __INT_LEAST8_TYPE__ yytype_int8;
192 : #elif defined YY_STDINT_H
193 : typedef int_least8_t yytype_int8;
194 : #else
195 : typedef signed char yytype_int8;
196 : #endif
197 :
198 : #ifdef __INT_LEAST16_MAX__
199 : typedef __INT_LEAST16_TYPE__ yytype_int16;
200 : #elif defined YY_STDINT_H
201 : typedef int_least16_t yytype_int16;
202 : #else
203 : typedef short yytype_int16;
204 : #endif
205 :
206 : /* Work around bug in HP-UX 11.23, which defines these macros
207 : incorrectly for preprocessor constants. This workaround can likely
208 : be removed in 2023, as HPE has promised support for HP-UX 11.23
209 : (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
210 : <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
211 : #ifdef __hpux
212 : # undef UINT_LEAST8_MAX
213 : # undef UINT_LEAST16_MAX
214 : # define UINT_LEAST8_MAX 255
215 : # define UINT_LEAST16_MAX 65535
216 : #endif
217 :
218 : #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
219 : typedef __UINT_LEAST8_TYPE__ yytype_uint8;
220 : #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
221 : && UINT_LEAST8_MAX <= INT_MAX)
222 : typedef uint_least8_t yytype_uint8;
223 : #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
224 : typedef unsigned char yytype_uint8;
225 : #else
226 : typedef short yytype_uint8;
227 : #endif
228 :
229 : #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
230 : typedef __UINT_LEAST16_TYPE__ yytype_uint16;
231 : #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
232 : && UINT_LEAST16_MAX <= INT_MAX)
233 : typedef uint_least16_t yytype_uint16;
234 : #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
235 : typedef unsigned short yytype_uint16;
236 : #else
237 : typedef int yytype_uint16;
238 : #endif
239 :
240 : #ifndef YYPTRDIFF_T
241 : # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
242 : # define YYPTRDIFF_T __PTRDIFF_TYPE__
243 : # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
244 : # elif defined PTRDIFF_MAX
245 : # ifndef ptrdiff_t
246 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
247 : # endif
248 : # define YYPTRDIFF_T ptrdiff_t
249 : # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
250 : # else
251 : # define YYPTRDIFF_T long
252 : # define YYPTRDIFF_MAXIMUM LONG_MAX
253 : # endif
254 : #endif
255 :
256 : #ifndef YYSIZE_T
257 : # ifdef __SIZE_TYPE__
258 : # define YYSIZE_T __SIZE_TYPE__
259 : # elif defined size_t
260 : # define YYSIZE_T size_t
261 : # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
262 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
263 : # define YYSIZE_T size_t
264 : # else
265 : # define YYSIZE_T unsigned
266 : # endif
267 : #endif
268 :
269 : #define YYSIZE_MAXIMUM \
270 : YY_CAST (YYPTRDIFF_T, \
271 : (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
272 : ? YYPTRDIFF_MAXIMUM \
273 : : YY_CAST (YYSIZE_T, -1)))
274 :
275 : #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
276 :
277 :
278 : /* Stored state numbers (used for stacks). */
279 : typedef yytype_int8 yy_state_t;
280 :
281 : /* State numbers in computations. */
282 : typedef int yy_state_fast_t;
283 :
284 : #ifndef YY_
285 : # if defined YYENABLE_NLS && YYENABLE_NLS
286 : # if ENABLE_NLS
287 : # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
288 : # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
289 : # endif
290 : # endif
291 : # ifndef YY_
292 : # define YY_(Msgid) Msgid
293 : # endif
294 : #endif
295 :
296 :
297 : #ifndef YY_ATTRIBUTE_PURE
298 : # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
299 : # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
300 : # else
301 : # define YY_ATTRIBUTE_PURE
302 : # endif
303 : #endif
304 :
305 : #ifndef YY_ATTRIBUTE_UNUSED
306 : # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
307 : # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
308 : # else
309 : # define YY_ATTRIBUTE_UNUSED
310 : # endif
311 : #endif
312 :
313 : /* Suppress unused-variable warnings by "using" E. */
314 : #if ! defined lint || defined __GNUC__
315 : # define YY_USE(E) ((void) (E))
316 : #else
317 : # define YY_USE(E) /* empty */
318 : #endif
319 :
320 : #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
321 : /* Suppress an incorrect diagnostic about yylval being uninitialized. */
322 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
323 : _Pragma ("GCC diagnostic push") \
324 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
325 : _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
326 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
327 : _Pragma ("GCC diagnostic pop")
328 : #else
329 : # define YY_INITIAL_VALUE(Value) Value
330 : #endif
331 : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
332 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
333 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
334 : #endif
335 : #ifndef YY_INITIAL_VALUE
336 : # define YY_INITIAL_VALUE(Value) /* Nothing. */
337 : #endif
338 :
339 : #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
340 : # define YY_IGNORE_USELESS_CAST_BEGIN \
341 : _Pragma ("GCC diagnostic push") \
342 : _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
343 : # define YY_IGNORE_USELESS_CAST_END \
344 : _Pragma ("GCC diagnostic pop")
345 : #endif
346 : #ifndef YY_IGNORE_USELESS_CAST_BEGIN
347 : # define YY_IGNORE_USELESS_CAST_BEGIN
348 : # define YY_IGNORE_USELESS_CAST_END
349 : #endif
350 :
351 :
352 : #define YY_ASSERT(E) ((void) (0 && (E)))
353 :
354 : #if !defined yyoverflow
355 :
356 : /* The parser invokes alloca or malloc; define the necessary symbols. */
357 :
358 : # ifdef YYSTACK_USE_ALLOCA
359 : # if YYSTACK_USE_ALLOCA
360 : # ifdef __GNUC__
361 : # define YYSTACK_ALLOC __builtin_alloca
362 : # elif defined __BUILTIN_VA_ARG_INCR
363 : # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
364 : # elif defined _AIX
365 : # define YYSTACK_ALLOC __alloca
366 : # elif defined _MSC_VER
367 : # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
368 : # define alloca _alloca
369 : # else
370 : # define YYSTACK_ALLOC alloca
371 : # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
372 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
373 : /* Use EXIT_SUCCESS as a witness for stdlib.h. */
374 : # ifndef EXIT_SUCCESS
375 : # define EXIT_SUCCESS 0
376 : # endif
377 : # endif
378 : # endif
379 : # endif
380 : # endif
381 :
382 : # ifdef YYSTACK_ALLOC
383 : /* Pacify GCC's 'empty if-body' warning. */
384 : # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
385 : # ifndef YYSTACK_ALLOC_MAXIMUM
386 : /* The OS might guarantee only one guard page at the bottom of the stack,
387 : and a page size can be as small as 4096 bytes. So we cannot safely
388 : invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
389 : to allow for a few compiler-allocated temporary stack slots. */
390 : # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
391 : # endif
392 : # else
393 : # define YYSTACK_ALLOC YYMALLOC
394 : # define YYSTACK_FREE YYFREE
395 : # ifndef YYSTACK_ALLOC_MAXIMUM
396 : # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
397 : # endif
398 : # if (defined __cplusplus && ! defined EXIT_SUCCESS \
399 : && ! ((defined YYMALLOC || defined malloc) \
400 : && (defined YYFREE || defined free)))
401 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
402 : # ifndef EXIT_SUCCESS
403 : # define EXIT_SUCCESS 0
404 : # endif
405 : # endif
406 : # ifndef YYMALLOC
407 : # define YYMALLOC malloc
408 : # if ! defined malloc && ! defined EXIT_SUCCESS
409 : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
410 : # endif
411 : # endif
412 : # ifndef YYFREE
413 : # define YYFREE free
414 : # if ! defined free && ! defined EXIT_SUCCESS
415 : void free (void *); /* INFRINGES ON USER NAME SPACE */
416 : # endif
417 : # endif
418 : # endif
419 : #endif /* !defined yyoverflow */
420 :
421 : #if (! defined yyoverflow \
422 : && (! defined __cplusplus \
423 : || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
424 :
425 : /* A type that is properly aligned for any stack member. */
426 : union yyalloc
427 : {
428 : yy_state_t yyss_alloc;
429 : YYSTYPE yyvs_alloc;
430 : };
431 :
432 : /* The size of the maximum gap between one aligned stack and the next. */
433 : # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
434 :
435 : /* The size of an array large to enough to hold all stacks, each with
436 : N elements. */
437 : # define YYSTACK_BYTES(N) \
438 : ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
439 : + YYSTACK_GAP_MAXIMUM)
440 :
441 : # define YYCOPY_NEEDED 1
442 :
443 : /* Relocate STACK from its old location to the new one. The
444 : local variables YYSIZE and YYSTACKSIZE give the old and new number of
445 : elements in the stack, and YYPTR gives the new location of the
446 : stack. Advance YYPTR to a properly aligned location for the next
447 : stack. */
448 : # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
449 : do \
450 : { \
451 : YYPTRDIFF_T yynewbytes; \
452 : YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
453 : Stack = &yyptr->Stack_alloc; \
454 : yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
455 : yyptr += yynewbytes / YYSIZEOF (*yyptr); \
456 : } \
457 : while (0)
458 :
459 : #endif
460 :
461 : #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
462 : /* Copy COUNT objects from SRC to DST. The source and destination do
463 : not overlap. */
464 : # ifndef YYCOPY
465 : # if defined __GNUC__ && 1 < __GNUC__
466 : # define YYCOPY(Dst, Src, Count) \
467 : __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
468 : # else
469 : # define YYCOPY(Dst, Src, Count) \
470 : do \
471 : { \
472 : YYPTRDIFF_T yyi; \
473 : for (yyi = 0; yyi < (Count); yyi++) \
474 : (Dst)[yyi] = (Src)[yyi]; \
475 : } \
476 : while (0)
477 : # endif
478 : # endif
479 : #endif /* !YYCOPY_NEEDED */
480 :
481 : /* YYFINAL -- State number of the termination state. */
482 : #define YYFINAL 12
483 : /* YYLAST -- Last index in YYTABLE. */
484 : #define YYLAST 22
485 :
486 : /* YYNTOKENS -- Number of terminals. */
487 : #define YYNTOKENS 11
488 : /* YYNNTS -- Number of nonterminals. */
489 : #define YYNNTS 5
490 : /* YYNRULES -- Number of rules. */
491 : #define YYNRULES 10
492 : /* YYNSTATES -- Number of states. */
493 : #define YYNSTATES 24
494 :
495 : /* YYMAXUTOK -- Last valid token kind. */
496 : #define YYMAXUTOK 262
497 :
498 :
499 : /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
500 : as returned by yylex, with out-of-bounds checking. */
501 : #define YYTRANSLATE(YYX) \
502 : (0 <= (YYX) && (YYX) <= YYMAXUTOK \
503 : ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
504 : : YYSYMBOL_YYUNDEF)
505 :
506 : /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
507 : as returned by yylex. */
508 : static const yytype_int8 yytranslate[] =
509 : {
510 : 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
511 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
513 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
514 : 8, 9, 2, 2, 10, 2, 2, 2, 2, 2,
515 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 : 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
536 : 5, 6, 7
537 : };
538 :
539 : #if YYDEBUG
540 : /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
541 : static const yytype_int8 yyrline[] =
542 : {
543 : 0, 63, 63, 67, 68, 69, 70, 74, 75, 79,
544 : 80
545 : };
546 : #endif
547 :
548 : /** Accessing symbol of state STATE. */
549 : #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
550 :
551 : #if YYDEBUG || 0
552 : /* The user-facing name of the symbol whose (internal) number is
553 : YYSYMBOL. No bounds checking. */
554 : static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
555 :
556 : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
557 : First, the terminals, then, starting at YYNTOKENS, nonterminals. */
558 : static const char *const yytname[] =
559 : {
560 : "\"end of file\"", "error", "\"invalid token\"", "NAME", "NUM", "JUNK",
561 : "ANY", "FIRST", "'('", "')'", "','", "$accept", "result",
562 : "standby_config", "standby_list", "standby_name", YY_NULLPTR
563 : };
564 :
565 : static const char *
566 : yysymbol_name (yysymbol_kind_t yysymbol)
567 : {
568 : return yytname[yysymbol];
569 : }
570 : #endif
571 :
572 : #ifdef YYPRINT
573 : /* YYTOKNUM[NUM] -- (External) token number corresponding to the
574 : (internal) symbol number NUM (which must be that of a token). */
575 : static const yytype_int16 yytoknum[] =
576 : {
577 : 0, 256, 257, 258, 259, 260, 261, 262, 40, 41,
578 : 44
579 : };
580 : #endif
581 :
582 : #define YYPACT_NINF (-10)
583 :
584 : #define yypact_value_is_default(Yyn) \
585 : ((Yyn) == YYPACT_NINF)
586 :
587 : #define YYTABLE_NINF (-1)
588 :
589 : #define yytable_value_is_error(Yyn) \
590 : 0
591 :
592 : /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
593 : STATE-NUM. */
594 : static const yytype_int8 yypact[] =
595 : {
596 : -2, -10, -5, 11, 14, 19, -10, -4, -10, 6,
597 : 12, 13, -10, 6, -10, 2, 6, 6, -10, -10,
598 : 4, 7, -10, -10
599 : };
600 :
601 : /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
602 : Performed when YYTABLE does not specify something else to do. Zero
603 : means the default is an error. */
604 : static const yytype_int8 yydefact[] =
605 : {
606 : 0, 9, 10, 0, 0, 0, 2, 3, 7, 0,
607 : 0, 0, 1, 0, 10, 0, 0, 0, 8, 4,
608 : 0, 0, 5, 6
609 : };
610 :
611 : /* YYPGOTO[NTERM-NUM]. */
612 : static const yytype_int8 yypgoto[] =
613 : {
614 : -10, -10, -10, -9, 9
615 : };
616 :
617 : /* YYDEFGOTO[NTERM-NUM]. */
618 : static const yytype_int8 yydefgoto[] =
619 : {
620 : 0, 5, 6, 7, 8
621 : };
622 :
623 : /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
624 : positive, shift that token. If negative, reduce the rule whose
625 : number is the opposite. If YYTABLE_NINF, syntax error. */
626 : static const yytype_int8 yytable[] =
627 : {
628 : 15, 1, 2, 9, 3, 4, 13, 20, 21, 1,
629 : 14, 19, 13, 22, 13, 10, 23, 13, 11, 12,
630 : 16, 17, 18
631 : };
632 :
633 : static const yytype_int8 yycheck[] =
634 : {
635 : 9, 3, 4, 8, 6, 7, 10, 16, 17, 3,
636 : 4, 9, 10, 9, 10, 4, 9, 10, 4, 0,
637 : 8, 8, 13
638 : };
639 :
640 : /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
641 : symbol of state STATE-NUM. */
642 : static const yytype_int8 yystos[] =
643 : {
644 : 0, 3, 4, 6, 7, 12, 13, 14, 15, 8,
645 : 4, 4, 0, 10, 4, 14, 8, 8, 15, 9,
646 : 14, 14, 9, 9
647 : };
648 :
649 : /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
650 : static const yytype_int8 yyr1[] =
651 : {
652 : 0, 11, 12, 13, 13, 13, 13, 14, 14, 15,
653 : 15
654 : };
655 :
656 : /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
657 : static const yytype_int8 yyr2[] =
658 : {
659 : 0, 2, 1, 1, 4, 5, 5, 1, 3, 1,
660 : 1
661 : };
662 :
663 :
664 : enum { YYENOMEM = -2 };
665 :
666 : #define yyerrok (yyerrstatus = 0)
667 : #define yyclearin (yychar = YYEMPTY)
668 :
669 : #define YYACCEPT goto yyacceptlab
670 : #define YYABORT goto yyabortlab
671 : #define YYERROR goto yyerrorlab
672 :
673 :
674 : #define YYRECOVERING() (!!yyerrstatus)
675 :
676 : #define YYBACKUP(Token, Value) \
677 : do \
678 : if (yychar == YYEMPTY) \
679 : { \
680 : yychar = (Token); \
681 : yylval = (Value); \
682 : YYPOPSTACK (yylen); \
683 : yystate = *yyssp; \
684 : goto yybackup; \
685 : } \
686 : else \
687 : { \
688 : yyerror (YY_("syntax error: cannot back up")); \
689 : YYERROR; \
690 : } \
691 : while (0)
692 :
693 : /* Backward compatibility with an undocumented macro.
694 : Use YYerror or YYUNDEF. */
695 : #define YYERRCODE YYUNDEF
696 :
697 :
698 : /* Enable debugging if requested. */
699 : #if YYDEBUG
700 :
701 : # ifndef YYFPRINTF
702 : # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
703 : # define YYFPRINTF fprintf
704 : # endif
705 :
706 : # define YYDPRINTF(Args) \
707 : do { \
708 : if (yydebug) \
709 : YYFPRINTF Args; \
710 : } while (0)
711 :
712 : /* This macro is provided for backward compatibility. */
713 : # ifndef YY_LOCATION_PRINT
714 : # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
715 : # endif
716 :
717 :
718 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
719 : do { \
720 : if (yydebug) \
721 : { \
722 : YYFPRINTF (stderr, "%s ", Title); \
723 : yy_symbol_print (stderr, \
724 : Kind, Value); \
725 : YYFPRINTF (stderr, "\n"); \
726 : } \
727 : } while (0)
728 :
729 :
730 : /*-----------------------------------.
731 : | Print this symbol's value on YYO. |
732 : `-----------------------------------*/
733 :
734 : static void
735 : yy_symbol_value_print (FILE *yyo,
736 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
737 : {
738 : FILE *yyoutput = yyo;
739 : YY_USE (yyoutput);
740 : if (!yyvaluep)
741 : return;
742 : # ifdef YYPRINT
743 : if (yykind < YYNTOKENS)
744 : YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
745 : # endif
746 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
747 : YY_USE (yykind);
748 : YY_IGNORE_MAYBE_UNINITIALIZED_END
749 : }
750 :
751 :
752 : /*---------------------------.
753 : | Print this symbol on YYO. |
754 : `---------------------------*/
755 :
756 : static void
757 : yy_symbol_print (FILE *yyo,
758 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
759 : {
760 : YYFPRINTF (yyo, "%s %s (",
761 : yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
762 :
763 : yy_symbol_value_print (yyo, yykind, yyvaluep);
764 : YYFPRINTF (yyo, ")");
765 : }
766 :
767 : /*------------------------------------------------------------------.
768 : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
769 : | TOP (included). |
770 : `------------------------------------------------------------------*/
771 :
772 : static void
773 : yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
774 : {
775 : YYFPRINTF (stderr, "Stack now");
776 : for (; yybottom <= yytop; yybottom++)
777 : {
778 : int yybot = *yybottom;
779 : YYFPRINTF (stderr, " %d", yybot);
780 : }
781 : YYFPRINTF (stderr, "\n");
782 : }
783 :
784 : # define YY_STACK_PRINT(Bottom, Top) \
785 : do { \
786 : if (yydebug) \
787 : yy_stack_print ((Bottom), (Top)); \
788 : } while (0)
789 :
790 :
791 : /*------------------------------------------------.
792 : | Report that the YYRULE is going to be reduced. |
793 : `------------------------------------------------*/
794 :
795 : static void
796 : yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
797 : int yyrule)
798 : {
799 : int yylno = yyrline[yyrule];
800 : int yynrhs = yyr2[yyrule];
801 : int yyi;
802 : YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
803 : yyrule - 1, yylno);
804 : /* The symbols being reduced. */
805 : for (yyi = 0; yyi < yynrhs; yyi++)
806 : {
807 : YYFPRINTF (stderr, " $%d = ", yyi + 1);
808 : yy_symbol_print (stderr,
809 : YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
810 : &yyvsp[(yyi + 1) - (yynrhs)]);
811 : YYFPRINTF (stderr, "\n");
812 : }
813 : }
814 :
815 : # define YY_REDUCE_PRINT(Rule) \
816 : do { \
817 : if (yydebug) \
818 : yy_reduce_print (yyssp, yyvsp, Rule); \
819 : } while (0)
820 :
821 : /* Nonzero means print parse trace. It is left uninitialized so that
822 : multiple parsers can coexist. */
823 : int yydebug;
824 : #else /* !YYDEBUG */
825 : # define YYDPRINTF(Args) ((void) 0)
826 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
827 : # define YY_STACK_PRINT(Bottom, Top)
828 : # define YY_REDUCE_PRINT(Rule)
829 : #endif /* !YYDEBUG */
830 :
831 :
832 : /* YYINITDEPTH -- initial size of the parser's stacks. */
833 : #ifndef YYINITDEPTH
834 : # define YYINITDEPTH 200
835 : #endif
836 :
837 : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
838 : if the built-in stack extension method is used).
839 :
840 : Do not make this value too large; the results are undefined if
841 : YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
842 : evaluated with infinite-precision integer arithmetic. */
843 :
844 : #ifndef YYMAXDEPTH
845 : # define YYMAXDEPTH 10000
846 : #endif
847 :
848 :
849 :
850 :
851 :
852 :
853 : /*-----------------------------------------------.
854 : | Release the memory associated to this symbol. |
855 : `-----------------------------------------------*/
856 :
857 : static void
858 260 : yydestruct (const char *yymsg,
859 : yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
860 : {
861 : YY_USE (yyvaluep);
862 260 : if (!yymsg)
863 0 : yymsg = "Deleting";
864 : YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
865 :
866 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
867 : YY_USE (yykind);
868 : YY_IGNORE_MAYBE_UNINITIALIZED_END
869 260 : }
870 :
871 :
872 : /* Lookahead token kind. */
873 : int yychar;
874 :
875 : /* The semantic value of the lookahead symbol. */
876 : YYSTYPE yylval;
877 : /* Number of syntax errors so far. */
878 : int yynerrs;
879 :
880 :
881 :
882 :
883 : /*----------.
884 : | yyparse. |
885 : `----------*/
886 :
887 : int
888 130 : yyparse (void)
889 : {
890 130 : yy_state_fast_t yystate = 0;
891 : /* Number of tokens to shift before error messages enabled. */
892 130 : int yyerrstatus = 0;
893 :
894 : /* Refer to the stacks through separate pointers, to allow yyoverflow
895 : to reallocate them elsewhere. */
896 :
897 : /* Their size. */
898 130 : YYPTRDIFF_T yystacksize = YYINITDEPTH;
899 :
900 : /* The state stack: array, bottom, top. */
901 : yy_state_t yyssa[YYINITDEPTH];
902 130 : yy_state_t *yyss = yyssa;
903 130 : yy_state_t *yyssp = yyss;
904 :
905 : /* The semantic value stack: array, bottom, top. */
906 : YYSTYPE yyvsa[YYINITDEPTH];
907 130 : YYSTYPE *yyvs = yyvsa;
908 130 : YYSTYPE *yyvsp = yyvs;
909 :
910 : int yyn;
911 : /* The return value of yyparse. */
912 : int yyresult;
913 : /* Lookahead symbol kind. */
914 130 : yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
915 : /* The variables used to return semantic value and location from the
916 : action routines. */
917 : YYSTYPE yyval;
918 :
919 :
920 :
921 : #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
922 :
923 : /* The number of symbols on the RHS of the reduced rule.
924 : Keep to zero when no symbol should be popped. */
925 130 : int yylen = 0;
926 :
927 : YYDPRINTF ((stderr, "Starting parse\n"));
928 :
929 130 : yychar = YYEMPTY; /* Cause a token to be read. */
930 130 : goto yysetstate;
931 :
932 :
933 : /*------------------------------------------------------------.
934 : | yynewstate -- push a new state, which is found in yystate. |
935 : `------------------------------------------------------------*/
936 1140 : yynewstate:
937 : /* In all cases, when you get here, the value and location stacks
938 : have just been pushed. So pushing a state here evens the stacks. */
939 1140 : yyssp++;
940 :
941 :
942 : /*--------------------------------------------------------------------.
943 : | yysetstate -- set current state (the top of the stack) to yystate. |
944 : `--------------------------------------------------------------------*/
945 1270 : yysetstate:
946 : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
947 : YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
948 : YY_IGNORE_USELESS_CAST_BEGIN
949 1270 : *yyssp = YY_CAST (yy_state_t, yystate);
950 : YY_IGNORE_USELESS_CAST_END
951 : YY_STACK_PRINT (yyss, yyssp);
952 :
953 1270 : if (yyss + yystacksize - 1 <= yyssp)
954 : #if !defined yyoverflow && !defined YYSTACK_RELOCATE
955 : goto yyexhaustedlab;
956 : #else
957 : {
958 : /* Get the current used size of the three stacks, in elements. */
959 0 : YYPTRDIFF_T yysize = yyssp - yyss + 1;
960 :
961 : # if defined yyoverflow
962 : {
963 : /* Give user a chance to reallocate the stack. Use copies of
964 : these so that the &'s don't force the real ones into
965 : memory. */
966 : yy_state_t *yyss1 = yyss;
967 : YYSTYPE *yyvs1 = yyvs;
968 :
969 : /* Each stack pointer address is followed by the size of the
970 : data in use in that stack, in bytes. This used to be a
971 : conditional around just the two extra args, but that might
972 : be undefined if yyoverflow is a macro. */
973 : yyoverflow (YY_("memory exhausted"),
974 : &yyss1, yysize * YYSIZEOF (*yyssp),
975 : &yyvs1, yysize * YYSIZEOF (*yyvsp),
976 : &yystacksize);
977 : yyss = yyss1;
978 : yyvs = yyvs1;
979 : }
980 : # else /* defined YYSTACK_RELOCATE */
981 : /* Extend the stack our own way. */
982 0 : if (YYMAXDEPTH <= yystacksize)
983 0 : goto yyexhaustedlab;
984 0 : yystacksize *= 2;
985 0 : if (YYMAXDEPTH < yystacksize)
986 0 : yystacksize = YYMAXDEPTH;
987 :
988 : {
989 0 : yy_state_t *yyss1 = yyss;
990 : union yyalloc *yyptr =
991 0 : YY_CAST (union yyalloc *,
992 : YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
993 0 : if (! yyptr)
994 0 : goto yyexhaustedlab;
995 0 : YYSTACK_RELOCATE (yyss_alloc, yyss);
996 0 : YYSTACK_RELOCATE (yyvs_alloc, yyvs);
997 : # undef YYSTACK_RELOCATE
998 0 : if (yyss1 != yyssa)
999 0 : YYSTACK_FREE (yyss1);
1000 : }
1001 : # endif
1002 :
1003 0 : yyssp = yyss + yysize - 1;
1004 0 : yyvsp = yyvs + yysize - 1;
1005 :
1006 : YY_IGNORE_USELESS_CAST_BEGIN
1007 : YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1008 : YY_CAST (long, yystacksize)));
1009 : YY_IGNORE_USELESS_CAST_END
1010 :
1011 0 : if (yyss + yystacksize - 1 <= yyssp)
1012 0 : YYABORT;
1013 : }
1014 : #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1015 :
1016 1270 : if (yystate == YYFINAL)
1017 130 : YYACCEPT;
1018 :
1019 1140 : goto yybackup;
1020 :
1021 :
1022 : /*-----------.
1023 : | yybackup. |
1024 : `-----------*/
1025 1140 : yybackup:
1026 : /* Do appropriate processing given the current state. Read a
1027 : lookahead token if we need one and don't already have one. */
1028 :
1029 : /* First try to decide what to do without reference to lookahead token. */
1030 1140 : yyn = yypact[yystate];
1031 1140 : if (yypact_value_is_default (yyn))
1032 546 : goto yydefault;
1033 :
1034 : /* Not known => get a lookahead token if don't already have one. */
1035 :
1036 : /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1037 594 : if (yychar == YYEMPTY)
1038 : {
1039 : YYDPRINTF ((stderr, "Reading a token\n"));
1040 500 : yychar = yylex ();
1041 : }
1042 :
1043 594 : if (yychar <= YYEOF)
1044 : {
1045 224 : yychar = YYEOF;
1046 224 : yytoken = YYSYMBOL_YYEOF;
1047 : YYDPRINTF ((stderr, "Now at end of input.\n"));
1048 : }
1049 370 : else if (yychar == YYerror)
1050 : {
1051 : /* The scanner already issued an error message, process directly
1052 : to error recovery. But do not keep the error token as
1053 : lookahead, it is too special and may lead us to an endless
1054 : loop in error recovery. */
1055 0 : yychar = YYUNDEF;
1056 0 : yytoken = YYSYMBOL_YYerror;
1057 0 : goto yyerrlab1;
1058 : }
1059 : else
1060 : {
1061 370 : yytoken = YYTRANSLATE (yychar);
1062 : YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1063 : }
1064 :
1065 : /* If the proper action on seeing token YYTOKEN is to reduce or to
1066 : detect an error, take that action. */
1067 594 : yyn += yytoken;
1068 594 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1069 94 : goto yydefault;
1070 500 : yyn = yytable[yyn];
1071 500 : if (yyn <= 0)
1072 : {
1073 : if (yytable_value_is_error (yyn))
1074 : goto yyerrlab;
1075 0 : yyn = -yyn;
1076 0 : goto yyreduce;
1077 : }
1078 :
1079 : /* Count tokens shifted since error; after three, turn off error
1080 : status. */
1081 500 : if (yyerrstatus)
1082 0 : yyerrstatus--;
1083 :
1084 : /* Shift the lookahead token. */
1085 : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1086 500 : yystate = yyn;
1087 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1088 500 : *++yyvsp = yylval;
1089 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1090 :
1091 : /* Discard the shifted token. */
1092 500 : yychar = YYEMPTY;
1093 500 : goto yynewstate;
1094 :
1095 :
1096 : /*-----------------------------------------------------------.
1097 : | yydefault -- do the default action for the current state. |
1098 : `-----------------------------------------------------------*/
1099 640 : yydefault:
1100 640 : yyn = yydefact[yystate];
1101 640 : if (yyn == 0)
1102 0 : goto yyerrlab;
1103 640 : goto yyreduce;
1104 :
1105 :
1106 : /*-----------------------------.
1107 : | yyreduce -- do a reduction. |
1108 : `-----------------------------*/
1109 640 : yyreduce:
1110 : /* yyn is the number of a rule to reduce with. */
1111 640 : yylen = yyr2[yyn];
1112 :
1113 : /* If YYLEN is nonzero, implement the default value of the action:
1114 : '$$ = $1'.
1115 :
1116 : Otherwise, the following line sets YYVAL to garbage.
1117 : This behavior is undocumented and Bison
1118 : users should not rely upon it. Assigning to YYVAL
1119 : unconditionally makes the parser a bit smaller, and it avoids a
1120 : GCC warning that YYVAL may be used uninitialized. */
1121 640 : yyval = yyvsp[1-yylen];
1122 :
1123 :
1124 : YY_REDUCE_PRINT (yyn);
1125 640 : switch (yyn)
1126 : {
1127 130 : case 2: /* result: standby_config */
1128 : #line 63 "syncrep_gram.y"
1129 : { syncrep_parse_result = (yyvsp[0].config); }
1130 : #line 1131 "syncrep_gram.c"
1131 130 : break;
1132 :
1133 94 : case 3: /* standby_config: standby_list */
1134 : #line 67 "syncrep_gram.y"
1135 : { (yyval.config) = create_syncrep_config("1", (yyvsp[0].list), SYNC_REP_PRIORITY); }
1136 : #line 1137 "syncrep_gram.c"
1137 94 : break;
1138 :
1139 24 : case 4: /* standby_config: NUM '(' standby_list ')' */
1140 : #line 68 "syncrep_gram.y"
1141 : { (yyval.config) = create_syncrep_config((yyvsp[-3].str), (yyvsp[-1].list), SYNC_REP_PRIORITY); }
1142 : #line 1143 "syncrep_gram.c"
1143 24 : break;
1144 :
1145 8 : case 5: /* standby_config: ANY NUM '(' standby_list ')' */
1146 : #line 69 "syncrep_gram.y"
1147 : { (yyval.config) = create_syncrep_config((yyvsp[-3].str), (yyvsp[-1].list), SYNC_REP_QUORUM); }
1148 : #line 1149 "syncrep_gram.c"
1149 8 : break;
1150 :
1151 4 : case 6: /* standby_config: FIRST NUM '(' standby_list ')' */
1152 : #line 70 "syncrep_gram.y"
1153 : { (yyval.config) = create_syncrep_config((yyvsp[-3].str), (yyvsp[-1].list), SYNC_REP_PRIORITY); }
1154 : #line 1155 "syncrep_gram.c"
1155 4 : break;
1156 :
1157 130 : case 7: /* standby_list: standby_name */
1158 : #line 74 "syncrep_gram.y"
1159 : { (yyval.list) = list_make1((yyvsp[0].str)); }
1160 : #line 1161 "syncrep_gram.c"
1161 130 : break;
1162 :
1163 60 : case 8: /* standby_list: standby_list ',' standby_name */
1164 : #line 75 "syncrep_gram.y"
1165 : { (yyval.list) = lappend((yyvsp[-2].list), (yyvsp[0].str)); }
1166 : #line 1167 "syncrep_gram.c"
1167 60 : break;
1168 :
1169 190 : case 9: /* standby_name: NAME */
1170 : #line 79 "syncrep_gram.y"
1171 : { (yyval.str) = (yyvsp[0].str); }
1172 : #line 1173 "syncrep_gram.c"
1173 190 : break;
1174 :
1175 0 : case 10: /* standby_name: NUM */
1176 : #line 80 "syncrep_gram.y"
1177 : { (yyval.str) = (yyvsp[0].str); }
1178 : #line 1179 "syncrep_gram.c"
1179 0 : break;
1180 :
1181 :
1182 : #line 1183 "syncrep_gram.c"
1183 :
1184 0 : default: break;
1185 : }
1186 : /* User semantic actions sometimes alter yychar, and that requires
1187 : that yytoken be updated with the new translation. We take the
1188 : approach of translating immediately before every use of yytoken.
1189 : One alternative is translating here after every semantic action,
1190 : but that translation would be missed if the semantic action invokes
1191 : YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1192 : if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1193 : incorrect destructor might then be invoked immediately. In the
1194 : case of YYERROR or YYBACKUP, subsequent parser actions might lead
1195 : to an incorrect destructor call or verbose syntax error message
1196 : before the lookahead is translated. */
1197 : YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1198 :
1199 640 : YYPOPSTACK (yylen);
1200 640 : yylen = 0;
1201 :
1202 640 : *++yyvsp = yyval;
1203 :
1204 : /* Now 'shift' the result of the reduction. Determine what state
1205 : that goes to, based on the state we popped back to and the rule
1206 : number reduced by. */
1207 : {
1208 640 : const int yylhs = yyr1[yyn] - YYNTOKENS;
1209 640 : const int yyi = yypgoto[yylhs] + *yyssp;
1210 276 : yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1211 146 : ? yytable[yyi]
1212 916 : : yydefgoto[yylhs]);
1213 : }
1214 :
1215 640 : goto yynewstate;
1216 :
1217 :
1218 : /*--------------------------------------.
1219 : | yyerrlab -- here on detecting error. |
1220 : `--------------------------------------*/
1221 0 : yyerrlab:
1222 : /* Make sure we have latest lookahead translation. See comments at
1223 : user semantic actions for why this is necessary. */
1224 0 : yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1225 : /* If not already recovering from an error, report this error. */
1226 0 : if (!yyerrstatus)
1227 : {
1228 0 : ++yynerrs;
1229 0 : yyerror (YY_("syntax error"));
1230 : }
1231 :
1232 0 : if (yyerrstatus == 3)
1233 : {
1234 : /* If just tried and failed to reuse lookahead token after an
1235 : error, discard it. */
1236 :
1237 0 : if (yychar <= YYEOF)
1238 : {
1239 : /* Return failure if at end of input. */
1240 0 : if (yychar == YYEOF)
1241 0 : YYABORT;
1242 : }
1243 : else
1244 : {
1245 0 : yydestruct ("Error: discarding",
1246 : yytoken, &yylval);
1247 0 : yychar = YYEMPTY;
1248 : }
1249 : }
1250 :
1251 : /* Else will try to reuse lookahead token after shifting the error
1252 : token. */
1253 0 : goto yyerrlab1;
1254 :
1255 :
1256 : /*---------------------------------------------------.
1257 : | yyerrorlab -- error raised explicitly by YYERROR. |
1258 : `---------------------------------------------------*/
1259 : yyerrorlab:
1260 : /* Pacify compilers when the user code never invokes YYERROR and the
1261 : label yyerrorlab therefore never appears in user code. */
1262 : if (0)
1263 : YYERROR;
1264 :
1265 : /* Do not reclaim the symbols of the rule whose action triggered
1266 : this YYERROR. */
1267 : YYPOPSTACK (yylen);
1268 : yylen = 0;
1269 : YY_STACK_PRINT (yyss, yyssp);
1270 : yystate = *yyssp;
1271 : goto yyerrlab1;
1272 :
1273 :
1274 : /*-------------------------------------------------------------.
1275 : | yyerrlab1 -- common code for both syntax error and YYERROR. |
1276 : `-------------------------------------------------------------*/
1277 0 : yyerrlab1:
1278 0 : yyerrstatus = 3; /* Each real token shifted decrements this. */
1279 :
1280 : /* Pop stack until we find a state that shifts the error token. */
1281 : for (;;)
1282 : {
1283 0 : yyn = yypact[yystate];
1284 0 : if (!yypact_value_is_default (yyn))
1285 : {
1286 0 : yyn += YYSYMBOL_YYerror;
1287 0 : if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1288 : {
1289 0 : yyn = yytable[yyn];
1290 0 : if (0 < yyn)
1291 0 : break;
1292 : }
1293 : }
1294 :
1295 : /* Pop the current state because it cannot handle the error token. */
1296 0 : if (yyssp == yyss)
1297 0 : YYABORT;
1298 :
1299 :
1300 0 : yydestruct ("Error: popping",
1301 0 : YY_ACCESSING_SYMBOL (yystate), yyvsp);
1302 0 : YYPOPSTACK (1);
1303 0 : yystate = *yyssp;
1304 : YY_STACK_PRINT (yyss, yyssp);
1305 : }
1306 :
1307 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1308 0 : *++yyvsp = yylval;
1309 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1310 :
1311 :
1312 : /* Shift the error token. */
1313 : YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1314 :
1315 0 : yystate = yyn;
1316 0 : goto yynewstate;
1317 :
1318 :
1319 : /*-------------------------------------.
1320 : | yyacceptlab -- YYACCEPT comes here. |
1321 : `-------------------------------------*/
1322 130 : yyacceptlab:
1323 130 : yyresult = 0;
1324 130 : goto yyreturn;
1325 :
1326 :
1327 : /*-----------------------------------.
1328 : | yyabortlab -- YYABORT comes here. |
1329 : `-----------------------------------*/
1330 0 : yyabortlab:
1331 0 : yyresult = 1;
1332 0 : goto yyreturn;
1333 :
1334 :
1335 : #if !defined yyoverflow
1336 : /*-------------------------------------------------.
1337 : | yyexhaustedlab -- memory exhaustion comes here. |
1338 : `-------------------------------------------------*/
1339 0 : yyexhaustedlab:
1340 0 : yyerror (YY_("memory exhausted"));
1341 0 : yyresult = 2;
1342 0 : goto yyreturn;
1343 : #endif
1344 :
1345 :
1346 : /*-------------------------------------------------------.
1347 : | yyreturn -- parsing is finished, clean up and return. |
1348 : `-------------------------------------------------------*/
1349 130 : yyreturn:
1350 130 : if (yychar != YYEMPTY)
1351 : {
1352 : /* Make sure we have latest lookahead translation. See comments at
1353 : user semantic actions for why this is necessary. */
1354 0 : yytoken = YYTRANSLATE (yychar);
1355 0 : yydestruct ("Cleanup: discarding lookahead",
1356 : yytoken, &yylval);
1357 : }
1358 : /* Do not reclaim the symbols of the rule whose action triggered
1359 : this YYABORT or YYACCEPT. */
1360 130 : YYPOPSTACK (yylen);
1361 : YY_STACK_PRINT (yyss, yyssp);
1362 390 : while (yyssp != yyss)
1363 : {
1364 260 : yydestruct ("Cleanup: popping",
1365 260 : YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
1366 260 : YYPOPSTACK (1);
1367 : }
1368 : #ifndef yyoverflow
1369 130 : if (yyss != yyssa)
1370 0 : YYSTACK_FREE (yyss);
1371 : #endif
1372 :
1373 130 : return yyresult;
1374 : }
1375 :
1376 : #line 82 "syncrep_gram.y"
1377 :
1378 :
1379 : static SyncRepConfigData *
1380 : create_syncrep_config(const char *num_sync, List *members, uint8 syncrep_method)
1381 : {
1382 : SyncRepConfigData *config;
1383 : int size;
1384 : ListCell *lc;
1385 : char *ptr;
1386 :
1387 : /* Compute space needed for flat representation */
1388 : size = offsetof(SyncRepConfigData, member_names);
1389 : foreach(lc, members)
1390 : {
1391 : char *standby_name = (char *) lfirst(lc);
1392 :
1393 : size += strlen(standby_name) + 1;
1394 : }
1395 :
1396 : /* And transform the data into flat representation */
1397 : config = (SyncRepConfigData *) palloc(size);
1398 :
1399 : config->config_size = size;
1400 : config->num_sync = atoi(num_sync);
1401 : config->syncrep_method = syncrep_method;
1402 : config->nmembers = list_length(members);
1403 : ptr = config->member_names;
1404 : foreach(lc, members)
1405 : {
1406 : char *standby_name = (char *) lfirst(lc);
1407 :
1408 : strcpy(ptr, standby_name);
1409 : ptr += strlen(standby_name) + 1;
1410 : }
1411 :
1412 : return config;
1413 : }
|