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