Line data Source code
1 : /* A Bison parser, made by GNU Bison 3.0.2. */
2 :
3 : /* Bison implementation for Yacc-like parsers in C
4 :
5 : Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
6 :
7 : This program is free software: you can redistribute it and/or modify
8 : it under the terms of the GNU General Public License as published by
9 : the Free Software Foundation, either version 3 of the License, or
10 : (at your option) any later version.
11 :
12 : This program is distributed in the hope that it will be useful,
13 : but WITHOUT ANY WARRANTY; without even the implied warranty of
14 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 : GNU General Public License for more details.
16 :
17 : You should have received a copy of the GNU General Public License
18 : along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 :
20 : /* As a special exception, you may create a larger work that contains
21 : part or all of the Bison parser skeleton and distribute that work
22 : under terms of your choice, so long as that work isn't itself a
23 : parser generator using the skeleton or a modified version thereof
24 : as a parser skeleton. Alternatively, if you modify or redistribute
25 : the parser skeleton itself, you may (at your option) remove this
26 : special exception, which will cause the skeleton and the resulting
27 : Bison output files to be licensed under the GNU General Public
28 : License without this special exception.
29 :
30 : This special exception was added by the Free Software Foundation in
31 : version 2.2 of Bison. */
32 :
33 : /* C LALR(1) parser skeleton written by Richard Stallman, by
34 : simplifying the original so-called "semantic" parser. */
35 :
36 : /* All symbols defined below should begin with yy or YY, to avoid
37 : infringing on user name space. This should be done even for local
38 : variables, as they might otherwise be expanded by user macros.
39 : There are some unavoidable exceptions within include files to
40 : define necessary library symbols; they are noted "INFRINGES ON
41 : USER NAME SPACE" below. */
42 :
43 : /* Identify Bison output. */
44 : #define YYBISON 1
45 :
46 : /* Bison version. */
47 : #define YYBISON_VERSION "3.0.2"
48 :
49 : /* Skeleton name. */
50 : #define YYSKELETON_NAME "yacc.c"
51 :
52 : /* Pure parsers. */
53 : #define YYPURE 0
54 :
55 : /* Push parsers. */
56 : #define YYPUSH 0
57 :
58 : /* Pull parsers. */
59 : #define YYPULL 1
60 :
61 :
62 : /* Substitute the variable and function names. */
63 : #define yyparse syncrep_yyparse
64 : #define yylex syncrep_yylex
65 : #define yyerror syncrep_yyerror
66 : #define yydebug syncrep_yydebug
67 : #define yynerrs syncrep_yynerrs
68 :
69 : #define yylval syncrep_yylval
70 : #define yychar syncrep_yychar
71 :
72 : /* Copy the first part of user declarations. */
73 : #line 1 "syncrep_gram.y" /* yacc.c:339 */
74 :
75 : /*-------------------------------------------------------------------------
76 : *
77 : * syncrep_gram.y - Parser for synchronous_standby_names
78 : *
79 : * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
80 : * Portions Copyright (c) 1994, Regents of the University of California
81 : *
82 : *
83 : * IDENTIFICATION
84 : * src/backend/replication/syncrep_gram.y
85 : *
86 : *-------------------------------------------------------------------------
87 : */
88 : #include "postgres.h"
89 :
90 : #include "replication/syncrep.h"
91 :
92 : /* Result of parsing is returned in one of these two variables */
93 : SyncRepConfigData *syncrep_parse_result;
94 : char *syncrep_parse_error_msg;
95 :
96 : static SyncRepConfigData *create_syncrep_config(const char *num_sync,
97 : List *members, uint8 syncrep_method);
98 :
99 : /*
100 : * Bison doesn't allocate anything that needs to live across parser calls,
101 : * so we can easily have it use palloc instead of malloc. This prevents
102 : * memory leaks if we error out during parsing. Note this only works with
103 : * bison >= 2.0. However, in bison 1.875 the default is to use alloca()
104 : * if possible, so there's not really much problem anyhow, at least if
105 : * you're building with gcc.
106 : */
107 : #define YYMALLOC palloc
108 : #define YYFREE pfree
109 :
110 :
111 : #line 112 "syncrep_gram.c" /* yacc.c:339 */
112 :
113 : # ifndef YY_NULLPTR
114 : # if defined __cplusplus && 201103L <= __cplusplus
115 : # define YY_NULLPTR nullptr
116 : # else
117 : # define YY_NULLPTR 0
118 : # endif
119 : # endif
120 :
121 : /* Enabling verbose error messages. */
122 : #ifdef YYERROR_VERBOSE
123 : # undef YYERROR_VERBOSE
124 : # define YYERROR_VERBOSE 1
125 : #else
126 : # define YYERROR_VERBOSE 0
127 : #endif
128 :
129 :
130 : /* Debug traces. */
131 : #ifndef YYDEBUG
132 : # define YYDEBUG 0
133 : #endif
134 : #if YYDEBUG
135 : extern int syncrep_yydebug;
136 : #endif
137 :
138 : /* Token type. */
139 : #ifndef YYTOKENTYPE
140 : # define YYTOKENTYPE
141 : enum yytokentype
142 : {
143 : NAME = 258,
144 : NUM = 259,
145 : JUNK = 260,
146 : ANY = 261,
147 : FIRST = 262
148 : };
149 : #endif
150 :
151 : /* Value type. */
152 : #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
153 : typedef union YYSTYPE YYSTYPE;
154 : union YYSTYPE
155 : {
156 : #line 43 "syncrep_gram.y" /* yacc.c:355 */
157 :
158 : char *str;
159 : List *list;
160 : SyncRepConfigData *config;
161 :
162 : #line 163 "syncrep_gram.c" /* yacc.c:355 */
163 : };
164 : # define YYSTYPE_IS_TRIVIAL 1
165 : # define YYSTYPE_IS_DECLARED 1
166 : #endif
167 :
168 :
169 : extern YYSTYPE syncrep_yylval;
170 :
171 : int syncrep_yyparse (void);
172 :
173 :
174 :
175 : /* Copy the second part of user declarations. */
176 :
177 : #line 178 "syncrep_gram.c" /* yacc.c:358 */
178 :
179 : #ifdef short
180 : # undef short
181 : #endif
182 :
183 : #ifdef YYTYPE_UINT8
184 : typedef YYTYPE_UINT8 yytype_uint8;
185 : #else
186 : typedef unsigned char yytype_uint8;
187 : #endif
188 :
189 : #ifdef YYTYPE_INT8
190 : typedef YYTYPE_INT8 yytype_int8;
191 : #else
192 : typedef signed char yytype_int8;
193 : #endif
194 :
195 : #ifdef YYTYPE_UINT16
196 : typedef YYTYPE_UINT16 yytype_uint16;
197 : #else
198 : typedef unsigned short int yytype_uint16;
199 : #endif
200 :
201 : #ifdef YYTYPE_INT16
202 : typedef YYTYPE_INT16 yytype_int16;
203 : #else
204 : typedef short int yytype_int16;
205 : #endif
206 :
207 : #ifndef YYSIZE_T
208 : # ifdef __SIZE_TYPE__
209 : # define YYSIZE_T __SIZE_TYPE__
210 : # elif defined size_t
211 : # define YYSIZE_T size_t
212 : # elif ! defined YYSIZE_T
213 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
214 : # define YYSIZE_T size_t
215 : # else
216 : # define YYSIZE_T unsigned int
217 : # endif
218 : #endif
219 :
220 : #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
221 :
222 : #ifndef YY_
223 : # if defined YYENABLE_NLS && YYENABLE_NLS
224 : # if ENABLE_NLS
225 : # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
226 : # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
227 : # endif
228 : # endif
229 : # ifndef YY_
230 : # define YY_(Msgid) Msgid
231 : # endif
232 : #endif
233 :
234 : #ifndef YY_ATTRIBUTE
235 : # if (defined __GNUC__ \
236 : && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
237 : || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
238 : # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
239 : # else
240 : # define YY_ATTRIBUTE(Spec) /* empty */
241 : # endif
242 : #endif
243 :
244 : #ifndef YY_ATTRIBUTE_PURE
245 : # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
246 : #endif
247 :
248 : #ifndef YY_ATTRIBUTE_UNUSED
249 : # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
250 : #endif
251 :
252 : #if !defined _Noreturn \
253 : && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
254 : # if defined _MSC_VER && 1200 <= _MSC_VER
255 : # define _Noreturn __declspec (noreturn)
256 : # else
257 : # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
258 : # endif
259 : #endif
260 :
261 : /* Suppress unused-variable warnings by "using" E. */
262 : #if ! defined lint || defined __GNUC__
263 : # define YYUSE(E) ((void) (E))
264 : #else
265 : # define YYUSE(E) /* empty */
266 : #endif
267 :
268 : #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
269 : /* Suppress an incorrect diagnostic about yylval being uninitialized. */
270 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
271 : _Pragma ("GCC diagnostic push") \
272 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
273 : _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
274 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
275 : _Pragma ("GCC diagnostic pop")
276 : #else
277 : # define YY_INITIAL_VALUE(Value) Value
278 : #endif
279 : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
280 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
281 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
282 : #endif
283 : #ifndef YY_INITIAL_VALUE
284 : # define YY_INITIAL_VALUE(Value) /* Nothing. */
285 : #endif
286 :
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 : # define YYSTACK_ALLOC YYMALLOC
328 : # 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 : # 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 : ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
374 : + 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 : do \
385 : { \
386 : YYSIZE_T yynewbytes; \
387 : YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
388 : Stack = &yyptr->Stack_alloc; \
389 : yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
390 : yyptr += yynewbytes / sizeof (*yyptr); \
391 : } \
392 : 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 : __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 : #define YYFINAL 12
418 : /* YYLAST -- Last index in YYTABLE. */
419 : #define YYLAST 22
420 :
421 : /* YYNTOKENS -- Number of terminals. */
422 : #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 : /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
431 : by yylex, with out-of-bounds checking. */
432 : #define YYUNDEFTOK 2
433 : #define YYMAXUTOK 262
434 :
435 : #define YYTRANSLATE(YYX) \
436 : ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
437 :
438 : /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
439 : as returned by yylex, without out-of-bounds checking. */
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 : (!!((Yystate) == (-10)))
505 :
506 : #define YYTABLE_NINF -1
507 :
508 : #define yytable_value_is_error(Yytable_value) \
509 : 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 : #define YYEMPTY (-2)
586 : #define YYEOF 0
587 :
588 : #define YYACCEPT goto yyacceptlab
589 : #define YYABORT goto yyabortlab
590 : #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 : #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 YYOUTPUT. |
652 : `----------------------------------------*/
653 :
654 : static void
655 : yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
656 : {
657 : FILE *yyo = yyoutput;
658 : YYUSE (yyo);
659 : if (!yyvaluep)
660 : return;
661 : # ifdef YYPRINT
662 : if (yytype < YYNTOKENS)
663 : YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
664 : # endif
665 : YYUSE (yytype);
666 : }
667 :
668 :
669 : /*--------------------------------.
670 : | Print this symbol on YYOUTPUT. |
671 : `--------------------------------*/
672 :
673 : static void
674 : yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
675 : {
676 : YYFPRINTF (yyoutput, "%s %s (",
677 : yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
678 :
679 : yy_symbol_value_print (yyoutput, yytype, yyvaluep);
680 : YYFPRINTF (yyoutput, ")");
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 int 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 : # 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 : # 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 : /* Fall through. */
830 : default:
831 : if (yyres)
832 : yyres[yyn] = *yyp;
833 : yyn++;
834 : break;
835 :
836 : case '"':
837 : if (yyres)
838 : yyres[yyn] = '\0';
839 : return yyn;
840 : }
841 : do_not_strip_quotes: ;
842 : }
843 :
844 : if (! yyres)
845 : return yystrlen (yystr);
846 :
847 : return yystpcpy (yyres, yystr) - yyres;
848 : }
849 : # endif
850 :
851 : /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
852 : about the unexpected token YYTOKEN for the state stack whose top is
853 : YYSSP.
854 :
855 : Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
856 : not large enough to hold the message. In that case, also set
857 : *YYMSG_ALLOC to the required number of bytes. Return 2 if the
858 : required number of bytes is too large to store. */
859 : static int
860 : yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
861 : yytype_int16 *yyssp, int yytoken)
862 : {
863 : YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
864 : YYSIZE_T yysize = yysize0;
865 : enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
866 : /* Internationalized format string. */
867 : const char *yyformat = YY_NULLPTR;
868 : /* Arguments of yyformat. */
869 : char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
870 : /* Number of reported tokens (one for the "unexpected", one per
871 : "expected"). */
872 : int yycount = 0;
873 :
874 : /* There are many possibilities here to consider:
875 : - If this state is a consistent state with a default action, then
876 : the only way this function was invoked is if the default action
877 : is an error action. In that case, don't check for expected
878 : tokens because there are none.
879 : - The only way there can be no lookahead present (in yychar) is if
880 : this state is a consistent state with a default action. Thus,
881 : detecting the absence of a lookahead is sufficient to determine
882 : that there is no unexpected or expected token to report. In that
883 : case, just report a simple "syntax error".
884 : - Don't assume there isn't a lookahead just because this state is a
885 : consistent state with a default action. There might have been a
886 : previous inconsistent state, consistent state with a non-default
887 : action, or user semantic action that manipulated yychar.
888 : - Of course, the expected token list depends on states to have
889 : correct lookahead information, and it depends on the parser not
890 : to perform extra reductions after fetching a lookahead from the
891 : scanner and before detecting a syntax error. Thus, state merging
892 : (from LALR or IELR) and default reductions corrupt the expected
893 : token list. However, the list is correct for canonical LR with
894 : one exception: it will still contain any token that will not be
895 : accepted due to an error action in a later state.
896 : */
897 : if (yytoken != YYEMPTY)
898 : {
899 : int yyn = yypact[*yyssp];
900 : yyarg[yycount++] = yytname[yytoken];
901 : if (!yypact_value_is_default (yyn))
902 : {
903 : /* Start YYX at -YYN if negative to avoid negative indexes in
904 : YYCHECK. In other words, skip the first -YYN actions for
905 : this state because they are default actions. */
906 : int yyxbegin = yyn < 0 ? -yyn : 0;
907 : /* Stay within bounds of both yycheck and yytname. */
908 : int yychecklim = YYLAST - yyn + 1;
909 : int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
910 : int yyx;
911 :
912 : for (yyx = yyxbegin; yyx < yyxend; ++yyx)
913 : if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
914 : && !yytable_value_is_error (yytable[yyx + yyn]))
915 : {
916 : if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
917 : {
918 : yycount = 1;
919 : yysize = yysize0;
920 : break;
921 : }
922 : yyarg[yycount++] = yytname[yyx];
923 : {
924 : YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
925 : if (! (yysize <= yysize1
926 : && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
927 : return 2;
928 : yysize = yysize1;
929 : }
930 : }
931 : }
932 : }
933 :
934 : switch (yycount)
935 : {
936 : # define YYCASE_(N, S) \
937 : case N: \
938 : yyformat = S; \
939 : break
940 : YYCASE_(0, YY_("syntax error"));
941 : YYCASE_(1, YY_("syntax error, unexpected %s"));
942 : YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
943 : YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
944 : YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
945 : YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
946 : # undef YYCASE_
947 : }
948 :
949 : {
950 : YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
951 : if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
952 : return 2;
953 : yysize = yysize1;
954 : }
955 :
956 : if (*yymsg_alloc < yysize)
957 : {
958 : *yymsg_alloc = 2 * yysize;
959 : if (! (yysize <= *yymsg_alloc
960 : && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
961 : *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
962 : return 1;
963 : }
964 :
965 : /* Avoid sprintf, as that infringes on the user's name space.
966 : Don't have undefined behavior even if the translation
967 : produced a string with the wrong number of "%s"s. */
968 : {
969 : char *yyp = *yymsg;
970 : int yyi = 0;
971 : while ((*yyp = *yyformat) != '\0')
972 : if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
973 : {
974 : yyp += yytnamerr (yyp, yyarg[yyi++]);
975 : yyformat += 2;
976 : }
977 : else
978 : {
979 : yyp++;
980 : yyformat++;
981 : }
982 : }
983 : return 0;
984 : }
985 : #endif /* YYERROR_VERBOSE */
986 :
987 : /*-----------------------------------------------.
988 : | Release the memory associated to this symbol. |
989 : `-----------------------------------------------*/
990 :
991 : static void
992 0 : yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
993 : {
994 : YYUSE (yyvaluep);
995 0 : if (!yymsg)
996 0 : yymsg = "Deleting";
997 : YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
998 :
999 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1000 : YYUSE (yytype);
1001 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1002 0 : }
1003 :
1004 :
1005 :
1006 :
1007 : /* The lookahead symbol. */
1008 : int yychar;
1009 :
1010 : /* The semantic value of the lookahead symbol. */
1011 : YYSTYPE yylval;
1012 : /* Number of syntax errors so far. */
1013 : int yynerrs;
1014 :
1015 :
1016 : /*----------.
1017 : | yyparse. |
1018 : `----------*/
1019 :
1020 : int
1021 0 : yyparse (void)
1022 : {
1023 : int yystate;
1024 : /* Number of tokens to shift before error messages enabled. */
1025 : int yyerrstatus;
1026 :
1027 : /* The stacks and their tools:
1028 : 'yyss': related to states.
1029 : 'yyvs': related to semantic values.
1030 :
1031 : Refer to the stacks through separate pointers, to allow yyoverflow
1032 : to reallocate them elsewhere. */
1033 :
1034 : /* The state stack. */
1035 : yytype_int16 yyssa[YYINITDEPTH];
1036 : yytype_int16 *yyss;
1037 : yytype_int16 *yyssp;
1038 :
1039 : /* The semantic value stack. */
1040 : YYSTYPE yyvsa[YYINITDEPTH];
1041 : YYSTYPE *yyvs;
1042 : YYSTYPE *yyvsp;
1043 :
1044 : YYSIZE_T yystacksize;
1045 :
1046 : int yyn;
1047 : int yyresult;
1048 : /* Lookahead token as an internal (translated) token number. */
1049 0 : int yytoken = 0;
1050 : /* The variables used to return semantic value and location from the
1051 : action routines. */
1052 : YYSTYPE yyval;
1053 :
1054 : #if YYERROR_VERBOSE
1055 : /* Buffer for error messages, and its allocated size. */
1056 : char yymsgbuf[128];
1057 : char *yymsg = yymsgbuf;
1058 : YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1059 : #endif
1060 :
1061 : #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1062 :
1063 : /* The number of symbols on the RHS of the reduced rule.
1064 : Keep to zero when no symbol should be popped. */
1065 0 : int yylen = 0;
1066 :
1067 0 : yyssp = yyss = yyssa;
1068 0 : yyvsp = yyvs = yyvsa;
1069 0 : yystacksize = YYINITDEPTH;
1070 :
1071 : YYDPRINTF ((stderr, "Starting parse\n"));
1072 :
1073 0 : yystate = 0;
1074 0 : yyerrstatus = 0;
1075 0 : yynerrs = 0;
1076 0 : yychar = YYEMPTY; /* Cause a token to be read. */
1077 0 : goto yysetstate;
1078 :
1079 : /*------------------------------------------------------------.
1080 : | yynewstate -- Push a new state, which is found in yystate. |
1081 : `------------------------------------------------------------*/
1082 : yynewstate:
1083 : /* In all cases, when you get here, the value and location stacks
1084 : have just been pushed. So pushing a state here evens the stacks. */
1085 0 : yyssp++;
1086 :
1087 : yysetstate:
1088 0 : *yyssp = yystate;
1089 :
1090 0 : if (yyss + yystacksize - 1 <= yyssp)
1091 : {
1092 : /* Get the current used size of the three stacks, in elements. */
1093 0 : YYSIZE_T yysize = yyssp - yyss + 1;
1094 :
1095 : #ifdef 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 :
1112 : yyss = yyss1;
1113 : yyvs = yyvs1;
1114 : }
1115 : #else /* no yyoverflow */
1116 : # ifndef YYSTACK_RELOCATE
1117 : goto yyexhaustedlab;
1118 : # else
1119 : /* Extend the stack our own way. */
1120 0 : if (YYMAXDEPTH <= yystacksize)
1121 0 : goto yyexhaustedlab;
1122 0 : yystacksize *= 2;
1123 0 : if (YYMAXDEPTH < yystacksize)
1124 0 : yystacksize = YYMAXDEPTH;
1125 :
1126 : {
1127 0 : yytype_int16 *yyss1 = yyss;
1128 0 : union yyalloc *yyptr =
1129 0 : (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1130 0 : if (! yyptr)
1131 0 : goto yyexhaustedlab;
1132 0 : YYSTACK_RELOCATE (yyss_alloc, yyss);
1133 0 : YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1134 : # undef YYSTACK_RELOCATE
1135 0 : if (yyss1 != yyssa)
1136 0 : YYSTACK_FREE (yyss1);
1137 : }
1138 : # endif
1139 : #endif /* no yyoverflow */
1140 :
1141 0 : yyssp = yyss + yysize - 1;
1142 0 : yyvsp = yyvs + yysize - 1;
1143 :
1144 : YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1145 : (unsigned long int) yystacksize));
1146 :
1147 0 : if (yyss + yystacksize - 1 <= yyssp)
1148 0 : YYABORT;
1149 : }
1150 :
1151 : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1152 :
1153 0 : if (yystate == YYFINAL)
1154 0 : YYACCEPT;
1155 :
1156 0 : goto yybackup;
1157 :
1158 : /*-----------.
1159 : | yybackup. |
1160 : `-----------*/
1161 : yybackup:
1162 :
1163 : /* Do appropriate processing given the current state. Read a
1164 : lookahead token if we need one and don't already have one. */
1165 :
1166 : /* First try to decide what to do without reference to lookahead token. */
1167 0 : yyn = yypact[yystate];
1168 0 : if (yypact_value_is_default (yyn))
1169 0 : goto yydefault;
1170 :
1171 : /* Not known => get a lookahead token if don't already have one. */
1172 :
1173 : /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1174 0 : if (yychar == YYEMPTY)
1175 : {
1176 : YYDPRINTF ((stderr, "Reading a token: "));
1177 0 : yychar = yylex ();
1178 : }
1179 :
1180 0 : if (yychar <= YYEOF)
1181 : {
1182 0 : yychar = yytoken = YYEOF;
1183 : YYDPRINTF ((stderr, "Now at end of input.\n"));
1184 : }
1185 : else
1186 : {
1187 0 : yytoken = YYTRANSLATE (yychar);
1188 : YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1189 : }
1190 :
1191 : /* If the proper action on seeing token YYTOKEN is to reduce or to
1192 : detect an error, take that action. */
1193 0 : yyn += yytoken;
1194 0 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1195 : goto yydefault;
1196 0 : yyn = yytable[yyn];
1197 0 : if (yyn <= 0)
1198 : {
1199 : if (yytable_value_is_error (yyn))
1200 : goto yyerrlab;
1201 0 : yyn = -yyn;
1202 0 : goto yyreduce;
1203 : }
1204 :
1205 : /* Count tokens shifted since error; after three, turn off error
1206 : status. */
1207 0 : if (yyerrstatus)
1208 0 : yyerrstatus--;
1209 :
1210 : /* Shift the lookahead token. */
1211 : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1212 :
1213 : /* Discard the shifted token. */
1214 0 : yychar = YYEMPTY;
1215 :
1216 0 : yystate = yyn;
1217 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1218 0 : *++yyvsp = yylval;
1219 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1220 :
1221 0 : goto yynewstate;
1222 :
1223 :
1224 : /*-----------------------------------------------------------.
1225 : | yydefault -- do the default action for the current state. |
1226 : `-----------------------------------------------------------*/
1227 : yydefault:
1228 0 : yyn = yydefact[yystate];
1229 0 : if (yyn == 0)
1230 0 : goto yyerrlab;
1231 0 : goto yyreduce;
1232 :
1233 :
1234 : /*-----------------------------.
1235 : | yyreduce -- Do a reduction. |
1236 : `-----------------------------*/
1237 : yyreduce:
1238 : /* yyn is the number of a rule to reduce with. */
1239 0 : yylen = yyr2[yyn];
1240 :
1241 : /* If YYLEN is nonzero, implement the default value of the action:
1242 : '$$ = $1'.
1243 :
1244 : Otherwise, the following line sets YYVAL to garbage.
1245 : This behavior is undocumented and Bison
1246 : users should not rely upon it. Assigning to YYVAL
1247 : unconditionally makes the parser a bit smaller, and it avoids a
1248 : GCC warning that YYVAL may be used uninitialized. */
1249 0 : yyval = yyvsp[1-yylen];
1250 :
1251 :
1252 : YY_REDUCE_PRINT (yyn);
1253 0 : switch (yyn)
1254 : {
1255 : case 2:
1256 : #line 59 "syncrep_gram.y" /* yacc.c:1646 */
1257 : { syncrep_parse_result = (yyvsp[0].config); }
1258 : #line 1259 "syncrep_gram.c" /* yacc.c:1646 */
1259 0 : break;
1260 :
1261 : case 3:
1262 : #line 63 "syncrep_gram.y" /* yacc.c:1646 */
1263 : { (yyval.config) = create_syncrep_config("1", (yyvsp[0].list), SYNC_REP_PRIORITY); }
1264 : #line 1265 "syncrep_gram.c" /* yacc.c:1646 */
1265 0 : break;
1266 :
1267 : case 4:
1268 : #line 64 "syncrep_gram.y" /* yacc.c:1646 */
1269 : { (yyval.config) = create_syncrep_config((yyvsp[-3].str), (yyvsp[-1].list), SYNC_REP_PRIORITY); }
1270 : #line 1271 "syncrep_gram.c" /* yacc.c:1646 */
1271 0 : break;
1272 :
1273 : case 5:
1274 : #line 65 "syncrep_gram.y" /* yacc.c:1646 */
1275 : { (yyval.config) = create_syncrep_config((yyvsp[-3].str), (yyvsp[-1].list), SYNC_REP_QUORUM); }
1276 : #line 1277 "syncrep_gram.c" /* yacc.c:1646 */
1277 0 : break;
1278 :
1279 : case 6:
1280 : #line 66 "syncrep_gram.y" /* yacc.c:1646 */
1281 : { (yyval.config) = create_syncrep_config((yyvsp[-3].str), (yyvsp[-1].list), SYNC_REP_PRIORITY); }
1282 : #line 1283 "syncrep_gram.c" /* yacc.c:1646 */
1283 0 : break;
1284 :
1285 : case 7:
1286 : #line 70 "syncrep_gram.y" /* yacc.c:1646 */
1287 : { (yyval.list) = list_make1((yyvsp[0].str)); }
1288 : #line 1289 "syncrep_gram.c" /* yacc.c:1646 */
1289 0 : break;
1290 :
1291 : case 8:
1292 : #line 71 "syncrep_gram.y" /* yacc.c:1646 */
1293 : { (yyval.list) = lappend((yyvsp[-2].list), (yyvsp[0].str)); }
1294 : #line 1295 "syncrep_gram.c" /* yacc.c:1646 */
1295 0 : break;
1296 :
1297 : case 9:
1298 : #line 75 "syncrep_gram.y" /* yacc.c:1646 */
1299 : { (yyval.str) = (yyvsp[0].str); }
1300 : #line 1301 "syncrep_gram.c" /* yacc.c:1646 */
1301 0 : break;
1302 :
1303 : case 10:
1304 : #line 76 "syncrep_gram.y" /* yacc.c:1646 */
1305 : { (yyval.str) = (yyvsp[0].str); }
1306 : #line 1307 "syncrep_gram.c" /* yacc.c:1646 */
1307 0 : break;
1308 :
1309 :
1310 : #line 1311 "syncrep_gram.c" /* yacc.c:1646 */
1311 0 : default: break;
1312 : }
1313 : /* User semantic actions sometimes alter yychar, and that requires
1314 : that yytoken be updated with the new translation. We take the
1315 : approach of translating immediately before every use of yytoken.
1316 : One alternative is translating here after every semantic action,
1317 : but that translation would be missed if the semantic action invokes
1318 : YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1319 : if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1320 : incorrect destructor might then be invoked immediately. In the
1321 : case of YYERROR or YYBACKUP, subsequent parser actions might lead
1322 : to an incorrect destructor call or verbose syntax error message
1323 : before the lookahead is translated. */
1324 : YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1325 :
1326 0 : YYPOPSTACK (yylen);
1327 0 : yylen = 0;
1328 : YY_STACK_PRINT (yyss, yyssp);
1329 :
1330 0 : *++yyvsp = yyval;
1331 :
1332 : /* Now 'shift' the result of the reduction. Determine what state
1333 : that goes to, based on the state we popped back to and the rule
1334 : number reduced by. */
1335 :
1336 0 : yyn = yyr1[yyn];
1337 :
1338 0 : yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1339 0 : if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1340 0 : yystate = yytable[yystate];
1341 : else
1342 0 : yystate = yydefgoto[yyn - YYNTOKENS];
1343 :
1344 0 : goto yynewstate;
1345 :
1346 :
1347 : /*--------------------------------------.
1348 : | yyerrlab -- here on detecting error. |
1349 : `--------------------------------------*/
1350 : yyerrlab:
1351 : /* Make sure we have latest lookahead translation. See comments at
1352 : user semantic actions for why this is necessary. */
1353 0 : yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1354 :
1355 : /* If not already recovering from an error, report this error. */
1356 0 : if (!yyerrstatus)
1357 : {
1358 0 : ++yynerrs;
1359 : #if ! YYERROR_VERBOSE
1360 0 : yyerror (YY_("syntax error"));
1361 : #else
1362 : # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1363 : yyssp, yytoken)
1364 : {
1365 : char const *yymsgp = YY_("syntax error");
1366 : int yysyntax_error_status;
1367 : yysyntax_error_status = YYSYNTAX_ERROR;
1368 : if (yysyntax_error_status == 0)
1369 : yymsgp = yymsg;
1370 : else if (yysyntax_error_status == 1)
1371 : {
1372 : if (yymsg != yymsgbuf)
1373 : YYSTACK_FREE (yymsg);
1374 : yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1375 : if (!yymsg)
1376 : {
1377 : yymsg = yymsgbuf;
1378 : yymsg_alloc = sizeof yymsgbuf;
1379 : yysyntax_error_status = 2;
1380 : }
1381 : else
1382 : {
1383 : yysyntax_error_status = YYSYNTAX_ERROR;
1384 : yymsgp = yymsg;
1385 : }
1386 : }
1387 : yyerror (yymsgp);
1388 : if (yysyntax_error_status == 2)
1389 : goto yyexhaustedlab;
1390 : }
1391 : # undef YYSYNTAX_ERROR
1392 : #endif
1393 : }
1394 :
1395 :
1396 :
1397 0 : if (yyerrstatus == 3)
1398 : {
1399 : /* If just tried and failed to reuse lookahead token after an
1400 : error, discard it. */
1401 :
1402 0 : if (yychar <= YYEOF)
1403 : {
1404 : /* Return failure if at end of input. */
1405 0 : if (yychar == YYEOF)
1406 0 : YYABORT;
1407 : }
1408 : else
1409 : {
1410 0 : yydestruct ("Error: discarding",
1411 : yytoken, &yylval);
1412 0 : yychar = YYEMPTY;
1413 : }
1414 : }
1415 :
1416 : /* Else will try to reuse lookahead token after shifting the error
1417 : token. */
1418 0 : goto yyerrlab1;
1419 :
1420 :
1421 : /*---------------------------------------------------.
1422 : | yyerrorlab -- error raised explicitly by YYERROR. |
1423 : `---------------------------------------------------*/
1424 : yyerrorlab:
1425 :
1426 : /* Pacify compilers like GCC when the user code never invokes
1427 : YYERROR and the label yyerrorlab therefore never appears in user
1428 : code. */
1429 : if (/*CONSTCOND*/ 0)
1430 : goto yyerrorlab;
1431 :
1432 : /* Do not reclaim the symbols of the rule whose action triggered
1433 : this YYERROR. */
1434 : YYPOPSTACK (yylen);
1435 : yylen = 0;
1436 : YY_STACK_PRINT (yyss, yyssp);
1437 : yystate = *yyssp;
1438 : goto yyerrlab1;
1439 :
1440 :
1441 : /*-------------------------------------------------------------.
1442 : | yyerrlab1 -- common code for both syntax error and YYERROR. |
1443 : `-------------------------------------------------------------*/
1444 : yyerrlab1:
1445 0 : yyerrstatus = 3; /* Each real token shifted decrements this. */
1446 :
1447 : for (;;)
1448 : {
1449 0 : yyn = yypact[yystate];
1450 0 : if (!yypact_value_is_default (yyn))
1451 : {
1452 0 : yyn += YYTERROR;
1453 0 : if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1454 : {
1455 0 : yyn = yytable[yyn];
1456 0 : if (0 < yyn)
1457 0 : break;
1458 : }
1459 : }
1460 :
1461 : /* Pop the current state because it cannot handle the error token. */
1462 0 : if (yyssp == yyss)
1463 0 : YYABORT;
1464 :
1465 :
1466 0 : yydestruct ("Error: popping",
1467 0 : yystos[yystate], yyvsp);
1468 0 : YYPOPSTACK (1);
1469 0 : yystate = *yyssp;
1470 : YY_STACK_PRINT (yyss, yyssp);
1471 0 : }
1472 :
1473 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1474 0 : *++yyvsp = yylval;
1475 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1476 :
1477 :
1478 : /* Shift the error token. */
1479 : YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1480 :
1481 0 : yystate = yyn;
1482 0 : goto yynewstate;
1483 :
1484 :
1485 : /*-------------------------------------.
1486 : | yyacceptlab -- YYACCEPT comes here. |
1487 : `-------------------------------------*/
1488 : yyacceptlab:
1489 0 : yyresult = 0;
1490 0 : goto yyreturn;
1491 :
1492 : /*-----------------------------------.
1493 : | yyabortlab -- YYABORT comes here. |
1494 : `-----------------------------------*/
1495 : yyabortlab:
1496 0 : yyresult = 1;
1497 0 : goto yyreturn;
1498 :
1499 : #if !defined yyoverflow || YYERROR_VERBOSE
1500 : /*-------------------------------------------------.
1501 : | yyexhaustedlab -- memory exhaustion comes here. |
1502 : `-------------------------------------------------*/
1503 : yyexhaustedlab:
1504 0 : yyerror (YY_("memory exhausted"));
1505 0 : yyresult = 2;
1506 : /* Fall through. */
1507 : #endif
1508 :
1509 : yyreturn:
1510 0 : if (yychar != YYEMPTY)
1511 : {
1512 : /* Make sure we have latest lookahead translation. See comments at
1513 : user semantic actions for why this is necessary. */
1514 0 : yytoken = YYTRANSLATE (yychar);
1515 0 : yydestruct ("Cleanup: discarding lookahead",
1516 : yytoken, &yylval);
1517 : }
1518 : /* Do not reclaim the symbols of the rule whose action triggered
1519 : this YYABORT or YYACCEPT. */
1520 0 : YYPOPSTACK (yylen);
1521 : YY_STACK_PRINT (yyss, yyssp);
1522 0 : while (yyssp != yyss)
1523 : {
1524 0 : yydestruct ("Cleanup: popping",
1525 0 : yystos[*yyssp], yyvsp);
1526 0 : YYPOPSTACK (1);
1527 : }
1528 : #ifndef yyoverflow
1529 0 : if (yyss != yyssa)
1530 0 : YYSTACK_FREE (yyss);
1531 : #endif
1532 : #if YYERROR_VERBOSE
1533 : if (yymsg != yymsgbuf)
1534 : YYSTACK_FREE (yymsg);
1535 : #endif
1536 0 : return yyresult;
1537 : }
1538 : #line 78 "syncrep_gram.y" /* yacc.c:1906 */
1539 :
1540 :
1541 : static SyncRepConfigData *
1542 : create_syncrep_config(const char *num_sync, List *members, uint8 syncrep_method)
1543 : {
1544 : SyncRepConfigData *config;
1545 : int size;
1546 : ListCell *lc;
1547 : char *ptr;
1548 :
1549 : /* Compute space needed for flat representation */
1550 : size = offsetof(SyncRepConfigData, member_names);
1551 : foreach(lc, members)
1552 : {
1553 : char *standby_name = (char *) lfirst(lc);
1554 :
1555 : size += strlen(standby_name) + 1;
1556 : }
1557 :
1558 : /* And transform the data into flat representation */
1559 : config = (SyncRepConfigData *) palloc(size);
1560 :
1561 : config->config_size = size;
1562 : config->num_sync = atoi(num_sync);
1563 : config->syncrep_method = syncrep_method;
1564 : config->nmembers = list_length(members);
1565 : ptr = config->member_names;
1566 : foreach(lc, members)
1567 : {
1568 : char *standby_name = (char *) lfirst(lc);
1569 :
1570 : strcpy(ptr, standby_name);
1571 : ptr += strlen(standby_name) + 1;
1572 : }
1573 :
1574 : return config;
1575 : }
1576 :
1577 : #include "syncrep_scanner.c"
|