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