YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

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