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 : 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 : #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
311 : /* Suppress an incorrect diagnostic about yylval being uninitialized. */
312 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
313 : _Pragma ("GCC diagnostic push") \
314 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
315 : _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
316 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
317 : _Pragma ("GCC diagnostic pop")
318 : #else
319 : # define YY_INITIAL_VALUE(Value) Value
320 : #endif
321 : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
322 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
323 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
324 : #endif
325 : #ifndef YY_INITIAL_VALUE
326 : # define YY_INITIAL_VALUE(Value) /* Nothing. */
327 : #endif
328 :
329 : #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
330 : # define YY_IGNORE_USELESS_CAST_BEGIN \
331 : _Pragma ("GCC diagnostic push") \
332 : _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
333 : # define YY_IGNORE_USELESS_CAST_END \
334 : _Pragma ("GCC diagnostic pop")
335 : #endif
336 : #ifndef YY_IGNORE_USELESS_CAST_BEGIN
337 : # define YY_IGNORE_USELESS_CAST_BEGIN
338 : # define YY_IGNORE_USELESS_CAST_END
339 : #endif
340 :
341 :
342 : #define YY_ASSERT(E) ((void) (0 && (E)))
343 :
344 : #if !defined yyoverflow
345 :
346 : /* The parser invokes alloca or malloc; define the necessary symbols. */
347 :
348 : # ifdef YYSTACK_USE_ALLOCA
349 : # if YYSTACK_USE_ALLOCA
350 : # ifdef __GNUC__
351 : # define YYSTACK_ALLOC __builtin_alloca
352 : # elif defined __BUILTIN_VA_ARG_INCR
353 : # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
354 : # elif defined _AIX
355 : # define YYSTACK_ALLOC __alloca
356 : # elif defined _MSC_VER
357 : # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
358 : # define alloca _alloca
359 : # else
360 : # define YYSTACK_ALLOC alloca
361 : # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
362 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
363 : /* Use EXIT_SUCCESS as a witness for stdlib.h. */
364 : # ifndef EXIT_SUCCESS
365 : # define EXIT_SUCCESS 0
366 : # endif
367 : # endif
368 : # endif
369 : # endif
370 : # endif
371 :
372 : # ifdef YYSTACK_ALLOC
373 : /* Pacify GCC's 'empty if-body' warning. */
374 : # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
375 : # ifndef YYSTACK_ALLOC_MAXIMUM
376 : /* The OS might guarantee only one guard page at the bottom of the stack,
377 : and a page size can be as small as 4096 bytes. So we cannot safely
378 : invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
379 : to allow for a few compiler-allocated temporary stack slots. */
380 : # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
381 : # endif
382 : # else
383 : # define YYSTACK_ALLOC YYMALLOC
384 : # define YYSTACK_FREE YYFREE
385 : # ifndef YYSTACK_ALLOC_MAXIMUM
386 : # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
387 : # endif
388 : # if (defined __cplusplus && ! defined EXIT_SUCCESS \
389 : && ! ((defined YYMALLOC || defined malloc) \
390 : && (defined YYFREE || defined free)))
391 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
392 : # ifndef EXIT_SUCCESS
393 : # define EXIT_SUCCESS 0
394 : # endif
395 : # endif
396 : # ifndef YYMALLOC
397 : # define YYMALLOC malloc
398 : # if ! defined malloc && ! defined EXIT_SUCCESS
399 : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
400 : # endif
401 : # endif
402 : # ifndef YYFREE
403 : # define YYFREE free
404 : # if ! defined free && ! defined EXIT_SUCCESS
405 : void free (void *); /* INFRINGES ON USER NAME SPACE */
406 : # endif
407 : # endif
408 : # endif
409 : #endif /* !defined yyoverflow */
410 :
411 : #if (! defined yyoverflow \
412 : && (! defined __cplusplus \
413 : || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
414 :
415 : /* A type that is properly aligned for any stack member. */
416 : union yyalloc
417 : {
418 : yy_state_t yyss_alloc;
419 : YYSTYPE yyvs_alloc;
420 : };
421 :
422 : /* The size of the maximum gap between one aligned stack and the next. */
423 : # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
424 :
425 : /* The size of an array large to enough to hold all stacks, each with
426 : N elements. */
427 : # define YYSTACK_BYTES(N) \
428 : ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
429 : + YYSTACK_GAP_MAXIMUM)
430 :
431 : # define YYCOPY_NEEDED 1
432 :
433 : /* Relocate STACK from its old location to the new one. The
434 : local variables YYSIZE and YYSTACKSIZE give the old and new number of
435 : elements in the stack, and YYPTR gives the new location of the
436 : stack. Advance YYPTR to a properly aligned location for the next
437 : stack. */
438 : # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
439 : do \
440 : { \
441 : YYPTRDIFF_T yynewbytes; \
442 : YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
443 : Stack = &yyptr->Stack_alloc; \
444 : yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
445 : yyptr += yynewbytes / YYSIZEOF (*yyptr); \
446 : } \
447 : while (0)
448 :
449 : #endif
450 :
451 : #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
452 : /* Copy COUNT objects from SRC to DST. The source and destination do
453 : not overlap. */
454 : # ifndef YYCOPY
455 : # if defined __GNUC__ && 1 < __GNUC__
456 : # define YYCOPY(Dst, Src, Count) \
457 : __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
458 : # else
459 : # define YYCOPY(Dst, Src, Count) \
460 : do \
461 : { \
462 : YYPTRDIFF_T yyi; \
463 : for (yyi = 0; yyi < (Count); yyi++) \
464 : (Dst)[yyi] = (Src)[yyi]; \
465 : } \
466 : while (0)
467 : # endif
468 : # endif
469 : #endif /* !YYCOPY_NEEDED */
470 :
471 : /* YYFINAL -- State number of the termination state. */
472 : #define YYFINAL 12
473 : /* YYLAST -- Last index in YYTABLE. */
474 : #define YYLAST 22
475 :
476 : /* YYNTOKENS -- Number of terminals. */
477 : #define YYNTOKENS 11
478 : /* YYNNTS -- Number of nonterminals. */
479 : #define YYNNTS 5
480 : /* YYNRULES -- Number of rules. */
481 : #define YYNRULES 10
482 : /* YYNSTATES -- Number of states. */
483 : #define YYNSTATES 24
484 :
485 : /* YYMAXUTOK -- Last valid token kind. */
486 : #define YYMAXUTOK 262
487 :
488 :
489 : /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
490 : as returned by yylex, with out-of-bounds checking. */
491 : #define YYTRANSLATE(YYX) \
492 : (0 <= (YYX) && (YYX) <= YYMAXUTOK \
493 : ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
494 : : YYSYMBOL_YYUNDEF)
495 :
496 : /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
497 : as returned by yylex. */
498 : static const yytype_int8 yytranslate[] =
499 : {
500 : 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 : 8, 9, 2, 2, 10, 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 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
509 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
510 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
511 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512 : 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, 1, 2, 3, 4,
526 : 5, 6, 7
527 : };
528 :
529 : #if YYDEBUG
530 : /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
531 : static const yytype_int8 yyrline[] =
532 : {
533 : 0, 61, 61, 68, 69, 70, 71, 75, 76, 80,
534 : 81
535 : };
536 : #endif
537 :
538 : /** Accessing symbol of state STATE. */
539 : #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
540 :
541 : #if YYDEBUG || 0
542 : /* The user-facing name of the symbol whose (internal) number is
543 : YYSYMBOL. No bounds checking. */
544 : static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
545 :
546 : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
547 : First, the terminals, then, starting at YYNTOKENS, nonterminals. */
548 : static const char *const yytname[] =
549 : {
550 : "\"end of file\"", "error", "\"invalid token\"", "NAME", "NUM", "JUNK",
551 : "ANY", "FIRST", "'('", "')'", "','", "$accept", "result",
552 : "standby_config", "standby_list", "standby_name", YY_NULLPTR
553 : };
554 :
555 : static const char *
556 : yysymbol_name (yysymbol_kind_t yysymbol)
557 : {
558 : return yytname[yysymbol];
559 : }
560 : #endif
561 :
562 : #ifdef YYPRINT
563 : /* YYTOKNUM[NUM] -- (External) token number corresponding to the
564 : (internal) symbol number NUM (which must be that of a token). */
565 : static const yytype_int16 yytoknum[] =
566 : {
567 : 0, 256, 257, 258, 259, 260, 261, 262, 40, 41,
568 : 44
569 : };
570 : #endif
571 :
572 : #define YYPACT_NINF (-10)
573 :
574 : #define yypact_value_is_default(Yyn) \
575 : ((Yyn) == YYPACT_NINF)
576 :
577 : #define YYTABLE_NINF (-1)
578 :
579 : #define yytable_value_is_error(Yyn) \
580 : 0
581 :
582 : /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
583 : STATE-NUM. */
584 : static const yytype_int8 yypact[] =
585 : {
586 : -2, -10, -5, 11, 14, 19, -10, -4, -10, 6,
587 : 12, 13, -10, 6, -10, 2, 6, 6, -10, -10,
588 : 4, 7, -10, -10
589 : };
590 :
591 : /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
592 : Performed when YYTABLE does not specify something else to do. Zero
593 : means the default is an error. */
594 : static const yytype_int8 yydefact[] =
595 : {
596 : 0, 9, 10, 0, 0, 0, 2, 3, 7, 0,
597 : 0, 0, 1, 0, 10, 0, 0, 0, 8, 4,
598 : 0, 0, 5, 6
599 : };
600 :
601 : /* YYPGOTO[NTERM-NUM]. */
602 : static const yytype_int8 yypgoto[] =
603 : {
604 : -10, -10, -10, -9, 9
605 : };
606 :
607 : /* YYDEFGOTO[NTERM-NUM]. */
608 : static const yytype_int8 yydefgoto[] =
609 : {
610 : 0, 5, 6, 7, 8
611 : };
612 :
613 : /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
614 : positive, shift that token. If negative, reduce the rule whose
615 : number is the opposite. If YYTABLE_NINF, syntax error. */
616 : static const yytype_int8 yytable[] =
617 : {
618 : 15, 1, 2, 9, 3, 4, 13, 20, 21, 1,
619 : 14, 19, 13, 22, 13, 10, 23, 13, 11, 12,
620 : 16, 17, 18
621 : };
622 :
623 : static const yytype_int8 yycheck[] =
624 : {
625 : 9, 3, 4, 8, 6, 7, 10, 16, 17, 3,
626 : 4, 9, 10, 9, 10, 4, 9, 10, 4, 0,
627 : 8, 8, 13
628 : };
629 :
630 : /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
631 : symbol of state STATE-NUM. */
632 : static const yytype_int8 yystos[] =
633 : {
634 : 0, 3, 4, 6, 7, 12, 13, 14, 15, 8,
635 : 4, 4, 0, 10, 4, 14, 8, 8, 15, 9,
636 : 14, 14, 9, 9
637 : };
638 :
639 : /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
640 : static const yytype_int8 yyr1[] =
641 : {
642 : 0, 11, 12, 13, 13, 13, 13, 14, 14, 15,
643 : 15
644 : };
645 :
646 : /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
647 : static const yytype_int8 yyr2[] =
648 : {
649 : 0, 2, 1, 1, 4, 5, 5, 1, 3, 1,
650 : 1
651 : };
652 :
653 :
654 : enum { YYENOMEM = -2 };
655 :
656 : #define yyerrok (yyerrstatus = 0)
657 : #define yyclearin (yychar = YYEMPTY)
658 :
659 : #define YYACCEPT goto yyacceptlab
660 : #define YYABORT goto yyabortlab
661 : #define YYERROR goto yyerrorlab
662 :
663 :
664 : #define YYRECOVERING() (!!yyerrstatus)
665 :
666 : #define YYBACKUP(Token, Value) \
667 : do \
668 : if (yychar == YYEMPTY) \
669 : { \
670 : yychar = (Token); \
671 : yylval = (Value); \
672 : YYPOPSTACK (yylen); \
673 : yystate = *yyssp; \
674 : goto yybackup; \
675 : } \
676 : else \
677 : { \
678 : yyerror (syncrep_parse_result_p, syncrep_parse_error_msg_p, yyscanner, YY_("syntax error: cannot back up")); \
679 : YYERROR; \
680 : } \
681 : while (0)
682 :
683 : /* Backward compatibility with an undocumented macro.
684 : Use YYerror or YYUNDEF. */
685 : #define YYERRCODE YYUNDEF
686 :
687 :
688 : /* Enable debugging if requested. */
689 : #if YYDEBUG
690 :
691 : # ifndef YYFPRINTF
692 : # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
693 : # define YYFPRINTF fprintf
694 : # endif
695 :
696 : # define YYDPRINTF(Args) \
697 : do { \
698 : if (yydebug) \
699 : YYFPRINTF Args; \
700 : } while (0)
701 :
702 : /* This macro is provided for backward compatibility. */
703 : # ifndef YY_LOCATION_PRINT
704 : # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
705 : # endif
706 :
707 :
708 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
709 : do { \
710 : if (yydebug) \
711 : { \
712 : YYFPRINTF (stderr, "%s ", Title); \
713 : yy_symbol_print (stderr, \
714 : Kind, Value, syncrep_parse_result_p, syncrep_parse_error_msg_p, yyscanner); \
715 : YYFPRINTF (stderr, "\n"); \
716 : } \
717 : } while (0)
718 :
719 :
720 : /*-----------------------------------.
721 : | Print this symbol's value on YYO. |
722 : `-----------------------------------*/
723 :
724 : static void
725 : yy_symbol_value_print (FILE *yyo,
726 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse_error_msg_p, yyscan_t yyscanner)
727 : {
728 : FILE *yyoutput = yyo;
729 : YY_USE (yyoutput);
730 : YY_USE (syncrep_parse_result_p);
731 : YY_USE (syncrep_parse_error_msg_p);
732 : YY_USE (yyscanner);
733 : if (!yyvaluep)
734 : return;
735 : # ifdef YYPRINT
736 : if (yykind < YYNTOKENS)
737 : YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
738 : # endif
739 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
740 : YY_USE (yykind);
741 : YY_IGNORE_MAYBE_UNINITIALIZED_END
742 : }
743 :
744 :
745 : /*---------------------------.
746 : | Print this symbol on YYO. |
747 : `---------------------------*/
748 :
749 : static void
750 : yy_symbol_print (FILE *yyo,
751 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse_error_msg_p, yyscan_t yyscanner)
752 : {
753 : YYFPRINTF (yyo, "%s %s (",
754 : yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
755 :
756 : yy_symbol_value_print (yyo, yykind, yyvaluep, syncrep_parse_result_p, syncrep_parse_error_msg_p, yyscanner);
757 : YYFPRINTF (yyo, ")");
758 : }
759 :
760 : /*------------------------------------------------------------------.
761 : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
762 : | TOP (included). |
763 : `------------------------------------------------------------------*/
764 :
765 : static void
766 : yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
767 : {
768 : YYFPRINTF (stderr, "Stack now");
769 : for (; yybottom <= yytop; yybottom++)
770 : {
771 : int yybot = *yybottom;
772 : YYFPRINTF (stderr, " %d", yybot);
773 : }
774 : YYFPRINTF (stderr, "\n");
775 : }
776 :
777 : # define YY_STACK_PRINT(Bottom, Top) \
778 : do { \
779 : if (yydebug) \
780 : yy_stack_print ((Bottom), (Top)); \
781 : } while (0)
782 :
783 :
784 : /*------------------------------------------------.
785 : | Report that the YYRULE is going to be reduced. |
786 : `------------------------------------------------*/
787 :
788 : static void
789 : yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
790 : int yyrule, SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse_error_msg_p, yyscan_t yyscanner)
791 : {
792 : int yylno = yyrline[yyrule];
793 : int yynrhs = yyr2[yyrule];
794 : int yyi;
795 : YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
796 : yyrule - 1, yylno);
797 : /* The symbols being reduced. */
798 : for (yyi = 0; yyi < yynrhs; yyi++)
799 : {
800 : YYFPRINTF (stderr, " $%d = ", yyi + 1);
801 : yy_symbol_print (stderr,
802 : YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
803 : &yyvsp[(yyi + 1) - (yynrhs)], syncrep_parse_result_p, syncrep_parse_error_msg_p, yyscanner);
804 : YYFPRINTF (stderr, "\n");
805 : }
806 : }
807 :
808 : # define YY_REDUCE_PRINT(Rule) \
809 : do { \
810 : if (yydebug) \
811 : yy_reduce_print (yyssp, yyvsp, Rule, syncrep_parse_result_p, syncrep_parse_error_msg_p, yyscanner); \
812 : } while (0)
813 :
814 : /* Nonzero means print parse trace. It is left uninitialized so that
815 : multiple parsers can coexist. */
816 : int yydebug;
817 : #else /* !YYDEBUG */
818 : # define YYDPRINTF(Args) ((void) 0)
819 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
820 : # define YY_STACK_PRINT(Bottom, Top)
821 : # define YY_REDUCE_PRINT(Rule)
822 : #endif /* !YYDEBUG */
823 :
824 :
825 : /* YYINITDEPTH -- initial size of the parser's stacks. */
826 : #ifndef YYINITDEPTH
827 : # define YYINITDEPTH 200
828 : #endif
829 :
830 : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
831 : if the built-in stack extension method is used).
832 :
833 : Do not make this value too large; the results are undefined if
834 : YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
835 : evaluated with infinite-precision integer arithmetic. */
836 :
837 : #ifndef YYMAXDEPTH
838 : # define YYMAXDEPTH 10000
839 : #endif
840 :
841 :
842 :
843 :
844 :
845 :
846 : /*-----------------------------------------------.
847 : | Release the memory associated to this symbol. |
848 : `-----------------------------------------------*/
849 :
850 : static void
851 272 : yydestruct (const char *yymsg,
852 : yysymbol_kind_t yykind, YYSTYPE *yyvaluep, SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse_error_msg_p, yyscan_t yyscanner)
853 : {
854 : YY_USE (yyvaluep);
855 : YY_USE (syncrep_parse_result_p);
856 : YY_USE (syncrep_parse_error_msg_p);
857 : YY_USE (yyscanner);
858 272 : 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 272 : }
866 :
867 :
868 :
869 :
870 :
871 :
872 : /*----------.
873 : | yyparse. |
874 : `----------*/
875 :
876 : int
877 136 : yyparse (SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse_error_msg_p, 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 136 : int yynerrs = 0;
891 :
892 136 : yy_state_fast_t yystate = 0;
893 : /* Number of tokens to shift before error messages enabled. */
894 136 : 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 136 : YYPTRDIFF_T yystacksize = YYINITDEPTH;
901 :
902 : /* The state stack: array, bottom, top. */
903 : yy_state_t yyssa[YYINITDEPTH];
904 136 : yy_state_t *yyss = yyssa;
905 136 : yy_state_t *yyssp = yyss;
906 :
907 : /* The semantic value stack: array, bottom, top. */
908 : YYSTYPE yyvsa[YYINITDEPTH];
909 136 : YYSTYPE *yyvs = yyvsa;
910 136 : YYSTYPE *yyvsp = yyvs;
911 :
912 : int yyn;
913 : /* The return value of yyparse. */
914 : int yyresult;
915 : /* Lookahead symbol kind. */
916 136 : 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 136 : int yylen = 0;
928 :
929 : YYDPRINTF ((stderr, "Starting parse\n"));
930 :
931 136 : yychar = YYEMPTY; /* Cause a token to be read. */
932 136 : goto yysetstate;
933 :
934 :
935 : /*------------------------------------------------------------.
936 : | yynewstate -- push a new state, which is found in yystate. |
937 : `------------------------------------------------------------*/
938 1176 : 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 1176 : yyssp++;
942 :
943 :
944 : /*--------------------------------------------------------------------.
945 : | yysetstate -- set current state (the top of the stack) to yystate. |
946 : `--------------------------------------------------------------------*/
947 1312 : yysetstate:
948 : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
949 : YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
950 : YY_IGNORE_USELESS_CAST_BEGIN
951 1312 : *yyssp = YY_CAST (yy_state_t, yystate);
952 : YY_IGNORE_USELESS_CAST_END
953 : YY_STACK_PRINT (yyss, yyssp);
954 :
955 1312 : 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 1312 : if (yystate == YYFINAL)
1019 136 : YYACCEPT;
1020 :
1021 1176 : goto yybackup;
1022 :
1023 :
1024 : /*-----------.
1025 : | yybackup. |
1026 : `-----------*/
1027 1176 : 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 1176 : yyn = yypact[yystate];
1033 1176 : if (yypact_value_is_default (yyn))
1034 564 : 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 612 : if (yychar == YYEMPTY)
1040 : {
1041 : YYDPRINTF ((stderr, "Reading a token\n"));
1042 512 : yychar = yylex (&yylval, syncrep_parse_error_msg_p, yyscanner);
1043 : }
1044 :
1045 612 : if (yychar <= YYEOF)
1046 : {
1047 236 : yychar = YYEOF;
1048 236 : yytoken = YYSYMBOL_YYEOF;
1049 : YYDPRINTF ((stderr, "Now at end of input.\n"));
1050 : }
1051 376 : 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 376 : 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 612 : yyn += yytoken;
1070 612 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1071 100 : goto yydefault;
1072 512 : yyn = yytable[yyn];
1073 512 : 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 512 : if (yyerrstatus)
1084 0 : yyerrstatus--;
1085 :
1086 : /* Shift the lookahead token. */
1087 : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1088 512 : yystate = yyn;
1089 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1090 512 : *++yyvsp = yylval;
1091 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1092 :
1093 : /* Discard the shifted token. */
1094 512 : yychar = YYEMPTY;
1095 512 : goto yynewstate;
1096 :
1097 :
1098 : /*-----------------------------------------------------------.
1099 : | yydefault -- do the default action for the current state. |
1100 : `-----------------------------------------------------------*/
1101 664 : yydefault:
1102 664 : yyn = yydefact[yystate];
1103 664 : if (yyn == 0)
1104 0 : goto yyerrlab;
1105 664 : goto yyreduce;
1106 :
1107 :
1108 : /*-----------------------------.
1109 : | yyreduce -- do a reduction. |
1110 : `-----------------------------*/
1111 664 : yyreduce:
1112 : /* yyn is the number of a rule to reduce with. */
1113 664 : 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 664 : yyval = yyvsp[1-yylen];
1124 :
1125 :
1126 : YY_REDUCE_PRINT (yyn);
1127 664 : switch (yyn)
1128 : {
1129 136 : case 2: /* result: standby_config */
1130 : #line 61 "syncrep_gram.y"
1131 : {
1132 : *syncrep_parse_result_p = (yyvsp[0].config);
1133 : (void) yynerrs; /* suppress compiler warning */
1134 : }
1135 : #line 1136 "syncrep_gram.c"
1136 136 : break;
1137 :
1138 100 : case 3: /* standby_config: standby_list */
1139 : #line 68 "syncrep_gram.y"
1140 : { (yyval.config) = create_syncrep_config("1", (yyvsp[0].list), SYNC_REP_PRIORITY); }
1141 : #line 1142 "syncrep_gram.c"
1142 100 : break;
1143 :
1144 24 : case 4: /* standby_config: NUM '(' standby_list ')' */
1145 : #line 69 "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 70 "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 71 "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 136 : case 7: /* standby_list: standby_name */
1163 : #line 75 "syncrep_gram.y"
1164 : { (yyval.list) = list_make1((yyvsp[0].str)); }
1165 : #line 1166 "syncrep_gram.c"
1166 136 : break;
1167 :
1168 60 : case 8: /* standby_list: standby_list ',' standby_name */
1169 : #line 76 "syncrep_gram.y"
1170 : { (yyval.list) = lappend((yyvsp[-2].list), (yyvsp[0].str)); }
1171 : #line 1172 "syncrep_gram.c"
1172 60 : break;
1173 :
1174 196 : case 9: /* standby_name: NAME */
1175 : #line 80 "syncrep_gram.y"
1176 : { (yyval.str) = (yyvsp[0].str); }
1177 : #line 1178 "syncrep_gram.c"
1178 196 : break;
1179 :
1180 0 : case 10: /* standby_name: NUM */
1181 : #line 81 "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 664 : YYPOPSTACK (yylen);
1205 664 : yylen = 0;
1206 :
1207 664 : *++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 664 : const int yylhs = yyr1[yyn] - YYNTOKENS;
1214 664 : const int yyi = yypgoto[yylhs] + *yyssp;
1215 282 : yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1216 146 : ? yytable[yyi]
1217 946 : : yydefgoto[yylhs]);
1218 : }
1219 :
1220 664 : 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 (syncrep_parse_result_p, syncrep_parse_error_msg_p, 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, syncrep_parse_result_p, syncrep_parse_error_msg_p, 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, syncrep_parse_result_p, syncrep_parse_error_msg_p, 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 136 : yyacceptlab:
1328 136 : yyresult = 0;
1329 136 : 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 (syncrep_parse_result_p, syncrep_parse_error_msg_p, 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 136 : yyreturn:
1355 136 : 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, syncrep_parse_result_p, syncrep_parse_error_msg_p, yyscanner);
1362 : }
1363 : /* Do not reclaim the symbols of the rule whose action triggered
1364 : this YYABORT or YYACCEPT. */
1365 136 : YYPOPSTACK (yylen);
1366 : YY_STACK_PRINT (yyss, yyssp);
1367 408 : while (yyssp != yyss)
1368 : {
1369 272 : yydestruct ("Cleanup: popping",
1370 272 : YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, syncrep_parse_result_p, syncrep_parse_error_msg_p, yyscanner);
1371 272 : YYPOPSTACK (1);
1372 : }
1373 : #ifndef yyoverflow
1374 136 : if (yyss != yyssa)
1375 0 : YYSTACK_FREE (yyss);
1376 : #endif
1377 :
1378 136 : return yyresult;
1379 : }
1380 :
1381 : #line 83 "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 : }
|