1 /* A Bison parser, made by GNU Bison 3.3.2.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 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 /* All symbols defined below should begin with yy or YY, to avoid
38    infringing on user name space.  This should be done even for local
39    variables, as they might otherwise be expanded by user macros.
40    There are some unavoidable exceptions within include files to
41    define necessary library symbols; they are noted "INFRINGES ON
42    USER NAME SPACE" below.  */
43 
44 /* Undocumented macros, especially those whose name start with YY_,
45    are private implementation details.  Do not rely on them.  */
46 
47 /* Identify Bison output.  */
48 #define YYBISON 1
49 
50 /* Bison version.  */
51 #define YYBISON_VERSION "3.3.2"
52 
53 /* Skeleton name.  */
54 #define YYSKELETON_NAME "yacc.c"
55 
56 /* Pure parsers.  */
57 #define YYPURE 0
58 
59 /* Push parsers.  */
60 #define YYPUSH 0
61 
62 /* Pull parsers.  */
63 #define YYPULL 1
64 
65 
66 /* Substitute the variable and function names.  */
67 #define yyparse         syncrep_yyparse
68 #define yylex           syncrep_yylex
69 #define yyerror         syncrep_yyerror
70 #define yydebug         syncrep_yydebug
71 #define yynerrs         syncrep_yynerrs
72 
73 #define yylval          syncrep_yylval
74 #define yychar          syncrep_yychar
75 
76 /* First part of user prologue.  */
77 #line 1 "syncrep_gram.y" /* yacc.c:337  */
78 
79 /*-------------------------------------------------------------------------
80  *
81  * syncrep_gram.y				- Parser for synchronous_standby_names
82  *
83  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
84  * Portions Copyright (c) 1994, Regents of the University of California
85  *
86  *
87  * IDENTIFICATION
88  *	  src/backend/replication/syncrep_gram.y
89  *
90  *-------------------------------------------------------------------------
91  */
92 #include "postgres.h"
93 
94 #include "replication/syncrep.h"
95 
96 /* Result of parsing is returned in one of these two variables */
97 SyncRepConfigData *syncrep_parse_result;
98 char	   *syncrep_parse_error_msg;
99 
100 static SyncRepConfigData *create_syncrep_config(const char *num_sync,
101 					  List *members);
102 
103 /*
104  * Bison doesn't allocate anything that needs to live across parser calls,
105  * so we can easily have it use palloc instead of malloc.  This prevents
106  * memory leaks if we error out during parsing.  Note this only works with
107  * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
108  * if possible, so there's not really much problem anyhow, at least if
109  * you're building with gcc.
110  */
111 #define YYMALLOC palloc
112 #define YYFREE   pfree
113 
114 
115 #line 116 "syncrep_gram.c" /* yacc.c:337  */
116 # ifndef YY_NULLPTR
117 #  if defined __cplusplus
118 #   if 201103L <= __cplusplus
119 #    define YY_NULLPTR nullptr
120 #   else
121 #    define YY_NULLPTR 0
122 #   endif
123 #  else
124 #   define YY_NULLPTR ((void*)0)
125 #  endif
126 # endif
127 
128 /* Enabling verbose error messages.  */
129 #ifdef YYERROR_VERBOSE
130 # undef YYERROR_VERBOSE
131 # define YYERROR_VERBOSE 1
132 #else
133 # define YYERROR_VERBOSE 0
134 #endif
135 
136 
137 /* Debug traces.  */
138 #ifndef YYDEBUG
139 # define YYDEBUG 0
140 #endif
141 #if YYDEBUG
142 extern int syncrep_yydebug;
143 #endif
144 
145 /* Token type.  */
146 #ifndef YYTOKENTYPE
147 # define YYTOKENTYPE
148   enum yytokentype
149   {
150     NAME = 258,
151     NUM = 259,
152     JUNK = 260
153   };
154 #endif
155 
156 /* Value type.  */
157 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
158 
159 union YYSTYPE
160 {
161 #line 43 "syncrep_gram.y" /* yacc.c:352  */
162 
163 	char	   *str;
164 	List	   *list;
165 	SyncRepConfigData *config;
166 
167 #line 168 "syncrep_gram.c" /* yacc.c:352  */
168 };
169 
170 typedef union YYSTYPE YYSTYPE;
171 # define YYSTYPE_IS_TRIVIAL 1
172 # define YYSTYPE_IS_DECLARED 1
173 #endif
174 
175 
176 extern YYSTYPE syncrep_yylval;
177 
178 int syncrep_yyparse (void);
179 
180 
181 
182 
183 
184 #ifdef short
185 # undef short
186 #endif
187 
188 #ifdef YYTYPE_UINT8
189 typedef YYTYPE_UINT8 yytype_uint8;
190 #else
191 typedef unsigned char yytype_uint8;
192 #endif
193 
194 #ifdef YYTYPE_INT8
195 typedef YYTYPE_INT8 yytype_int8;
196 #else
197 typedef signed char yytype_int8;
198 #endif
199 
200 #ifdef YYTYPE_UINT16
201 typedef YYTYPE_UINT16 yytype_uint16;
202 #else
203 typedef unsigned short yytype_uint16;
204 #endif
205 
206 #ifdef YYTYPE_INT16
207 typedef YYTYPE_INT16 yytype_int16;
208 #else
209 typedef short yytype_int16;
210 #endif
211 
212 #ifndef YYSIZE_T
213 # ifdef __SIZE_TYPE__
214 #  define YYSIZE_T __SIZE_TYPE__
215 # elif defined size_t
216 #  define YYSIZE_T size_t
217 # elif ! defined YYSIZE_T
218 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
219 #  define YYSIZE_T size_t
220 # else
221 #  define YYSIZE_T unsigned
222 # endif
223 #endif
224 
225 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
226 
227 #ifndef YY_
228 # if defined YYENABLE_NLS && YYENABLE_NLS
229 #  if ENABLE_NLS
230 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
231 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
232 #  endif
233 # endif
234 # ifndef YY_
235 #  define YY_(Msgid) Msgid
236 # endif
237 #endif
238 
239 #ifndef YY_ATTRIBUTE
240 # if (defined __GNUC__                                               \
241       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
242      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
243 #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
244 # else
245 #  define YY_ATTRIBUTE(Spec) /* empty */
246 # endif
247 #endif
248 
249 #ifndef YY_ATTRIBUTE_PURE
250 # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
251 #endif
252 
253 #ifndef YY_ATTRIBUTE_UNUSED
254 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
255 #endif
256 
257 /* Suppress unused-variable warnings by "using" E.  */
258 #if ! defined lint || defined __GNUC__
259 # define YYUSE(E) ((void) (E))
260 #else
261 # define YYUSE(E) /* empty */
262 #endif
263 
264 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
265 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
266 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
267     _Pragma ("GCC diagnostic push") \
268     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
269     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
270 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
271     _Pragma ("GCC diagnostic pop")
272 #else
273 # define YY_INITIAL_VALUE(Value) Value
274 #endif
275 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
276 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
277 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
278 #endif
279 #ifndef YY_INITIAL_VALUE
280 # define YY_INITIAL_VALUE(Value) /* Nothing. */
281 #endif
282 
283 
284 #if ! defined yyoverflow || YYERROR_VERBOSE
285 
286 /* The parser invokes alloca or malloc; define the necessary symbols.  */
287 
288 # ifdef YYSTACK_USE_ALLOCA
289 #  if YYSTACK_USE_ALLOCA
290 #   ifdef __GNUC__
291 #    define YYSTACK_ALLOC __builtin_alloca
292 #   elif defined __BUILTIN_VA_ARG_INCR
293 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
294 #   elif defined _AIX
295 #    define YYSTACK_ALLOC __alloca
296 #   elif defined _MSC_VER
297 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
298 #    define alloca _alloca
299 #   else
300 #    define YYSTACK_ALLOC alloca
301 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
302 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
303       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
304 #     ifndef EXIT_SUCCESS
305 #      define EXIT_SUCCESS 0
306 #     endif
307 #    endif
308 #   endif
309 #  endif
310 # endif
311 
312 # ifdef YYSTACK_ALLOC
313    /* Pacify GCC's 'empty if-body' warning.  */
314 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
315 #  ifndef YYSTACK_ALLOC_MAXIMUM
316     /* The OS might guarantee only one guard page at the bottom of the stack,
317        and a page size can be as small as 4096 bytes.  So we cannot safely
318        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
319        to allow for a few compiler-allocated temporary stack slots.  */
320 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
321 #  endif
322 # else
323 #  define YYSTACK_ALLOC YYMALLOC
324 #  define YYSTACK_FREE YYFREE
325 #  ifndef YYSTACK_ALLOC_MAXIMUM
326 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
327 #  endif
328 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
329        && ! ((defined YYMALLOC || defined malloc) \
330              && (defined YYFREE || defined free)))
331 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
332 #   ifndef EXIT_SUCCESS
333 #    define EXIT_SUCCESS 0
334 #   endif
335 #  endif
336 #  ifndef YYMALLOC
337 #   define YYMALLOC malloc
338 #   if ! defined malloc && ! defined EXIT_SUCCESS
339 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
340 #   endif
341 #  endif
342 #  ifndef YYFREE
343 #   define YYFREE free
344 #   if ! defined free && ! defined EXIT_SUCCESS
345 void free (void *); /* INFRINGES ON USER NAME SPACE */
346 #   endif
347 #  endif
348 # endif
349 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
350 
351 
352 #if (! defined yyoverflow \
353      && (! defined __cplusplus \
354          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
355 
356 /* A type that is properly aligned for any stack member.  */
357 union yyalloc
358 {
359   yytype_int16 yyss_alloc;
360   YYSTYPE yyvs_alloc;
361 };
362 
363 /* The size of the maximum gap between one aligned stack and the next.  */
364 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
365 
366 /* The size of an array large to enough to hold all stacks, each with
367    N elements.  */
368 # define YYSTACK_BYTES(N) \
369      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
370       + YYSTACK_GAP_MAXIMUM)
371 
372 # define YYCOPY_NEEDED 1
373 
374 /* Relocate STACK from its old location to the new one.  The
375    local variables YYSIZE and YYSTACKSIZE give the old and new number of
376    elements in the stack, and YYPTR gives the new location of the
377    stack.  Advance YYPTR to a properly aligned location for the next
378    stack.  */
379 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
380     do                                                                  \
381       {                                                                 \
382         YYSIZE_T yynewbytes;                                            \
383         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
384         Stack = &yyptr->Stack_alloc;                                    \
385         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
386         yyptr += yynewbytes / sizeof (*yyptr);                          \
387       }                                                                 \
388     while (0)
389 
390 #endif
391 
392 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
393 /* Copy COUNT objects from SRC to DST.  The source and destination do
394    not overlap.  */
395 # ifndef YYCOPY
396 #  if defined __GNUC__ && 1 < __GNUC__
397 #   define YYCOPY(Dst, Src, Count) \
398       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
399 #  else
400 #   define YYCOPY(Dst, Src, Count)              \
401       do                                        \
402         {                                       \
403           YYSIZE_T yyi;                         \
404           for (yyi = 0; yyi < (Count); yyi++)   \
405             (Dst)[yyi] = (Src)[yyi];            \
406         }                                       \
407       while (0)
408 #  endif
409 # endif
410 #endif /* !YYCOPY_NEEDED */
411 
412 /* YYFINAL -- State number of the termination state.  */
413 #define YYFINAL  8
414 /* YYLAST -- Last index in YYTABLE.  */
415 #define YYLAST   12
416 
417 /* YYNTOKENS -- Number of terminals.  */
418 #define YYNTOKENS  9
419 /* YYNNTS -- Number of nonterminals.  */
420 #define YYNNTS  5
421 /* YYNRULES -- Number of rules.  */
422 #define YYNRULES  8
423 /* YYNSTATES -- Number of states.  */
424 #define YYNSTATES  14
425 
426 #define YYUNDEFTOK  2
427 #define YYMAXUTOK   260
428 
429 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
430    as returned by yylex, with out-of-bounds checking.  */
431 #define YYTRANSLATE(YYX)                                                \
432   ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
433 
434 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
435    as returned by yylex.  */
436 static const yytype_uint8 yytranslate[] =
437 {
438        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
439        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
440        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
441        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
442        6,     7,     2,     2,     8,     2,     2,     2,     2,     2,
443        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
444        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
445        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
446        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
447        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
448        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
449        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
450        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
451        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
452        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
453        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
454        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
455        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
456        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
457        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
458        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
459        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
460        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
461        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
462        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
463        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
464        5
465 };
466 
467 #if YYDEBUG
468   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
469 static const yytype_uint8 yyrline[] =
470 {
471        0,    59,    59,    63,    64,    68,    69,    73,    74
472 };
473 #endif
474 
475 #if YYDEBUG || YYERROR_VERBOSE || 0
476 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
477    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
478 static const char *const yytname[] =
479 {
480   "$end", "error", "$undefined", "NAME", "NUM", "JUNK", "'('", "')'",
481   "','", "$accept", "result", "standby_config", "standby_list",
482   "standby_name", YY_NULLPTR
483 };
484 #endif
485 
486 # ifdef YYPRINT
487 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
488    (internal) symbol number NUM (which must be that of a token).  */
489 static const yytype_uint16 yytoknum[] =
490 {
491        0,   256,   257,   258,   259,   260,    40,    41,    44
492 };
493 # endif
494 
495 #define YYPACT_NINF -4
496 
497 #define yypact_value_is_default(Yystate) \
498   (!!((Yystate) == (-4)))
499 
500 #define YYTABLE_NINF -1
501 
502 #define yytable_value_is_error(Yytable_value) \
503   0
504 
505   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
506      STATE-NUM.  */
507 static const yytype_int8 yypact[] =
508 {
509       -3,    -4,     1,     4,    -4,     0,    -4,    -1,    -4,    -1,
510       -4,    -2,    -4,    -4
511 };
512 
513   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
514      Performed when YYTABLE does not specify something else to do.  Zero
515      means the default is an error.  */
516 static const yytype_uint8 yydefact[] =
517 {
518        0,     7,     8,     0,     2,     3,     5,     0,     1,     0,
519        8,     0,     6,     4
520 };
521 
522   /* YYPGOTO[NTERM-NUM].  */
523 static const yytype_int8 yypgoto[] =
524 {
525       -4,    -4,    -4,     2,     3
526 };
527 
528   /* YYDEFGOTO[NTERM-NUM].  */
529 static const yytype_int8 yydefgoto[] =
530 {
531       -1,     3,     4,     5,     6
532 };
533 
534   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
535      positive, shift that token.  If negative, reduce the rule whose
536      number is the opposite.  If YYTABLE_NINF, syntax error.  */
537 static const yytype_uint8 yytable[] =
538 {
539        1,     2,     1,    10,     8,    13,     9,     7,     9,    11,
540        0,     0,    12
541 };
542 
543 static const yytype_int8 yycheck[] =
544 {
545        3,     4,     3,     4,     0,     7,     8,     6,     8,     7,
546       -1,    -1,     9
547 };
548 
549   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
550      symbol of state STATE-NUM.  */
551 static const yytype_uint8 yystos[] =
552 {
553        0,     3,     4,    10,    11,    12,    13,     6,     0,     8,
554        4,    12,    13,     7
555 };
556 
557   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
558 static const yytype_uint8 yyr1[] =
559 {
560        0,     9,    10,    11,    11,    12,    12,    13,    13
561 };
562 
563   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
564 static const yytype_uint8 yyr2[] =
565 {
566        0,     2,     1,     1,     4,     1,     3,     1,     1
567 };
568 
569 
570 #define yyerrok         (yyerrstatus = 0)
571 #define yyclearin       (yychar = YYEMPTY)
572 #define YYEMPTY         (-2)
573 #define YYEOF           0
574 
575 #define YYACCEPT        goto yyacceptlab
576 #define YYABORT         goto yyabortlab
577 #define YYERROR         goto yyerrorlab
578 
579 
580 #define YYRECOVERING()  (!!yyerrstatus)
581 
582 #define YYBACKUP(Token, Value)                                    \
583   do                                                              \
584     if (yychar == YYEMPTY)                                        \
585       {                                                           \
586         yychar = (Token);                                         \
587         yylval = (Value);                                         \
588         YYPOPSTACK (yylen);                                       \
589         yystate = *yyssp;                                         \
590         goto yybackup;                                            \
591       }                                                           \
592     else                                                          \
593       {                                                           \
594         yyerror (YY_("syntax error: cannot back up")); \
595         YYERROR;                                                  \
596       }                                                           \
597   while (0)
598 
599 /* Error token number */
600 #define YYTERROR        1
601 #define YYERRCODE       256
602 
603 
604 
605 /* Enable debugging if requested.  */
606 #if YYDEBUG
607 
608 # ifndef YYFPRINTF
609 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
610 #  define YYFPRINTF fprintf
611 # endif
612 
613 # define YYDPRINTF(Args)                        \
614 do {                                            \
615   if (yydebug)                                  \
616     YYFPRINTF Args;                             \
617 } while (0)
618 
619 /* This macro is provided for backward compatibility. */
620 #ifndef YY_LOCATION_PRINT
621 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
622 #endif
623 
624 
625 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
626 do {                                                                      \
627   if (yydebug)                                                            \
628     {                                                                     \
629       YYFPRINTF (stderr, "%s ", Title);                                   \
630       yy_symbol_print (stderr,                                            \
631                   Type, Value); \
632       YYFPRINTF (stderr, "\n");                                           \
633     }                                                                     \
634 } while (0)
635 
636 
637 /*-----------------------------------.
638 | Print this symbol's value on YYO.  |
639 `-----------------------------------*/
640 
641 static void
yy_symbol_value_print(FILE * yyo,int yytype,YYSTYPE const * const yyvaluep)642 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
643 {
644   FILE *yyoutput = yyo;
645   YYUSE (yyoutput);
646   if (!yyvaluep)
647     return;
648 # ifdef YYPRINT
649   if (yytype < YYNTOKENS)
650     YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
651 # endif
652   YYUSE (yytype);
653 }
654 
655 
656 /*---------------------------.
657 | Print this symbol on YYO.  |
658 `---------------------------*/
659 
660 static void
yy_symbol_print(FILE * yyo,int yytype,YYSTYPE const * const yyvaluep)661 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
662 {
663   YYFPRINTF (yyo, "%s %s (",
664              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
665 
666   yy_symbol_value_print (yyo, yytype, yyvaluep);
667   YYFPRINTF (yyo, ")");
668 }
669 
670 /*------------------------------------------------------------------.
671 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
672 | TOP (included).                                                   |
673 `------------------------------------------------------------------*/
674 
675 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)676 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
677 {
678   YYFPRINTF (stderr, "Stack now");
679   for (; yybottom <= yytop; yybottom++)
680     {
681       int yybot = *yybottom;
682       YYFPRINTF (stderr, " %d", yybot);
683     }
684   YYFPRINTF (stderr, "\n");
685 }
686 
687 # define YY_STACK_PRINT(Bottom, Top)                            \
688 do {                                                            \
689   if (yydebug)                                                  \
690     yy_stack_print ((Bottom), (Top));                           \
691 } while (0)
692 
693 
694 /*------------------------------------------------.
695 | Report that the YYRULE is going to be reduced.  |
696 `------------------------------------------------*/
697 
698 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule)699 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
700 {
701   unsigned long yylno = yyrline[yyrule];
702   int yynrhs = yyr2[yyrule];
703   int yyi;
704   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
705              yyrule - 1, yylno);
706   /* The symbols being reduced.  */
707   for (yyi = 0; yyi < yynrhs; yyi++)
708     {
709       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
710       yy_symbol_print (stderr,
711                        yystos[yyssp[yyi + 1 - yynrhs]],
712                        &yyvsp[(yyi + 1) - (yynrhs)]
713                                               );
714       YYFPRINTF (stderr, "\n");
715     }
716 }
717 
718 # define YY_REDUCE_PRINT(Rule)          \
719 do {                                    \
720   if (yydebug)                          \
721     yy_reduce_print (yyssp, yyvsp, Rule); \
722 } while (0)
723 
724 /* Nonzero means print parse trace.  It is left uninitialized so that
725    multiple parsers can coexist.  */
726 int yydebug;
727 #else /* !YYDEBUG */
728 # define YYDPRINTF(Args)
729 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
730 # define YY_STACK_PRINT(Bottom, Top)
731 # define YY_REDUCE_PRINT(Rule)
732 #endif /* !YYDEBUG */
733 
734 
735 /* YYINITDEPTH -- initial size of the parser's stacks.  */
736 #ifndef YYINITDEPTH
737 # define YYINITDEPTH 200
738 #endif
739 
740 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
741    if the built-in stack extension method is used).
742 
743    Do not make this value too large; the results are undefined if
744    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
745    evaluated with infinite-precision integer arithmetic.  */
746 
747 #ifndef YYMAXDEPTH
748 # define YYMAXDEPTH 10000
749 #endif
750 
751 
752 #if YYERROR_VERBOSE
753 
754 # ifndef yystrlen
755 #  if defined __GLIBC__ && defined _STRING_H
756 #   define yystrlen strlen
757 #  else
758 /* Return the length of YYSTR.  */
759 static YYSIZE_T
yystrlen(const char * yystr)760 yystrlen (const char *yystr)
761 {
762   YYSIZE_T yylen;
763   for (yylen = 0; yystr[yylen]; yylen++)
764     continue;
765   return yylen;
766 }
767 #  endif
768 # endif
769 
770 # ifndef yystpcpy
771 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
772 #   define yystpcpy stpcpy
773 #  else
774 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
775    YYDEST.  */
776 static char *
yystpcpy(char * yydest,const char * yysrc)777 yystpcpy (char *yydest, const char *yysrc)
778 {
779   char *yyd = yydest;
780   const char *yys = yysrc;
781 
782   while ((*yyd++ = *yys++) != '\0')
783     continue;
784 
785   return yyd - 1;
786 }
787 #  endif
788 # endif
789 
790 # ifndef yytnamerr
791 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
792    quotes and backslashes, so that it's suitable for yyerror.  The
793    heuristic is that double-quoting is unnecessary unless the string
794    contains an apostrophe, a comma, or backslash (other than
795    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
796    null, do not copy; instead, return the length of what the result
797    would have been.  */
798 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)799 yytnamerr (char *yyres, const char *yystr)
800 {
801   if (*yystr == '"')
802     {
803       YYSIZE_T yyn = 0;
804       char const *yyp = yystr;
805 
806       for (;;)
807         switch (*++yyp)
808           {
809           case '\'':
810           case ',':
811             goto do_not_strip_quotes;
812 
813           case '\\':
814             if (*++yyp != '\\')
815               goto do_not_strip_quotes;
816             else
817               goto append;
818 
819           append:
820           default:
821             if (yyres)
822               yyres[yyn] = *yyp;
823             yyn++;
824             break;
825 
826           case '"':
827             if (yyres)
828               yyres[yyn] = '\0';
829             return yyn;
830           }
831     do_not_strip_quotes: ;
832     }
833 
834   if (! yyres)
835     return yystrlen (yystr);
836 
837   return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
838 }
839 # endif
840 
841 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
842    about the unexpected token YYTOKEN for the state stack whose top is
843    YYSSP.
844 
845    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
846    not large enough to hold the message.  In that case, also set
847    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
848    required number of bytes is too large to store.  */
849 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)850 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
851                 yytype_int16 *yyssp, int yytoken)
852 {
853   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
854   YYSIZE_T yysize = yysize0;
855   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
856   /* Internationalized format string. */
857   const char *yyformat = YY_NULLPTR;
858   /* Arguments of yyformat. */
859   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
860   /* Number of reported tokens (one for the "unexpected", one per
861      "expected"). */
862   int yycount = 0;
863 
864   /* There are many possibilities here to consider:
865      - If this state is a consistent state with a default action, then
866        the only way this function was invoked is if the default action
867        is an error action.  In that case, don't check for expected
868        tokens because there are none.
869      - The only way there can be no lookahead present (in yychar) is if
870        this state is a consistent state with a default action.  Thus,
871        detecting the absence of a lookahead is sufficient to determine
872        that there is no unexpected or expected token to report.  In that
873        case, just report a simple "syntax error".
874      - Don't assume there isn't a lookahead just because this state is a
875        consistent state with a default action.  There might have been a
876        previous inconsistent state, consistent state with a non-default
877        action, or user semantic action that manipulated yychar.
878      - Of course, the expected token list depends on states to have
879        correct lookahead information, and it depends on the parser not
880        to perform extra reductions after fetching a lookahead from the
881        scanner and before detecting a syntax error.  Thus, state merging
882        (from LALR or IELR) and default reductions corrupt the expected
883        token list.  However, the list is correct for canonical LR with
884        one exception: it will still contain any token that will not be
885        accepted due to an error action in a later state.
886   */
887   if (yytoken != YYEMPTY)
888     {
889       int yyn = yypact[*yyssp];
890       yyarg[yycount++] = yytname[yytoken];
891       if (!yypact_value_is_default (yyn))
892         {
893           /* Start YYX at -YYN if negative to avoid negative indexes in
894              YYCHECK.  In other words, skip the first -YYN actions for
895              this state because they are default actions.  */
896           int yyxbegin = yyn < 0 ? -yyn : 0;
897           /* Stay within bounds of both yycheck and yytname.  */
898           int yychecklim = YYLAST - yyn + 1;
899           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
900           int yyx;
901 
902           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
903             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
904                 && !yytable_value_is_error (yytable[yyx + yyn]))
905               {
906                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
907                   {
908                     yycount = 1;
909                     yysize = yysize0;
910                     break;
911                   }
912                 yyarg[yycount++] = yytname[yyx];
913                 {
914                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
915                   if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
916                     yysize = yysize1;
917                   else
918                     return 2;
919                 }
920               }
921         }
922     }
923 
924   switch (yycount)
925     {
926 # define YYCASE_(N, S)                      \
927       case N:                               \
928         yyformat = S;                       \
929       break
930     default: /* Avoid compiler warnings. */
931       YYCASE_(0, YY_("syntax error"));
932       YYCASE_(1, YY_("syntax error, unexpected %s"));
933       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
934       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
935       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
936       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
937 # undef YYCASE_
938     }
939 
940   {
941     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
942     if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
943       yysize = yysize1;
944     else
945       return 2;
946   }
947 
948   if (*yymsg_alloc < yysize)
949     {
950       *yymsg_alloc = 2 * yysize;
951       if (! (yysize <= *yymsg_alloc
952              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
953         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
954       return 1;
955     }
956 
957   /* Avoid sprintf, as that infringes on the user's name space.
958      Don't have undefined behavior even if the translation
959      produced a string with the wrong number of "%s"s.  */
960   {
961     char *yyp = *yymsg;
962     int yyi = 0;
963     while ((*yyp = *yyformat) != '\0')
964       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
965         {
966           yyp += yytnamerr (yyp, yyarg[yyi++]);
967           yyformat += 2;
968         }
969       else
970         {
971           yyp++;
972           yyformat++;
973         }
974   }
975   return 0;
976 }
977 #endif /* YYERROR_VERBOSE */
978 
979 /*-----------------------------------------------.
980 | Release the memory associated to this symbol.  |
981 `-----------------------------------------------*/
982 
983 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)984 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
985 {
986   YYUSE (yyvaluep);
987   if (!yymsg)
988     yymsg = "Deleting";
989   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
990 
991   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
992   YYUSE (yytype);
993   YY_IGNORE_MAYBE_UNINITIALIZED_END
994 }
995 
996 
997 
998 
999 /* The lookahead symbol.  */
1000 int yychar;
1001 
1002 /* The semantic value of the lookahead symbol.  */
1003 YYSTYPE yylval;
1004 /* Number of syntax errors so far.  */
1005 int yynerrs;
1006 
1007 
1008 /*----------.
1009 | yyparse.  |
1010 `----------*/
1011 
1012 int
yyparse(void)1013 yyparse (void)
1014 {
1015     int yystate;
1016     /* Number of tokens to shift before error messages enabled.  */
1017     int yyerrstatus;
1018 
1019     /* The stacks and their tools:
1020        'yyss': related to states.
1021        'yyvs': related to semantic values.
1022 
1023        Refer to the stacks through separate pointers, to allow yyoverflow
1024        to reallocate them elsewhere.  */
1025 
1026     /* The state stack.  */
1027     yytype_int16 yyssa[YYINITDEPTH];
1028     yytype_int16 *yyss;
1029     yytype_int16 *yyssp;
1030 
1031     /* The semantic value stack.  */
1032     YYSTYPE yyvsa[YYINITDEPTH];
1033     YYSTYPE *yyvs;
1034     YYSTYPE *yyvsp;
1035 
1036     YYSIZE_T yystacksize;
1037 
1038   int yyn;
1039   int yyresult;
1040   /* Lookahead token as an internal (translated) token number.  */
1041   int yytoken = 0;
1042   /* The variables used to return semantic value and location from the
1043      action routines.  */
1044   YYSTYPE yyval;
1045 
1046 #if YYERROR_VERBOSE
1047   /* Buffer for error messages, and its allocated size.  */
1048   char yymsgbuf[128];
1049   char *yymsg = yymsgbuf;
1050   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1051 #endif
1052 
1053 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1054 
1055   /* The number of symbols on the RHS of the reduced rule.
1056      Keep to zero when no symbol should be popped.  */
1057   int yylen = 0;
1058 
1059   yyssp = yyss = yyssa;
1060   yyvsp = yyvs = yyvsa;
1061   yystacksize = YYINITDEPTH;
1062 
1063   YYDPRINTF ((stderr, "Starting parse\n"));
1064 
1065   yystate = 0;
1066   yyerrstatus = 0;
1067   yynerrs = 0;
1068   yychar = YYEMPTY; /* Cause a token to be read.  */
1069   goto yysetstate;
1070 
1071 
1072 /*------------------------------------------------------------.
1073 | yynewstate -- push a new state, which is found in yystate.  |
1074 `------------------------------------------------------------*/
1075 yynewstate:
1076   /* In all cases, when you get here, the value and location stacks
1077      have just been pushed.  So pushing a state here evens the stacks.  */
1078   yyssp++;
1079 
1080 
1081 /*--------------------------------------------------------------------.
1082 | yynewstate -- set current state (the top of the stack) to yystate.  |
1083 `--------------------------------------------------------------------*/
1084 yysetstate:
1085   *yyssp = (yytype_int16) yystate;
1086 
1087   if (yyss + yystacksize - 1 <= yyssp)
1088 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1089     goto yyexhaustedlab;
1090 #else
1091     {
1092       /* Get the current used size of the three stacks, in elements.  */
1093       YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
1094 
1095 # if defined yyoverflow
1096       {
1097         /* Give user a chance to reallocate the stack.  Use copies of
1098            these so that the &'s don't force the real ones into
1099            memory.  */
1100         YYSTYPE *yyvs1 = yyvs;
1101         yytype_int16 *yyss1 = yyss;
1102 
1103         /* Each stack pointer address is followed by the size of the
1104            data in use in that stack, in bytes.  This used to be a
1105            conditional around just the two extra args, but that might
1106            be undefined if yyoverflow is a macro.  */
1107         yyoverflow (YY_("memory exhausted"),
1108                     &yyss1, yysize * sizeof (*yyssp),
1109                     &yyvs1, yysize * sizeof (*yyvsp),
1110                     &yystacksize);
1111         yyss = yyss1;
1112         yyvs = yyvs1;
1113       }
1114 # else /* defined YYSTACK_RELOCATE */
1115       /* Extend the stack our own way.  */
1116       if (YYMAXDEPTH <= yystacksize)
1117         goto yyexhaustedlab;
1118       yystacksize *= 2;
1119       if (YYMAXDEPTH < yystacksize)
1120         yystacksize = YYMAXDEPTH;
1121 
1122       {
1123         yytype_int16 *yyss1 = yyss;
1124         union yyalloc *yyptr =
1125           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1126         if (! yyptr)
1127           goto yyexhaustedlab;
1128         YYSTACK_RELOCATE (yyss_alloc, yyss);
1129         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1130 # undef YYSTACK_RELOCATE
1131         if (yyss1 != yyssa)
1132           YYSTACK_FREE (yyss1);
1133       }
1134 # endif
1135 
1136       yyssp = yyss + yysize - 1;
1137       yyvsp = yyvs + yysize - 1;
1138 
1139       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1140                   (unsigned long) yystacksize));
1141 
1142       if (yyss + yystacksize - 1 <= yyssp)
1143         YYABORT;
1144     }
1145 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1146 
1147   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1148 
1149   if (yystate == YYFINAL)
1150     YYACCEPT;
1151 
1152   goto yybackup;
1153 
1154 
1155 /*-----------.
1156 | yybackup.  |
1157 `-----------*/
1158 yybackup:
1159   /* Do appropriate processing given the current state.  Read a
1160      lookahead token if we need one and don't already have one.  */
1161 
1162   /* First try to decide what to do without reference to lookahead token.  */
1163   yyn = yypact[yystate];
1164   if (yypact_value_is_default (yyn))
1165     goto yydefault;
1166 
1167   /* Not known => get a lookahead token if don't already have one.  */
1168 
1169   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1170   if (yychar == YYEMPTY)
1171     {
1172       YYDPRINTF ((stderr, "Reading a token: "));
1173       yychar = yylex ();
1174     }
1175 
1176   if (yychar <= YYEOF)
1177     {
1178       yychar = yytoken = YYEOF;
1179       YYDPRINTF ((stderr, "Now at end of input.\n"));
1180     }
1181   else
1182     {
1183       yytoken = YYTRANSLATE (yychar);
1184       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1185     }
1186 
1187   /* If the proper action on seeing token YYTOKEN is to reduce or to
1188      detect an error, take that action.  */
1189   yyn += yytoken;
1190   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1191     goto yydefault;
1192   yyn = yytable[yyn];
1193   if (yyn <= 0)
1194     {
1195       if (yytable_value_is_error (yyn))
1196         goto yyerrlab;
1197       yyn = -yyn;
1198       goto yyreduce;
1199     }
1200 
1201   /* Count tokens shifted since error; after three, turn off error
1202      status.  */
1203   if (yyerrstatus)
1204     yyerrstatus--;
1205 
1206   /* Shift the lookahead token.  */
1207   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1208 
1209   /* Discard the shifted token.  */
1210   yychar = YYEMPTY;
1211 
1212   yystate = yyn;
1213   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1214   *++yyvsp = yylval;
1215   YY_IGNORE_MAYBE_UNINITIALIZED_END
1216 
1217   goto yynewstate;
1218 
1219 
1220 /*-----------------------------------------------------------.
1221 | yydefault -- do the default action for the current state.  |
1222 `-----------------------------------------------------------*/
1223 yydefault:
1224   yyn = yydefact[yystate];
1225   if (yyn == 0)
1226     goto yyerrlab;
1227   goto yyreduce;
1228 
1229 
1230 /*-----------------------------.
1231 | yyreduce -- do a reduction.  |
1232 `-----------------------------*/
1233 yyreduce:
1234   /* yyn is the number of a rule to reduce with.  */
1235   yylen = yyr2[yyn];
1236 
1237   /* If YYLEN is nonzero, implement the default value of the action:
1238      '$$ = $1'.
1239 
1240      Otherwise, the following line sets YYVAL to garbage.
1241      This behavior is undocumented and Bison
1242      users should not rely upon it.  Assigning to YYVAL
1243      unconditionally makes the parser a bit smaller, and it avoids a
1244      GCC warning that YYVAL may be used uninitialized.  */
1245   yyval = yyvsp[1-yylen];
1246 
1247 
1248   YY_REDUCE_PRINT (yyn);
1249   switch (yyn)
1250     {
1251         case 2:
1252 #line 59 "syncrep_gram.y" /* yacc.c:1652  */
1253     { syncrep_parse_result = (yyvsp[0].config); }
1254 #line 1255 "syncrep_gram.c" /* yacc.c:1652  */
1255     break;
1256 
1257   case 3:
1258 #line 63 "syncrep_gram.y" /* yacc.c:1652  */
1259     { (yyval.config) = create_syncrep_config("1", (yyvsp[0].list)); }
1260 #line 1261 "syncrep_gram.c" /* yacc.c:1652  */
1261     break;
1262 
1263   case 4:
1264 #line 64 "syncrep_gram.y" /* yacc.c:1652  */
1265     { (yyval.config) = create_syncrep_config((yyvsp[-3].str), (yyvsp[-1].list)); }
1266 #line 1267 "syncrep_gram.c" /* yacc.c:1652  */
1267     break;
1268 
1269   case 5:
1270 #line 68 "syncrep_gram.y" /* yacc.c:1652  */
1271     { (yyval.list) = list_make1((yyvsp[0].str)); }
1272 #line 1273 "syncrep_gram.c" /* yacc.c:1652  */
1273     break;
1274 
1275   case 6:
1276 #line 69 "syncrep_gram.y" /* yacc.c:1652  */
1277     { (yyval.list) = lappend((yyvsp[-2].list), (yyvsp[0].str)); }
1278 #line 1279 "syncrep_gram.c" /* yacc.c:1652  */
1279     break;
1280 
1281   case 7:
1282 #line 73 "syncrep_gram.y" /* yacc.c:1652  */
1283     { (yyval.str) = (yyvsp[0].str); }
1284 #line 1285 "syncrep_gram.c" /* yacc.c:1652  */
1285     break;
1286 
1287   case 8:
1288 #line 74 "syncrep_gram.y" /* yacc.c:1652  */
1289     { (yyval.str) = (yyvsp[0].str); }
1290 #line 1291 "syncrep_gram.c" /* yacc.c:1652  */
1291     break;
1292 
1293 
1294 #line 1295 "syncrep_gram.c" /* yacc.c:1652  */
1295       default: break;
1296     }
1297   /* User semantic actions sometimes alter yychar, and that requires
1298      that yytoken be updated with the new translation.  We take the
1299      approach of translating immediately before every use of yytoken.
1300      One alternative is translating here after every semantic action,
1301      but that translation would be missed if the semantic action invokes
1302      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1303      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1304      incorrect destructor might then be invoked immediately.  In the
1305      case of YYERROR or YYBACKUP, subsequent parser actions might lead
1306      to an incorrect destructor call or verbose syntax error message
1307      before the lookahead is translated.  */
1308   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1309 
1310   YYPOPSTACK (yylen);
1311   yylen = 0;
1312   YY_STACK_PRINT (yyss, yyssp);
1313 
1314   *++yyvsp = yyval;
1315 
1316   /* Now 'shift' the result of the reduction.  Determine what state
1317      that goes to, based on the state we popped back to and the rule
1318      number reduced by.  */
1319   {
1320     const int yylhs = yyr1[yyn] - YYNTOKENS;
1321     const int yyi = yypgoto[yylhs] + *yyssp;
1322     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1323                ? yytable[yyi]
1324                : yydefgoto[yylhs]);
1325   }
1326 
1327   goto yynewstate;
1328 
1329 
1330 /*--------------------------------------.
1331 | yyerrlab -- here on detecting error.  |
1332 `--------------------------------------*/
1333 yyerrlab:
1334   /* Make sure we have latest lookahead translation.  See comments at
1335      user semantic actions for why this is necessary.  */
1336   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1337 
1338   /* If not already recovering from an error, report this error.  */
1339   if (!yyerrstatus)
1340     {
1341       ++yynerrs;
1342 #if ! YYERROR_VERBOSE
1343       yyerror (YY_("syntax error"));
1344 #else
1345 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1346                                         yyssp, yytoken)
1347       {
1348         char const *yymsgp = YY_("syntax error");
1349         int yysyntax_error_status;
1350         yysyntax_error_status = YYSYNTAX_ERROR;
1351         if (yysyntax_error_status == 0)
1352           yymsgp = yymsg;
1353         else if (yysyntax_error_status == 1)
1354           {
1355             if (yymsg != yymsgbuf)
1356               YYSTACK_FREE (yymsg);
1357             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1358             if (!yymsg)
1359               {
1360                 yymsg = yymsgbuf;
1361                 yymsg_alloc = sizeof yymsgbuf;
1362                 yysyntax_error_status = 2;
1363               }
1364             else
1365               {
1366                 yysyntax_error_status = YYSYNTAX_ERROR;
1367                 yymsgp = yymsg;
1368               }
1369           }
1370         yyerror (yymsgp);
1371         if (yysyntax_error_status == 2)
1372           goto yyexhaustedlab;
1373       }
1374 # undef YYSYNTAX_ERROR
1375 #endif
1376     }
1377 
1378 
1379 
1380   if (yyerrstatus == 3)
1381     {
1382       /* If just tried and failed to reuse lookahead token after an
1383          error, discard it.  */
1384 
1385       if (yychar <= YYEOF)
1386         {
1387           /* Return failure if at end of input.  */
1388           if (yychar == YYEOF)
1389             YYABORT;
1390         }
1391       else
1392         {
1393           yydestruct ("Error: discarding",
1394                       yytoken, &yylval);
1395           yychar = YYEMPTY;
1396         }
1397     }
1398 
1399   /* Else will try to reuse lookahead token after shifting the error
1400      token.  */
1401   goto yyerrlab1;
1402 
1403 
1404 /*---------------------------------------------------.
1405 | yyerrorlab -- error raised explicitly by YYERROR.  |
1406 `---------------------------------------------------*/
1407 yyerrorlab:
1408   /* Pacify compilers when the user code never invokes YYERROR and the
1409      label yyerrorlab therefore never appears in user code.  */
1410   if (0)
1411     YYERROR;
1412 
1413   /* Do not reclaim the symbols of the rule whose action triggered
1414      this YYERROR.  */
1415   YYPOPSTACK (yylen);
1416   yylen = 0;
1417   YY_STACK_PRINT (yyss, yyssp);
1418   yystate = *yyssp;
1419   goto yyerrlab1;
1420 
1421 
1422 /*-------------------------------------------------------------.
1423 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1424 `-------------------------------------------------------------*/
1425 yyerrlab1:
1426   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1427 
1428   for (;;)
1429     {
1430       yyn = yypact[yystate];
1431       if (!yypact_value_is_default (yyn))
1432         {
1433           yyn += YYTERROR;
1434           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1435             {
1436               yyn = yytable[yyn];
1437               if (0 < yyn)
1438                 break;
1439             }
1440         }
1441 
1442       /* Pop the current state because it cannot handle the error token.  */
1443       if (yyssp == yyss)
1444         YYABORT;
1445 
1446 
1447       yydestruct ("Error: popping",
1448                   yystos[yystate], yyvsp);
1449       YYPOPSTACK (1);
1450       yystate = *yyssp;
1451       YY_STACK_PRINT (yyss, yyssp);
1452     }
1453 
1454   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1455   *++yyvsp = yylval;
1456   YY_IGNORE_MAYBE_UNINITIALIZED_END
1457 
1458 
1459   /* Shift the error token.  */
1460   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1461 
1462   yystate = yyn;
1463   goto yynewstate;
1464 
1465 
1466 /*-------------------------------------.
1467 | yyacceptlab -- YYACCEPT comes here.  |
1468 `-------------------------------------*/
1469 yyacceptlab:
1470   yyresult = 0;
1471   goto yyreturn;
1472 
1473 
1474 /*-----------------------------------.
1475 | yyabortlab -- YYABORT comes here.  |
1476 `-----------------------------------*/
1477 yyabortlab:
1478   yyresult = 1;
1479   goto yyreturn;
1480 
1481 
1482 #if !defined yyoverflow || YYERROR_VERBOSE
1483 /*-------------------------------------------------.
1484 | yyexhaustedlab -- memory exhaustion comes here.  |
1485 `-------------------------------------------------*/
1486 yyexhaustedlab:
1487   yyerror (YY_("memory exhausted"));
1488   yyresult = 2;
1489   /* Fall through.  */
1490 #endif
1491 
1492 
1493 /*-----------------------------------------------------.
1494 | yyreturn -- parsing is finished, return the result.  |
1495 `-----------------------------------------------------*/
1496 yyreturn:
1497   if (yychar != YYEMPTY)
1498     {
1499       /* Make sure we have latest lookahead translation.  See comments at
1500          user semantic actions for why this is necessary.  */
1501       yytoken = YYTRANSLATE (yychar);
1502       yydestruct ("Cleanup: discarding lookahead",
1503                   yytoken, &yylval);
1504     }
1505   /* Do not reclaim the symbols of the rule whose action triggered
1506      this YYABORT or YYACCEPT.  */
1507   YYPOPSTACK (yylen);
1508   YY_STACK_PRINT (yyss, yyssp);
1509   while (yyssp != yyss)
1510     {
1511       yydestruct ("Cleanup: popping",
1512                   yystos[*yyssp], yyvsp);
1513       YYPOPSTACK (1);
1514     }
1515 #ifndef yyoverflow
1516   if (yyss != yyssa)
1517     YYSTACK_FREE (yyss);
1518 #endif
1519 #if YYERROR_VERBOSE
1520   if (yymsg != yymsgbuf)
1521     YYSTACK_FREE (yymsg);
1522 #endif
1523   return yyresult;
1524 }
1525 #line 76 "syncrep_gram.y" /* yacc.c:1918  */
1526 
1527 
1528 
1529 static SyncRepConfigData *
create_syncrep_config(const char * num_sync,List * members)1530 create_syncrep_config(const char *num_sync, List *members)
1531 {
1532 	SyncRepConfigData *config;
1533 	int			size;
1534 	ListCell   *lc;
1535 	char	   *ptr;
1536 
1537 	/* Compute space needed for flat representation */
1538 	size = offsetof(SyncRepConfigData, member_names);
1539 	foreach(lc, members)
1540 	{
1541 		char	   *standby_name = (char *) lfirst(lc);
1542 
1543 		size += strlen(standby_name) + 1;
1544 	}
1545 
1546 	/* And transform the data into flat representation */
1547 	config = (SyncRepConfigData *) palloc(size);
1548 
1549 	config->config_size = size;
1550 	config->num_sync = atoi(num_sync);
1551 	config->nmembers = list_length(members);
1552 	ptr = config->member_names;
1553 	foreach(lc, members)
1554 	{
1555 		char	   *standby_name = (char *) lfirst(lc);
1556 
1557 		strcpy(ptr, standby_name);
1558 		ptr += strlen(standby_name) + 1;
1559 	}
1560 
1561 	return config;
1562 }
1563 
1564 #include "syncrep_scanner.c"
1565