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