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 1
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 :
74 : /* First part of user prologue. */
75 : #line 1 "syncrep_gram.y"
76 :
77 : /*-------------------------------------------------------------------------
78 : *
79 : * syncrep_gram.y - Parser for synchronous_standby_names
80 : *
81 : * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
82 : * Portions Copyright (c) 1994, Regents of the University of California
83 : *
84 : *
85 : * IDENTIFICATION
86 : * src/backend/replication/syncrep_gram.y
87 : *
88 : *-------------------------------------------------------------------------
89 : */
90 : #include "postgres.h"
91 :
92 : #include "nodes/pg_list.h"
93 : #include "replication/syncrep.h"
94 :
95 : #include "syncrep_gram.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, 62, 62, 69, 70, 71, 72, 76, 77, 81,
538 : 82
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 (yyscanner, 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, yyscanner); \
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, yyscan_t yyscanner)
731 : {
732 : FILE *yyoutput = yyo;
733 : YY_USE (yyoutput);
734 : YY_USE (yyscanner);
735 : if (!yyvaluep)
736 : return;
737 : # ifdef YYPRINT
738 : if (yykind < YYNTOKENS)
739 : YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
740 : # endif
741 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
742 : YY_USE (yykind);
743 : YY_IGNORE_MAYBE_UNINITIALIZED_END
744 : }
745 :
746 :
747 : /*---------------------------.
748 : | Print this symbol on YYO. |
749 : `---------------------------*/
750 :
751 : static void
752 : yy_symbol_print (FILE *yyo,
753 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
754 : {
755 : YYFPRINTF (yyo, "%s %s (",
756 : yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
757 :
758 : yy_symbol_value_print (yyo, yykind, yyvaluep, yyscanner);
759 : YYFPRINTF (yyo, ")");
760 : }
761 :
762 : /*------------------------------------------------------------------.
763 : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
764 : | TOP (included). |
765 : `------------------------------------------------------------------*/
766 :
767 : static void
768 : yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
769 : {
770 : YYFPRINTF (stderr, "Stack now");
771 : for (; yybottom <= yytop; yybottom++)
772 : {
773 : int yybot = *yybottom;
774 : YYFPRINTF (stderr, " %d", yybot);
775 : }
776 : YYFPRINTF (stderr, "\n");
777 : }
778 :
779 : # define YY_STACK_PRINT(Bottom, Top) \
780 : do { \
781 : if (yydebug) \
782 : yy_stack_print ((Bottom), (Top)); \
783 : } while (0)
784 :
785 :
786 : /*------------------------------------------------.
787 : | Report that the YYRULE is going to be reduced. |
788 : `------------------------------------------------*/
789 :
790 : static void
791 : yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
792 : int yyrule, yyscan_t yyscanner)
793 : {
794 : int yylno = yyrline[yyrule];
795 : int yynrhs = yyr2[yyrule];
796 : int yyi;
797 : YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
798 : yyrule - 1, yylno);
799 : /* The symbols being reduced. */
800 : for (yyi = 0; yyi < yynrhs; yyi++)
801 : {
802 : YYFPRINTF (stderr, " $%d = ", yyi + 1);
803 : yy_symbol_print (stderr,
804 : YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
805 : &yyvsp[(yyi + 1) - (yynrhs)], yyscanner);
806 : YYFPRINTF (stderr, "\n");
807 : }
808 : }
809 :
810 : # define YY_REDUCE_PRINT(Rule) \
811 : do { \
812 : if (yydebug) \
813 : yy_reduce_print (yyssp, yyvsp, Rule, yyscanner); \
814 : } while (0)
815 :
816 : /* Nonzero means print parse trace. It is left uninitialized so that
817 : multiple parsers can coexist. */
818 : int yydebug;
819 : #else /* !YYDEBUG */
820 : # define YYDPRINTF(Args) ((void) 0)
821 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
822 : # define YY_STACK_PRINT(Bottom, Top)
823 : # define YY_REDUCE_PRINT(Rule)
824 : #endif /* !YYDEBUG */
825 :
826 :
827 : /* YYINITDEPTH -- initial size of the parser's stacks. */
828 : #ifndef YYINITDEPTH
829 : # define YYINITDEPTH 200
830 : #endif
831 :
832 : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
833 : if the built-in stack extension method is used).
834 :
835 : Do not make this value too large; the results are undefined if
836 : YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
837 : evaluated with infinite-precision integer arithmetic. */
838 :
839 : #ifndef YYMAXDEPTH
840 : # define YYMAXDEPTH 10000
841 : #endif
842 :
843 :
844 :
845 :
846 :
847 :
848 : /*-----------------------------------------------.
849 : | Release the memory associated to this symbol. |
850 : `-----------------------------------------------*/
851 :
852 : static void
853 260 : yydestruct (const char *yymsg,
854 : yysymbol_kind_t yykind, YYSTYPE *yyvaluep, yyscan_t yyscanner)
855 : {
856 : YY_USE (yyvaluep);
857 : YY_USE (yyscanner);
858 260 : if (!yymsg)
859 0 : yymsg = "Deleting";
860 : YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
861 :
862 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
863 : YY_USE (yykind);
864 : YY_IGNORE_MAYBE_UNINITIALIZED_END
865 260 : }
866 :
867 :
868 :
869 :
870 :
871 :
872 : /*----------.
873 : | yyparse. |
874 : `----------*/
875 :
876 : int
877 130 : yyparse (yyscan_t yyscanner)
878 : {
879 : /* Lookahead token kind. */
880 : int yychar;
881 :
882 :
883 : /* The semantic value of the lookahead symbol. */
884 : /* Default value used for initialization, for pacifying older GCCs
885 : or non-GCC compilers. */
886 : YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
887 : YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
888 :
889 : /* Number of syntax errors so far. */
890 130 : int yynerrs = 0;
891 :
892 130 : yy_state_fast_t yystate = 0;
893 : /* Number of tokens to shift before error messages enabled. */
894 130 : int yyerrstatus = 0;
895 :
896 : /* Refer to the stacks through separate pointers, to allow yyoverflow
897 : to reallocate them elsewhere. */
898 :
899 : /* Their size. */
900 130 : YYPTRDIFF_T yystacksize = YYINITDEPTH;
901 :
902 : /* The state stack: array, bottom, top. */
903 : yy_state_t yyssa[YYINITDEPTH];
904 130 : yy_state_t *yyss = yyssa;
905 130 : yy_state_t *yyssp = yyss;
906 :
907 : /* The semantic value stack: array, bottom, top. */
908 : YYSTYPE yyvsa[YYINITDEPTH];
909 130 : YYSTYPE *yyvs = yyvsa;
910 130 : YYSTYPE *yyvsp = yyvs;
911 :
912 : int yyn;
913 : /* The return value of yyparse. */
914 : int yyresult;
915 : /* Lookahead symbol kind. */
916 130 : yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
917 : /* The variables used to return semantic value and location from the
918 : action routines. */
919 : YYSTYPE yyval;
920 :
921 :
922 :
923 : #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
924 :
925 : /* The number of symbols on the RHS of the reduced rule.
926 : Keep to zero when no symbol should be popped. */
927 130 : int yylen = 0;
928 :
929 : YYDPRINTF ((stderr, "Starting parse\n"));
930 :
931 130 : yychar = YYEMPTY; /* Cause a token to be read. */
932 130 : goto yysetstate;
933 :
934 :
935 : /*------------------------------------------------------------.
936 : | yynewstate -- push a new state, which is found in yystate. |
937 : `------------------------------------------------------------*/
938 1140 : yynewstate:
939 : /* In all cases, when you get here, the value and location stacks
940 : have just been pushed. So pushing a state here evens the stacks. */
941 1140 : yyssp++;
942 :
943 :
944 : /*--------------------------------------------------------------------.
945 : | yysetstate -- set current state (the top of the stack) to yystate. |
946 : `--------------------------------------------------------------------*/
947 1270 : yysetstate:
948 : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
949 : YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
950 : YY_IGNORE_USELESS_CAST_BEGIN
951 1270 : *yyssp = YY_CAST (yy_state_t, yystate);
952 : YY_IGNORE_USELESS_CAST_END
953 : YY_STACK_PRINT (yyss, yyssp);
954 :
955 1270 : if (yyss + yystacksize - 1 <= yyssp)
956 : #if !defined yyoverflow && !defined YYSTACK_RELOCATE
957 : goto yyexhaustedlab;
958 : #else
959 : {
960 : /* Get the current used size of the three stacks, in elements. */
961 0 : YYPTRDIFF_T yysize = yyssp - yyss + 1;
962 :
963 : # if defined yyoverflow
964 : {
965 : /* Give user a chance to reallocate the stack. Use copies of
966 : these so that the &'s don't force the real ones into
967 : memory. */
968 : yy_state_t *yyss1 = yyss;
969 : YYSTYPE *yyvs1 = yyvs;
970 :
971 : /* Each stack pointer address is followed by the size of the
972 : data in use in that stack, in bytes. This used to be a
973 : conditional around just the two extra args, but that might
974 : be undefined if yyoverflow is a macro. */
975 : yyoverflow (YY_("memory exhausted"),
976 : &yyss1, yysize * YYSIZEOF (*yyssp),
977 : &yyvs1, yysize * YYSIZEOF (*yyvsp),
978 : &yystacksize);
979 : yyss = yyss1;
980 : yyvs = yyvs1;
981 : }
982 : # else /* defined YYSTACK_RELOCATE */
983 : /* Extend the stack our own way. */
984 0 : if (YYMAXDEPTH <= yystacksize)
985 0 : goto yyexhaustedlab;
986 0 : yystacksize *= 2;
987 0 : if (YYMAXDEPTH < yystacksize)
988 0 : yystacksize = YYMAXDEPTH;
989 :
990 : {
991 0 : yy_state_t *yyss1 = yyss;
992 : union yyalloc *yyptr =
993 0 : YY_CAST (union yyalloc *,
994 : YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
995 0 : if (! yyptr)
996 0 : goto yyexhaustedlab;
997 0 : YYSTACK_RELOCATE (yyss_alloc, yyss);
998 0 : YYSTACK_RELOCATE (yyvs_alloc, yyvs);
999 : # undef YYSTACK_RELOCATE
1000 0 : if (yyss1 != yyssa)
1001 0 : YYSTACK_FREE (yyss1);
1002 : }
1003 : # endif
1004 :
1005 0 : yyssp = yyss + yysize - 1;
1006 0 : yyvsp = yyvs + yysize - 1;
1007 :
1008 : YY_IGNORE_USELESS_CAST_BEGIN
1009 : YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1010 : YY_CAST (long, yystacksize)));
1011 : YY_IGNORE_USELESS_CAST_END
1012 :
1013 0 : if (yyss + yystacksize - 1 <= yyssp)
1014 0 : YYABORT;
1015 : }
1016 : #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1017 :
1018 1270 : if (yystate == YYFINAL)
1019 130 : YYACCEPT;
1020 :
1021 1140 : goto yybackup;
1022 :
1023 :
1024 : /*-----------.
1025 : | yybackup. |
1026 : `-----------*/
1027 1140 : yybackup:
1028 : /* Do appropriate processing given the current state. Read a
1029 : lookahead token if we need one and don't already have one. */
1030 :
1031 : /* First try to decide what to do without reference to lookahead token. */
1032 1140 : yyn = yypact[yystate];
1033 1140 : if (yypact_value_is_default (yyn))
1034 546 : goto yydefault;
1035 :
1036 : /* Not known => get a lookahead token if don't already have one. */
1037 :
1038 : /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1039 594 : if (yychar == YYEMPTY)
1040 : {
1041 : YYDPRINTF ((stderr, "Reading a token\n"));
1042 500 : yychar = yylex (&yylval, yyscanner);
1043 : }
1044 :
1045 594 : if (yychar <= YYEOF)
1046 : {
1047 224 : yychar = YYEOF;
1048 224 : yytoken = YYSYMBOL_YYEOF;
1049 : YYDPRINTF ((stderr, "Now at end of input.\n"));
1050 : }
1051 370 : else if (yychar == YYerror)
1052 : {
1053 : /* The scanner already issued an error message, process directly
1054 : to error recovery. But do not keep the error token as
1055 : lookahead, it is too special and may lead us to an endless
1056 : loop in error recovery. */
1057 0 : yychar = YYUNDEF;
1058 0 : yytoken = YYSYMBOL_YYerror;
1059 0 : goto yyerrlab1;
1060 : }
1061 : else
1062 : {
1063 370 : yytoken = YYTRANSLATE (yychar);
1064 : YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1065 : }
1066 :
1067 : /* If the proper action on seeing token YYTOKEN is to reduce or to
1068 : detect an error, take that action. */
1069 594 : yyn += yytoken;
1070 594 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1071 94 : goto yydefault;
1072 500 : yyn = yytable[yyn];
1073 500 : if (yyn <= 0)
1074 : {
1075 : if (yytable_value_is_error (yyn))
1076 : goto yyerrlab;
1077 0 : yyn = -yyn;
1078 0 : goto yyreduce;
1079 : }
1080 :
1081 : /* Count tokens shifted since error; after three, turn off error
1082 : status. */
1083 500 : if (yyerrstatus)
1084 0 : yyerrstatus--;
1085 :
1086 : /* Shift the lookahead token. */
1087 : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1088 500 : yystate = yyn;
1089 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1090 500 : *++yyvsp = yylval;
1091 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1092 :
1093 : /* Discard the shifted token. */
1094 500 : yychar = YYEMPTY;
1095 500 : goto yynewstate;
1096 :
1097 :
1098 : /*-----------------------------------------------------------.
1099 : | yydefault -- do the default action for the current state. |
1100 : `-----------------------------------------------------------*/
1101 640 : yydefault:
1102 640 : yyn = yydefact[yystate];
1103 640 : if (yyn == 0)
1104 0 : goto yyerrlab;
1105 640 : goto yyreduce;
1106 :
1107 :
1108 : /*-----------------------------.
1109 : | yyreduce -- do a reduction. |
1110 : `-----------------------------*/
1111 640 : yyreduce:
1112 : /* yyn is the number of a rule to reduce with. */
1113 640 : yylen = yyr2[yyn];
1114 :
1115 : /* If YYLEN is nonzero, implement the default value of the action:
1116 : '$$ = $1'.
1117 :
1118 : Otherwise, the following line sets YYVAL to garbage.
1119 : This behavior is undocumented and Bison
1120 : users should not rely upon it. Assigning to YYVAL
1121 : unconditionally makes the parser a bit smaller, and it avoids a
1122 : GCC warning that YYVAL may be used uninitialized. */
1123 640 : yyval = yyvsp[1-yylen];
1124 :
1125 :
1126 : YY_REDUCE_PRINT (yyn);
1127 640 : switch (yyn)
1128 : {
1129 130 : case 2: /* result: standby_config */
1130 : #line 62 "syncrep_gram.y"
1131 : {
1132 : syncrep_parse_result = (yyvsp[0].config);
1133 : (void) yynerrs; /* suppress compiler warning */
1134 : }
1135 : #line 1136 "syncrep_gram.c"
1136 130 : break;
1137 :
1138 94 : case 3: /* standby_config: standby_list */
1139 : #line 69 "syncrep_gram.y"
1140 : { (yyval.config) = create_syncrep_config("1", (yyvsp[0].list), SYNC_REP_PRIORITY); }
1141 : #line 1142 "syncrep_gram.c"
1142 94 : break;
1143 :
1144 24 : case 4: /* standby_config: NUM '(' standby_list ')' */
1145 : #line 70 "syncrep_gram.y"
1146 : { (yyval.config) = create_syncrep_config((yyvsp[-3].str), (yyvsp[-1].list), SYNC_REP_PRIORITY); }
1147 : #line 1148 "syncrep_gram.c"
1148 24 : break;
1149 :
1150 8 : case 5: /* standby_config: ANY NUM '(' standby_list ')' */
1151 : #line 71 "syncrep_gram.y"
1152 : { (yyval.config) = create_syncrep_config((yyvsp[-3].str), (yyvsp[-1].list), SYNC_REP_QUORUM); }
1153 : #line 1154 "syncrep_gram.c"
1154 8 : break;
1155 :
1156 4 : case 6: /* standby_config: FIRST NUM '(' standby_list ')' */
1157 : #line 72 "syncrep_gram.y"
1158 : { (yyval.config) = create_syncrep_config((yyvsp[-3].str), (yyvsp[-1].list), SYNC_REP_PRIORITY); }
1159 : #line 1160 "syncrep_gram.c"
1160 4 : break;
1161 :
1162 130 : case 7: /* standby_list: standby_name */
1163 : #line 76 "syncrep_gram.y"
1164 : { (yyval.list) = list_make1((yyvsp[0].str)); }
1165 : #line 1166 "syncrep_gram.c"
1166 130 : break;
1167 :
1168 60 : case 8: /* standby_list: standby_list ',' standby_name */
1169 : #line 77 "syncrep_gram.y"
1170 : { (yyval.list) = lappend((yyvsp[-2].list), (yyvsp[0].str)); }
1171 : #line 1172 "syncrep_gram.c"
1172 60 : break;
1173 :
1174 190 : case 9: /* standby_name: NAME */
1175 : #line 81 "syncrep_gram.y"
1176 : { (yyval.str) = (yyvsp[0].str); }
1177 : #line 1178 "syncrep_gram.c"
1178 190 : break;
1179 :
1180 0 : case 10: /* standby_name: NUM */
1181 : #line 82 "syncrep_gram.y"
1182 : { (yyval.str) = (yyvsp[0].str); }
1183 : #line 1184 "syncrep_gram.c"
1184 0 : break;
1185 :
1186 :
1187 : #line 1188 "syncrep_gram.c"
1188 :
1189 0 : default: break;
1190 : }
1191 : /* User semantic actions sometimes alter yychar, and that requires
1192 : that yytoken be updated with the new translation. We take the
1193 : approach of translating immediately before every use of yytoken.
1194 : One alternative is translating here after every semantic action,
1195 : but that translation would be missed if the semantic action invokes
1196 : YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1197 : if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1198 : incorrect destructor might then be invoked immediately. In the
1199 : case of YYERROR or YYBACKUP, subsequent parser actions might lead
1200 : to an incorrect destructor call or verbose syntax error message
1201 : before the lookahead is translated. */
1202 : YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1203 :
1204 640 : YYPOPSTACK (yylen);
1205 640 : yylen = 0;
1206 :
1207 640 : *++yyvsp = yyval;
1208 :
1209 : /* Now 'shift' the result of the reduction. Determine what state
1210 : that goes to, based on the state we popped back to and the rule
1211 : number reduced by. */
1212 : {
1213 640 : const int yylhs = yyr1[yyn] - YYNTOKENS;
1214 640 : const int yyi = yypgoto[yylhs] + *yyssp;
1215 276 : yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1216 146 : ? yytable[yyi]
1217 916 : : yydefgoto[yylhs]);
1218 : }
1219 :
1220 640 : goto yynewstate;
1221 :
1222 :
1223 : /*--------------------------------------.
1224 : | yyerrlab -- here on detecting error. |
1225 : `--------------------------------------*/
1226 0 : yyerrlab:
1227 : /* Make sure we have latest lookahead translation. See comments at
1228 : user semantic actions for why this is necessary. */
1229 0 : yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1230 : /* If not already recovering from an error, report this error. */
1231 0 : if (!yyerrstatus)
1232 : {
1233 0 : ++yynerrs;
1234 0 : yyerror (yyscanner, YY_("syntax error"));
1235 : }
1236 :
1237 0 : if (yyerrstatus == 3)
1238 : {
1239 : /* If just tried and failed to reuse lookahead token after an
1240 : error, discard it. */
1241 :
1242 0 : if (yychar <= YYEOF)
1243 : {
1244 : /* Return failure if at end of input. */
1245 0 : if (yychar == YYEOF)
1246 0 : YYABORT;
1247 : }
1248 : else
1249 : {
1250 0 : yydestruct ("Error: discarding",
1251 : yytoken, &yylval, yyscanner);
1252 0 : yychar = YYEMPTY;
1253 : }
1254 : }
1255 :
1256 : /* Else will try to reuse lookahead token after shifting the error
1257 : token. */
1258 0 : goto yyerrlab1;
1259 :
1260 :
1261 : /*---------------------------------------------------.
1262 : | yyerrorlab -- error raised explicitly by YYERROR. |
1263 : `---------------------------------------------------*/
1264 : yyerrorlab:
1265 : /* Pacify compilers when the user code never invokes YYERROR and the
1266 : label yyerrorlab therefore never appears in user code. */
1267 : if (0)
1268 : YYERROR;
1269 :
1270 : /* Do not reclaim the symbols of the rule whose action triggered
1271 : this YYERROR. */
1272 : YYPOPSTACK (yylen);
1273 : yylen = 0;
1274 : YY_STACK_PRINT (yyss, yyssp);
1275 : yystate = *yyssp;
1276 : goto yyerrlab1;
1277 :
1278 :
1279 : /*-------------------------------------------------------------.
1280 : | yyerrlab1 -- common code for both syntax error and YYERROR. |
1281 : `-------------------------------------------------------------*/
1282 0 : yyerrlab1:
1283 0 : yyerrstatus = 3; /* Each real token shifted decrements this. */
1284 :
1285 : /* Pop stack until we find a state that shifts the error token. */
1286 : for (;;)
1287 : {
1288 0 : yyn = yypact[yystate];
1289 0 : if (!yypact_value_is_default (yyn))
1290 : {
1291 0 : yyn += YYSYMBOL_YYerror;
1292 0 : if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1293 : {
1294 0 : yyn = yytable[yyn];
1295 0 : if (0 < yyn)
1296 0 : break;
1297 : }
1298 : }
1299 :
1300 : /* Pop the current state because it cannot handle the error token. */
1301 0 : if (yyssp == yyss)
1302 0 : YYABORT;
1303 :
1304 :
1305 0 : yydestruct ("Error: popping",
1306 0 : YY_ACCESSING_SYMBOL (yystate), yyvsp, yyscanner);
1307 0 : YYPOPSTACK (1);
1308 0 : yystate = *yyssp;
1309 : YY_STACK_PRINT (yyss, yyssp);
1310 : }
1311 :
1312 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1313 0 : *++yyvsp = yylval;
1314 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1315 :
1316 :
1317 : /* Shift the error token. */
1318 : YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1319 :
1320 0 : yystate = yyn;
1321 0 : goto yynewstate;
1322 :
1323 :
1324 : /*-------------------------------------.
1325 : | yyacceptlab -- YYACCEPT comes here. |
1326 : `-------------------------------------*/
1327 130 : yyacceptlab:
1328 130 : yyresult = 0;
1329 130 : goto yyreturn;
1330 :
1331 :
1332 : /*-----------------------------------.
1333 : | yyabortlab -- YYABORT comes here. |
1334 : `-----------------------------------*/
1335 0 : yyabortlab:
1336 0 : yyresult = 1;
1337 0 : goto yyreturn;
1338 :
1339 :
1340 : #if !defined yyoverflow
1341 : /*-------------------------------------------------.
1342 : | yyexhaustedlab -- memory exhaustion comes here. |
1343 : `-------------------------------------------------*/
1344 0 : yyexhaustedlab:
1345 0 : yyerror (yyscanner, YY_("memory exhausted"));
1346 0 : yyresult = 2;
1347 0 : goto yyreturn;
1348 : #endif
1349 :
1350 :
1351 : /*-------------------------------------------------------.
1352 : | yyreturn -- parsing is finished, clean up and return. |
1353 : `-------------------------------------------------------*/
1354 130 : yyreturn:
1355 130 : if (yychar != YYEMPTY)
1356 : {
1357 : /* Make sure we have latest lookahead translation. See comments at
1358 : user semantic actions for why this is necessary. */
1359 0 : yytoken = YYTRANSLATE (yychar);
1360 0 : yydestruct ("Cleanup: discarding lookahead",
1361 : yytoken, &yylval, yyscanner);
1362 : }
1363 : /* Do not reclaim the symbols of the rule whose action triggered
1364 : this YYABORT or YYACCEPT. */
1365 130 : YYPOPSTACK (yylen);
1366 : YY_STACK_PRINT (yyss, yyssp);
1367 390 : while (yyssp != yyss)
1368 : {
1369 260 : yydestruct ("Cleanup: popping",
1370 260 : YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yyscanner);
1371 260 : YYPOPSTACK (1);
1372 : }
1373 : #ifndef yyoverflow
1374 130 : if (yyss != yyssa)
1375 0 : YYSTACK_FREE (yyss);
1376 : #endif
1377 :
1378 130 : return yyresult;
1379 : }
1380 :
1381 : #line 84 "syncrep_gram.y"
1382 :
1383 :
1384 : static SyncRepConfigData *
1385 : create_syncrep_config(const char *num_sync, List *members, uint8 syncrep_method)
1386 : {
1387 : SyncRepConfigData *config;
1388 : int size;
1389 : ListCell *lc;
1390 : char *ptr;
1391 :
1392 : /* Compute space needed for flat representation */
1393 : size = offsetof(SyncRepConfigData, member_names);
1394 : foreach(lc, members)
1395 : {
1396 : char *standby_name = (char *) lfirst(lc);
1397 :
1398 : size += strlen(standby_name) + 1;
1399 : }
1400 :
1401 : /* And transform the data into flat representation */
1402 : config = (SyncRepConfigData *) palloc(size);
1403 :
1404 : config->config_size = size;
1405 : config->num_sync = atoi(num_sync);
1406 : config->syncrep_method = syncrep_method;
1407 : config->nmembers = list_length(members);
1408 : ptr = config->member_names;
1409 : foreach(lc, members)
1410 : {
1411 : char *standby_name = (char *) lfirst(lc);
1412 :
1413 : strcpy(ptr, standby_name);
1414 : ptr += strlen(standby_name) + 1;
1415 : }
1416 :
1417 : return config;
1418 : }
|