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