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