Line | Count | Source |
1 | | /* A Bison parser, made by GNU Bison 3.5.1. */ |
2 | | |
3 | | /* Bison implementation for Yacc-like parsers in C |
4 | | |
5 | | Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, |
6 | | Inc. |
7 | | |
8 | | This program is free software: you can redistribute it and/or modify |
9 | | it under the terms of the GNU General Public License as published by |
10 | | the Free Software Foundation, either version 3 of the License, or |
11 | | (at your option) any later version. |
12 | | |
13 | | This program is distributed in the hope that it will be useful, |
14 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | GNU General Public License for more details. |
17 | | |
18 | | You should have received a copy of the GNU General Public License |
19 | | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
20 | | |
21 | | /* As a special exception, you may create a larger work that contains |
22 | | part or all of the Bison parser skeleton and distribute that work |
23 | | under terms of your choice, so long as that work isn't itself a |
24 | | parser generator using the skeleton or a modified version thereof |
25 | | as a parser skeleton. Alternatively, if you modify or redistribute |
26 | | the parser skeleton itself, you may (at your option) remove this |
27 | | special exception, which will cause the skeleton and the resulting |
28 | | Bison output files to be licensed under the GNU General Public |
29 | | License without this special exception. |
30 | | |
31 | | This special exception was added by the Free Software Foundation in |
32 | | version 2.2 of Bison. */ |
33 | | |
34 | | /* C LALR(1) parser skeleton written by Richard Stallman, by |
35 | | simplifying the original so-called "semantic" parser. */ |
36 | | |
37 | | /* All symbols defined below should begin with yy or YY, to avoid |
38 | | infringing on user name space. This should be done even for local |
39 | | variables, as they might otherwise be expanded by user macros. |
40 | | There are some unavoidable exceptions within include files to |
41 | | define necessary library symbols; they are noted "INFRINGES ON |
42 | | USER NAME SPACE" below. */ |
43 | | |
44 | | /* Undocumented macros, especially those whose name start with YY_, |
45 | | are private implementation details. Do not rely on them. */ |
46 | | |
47 | | /* Identify Bison output. */ |
48 | | #define YYBISON 1 |
49 | | |
50 | | /* Bison version. */ |
51 | | #define YYBISON_VERSION "3.5.1" |
52 | | |
53 | | /* Skeleton name. */ |
54 | | #define YYSKELETON_NAME "yacc.c" |
55 | | |
56 | | /* Pure parsers. */ |
57 | | #define YYPURE 0 |
58 | | |
59 | | /* Push parsers. */ |
60 | | #define YYPUSH 0 |
61 | | |
62 | | /* Pull parsers. */ |
63 | | #define YYPULL 1 |
64 | | |
65 | | |
66 | | |
67 | | |
68 | | /* First part of user prologue. */ |
69 | | #line 1 "gram.y" |
70 | | |
71 | | /* This file is part of GDBM, the GNU data base manager. |
72 | | Copyright (C) 1990-2025 Free Software Foundation, Inc. |
73 | | |
74 | | GDBM is free software; you can redistribute it and/or modify |
75 | | it under the terms of the GNU General Public License as published by |
76 | | the Free Software Foundation; either version 3, or (at your option) |
77 | | any later version. |
78 | | |
79 | | GDBM is distributed in the hope that it will be useful, |
80 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
81 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
82 | | GNU General Public License for more details. |
83 | | |
84 | | You should have received a copy of the GNU General Public License |
85 | | along with GDBM. If not, see <http://www.gnu.org/licenses/>. */ |
86 | | |
87 | | #include <autoconf.h> |
88 | | #include "gdbmtool.h" |
89 | | |
90 | | struct dsegm *dsdef[DS_MAX]; |
91 | | |
92 | | |
93 | | #line 94 "gram.c" |
94 | | |
95 | | # ifndef YY_CAST |
96 | | # ifdef __cplusplus |
97 | | # define YY_CAST(Type, Val) static_cast<Type> (Val) |
98 | | # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) |
99 | | # else |
100 | 704k | # define YY_CAST(Type, Val) ((Type) (Val)) |
101 | | # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) |
102 | | # endif |
103 | | # endif |
104 | | # ifndef YY_NULLPTR |
105 | | # if defined __cplusplus |
106 | | # if 201103L <= __cplusplus |
107 | | # define YY_NULLPTR nullptr |
108 | | # else |
109 | | # define YY_NULLPTR 0 |
110 | | # endif |
111 | | # else |
112 | 0 | # define YY_NULLPTR ((void*)0) |
113 | | # endif |
114 | | # endif |
115 | | |
116 | | /* Enabling verbose error messages. */ |
117 | | #ifdef YYERROR_VERBOSE |
118 | | # undef YYERROR_VERBOSE |
119 | | # define YYERROR_VERBOSE 1 |
120 | | #else |
121 | | # define YYERROR_VERBOSE 1 |
122 | | #endif |
123 | | |
124 | | /* Use api.header.include to #include this header |
125 | | instead of duplicating it here. */ |
126 | | #ifndef YY_YY_GRAM_H_INCLUDED |
127 | | # define YY_YY_GRAM_H_INCLUDED |
128 | | /* Debug traces. */ |
129 | | #ifndef YYDEBUG |
130 | | # define YYDEBUG 0 |
131 | | #endif |
132 | | #if YYDEBUG |
133 | | extern int yydebug; |
134 | | #endif |
135 | | |
136 | | /* Token type. */ |
137 | | #ifndef YYTOKENTYPE |
138 | | # define YYTOKENTYPE |
139 | | enum yytokentype |
140 | | { |
141 | | T_TYPE = 258, |
142 | | T_OFF = 259, |
143 | | T_PAD = 260, |
144 | | T_DEF = 261, |
145 | | T_SET = 262, |
146 | | T_UNSET = 263, |
147 | | T_BOGUS = 264, |
148 | | T_CMD = 265, |
149 | | T_SHELL = 266, |
150 | | T_NUM = 267, |
151 | | T_IDENT = 268, |
152 | | T_WORD = 269, |
153 | | T_PIPELINE = 270 |
154 | | }; |
155 | | #endif |
156 | | |
157 | | /* Value type. */ |
158 | | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
159 | | union YYSTYPE |
160 | | { |
161 | | #line 52 "gram.y" |
162 | | |
163 | | char *string; |
164 | | struct kvpair *kvpair; |
165 | | struct { struct kvpair *head, *tail; } kvlist; |
166 | | struct { struct slist *head, *tail; } slist; |
167 | | struct gdbmarg *arg; |
168 | | struct gdbmarglist arglist; |
169 | | int num; |
170 | | struct datadef *type; |
171 | | struct dsegm *dsegm; |
172 | | struct { struct dsegm *head, *tail; } dsegmlist; |
173 | | struct command *cmd; |
174 | | |
175 | | #line 176 "gram.c" |
176 | | |
177 | | }; |
178 | | typedef union YYSTYPE YYSTYPE; |
179 | | # define YYSTYPE_IS_TRIVIAL 1 |
180 | | # define YYSTYPE_IS_DECLARED 1 |
181 | | #endif |
182 | | |
183 | | /* Location type. */ |
184 | | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED |
185 | | typedef struct YYLTYPE YYLTYPE; |
186 | | struct YYLTYPE |
187 | | { |
188 | | int first_line; |
189 | | int first_column; |
190 | | int last_line; |
191 | | int last_column; |
192 | | }; |
193 | | # define YYLTYPE_IS_DECLARED 1 |
194 | | # define YYLTYPE_IS_TRIVIAL 1 |
195 | | #endif |
196 | | |
197 | | |
198 | | extern YYSTYPE yylval; |
199 | | extern YYLTYPE yylloc; |
200 | | int yyparse (void); |
201 | | |
202 | | #endif /* !YY_YY_GRAM_H_INCLUDED */ |
203 | | |
204 | | |
205 | | |
206 | | #ifdef short |
207 | | # undef short |
208 | | #endif |
209 | | |
210 | | /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure |
211 | | <limits.h> and (if available) <stdint.h> are included |
212 | | so that the code can choose integer types of a good width. */ |
213 | | |
214 | | #ifndef __PTRDIFF_MAX__ |
215 | | # include <limits.h> /* INFRINGES ON USER NAME SPACE */ |
216 | | # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
217 | | # include <stdint.h> /* INFRINGES ON USER NAME SPACE */ |
218 | | # define YY_STDINT_H |
219 | | # endif |
220 | | #endif |
221 | | |
222 | | /* Narrow types that promote to a signed type and that can represent a |
223 | | signed or unsigned integer of at least N bits. In tables they can |
224 | | save space and decrease cache pressure. Promoting to a signed type |
225 | | helps avoid bugs in integer arithmetic. */ |
226 | | |
227 | | #ifdef __INT_LEAST8_MAX__ |
228 | | typedef __INT_LEAST8_TYPE__ yytype_int8; |
229 | | #elif defined YY_STDINT_H |
230 | | typedef int_least8_t yytype_int8; |
231 | | #else |
232 | | typedef signed char yytype_int8; |
233 | | #endif |
234 | | |
235 | | #ifdef __INT_LEAST16_MAX__ |
236 | | typedef __INT_LEAST16_TYPE__ yytype_int16; |
237 | | #elif defined YY_STDINT_H |
238 | | typedef int_least16_t yytype_int16; |
239 | | #else |
240 | | typedef short yytype_int16; |
241 | | #endif |
242 | | |
243 | | #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ |
244 | | typedef __UINT_LEAST8_TYPE__ yytype_uint8; |
245 | | #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ |
246 | | && UINT_LEAST8_MAX <= INT_MAX) |
247 | | typedef uint_least8_t yytype_uint8; |
248 | | #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX |
249 | | typedef unsigned char yytype_uint8; |
250 | | #else |
251 | | typedef short yytype_uint8; |
252 | | #endif |
253 | | |
254 | | #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ |
255 | | typedef __UINT_LEAST16_TYPE__ yytype_uint16; |
256 | | #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ |
257 | | && UINT_LEAST16_MAX <= INT_MAX) |
258 | | typedef uint_least16_t yytype_uint16; |
259 | | #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX |
260 | | typedef unsigned short yytype_uint16; |
261 | | #else |
262 | | typedef int yytype_uint16; |
263 | | #endif |
264 | | |
265 | | #ifndef YYPTRDIFF_T |
266 | | # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ |
267 | 8.03k | # define YYPTRDIFF_T __PTRDIFF_TYPE__ |
268 | | # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ |
269 | | # elif defined PTRDIFF_MAX |
270 | | # ifndef ptrdiff_t |
271 | | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
272 | | # endif |
273 | | # define YYPTRDIFF_T ptrdiff_t |
274 | | # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX |
275 | | # else |
276 | | # define YYPTRDIFF_T long |
277 | | # define YYPTRDIFF_MAXIMUM LONG_MAX |
278 | | # endif |
279 | | #endif |
280 | | |
281 | | #ifndef YYSIZE_T |
282 | | # ifdef __SIZE_TYPE__ |
283 | | # define YYSIZE_T __SIZE_TYPE__ |
284 | | # elif defined size_t |
285 | | # define YYSIZE_T size_t |
286 | | # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
287 | | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
288 | | # define YYSIZE_T size_t |
289 | | # else |
290 | | # define YYSIZE_T unsigned |
291 | | # endif |
292 | | #endif |
293 | | |
294 | | #define YYSIZE_MAXIMUM \ |
295 | 0 | YY_CAST (YYPTRDIFF_T, \ |
296 | | (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ |
297 | | ? YYPTRDIFF_MAXIMUM \ |
298 | | : YY_CAST (YYSIZE_T, -1))) |
299 | | |
300 | 0 | #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) |
301 | | |
302 | | /* Stored state numbers (used for stacks). */ |
303 | | typedef yytype_int8 yy_state_t; |
304 | | |
305 | | /* State numbers in computations. */ |
306 | | typedef int yy_state_fast_t; |
307 | | |
308 | | #ifndef YY_ |
309 | | # if defined YYENABLE_NLS && YYENABLE_NLS |
310 | | # if ENABLE_NLS |
311 | | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
312 | | # define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
313 | | # endif |
314 | | # endif |
315 | | # ifndef YY_ |
316 | 0 | # define YY_(Msgid) Msgid |
317 | | # endif |
318 | | #endif |
319 | | |
320 | | #ifndef YY_ATTRIBUTE_PURE |
321 | | # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) |
322 | | # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
323 | | # else |
324 | | # define YY_ATTRIBUTE_PURE |
325 | | # endif |
326 | | #endif |
327 | | |
328 | | #ifndef YY_ATTRIBUTE_UNUSED |
329 | | # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) |
330 | | # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
331 | | # else |
332 | | # define YY_ATTRIBUTE_UNUSED |
333 | | # endif |
334 | | #endif |
335 | | |
336 | | /* Suppress unused-variable warnings by "using" E. */ |
337 | | #if ! defined lint || defined __GNUC__ |
338 | 13.7k | # define YYUSE(E) ((void) (E)) |
339 | | #else |
340 | | # define YYUSE(E) /* empty */ |
341 | | #endif |
342 | | |
343 | | #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ |
344 | | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
345 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
346 | | _Pragma ("GCC diagnostic push") \ |
347 | | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ |
348 | | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
349 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
350 | | _Pragma ("GCC diagnostic pop") |
351 | | #else |
352 | | # define YY_INITIAL_VALUE(Value) Value |
353 | | #endif |
354 | | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
355 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
356 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
357 | | #endif |
358 | | #ifndef YY_INITIAL_VALUE |
359 | | # define YY_INITIAL_VALUE(Value) /* Nothing. */ |
360 | | #endif |
361 | | |
362 | | #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ |
363 | | # define YY_IGNORE_USELESS_CAST_BEGIN \ |
364 | | _Pragma ("GCC diagnostic push") \ |
365 | | _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") |
366 | | # define YY_IGNORE_USELESS_CAST_END \ |
367 | | _Pragma ("GCC diagnostic pop") |
368 | | #endif |
369 | | #ifndef YY_IGNORE_USELESS_CAST_BEGIN |
370 | | # define YY_IGNORE_USELESS_CAST_BEGIN |
371 | | # define YY_IGNORE_USELESS_CAST_END |
372 | | #endif |
373 | | |
374 | | |
375 | 704k | #define YY_ASSERT(E) ((void) (0 && (E))) |
376 | | |
377 | | #if ! defined yyoverflow || YYERROR_VERBOSE |
378 | | |
379 | | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
380 | | |
381 | | # ifdef YYSTACK_USE_ALLOCA |
382 | | # if YYSTACK_USE_ALLOCA |
383 | | # ifdef __GNUC__ |
384 | | # define YYSTACK_ALLOC __builtin_alloca |
385 | | # elif defined __BUILTIN_VA_ARG_INCR |
386 | | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
387 | | # elif defined _AIX |
388 | | # define YYSTACK_ALLOC __alloca |
389 | | # elif defined _MSC_VER |
390 | | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
391 | | # define alloca _alloca |
392 | | # else |
393 | | # define YYSTACK_ALLOC alloca |
394 | | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
395 | | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
396 | | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
397 | | # ifndef EXIT_SUCCESS |
398 | | # define EXIT_SUCCESS 0 |
399 | | # endif |
400 | | # endif |
401 | | # endif |
402 | | # endif |
403 | | # endif |
404 | | |
405 | | # ifdef YYSTACK_ALLOC |
406 | | /* Pacify GCC's 'empty if-body' warning. */ |
407 | | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
408 | | # ifndef YYSTACK_ALLOC_MAXIMUM |
409 | | /* The OS might guarantee only one guard page at the bottom of the stack, |
410 | | and a page size can be as small as 4096 bytes. So we cannot safely |
411 | | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
412 | | to allow for a few compiler-allocated temporary stack slots. */ |
413 | | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
414 | | # endif |
415 | | # else |
416 | | # define YYSTACK_ALLOC YYMALLOC |
417 | 0 | # define YYSTACK_FREE YYFREE |
418 | | # ifndef YYSTACK_ALLOC_MAXIMUM |
419 | 0 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
420 | | # endif |
421 | | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
422 | | && ! ((defined YYMALLOC || defined malloc) \ |
423 | | && (defined YYFREE || defined free))) |
424 | | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
425 | | # ifndef EXIT_SUCCESS |
426 | | # define EXIT_SUCCESS 0 |
427 | | # endif |
428 | | # endif |
429 | | # ifndef YYMALLOC |
430 | | # define YYMALLOC malloc |
431 | | # if ! defined malloc && ! defined EXIT_SUCCESS |
432 | | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
433 | | # endif |
434 | | # endif |
435 | | # ifndef YYFREE |
436 | 0 | # define YYFREE free |
437 | | # if ! defined free && ! defined EXIT_SUCCESS |
438 | | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
439 | | # endif |
440 | | # endif |
441 | | # endif |
442 | | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
443 | | |
444 | | |
445 | | #if (! defined yyoverflow \ |
446 | | && (! defined __cplusplus \ |
447 | | || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ |
448 | | && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
449 | | |
450 | | /* A type that is properly aligned for any stack member. */ |
451 | | union yyalloc |
452 | | { |
453 | | yy_state_t yyss_alloc; |
454 | | YYSTYPE yyvs_alloc; |
455 | | YYLTYPE yyls_alloc; |
456 | | }; |
457 | | |
458 | | /* The size of the maximum gap between one aligned stack and the next. */ |
459 | 0 | # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) |
460 | | |
461 | | /* The size of an array large to enough to hold all stacks, each with |
462 | | N elements. */ |
463 | | # define YYSTACK_BYTES(N) \ |
464 | | ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \ |
465 | | + YYSIZEOF (YYLTYPE)) \ |
466 | | + 2 * YYSTACK_GAP_MAXIMUM) |
467 | | |
468 | | # define YYCOPY_NEEDED 1 |
469 | | |
470 | | /* Relocate STACK from its old location to the new one. The |
471 | | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
472 | | elements in the stack, and YYPTR gives the new location of the |
473 | | stack. Advance YYPTR to a properly aligned location for the next |
474 | | stack. */ |
475 | | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
476 | 0 | do \ |
477 | 0 | { \ |
478 | 0 | YYPTRDIFF_T yynewbytes; \ |
479 | 0 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
480 | 0 | Stack = &yyptr->Stack_alloc; \ |
481 | 0 | yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
482 | 0 | yyptr += yynewbytes / YYSIZEOF (*yyptr); \ |
483 | 0 | } \ |
484 | 0 | while (0) |
485 | | |
486 | | #endif |
487 | | |
488 | | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
489 | | /* Copy COUNT objects from SRC to DST. The source and destination do |
490 | | not overlap. */ |
491 | | # ifndef YYCOPY |
492 | | # if defined __GNUC__ && 1 < __GNUC__ |
493 | | # define YYCOPY(Dst, Src, Count) \ |
494 | 0 | __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) |
495 | | # else |
496 | | # define YYCOPY(Dst, Src, Count) \ |
497 | | do \ |
498 | | { \ |
499 | | YYPTRDIFF_T yyi; \ |
500 | | for (yyi = 0; yyi < (Count); yyi++) \ |
501 | | (Dst)[yyi] = (Src)[yyi]; \ |
502 | | } \ |
503 | | while (0) |
504 | | # endif |
505 | | # endif |
506 | | #endif /* !YYCOPY_NEEDED */ |
507 | | |
508 | | /* YYFINAL -- State number of the termination state. */ |
509 | 704k | #define YYFINAL 27 |
510 | | /* YYLAST -- Last index in YYTABLE. */ |
511 | 1.11M | #define YYLAST 76 |
512 | | |
513 | | /* YYNTOKENS -- Number of terminals. */ |
514 | 511k | #define YYNTOKENS 24 |
515 | | /* YYNNTS -- Number of nonterminals. */ |
516 | | #define YYNNTS 29 |
517 | | /* YYNRULES -- Number of rules. */ |
518 | | #define YYNRULES 59 |
519 | | /* YYNSTATES -- Number of states. */ |
520 | | #define YYNSTATES 86 |
521 | | |
522 | 0 | #define YYUNDEFTOK 2 |
523 | 339k | #define YYMAXUTOK 270 |
524 | | |
525 | | |
526 | | /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM |
527 | | as returned by yylex, with out-of-bounds checking. */ |
528 | | #define YYTRANSLATE(YYX) \ |
529 | 339k | (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
530 | | |
531 | | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
532 | | as returned by yylex. */ |
533 | | static const yytype_int8 yytranslate[] = |
534 | | { |
535 | | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
536 | | 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
537 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
538 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
539 | | 2, 2, 2, 2, 21, 2, 2, 2, 2, 2, |
540 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 17, |
541 | | 2, 18, 2, 2, 2, 2, 2, 2, 2, 2, |
542 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
543 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
544 | | 2, 22, 2, 23, 2, 2, 2, 2, 2, 2, |
545 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
546 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
547 | | 2, 2, 2, 19, 2, 20, 2, 2, 2, 2, |
548 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
549 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
550 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
551 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
552 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
553 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
554 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
555 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
556 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
557 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
558 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
559 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
560 | | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
561 | | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
562 | | 15 |
563 | | }; |
564 | | |
565 | | #if YYDEBUG |
566 | | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
567 | | static const yytype_int16 yyrline[] = |
568 | | { |
569 | | 0, 77, 77, 78, 81, 82, 85, 92, 99, 100, |
570 | | 101, 111, 111, 123, 124, 128, 131, 134, 135, 139, |
571 | | 142, 145, 149, 156, 160, 167, 173, 179, 183, 198, |
572 | | 199, 207, 211, 217, 221, 229, 230, 233, 233, 241, |
573 | | 245, 251, 252, 255, 277, 281, 289, 293, 297, 302, |
574 | | 309, 313, 314, 317, 318, 321, 361, 389, 390, 393 |
575 | | }; |
576 | | #endif |
577 | | |
578 | | #if YYDEBUG || YYERROR_VERBOSE || 1 |
579 | | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
580 | | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
581 | | static const char *const yytname[] = |
582 | | { |
583 | | "$end", "error", "$undefined", "T_TYPE", "\"off\"", "\"pad\"", |
584 | | "\"define\"", "\"set\"", "\"unset\"", "T_BOGUS", "\"command verb\"", |
585 | | "\"shell\"", "\"number\"", "\"identifier\"", "\"word\"", "\"pipeline\"", |
586 | | "'\\n'", "';'", "'='", "'{'", "'}'", "','", "'['", "']'", "$accept", |
587 | | "input", "stmtlist", "stmt", "$@1", "command", "pipeline", "eol", |
588 | | "arglist", "arg1list", "arg", "compound", "kvlist", "kvpair", "value", |
589 | | "slist", "string", "defn", "$@2", "defbody", "optcomma", "defid", |
590 | | "deflist", "def", "set", "asgnlist", "asgn", "varlist", "var", YY_NULLPTR |
591 | | }; |
592 | | #endif |
593 | | |
594 | | # ifdef YYPRINT |
595 | | /* YYTOKNUM[NUM] -- (External) token number corresponding to the |
596 | | (internal) symbol number NUM (which must be that of a token). */ |
597 | | static const yytype_int16 yytoknum[] = |
598 | | { |
599 | | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
600 | | 265, 266, 267, 268, 269, 270, 10, 59, 61, 123, |
601 | | 125, 44, 91, 93 |
602 | | }; |
603 | | # endif |
604 | | |
605 | 701k | #define YYPACT_NINF (-14) |
606 | | |
607 | | #define yypact_value_is_default(Yyn) \ |
608 | 701k | ((Yyn) == YYPACT_NINF) |
609 | | |
610 | | #define YYTABLE_NINF (-4) |
611 | | |
612 | | #define yytable_value_is_error(Yyn) \ |
613 | 2.85k | 0 |
614 | | |
615 | | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
616 | | STATE-NUM. */ |
617 | | static const yytype_int8 yypact[] = |
618 | | { |
619 | | 8, -14, -3, 21, 37, -10, -14, -14, -14, -14, |
620 | | 55, 29, -14, 13, -14, -10, -10, -10, -14, -14, |
621 | | 38, 21, -14, -14, 37, -14, -14, -14, -14, 39, |
622 | | -14, 28, 43, 13, -14, -14, -14, -14, -14, -14, |
623 | | 2, 9, -14, -14, 9, 41, 9, 31, -14, -14, |
624 | | -14, -14, -10, -14, -14, -1, -14, -14, -14, -14, |
625 | | 30, 33, -14, -14, 28, -14, 48, 50, 51, 44, |
626 | | -14, -14, -14, 9, -14, 42, -14, -14, -1, 46, |
627 | | -14, 56, -14, -14, 47, -14 |
628 | | }; |
629 | | |
630 | | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
631 | | Performed when YYTABLE does not specify something else to do. Zero |
632 | | means the default is an error. */ |
633 | | static const yytype_int8 yydefact[] = |
634 | | { |
635 | | 0, 11, 0, 50, 0, 0, 13, 14, 17, 18, |
636 | | 0, 0, 4, 19, 6, 0, 0, 0, 43, 37, |
637 | | 55, 51, 53, 59, 52, 57, 10, 1, 5, 35, |
638 | | 36, 0, 15, 20, 21, 25, 23, 9, 8, 12, |
639 | | 0, 0, 54, 58, 0, 35, 0, 0, 27, 29, |
640 | | 31, 16, 0, 22, 40, 0, 38, 35, 56, 24, |
641 | | 0, 0, 33, 26, 0, 7, 0, 0, 0, 41, |
642 | | 44, 30, 32, 0, 28, 46, 48, 49, 42, 0, |
643 | | 34, 0, 45, 39, 0, 47 |
644 | | }; |
645 | | |
646 | | /* YYPGOTO[NTERM-NUM]. */ |
647 | | static const yytype_int8 yypgoto[] = |
648 | | { |
649 | | -14, -14, -14, 58, -14, -14, -14, -4, -14, -14, |
650 | | 34, -14, -14, 7, 12, -14, -13, -14, -14, -14, |
651 | | -14, -14, -14, -5, -14, -14, 53, -14, 52 |
652 | | }; |
653 | | |
654 | | /* YYDEFGOTO[NTERM-NUM]. */ |
655 | | static const yytype_int8 yydefgoto[] = |
656 | | { |
657 | | -1, 10, 11, 12, 17, 13, 52, 14, 32, 33, |
658 | | 34, 35, 47, 48, 49, 61, 50, 15, 40, 56, |
659 | | 79, 19, 69, 70, 16, 21, 22, 24, 25 |
660 | | }; |
661 | | |
662 | | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
663 | | positive, shift that token. If negative, reduce the rule whose |
664 | | number is the opposite. If YYTABLE_NINF, syntax error. */ |
665 | | static const yytype_int8 yytable[] = |
666 | | { |
667 | | 36, 26, 66, 67, 68, 54, 8, 9, -2, 1, |
668 | | 18, 37, 38, 39, 2, 3, 4, 5, 6, 7, |
669 | | 36, 55, 57, 30, 8, 9, 29, 30, 58, -3, |
670 | | 1, 59, 31, 62, 20, 2, 3, 4, 5, 6, |
671 | | 7, 45, 30, 57, 30, 8, 9, 46, 65, 46, |
672 | | 23, 63, 64, 72, 73, 27, 41, 44, 51, 60, |
673 | | 80, 75, 76, 77, 81, 78, 83, 53, 84, 28, |
674 | | 85, 74, 71, 82, 42, 0, 43 |
675 | | }; |
676 | | |
677 | | static const yytype_int8 yycheck[] = |
678 | | { |
679 | | 13, 5, 3, 4, 5, 3, 16, 17, 0, 1, |
680 | | 13, 15, 16, 17, 6, 7, 8, 9, 10, 11, |
681 | | 33, 19, 13, 14, 16, 17, 13, 14, 41, 0, |
682 | | 1, 44, 19, 46, 13, 6, 7, 8, 9, 10, |
683 | | 11, 13, 14, 13, 14, 16, 17, 19, 52, 19, |
684 | | 13, 20, 21, 20, 21, 0, 18, 18, 15, 18, |
685 | | 73, 13, 12, 12, 22, 21, 20, 33, 12, 11, |
686 | | 23, 64, 60, 78, 21, -1, 24 |
687 | | }; |
688 | | |
689 | | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
690 | | symbol of state STATE-NUM. */ |
691 | | static const yytype_int8 yystos[] = |
692 | | { |
693 | | 0, 1, 6, 7, 8, 9, 10, 11, 16, 17, |
694 | | 25, 26, 27, 29, 31, 41, 48, 28, 13, 45, |
695 | | 13, 49, 50, 13, 51, 52, 31, 0, 27, 13, |
696 | | 14, 19, 32, 33, 34, 35, 40, 31, 31, 31, |
697 | | 42, 18, 50, 52, 18, 13, 19, 36, 37, 38, |
698 | | 40, 15, 30, 34, 3, 19, 43, 13, 40, 40, |
699 | | 18, 39, 40, 20, 21, 31, 3, 4, 5, 46, |
700 | | 47, 38, 20, 21, 37, 13, 12, 12, 21, 44, |
701 | | 40, 22, 47, 20, 12, 23 |
702 | | }; |
703 | | |
704 | | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
705 | | static const yytype_int8 yyr1[] = |
706 | | { |
707 | | 0, 24, 25, 25, 26, 26, 27, 27, 27, 27, |
708 | | 27, 28, 27, 29, 29, 30, 30, 31, 31, 32, |
709 | | 32, 33, 33, 34, 34, 34, 35, 36, 36, 37, |
710 | | 37, 38, 38, 39, 39, 40, 40, 42, 41, 43, |
711 | | 43, 44, 44, 45, 46, 46, 47, 47, 47, 47, |
712 | | 48, 48, 48, 49, 49, 50, 50, 51, 51, 52 |
713 | | }; |
714 | | |
715 | | /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ |
716 | | static const yytype_int8 yyr2[] = |
717 | | { |
718 | | 0, 2, 0, 1, 1, 2, 1, 4, 2, 2, |
719 | | 2, 0, 3, 1, 1, 0, 1, 1, 1, 0, |
720 | | 1, 1, 2, 1, 3, 1, 3, 1, 3, 1, |
721 | | 3, 1, 3, 1, 3, 1, 1, 0, 4, 4, |
722 | | 1, 0, 1, 1, 1, 3, 2, 5, 2, 2, |
723 | | 1, 2, 2, 1, 2, 1, 3, 1, 2, 1 |
724 | | }; |
725 | | |
726 | | |
727 | 0 | #define yyerrok (yyerrstatus = 0) |
728 | 0 | #define yyclearin (yychar = YYEMPTY) |
729 | 541k | #define YYEMPTY (-2) |
730 | 350k | #define YYEOF 0 |
731 | | |
732 | 2.85k | #define YYACCEPT goto yyacceptlab |
733 | 1.15k | #define YYABORT goto yyabortlab |
734 | 0 | #define YYERROR goto yyerrorlab |
735 | | |
736 | | |
737 | | #define YYRECOVERING() (!!yyerrstatus) |
738 | | |
739 | | #define YYBACKUP(Token, Value) \ |
740 | | do \ |
741 | | if (yychar == YYEMPTY) \ |
742 | | { \ |
743 | | yychar = (Token); \ |
744 | | yylval = (Value); \ |
745 | | YYPOPSTACK (yylen); \ |
746 | | yystate = *yyssp; \ |
747 | | goto yybackup; \ |
748 | | } \ |
749 | | else \ |
750 | | { \ |
751 | | yyerror (YY_("syntax error: cannot back up")); \ |
752 | | YYERROR; \ |
753 | | } \ |
754 | | while (0) |
755 | | |
756 | | /* Error token number */ |
757 | 0 | #define YYTERROR 1 |
758 | | #define YYERRCODE 256 |
759 | | |
760 | | |
761 | | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
762 | | If N is 0, then set CURRENT to the empty location which ends |
763 | | the previous symbol: RHS[0] (always defined). */ |
764 | | |
765 | | #ifndef YYLLOC_DEFAULT |
766 | | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
767 | | do \ |
768 | | if (N) \ |
769 | | { \ |
770 | | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
771 | | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
772 | | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
773 | | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
774 | | } \ |
775 | | else \ |
776 | | { \ |
777 | | (Current).first_line = (Current).last_line = \ |
778 | | YYRHSLOC (Rhs, 0).last_line; \ |
779 | | (Current).first_column = (Current).last_column = \ |
780 | | YYRHSLOC (Rhs, 0).last_column; \ |
781 | | } \ |
782 | | while (0) |
783 | | #endif |
784 | | |
785 | 918k | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
786 | | |
787 | | |
788 | | /* Enable debugging if requested. */ |
789 | | #if YYDEBUG |
790 | | |
791 | | # ifndef YYFPRINTF |
792 | | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
793 | | # define YYFPRINTF fprintf |
794 | | # endif |
795 | | |
796 | | # define YYDPRINTF(Args) \ |
797 | | do { \ |
798 | | if (yydebug) \ |
799 | | YYFPRINTF Args; \ |
800 | | } while (0) |
801 | | |
802 | | |
803 | | /* YY_LOCATION_PRINT -- Print the location on the stream. |
804 | | This macro was not mandated originally: define only if we know |
805 | | we won't break user code: when these are the locations we know. */ |
806 | | |
807 | | #ifndef YY_LOCATION_PRINT |
808 | | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL |
809 | | |
810 | | /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ |
811 | | |
812 | | YY_ATTRIBUTE_UNUSED |
813 | | static int |
814 | | yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) |
815 | | { |
816 | | int res = 0; |
817 | | int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; |
818 | | if (0 <= yylocp->first_line) |
819 | | { |
820 | | res += YYFPRINTF (yyo, "%d", yylocp->first_line); |
821 | | if (0 <= yylocp->first_column) |
822 | | res += YYFPRINTF (yyo, ".%d", yylocp->first_column); |
823 | | } |
824 | | if (0 <= yylocp->last_line) |
825 | | { |
826 | | if (yylocp->first_line < yylocp->last_line) |
827 | | { |
828 | | res += YYFPRINTF (yyo, "-%d", yylocp->last_line); |
829 | | if (0 <= end_col) |
830 | | res += YYFPRINTF (yyo, ".%d", end_col); |
831 | | } |
832 | | else if (0 <= end_col && yylocp->first_column < end_col) |
833 | | res += YYFPRINTF (yyo, "-%d", end_col); |
834 | | } |
835 | | return res; |
836 | | } |
837 | | |
838 | | # define YY_LOCATION_PRINT(File, Loc) \ |
839 | | yy_location_print_ (File, &(Loc)) |
840 | | |
841 | | # else |
842 | | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
843 | | # endif |
844 | | #endif |
845 | | |
846 | | |
847 | | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
848 | | do { \ |
849 | | if (yydebug) \ |
850 | | { \ |
851 | | YYFPRINTF (stderr, "%s ", Title); \ |
852 | | yy_symbol_print (stderr, \ |
853 | | Type, Value, Location); \ |
854 | | YYFPRINTF (stderr, "\n"); \ |
855 | | } \ |
856 | | } while (0) |
857 | | |
858 | | |
859 | | /*-----------------------------------. |
860 | | | Print this symbol's value on YYO. | |
861 | | `-----------------------------------*/ |
862 | | |
863 | | static void |
864 | | yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) |
865 | | { |
866 | | FILE *yyoutput = yyo; |
867 | | YYUSE (yyoutput); |
868 | | YYUSE (yylocationp); |
869 | | if (!yyvaluep) |
870 | | return; |
871 | | # ifdef YYPRINT |
872 | | if (yytype < YYNTOKENS) |
873 | | YYPRINT (yyo, yytoknum[yytype], *yyvaluep); |
874 | | # endif |
875 | | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
876 | | YYUSE (yytype); |
877 | | YY_IGNORE_MAYBE_UNINITIALIZED_END |
878 | | } |
879 | | |
880 | | |
881 | | /*---------------------------. |
882 | | | Print this symbol on YYO. | |
883 | | `---------------------------*/ |
884 | | |
885 | | static void |
886 | | yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) |
887 | | { |
888 | | YYFPRINTF (yyo, "%s %s (", |
889 | | yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); |
890 | | |
891 | | YY_LOCATION_PRINT (yyo, *yylocationp); |
892 | | YYFPRINTF (yyo, ": "); |
893 | | yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp); |
894 | | YYFPRINTF (yyo, ")"); |
895 | | } |
896 | | |
897 | | /*------------------------------------------------------------------. |
898 | | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
899 | | | TOP (included). | |
900 | | `------------------------------------------------------------------*/ |
901 | | |
902 | | static void |
903 | | yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) |
904 | | { |
905 | | YYFPRINTF (stderr, "Stack now"); |
906 | | for (; yybottom <= yytop; yybottom++) |
907 | | { |
908 | | int yybot = *yybottom; |
909 | | YYFPRINTF (stderr, " %d", yybot); |
910 | | } |
911 | | YYFPRINTF (stderr, "\n"); |
912 | | } |
913 | | |
914 | | # define YY_STACK_PRINT(Bottom, Top) \ |
915 | | do { \ |
916 | | if (yydebug) \ |
917 | | yy_stack_print ((Bottom), (Top)); \ |
918 | | } while (0) |
919 | | |
920 | | |
921 | | /*------------------------------------------------. |
922 | | | Report that the YYRULE is going to be reduced. | |
923 | | `------------------------------------------------*/ |
924 | | |
925 | | static void |
926 | | yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) |
927 | | { |
928 | | int yylno = yyrline[yyrule]; |
929 | | int yynrhs = yyr2[yyrule]; |
930 | | int yyi; |
931 | | YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", |
932 | | yyrule - 1, yylno); |
933 | | /* The symbols being reduced. */ |
934 | | for (yyi = 0; yyi < yynrhs; yyi++) |
935 | | { |
936 | | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
937 | | yy_symbol_print (stderr, |
938 | | yystos[+yyssp[yyi + 1 - yynrhs]], |
939 | | &yyvsp[(yyi + 1) - (yynrhs)] |
940 | | , &(yylsp[(yyi + 1) - (yynrhs)]) ); |
941 | | YYFPRINTF (stderr, "\n"); |
942 | | } |
943 | | } |
944 | | |
945 | | # define YY_REDUCE_PRINT(Rule) \ |
946 | | do { \ |
947 | | if (yydebug) \ |
948 | | yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \ |
949 | | } while (0) |
950 | | |
951 | | /* Nonzero means print parse trace. It is left uninitialized so that |
952 | | multiple parsers can coexist. */ |
953 | | int yydebug; |
954 | | #else /* !YYDEBUG */ |
955 | | # define YYDPRINTF(Args) |
956 | | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
957 | | # define YY_STACK_PRINT(Bottom, Top) |
958 | | # define YY_REDUCE_PRINT(Rule) |
959 | | #endif /* !YYDEBUG */ |
960 | | |
961 | | |
962 | | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
963 | | #ifndef YYINITDEPTH |
964 | 4.01k | # define YYINITDEPTH 200 |
965 | | #endif |
966 | | |
967 | | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
968 | | if the built-in stack extension method is used). |
969 | | |
970 | | Do not make this value too large; the results are undefined if |
971 | | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
972 | | evaluated with infinite-precision integer arithmetic. */ |
973 | | |
974 | | #ifndef YYMAXDEPTH |
975 | 0 | # define YYMAXDEPTH 10000 |
976 | | #endif |
977 | | |
978 | | |
979 | | #if YYERROR_VERBOSE |
980 | | |
981 | | # ifndef yystrlen |
982 | | # if defined __GLIBC__ && defined _STRING_H |
983 | 0 | # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) |
984 | | # else |
985 | | /* Return the length of YYSTR. */ |
986 | | static YYPTRDIFF_T |
987 | | yystrlen (const char *yystr) |
988 | | { |
989 | | YYPTRDIFF_T yylen; |
990 | | for (yylen = 0; yystr[yylen]; yylen++) |
991 | | continue; |
992 | | return yylen; |
993 | | } |
994 | | # endif |
995 | | # endif |
996 | | |
997 | | # ifndef yystpcpy |
998 | | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
999 | | # define yystpcpy stpcpy |
1000 | | # else |
1001 | | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
1002 | | YYDEST. */ |
1003 | | static char * |
1004 | | yystpcpy (char *yydest, const char *yysrc) |
1005 | 0 | { |
1006 | 0 | char *yyd = yydest; |
1007 | 0 | const char *yys = yysrc; |
1008 | |
|
1009 | 0 | while ((*yyd++ = *yys++) != '\0') |
1010 | 0 | continue; |
1011 | |
|
1012 | 0 | return yyd - 1; |
1013 | 0 | } |
1014 | | # endif |
1015 | | # endif |
1016 | | |
1017 | | # ifndef yytnamerr |
1018 | | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
1019 | | quotes and backslashes, so that it's suitable for yyerror. The |
1020 | | heuristic is that double-quoting is unnecessary unless the string |
1021 | | contains an apostrophe, a comma, or backslash (other than |
1022 | | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
1023 | | null, do not copy; instead, return the length of what the result |
1024 | | would have been. */ |
1025 | | static YYPTRDIFF_T |
1026 | | yytnamerr (char *yyres, const char *yystr) |
1027 | 0 | { |
1028 | 0 | if (*yystr == '"') |
1029 | 0 | { |
1030 | 0 | YYPTRDIFF_T yyn = 0; |
1031 | 0 | char const *yyp = yystr; |
1032 | |
|
1033 | 0 | for (;;) |
1034 | 0 | switch (*++yyp) |
1035 | 0 | { |
1036 | 0 | case '\'': |
1037 | 0 | case ',': |
1038 | 0 | goto do_not_strip_quotes; |
1039 | | |
1040 | 0 | case '\\': |
1041 | 0 | if (*++yyp != '\\') |
1042 | 0 | goto do_not_strip_quotes; |
1043 | 0 | else |
1044 | 0 | goto append; |
1045 | | |
1046 | 0 | append: |
1047 | 0 | default: |
1048 | 0 | if (yyres) |
1049 | 0 | yyres[yyn] = *yyp; |
1050 | 0 | yyn++; |
1051 | 0 | break; |
1052 | | |
1053 | 0 | case '"': |
1054 | 0 | if (yyres) |
1055 | 0 | yyres[yyn] = '\0'; |
1056 | 0 | return yyn; |
1057 | 0 | } |
1058 | 0 | do_not_strip_quotes: ; |
1059 | 0 | } |
1060 | | |
1061 | 0 | if (yyres) |
1062 | 0 | return yystpcpy (yyres, yystr) - yyres; |
1063 | 0 | else |
1064 | 0 | return yystrlen (yystr); |
1065 | 0 | } |
1066 | | # endif |
1067 | | |
1068 | | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
1069 | | about the unexpected token YYTOKEN for the state stack whose top is |
1070 | | YYSSP. |
1071 | | |
1072 | | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is |
1073 | | not large enough to hold the message. In that case, also set |
1074 | | *YYMSG_ALLOC to the required number of bytes. Return 2 if the |
1075 | | required number of bytes is too large to store. */ |
1076 | | static int |
1077 | | yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, |
1078 | | yy_state_t *yyssp, int yytoken) |
1079 | 0 | { |
1080 | 0 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
1081 | | /* Internationalized format string. */ |
1082 | 0 | const char *yyformat = YY_NULLPTR; |
1083 | | /* Arguments of yyformat: reported tokens (one for the "unexpected", |
1084 | | one per "expected"). */ |
1085 | 0 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
1086 | | /* Actual size of YYARG. */ |
1087 | 0 | int yycount = 0; |
1088 | | /* Cumulated lengths of YYARG. */ |
1089 | 0 | YYPTRDIFF_T yysize = 0; |
1090 | | |
1091 | | /* There are many possibilities here to consider: |
1092 | | - If this state is a consistent state with a default action, then |
1093 | | the only way this function was invoked is if the default action |
1094 | | is an error action. In that case, don't check for expected |
1095 | | tokens because there are none. |
1096 | | - The only way there can be no lookahead present (in yychar) is if |
1097 | | this state is a consistent state with a default action. Thus, |
1098 | | detecting the absence of a lookahead is sufficient to determine |
1099 | | that there is no unexpected or expected token to report. In that |
1100 | | case, just report a simple "syntax error". |
1101 | | - Don't assume there isn't a lookahead just because this state is a |
1102 | | consistent state with a default action. There might have been a |
1103 | | previous inconsistent state, consistent state with a non-default |
1104 | | action, or user semantic action that manipulated yychar. |
1105 | | - Of course, the expected token list depends on states to have |
1106 | | correct lookahead information, and it depends on the parser not |
1107 | | to perform extra reductions after fetching a lookahead from the |
1108 | | scanner and before detecting a syntax error. Thus, state merging |
1109 | | (from LALR or IELR) and default reductions corrupt the expected |
1110 | | token list. However, the list is correct for canonical LR with |
1111 | | one exception: it will still contain any token that will not be |
1112 | | accepted due to an error action in a later state. |
1113 | | */ |
1114 | 0 | if (yytoken != YYEMPTY) |
1115 | 0 | { |
1116 | 0 | int yyn = yypact[+*yyssp]; |
1117 | 0 | YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); |
1118 | 0 | yysize = yysize0; |
1119 | 0 | yyarg[yycount++] = yytname[yytoken]; |
1120 | 0 | if (!yypact_value_is_default (yyn)) |
1121 | 0 | { |
1122 | | /* Start YYX at -YYN if negative to avoid negative indexes in |
1123 | | YYCHECK. In other words, skip the first -YYN actions for |
1124 | | this state because they are default actions. */ |
1125 | 0 | int yyxbegin = yyn < 0 ? -yyn : 0; |
1126 | | /* Stay within bounds of both yycheck and yytname. */ |
1127 | 0 | int yychecklim = YYLAST - yyn + 1; |
1128 | 0 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
1129 | 0 | int yyx; |
1130 | |
|
1131 | 0 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
1132 | 0 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR |
1133 | 0 | && !yytable_value_is_error (yytable[yyx + yyn])) |
1134 | 0 | { |
1135 | 0 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
1136 | 0 | { |
1137 | 0 | yycount = 1; |
1138 | 0 | yysize = yysize0; |
1139 | 0 | break; |
1140 | 0 | } |
1141 | 0 | yyarg[yycount++] = yytname[yyx]; |
1142 | 0 | { |
1143 | 0 | YYPTRDIFF_T yysize1 |
1144 | 0 | = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); |
1145 | 0 | if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) |
1146 | 0 | yysize = yysize1; |
1147 | 0 | else |
1148 | 0 | return 2; |
1149 | 0 | } |
1150 | 0 | } |
1151 | 0 | } |
1152 | 0 | } |
1153 | | |
1154 | 0 | switch (yycount) |
1155 | 0 | { |
1156 | 0 | # define YYCASE_(N, S) \ |
1157 | 0 | case N: \ |
1158 | 0 | yyformat = S; \ |
1159 | 0 | break |
1160 | 0 | default: /* Avoid compiler warnings. */ |
1161 | 0 | YYCASE_(0, YY_("syntax error")); |
1162 | 0 | YYCASE_(1, YY_("syntax error, unexpected %s")); |
1163 | 0 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
1164 | 0 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
1165 | 0 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
1166 | 0 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
1167 | 0 | # undef YYCASE_ |
1168 | 0 | } |
1169 | | |
1170 | 0 | { |
1171 | | /* Don't count the "%s"s in the final size, but reserve room for |
1172 | | the terminator. */ |
1173 | 0 | YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; |
1174 | 0 | if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) |
1175 | 0 | yysize = yysize1; |
1176 | 0 | else |
1177 | 0 | return 2; |
1178 | 0 | } |
1179 | | |
1180 | 0 | if (*yymsg_alloc < yysize) |
1181 | 0 | { |
1182 | 0 | *yymsg_alloc = 2 * yysize; |
1183 | 0 | if (! (yysize <= *yymsg_alloc |
1184 | 0 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
1185 | 0 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
1186 | 0 | return 1; |
1187 | 0 | } |
1188 | | |
1189 | | /* Avoid sprintf, as that infringes on the user's name space. |
1190 | | Don't have undefined behavior even if the translation |
1191 | | produced a string with the wrong number of "%s"s. */ |
1192 | 0 | { |
1193 | 0 | char *yyp = *yymsg; |
1194 | 0 | int yyi = 0; |
1195 | 0 | while ((*yyp = *yyformat) != '\0') |
1196 | 0 | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) |
1197 | 0 | { |
1198 | 0 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
1199 | 0 | yyformat += 2; |
1200 | 0 | } |
1201 | 0 | else |
1202 | 0 | { |
1203 | 0 | ++yyp; |
1204 | 0 | ++yyformat; |
1205 | 0 | } |
1206 | 0 | } |
1207 | 0 | return 0; |
1208 | 0 | } |
1209 | | #endif /* YYERROR_VERBOSE */ |
1210 | | |
1211 | | /*-----------------------------------------------. |
1212 | | | Release the memory associated to this symbol. | |
1213 | | `-----------------------------------------------*/ |
1214 | | |
1215 | | static void |
1216 | | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) |
1217 | 6.87k | { |
1218 | 6.87k | YYUSE (yyvaluep); |
1219 | 6.87k | YYUSE (yylocationp); |
1220 | 6.87k | if (!yymsg) |
1221 | 0 | yymsg = "Deleting"; |
1222 | 6.87k | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
1223 | | |
1224 | 6.87k | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1225 | 6.87k | switch (yytype) |
1226 | 6.87k | { |
1227 | 0 | case 13: /* "identifier" */ |
1228 | 0 | #line 71 "gram.y" |
1229 | 0 | { free (((*yyvaluep).string)); } |
1230 | 0 | #line 1231 "gram.c" |
1231 | 0 | break; |
1232 | | |
1233 | 0 | case 14: /* "word" */ |
1234 | 0 | #line 71 "gram.y" |
1235 | 0 | { free (((*yyvaluep).string)); } |
1236 | 0 | #line 1237 "gram.c" |
1237 | 0 | break; |
1238 | | |
1239 | 0 | case 15: /* "pipeline" */ |
1240 | 0 | #line 71 "gram.y" |
1241 | 0 | { free (((*yyvaluep).string)); } |
1242 | 0 | #line 1243 "gram.c" |
1243 | 0 | break; |
1244 | | |
1245 | 0 | case 30: /* pipeline */ |
1246 | 0 | #line 71 "gram.y" |
1247 | 0 | { free (((*yyvaluep).string)); } |
1248 | 0 | #line 1249 "gram.c" |
1249 | 0 | break; |
1250 | | |
1251 | 0 | case 32: /* arglist */ |
1252 | 0 | #line 66 "gram.y" |
1253 | 0 | { gdbmarglist_free (&((*yyvaluep).arglist)); } |
1254 | 0 | #line 1255 "gram.c" |
1255 | 0 | break; |
1256 | | |
1257 | 0 | case 33: /* arg1list */ |
1258 | 0 | #line 66 "gram.y" |
1259 | 0 | { gdbmarglist_free (&((*yyvaluep).arglist)); } |
1260 | 0 | #line 1261 "gram.c" |
1261 | 0 | break; |
1262 | | |
1263 | 0 | case 34: /* arg */ |
1264 | 0 | #line 67 "gram.y" |
1265 | 0 | { gdbmarg_free (((*yyvaluep).arg)); } |
1266 | 0 | #line 1267 "gram.c" |
1267 | 0 | break; |
1268 | | |
1269 | 0 | case 35: /* compound */ |
1270 | 0 | #line 69 "gram.y" |
1271 | 0 | { kvlist_free (((*yyvaluep).kvpair)); } |
1272 | 0 | #line 1273 "gram.c" |
1273 | 0 | break; |
1274 | | |
1275 | 0 | case 36: /* kvlist */ |
1276 | 0 | #line 68 "gram.y" |
1277 | 0 | { kvlist_free (((*yyvaluep).kvlist).head); } |
1278 | 0 | #line 1279 "gram.c" |
1279 | 0 | break; |
1280 | | |
1281 | 0 | case 37: /* kvpair */ |
1282 | 0 | #line 69 "gram.y" |
1283 | 0 | { kvlist_free (((*yyvaluep).kvpair)); } |
1284 | 0 | #line 1285 "gram.c" |
1285 | 0 | break; |
1286 | | |
1287 | 0 | case 38: /* value */ |
1288 | 0 | #line 69 "gram.y" |
1289 | 0 | { kvlist_free (((*yyvaluep).kvpair)); } |
1290 | 0 | #line 1291 "gram.c" |
1291 | 0 | break; |
1292 | | |
1293 | 0 | case 39: /* slist */ |
1294 | 0 | #line 70 "gram.y" |
1295 | 0 | { slist_free (((*yyvaluep).slist).head); } |
1296 | 0 | #line 1297 "gram.c" |
1297 | 0 | break; |
1298 | | |
1299 | 0 | case 40: /* string */ |
1300 | 0 | #line 71 "gram.y" |
1301 | 0 | { free (((*yyvaluep).string)); } |
1302 | 0 | #line 1303 "gram.c" |
1303 | 0 | break; |
1304 | | |
1305 | 0 | case 43: /* defbody */ |
1306 | 0 | #line 72 "gram.y" |
1307 | 0 | { dsegm_list_free (((*yyvaluep).dsegm)); } |
1308 | 0 | #line 1309 "gram.c" |
1309 | 0 | break; |
1310 | | |
1311 | 0 | case 46: /* deflist */ |
1312 | 0 | #line 73 "gram.y" |
1313 | 0 | { dsegm_list_free (((*yyvaluep).dsegmlist).head); } |
1314 | 0 | #line 1315 "gram.c" |
1315 | 0 | break; |
1316 | | |
1317 | 0 | case 47: /* def */ |
1318 | 0 | #line 72 "gram.y" |
1319 | 0 | { dsegm_list_free (((*yyvaluep).dsegm)); } |
1320 | 0 | #line 1321 "gram.c" |
1321 | 0 | break; |
1322 | | |
1323 | 6.87k | default: |
1324 | 6.87k | break; |
1325 | 6.87k | } |
1326 | 6.87k | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1327 | 6.87k | } |
1328 | | |
1329 | | |
1330 | | |
1331 | | |
1332 | | /* The lookahead symbol. */ |
1333 | | int yychar; |
1334 | | |
1335 | | /* The semantic value of the lookahead symbol. */ |
1336 | | YYSTYPE yylval; |
1337 | | /* Location data for the lookahead symbol. */ |
1338 | | YYLTYPE yylloc |
1339 | | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL |
1340 | | = { 1, 1, 1, 1 } |
1341 | | # endif |
1342 | | ; |
1343 | | /* Number of syntax errors so far. */ |
1344 | | int yynerrs; |
1345 | | |
1346 | | |
1347 | | /*----------. |
1348 | | | yyparse. | |
1349 | | `----------*/ |
1350 | | |
1351 | | int |
1352 | | yyparse (void) |
1353 | 4.01k | { |
1354 | 4.01k | yy_state_fast_t yystate; |
1355 | | /* Number of tokens to shift before error messages enabled. */ |
1356 | 4.01k | int yyerrstatus; |
1357 | | |
1358 | | /* The stacks and their tools: |
1359 | | 'yyss': related to states. |
1360 | | 'yyvs': related to semantic values. |
1361 | | 'yyls': related to locations. |
1362 | | |
1363 | | Refer to the stacks through separate pointers, to allow yyoverflow |
1364 | | to reallocate them elsewhere. */ |
1365 | | |
1366 | | /* The state stack. */ |
1367 | 4.01k | yy_state_t yyssa[YYINITDEPTH]; |
1368 | 4.01k | yy_state_t *yyss; |
1369 | 4.01k | yy_state_t *yyssp; |
1370 | | |
1371 | | /* The semantic value stack. */ |
1372 | 4.01k | YYSTYPE yyvsa[YYINITDEPTH]; |
1373 | 4.01k | YYSTYPE *yyvs; |
1374 | 4.01k | YYSTYPE *yyvsp; |
1375 | | |
1376 | | /* The location stack. */ |
1377 | 4.01k | YYLTYPE yylsa[YYINITDEPTH]; |
1378 | 4.01k | YYLTYPE *yyls; |
1379 | 4.01k | YYLTYPE *yylsp; |
1380 | | |
1381 | | /* The locations where the error started and ended. */ |
1382 | 4.01k | YYLTYPE yyerror_range[3]; |
1383 | | |
1384 | 4.01k | YYPTRDIFF_T yystacksize; |
1385 | | |
1386 | 4.01k | int yyn; |
1387 | 4.01k | int yyresult; |
1388 | | /* Lookahead token as an internal (translated) token number. */ |
1389 | 4.01k | int yytoken = 0; |
1390 | | /* The variables used to return semantic value and location from the |
1391 | | action routines. */ |
1392 | 4.01k | YYSTYPE yyval; |
1393 | 4.01k | YYLTYPE yyloc; |
1394 | | |
1395 | 4.01k | #if YYERROR_VERBOSE |
1396 | | /* Buffer for error messages, and its allocated size. */ |
1397 | 4.01k | char yymsgbuf[128]; |
1398 | 4.01k | char *yymsg = yymsgbuf; |
1399 | 4.01k | YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; |
1400 | 4.01k | #endif |
1401 | | |
1402 | 522k | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) |
1403 | | |
1404 | | /* The number of symbols on the RHS of the reduced rule. |
1405 | | Keep to zero when no symbol should be popped. */ |
1406 | 4.01k | int yylen = 0; |
1407 | | |
1408 | 4.01k | yyssp = yyss = yyssa; |
1409 | 4.01k | yyvsp = yyvs = yyvsa; |
1410 | 4.01k | yylsp = yyls = yylsa; |
1411 | 4.01k | yystacksize = YYINITDEPTH; |
1412 | | |
1413 | 4.01k | YYDPRINTF ((stderr, "Starting parse\n")); |
1414 | | |
1415 | 4.01k | yystate = 0; |
1416 | 4.01k | yyerrstatus = 0; |
1417 | 4.01k | yynerrs = 0; |
1418 | 4.01k | yychar = YYEMPTY; /* Cause a token to be read. */ |
1419 | 4.01k | yylsp[0] = yylloc; |
1420 | 4.01k | goto yysetstate; |
1421 | | |
1422 | | |
1423 | | /*------------------------------------------------------------. |
1424 | | | yynewstate -- push a new state, which is found in yystate. | |
1425 | | `------------------------------------------------------------*/ |
1426 | 700k | yynewstate: |
1427 | | /* In all cases, when you get here, the value and location stacks |
1428 | | have just been pushed. So pushing a state here evens the stacks. */ |
1429 | 700k | yyssp++; |
1430 | | |
1431 | | |
1432 | | /*--------------------------------------------------------------------. |
1433 | | | yysetstate -- set current state (the top of the stack) to yystate. | |
1434 | | `--------------------------------------------------------------------*/ |
1435 | 704k | yysetstate: |
1436 | 704k | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
1437 | 704k | YY_ASSERT (0 <= yystate && yystate < YYNSTATES); |
1438 | 704k | YY_IGNORE_USELESS_CAST_BEGIN |
1439 | 704k | *yyssp = YY_CAST (yy_state_t, yystate); |
1440 | 704k | YY_IGNORE_USELESS_CAST_END |
1441 | | |
1442 | 704k | if (yyss + yystacksize - 1 <= yyssp) |
1443 | | #if !defined yyoverflow && !defined YYSTACK_RELOCATE |
1444 | | goto yyexhaustedlab; |
1445 | | #else |
1446 | 0 | { |
1447 | | /* Get the current used size of the three stacks, in elements. */ |
1448 | 0 | YYPTRDIFF_T yysize = yyssp - yyss + 1; |
1449 | |
|
1450 | | # if defined yyoverflow |
1451 | | { |
1452 | | /* Give user a chance to reallocate the stack. Use copies of |
1453 | | these so that the &'s don't force the real ones into |
1454 | | memory. */ |
1455 | | yy_state_t *yyss1 = yyss; |
1456 | | YYSTYPE *yyvs1 = yyvs; |
1457 | | YYLTYPE *yyls1 = yyls; |
1458 | | |
1459 | | /* Each stack pointer address is followed by the size of the |
1460 | | data in use in that stack, in bytes. This used to be a |
1461 | | conditional around just the two extra args, but that might |
1462 | | be undefined if yyoverflow is a macro. */ |
1463 | | yyoverflow (YY_("memory exhausted"), |
1464 | | &yyss1, yysize * YYSIZEOF (*yyssp), |
1465 | | &yyvs1, yysize * YYSIZEOF (*yyvsp), |
1466 | | &yyls1, yysize * YYSIZEOF (*yylsp), |
1467 | | &yystacksize); |
1468 | | yyss = yyss1; |
1469 | | yyvs = yyvs1; |
1470 | | yyls = yyls1; |
1471 | | } |
1472 | | # else /* defined YYSTACK_RELOCATE */ |
1473 | | /* Extend the stack our own way. */ |
1474 | 0 | if (YYMAXDEPTH <= yystacksize) |
1475 | 0 | goto yyexhaustedlab; |
1476 | 0 | yystacksize *= 2; |
1477 | 0 | if (YYMAXDEPTH < yystacksize) |
1478 | 0 | yystacksize = YYMAXDEPTH; |
1479 | |
|
1480 | 0 | { |
1481 | 0 | yy_state_t *yyss1 = yyss; |
1482 | 0 | union yyalloc *yyptr = |
1483 | 0 | YY_CAST (union yyalloc *, |
1484 | 0 | YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); |
1485 | 0 | if (! yyptr) |
1486 | 0 | goto yyexhaustedlab; |
1487 | 0 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1488 | 0 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
1489 | 0 | YYSTACK_RELOCATE (yyls_alloc, yyls); |
1490 | 0 | # undef YYSTACK_RELOCATE |
1491 | 0 | if (yyss1 != yyssa) |
1492 | 0 | YYSTACK_FREE (yyss1); |
1493 | 0 | } |
1494 | 0 | # endif |
1495 | | |
1496 | 0 | yyssp = yyss + yysize - 1; |
1497 | 0 | yyvsp = yyvs + yysize - 1; |
1498 | 0 | yylsp = yyls + yysize - 1; |
1499 | |
|
1500 | 0 | YY_IGNORE_USELESS_CAST_BEGIN |
1501 | 0 | YYDPRINTF ((stderr, "Stack size increased to %ld\n", |
1502 | 0 | YY_CAST (long, yystacksize))); |
1503 | 0 | YY_IGNORE_USELESS_CAST_END |
1504 | |
|
1505 | 0 | if (yyss + yystacksize - 1 <= yyssp) |
1506 | 0 | YYABORT; |
1507 | 0 | } |
1508 | 704k | #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ |
1509 | | |
1510 | 704k | if (yystate == YYFINAL) |
1511 | 2.85k | YYACCEPT; |
1512 | | |
1513 | 701k | goto yybackup; |
1514 | | |
1515 | | |
1516 | | /*-----------. |
1517 | | | yybackup. | |
1518 | | `-----------*/ |
1519 | 701k | yybackup: |
1520 | | /* Do appropriate processing given the current state. Read a |
1521 | | lookahead token if we need one and don't already have one. */ |
1522 | | |
1523 | | /* First try to decide what to do without reference to lookahead token. */ |
1524 | 701k | yyn = yypact[yystate]; |
1525 | 701k | if (yypact_value_is_default (yyn)) |
1526 | 356k | goto yydefault; |
1527 | | |
1528 | | /* Not known => get a lookahead token if don't already have one. */ |
1529 | | |
1530 | | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
1531 | 344k | if (yychar == YYEMPTY) |
1532 | 188k | { |
1533 | 188k | YYDPRINTF ((stderr, "Reading a token: ")); |
1534 | 188k | yychar = yylex (); |
1535 | 188k | } |
1536 | | |
1537 | 344k | if (yychar <= YYEOF) |
1538 | 5.71k | { |
1539 | 5.71k | yychar = yytoken = YYEOF; |
1540 | 5.71k | YYDPRINTF ((stderr, "Now at end of input.\n")); |
1541 | 5.71k | } |
1542 | 339k | else |
1543 | 339k | { |
1544 | 339k | yytoken = YYTRANSLATE (yychar); |
1545 | 339k | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
1546 | 339k | } |
1547 | | |
1548 | | /* If the proper action on seeing token YYTOKEN is to reduce or to |
1549 | | detect an error, take that action. */ |
1550 | 344k | yyn += yytoken; |
1551 | 344k | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
1552 | 153k | goto yydefault; |
1553 | 191k | yyn = yytable[yyn]; |
1554 | 191k | if (yyn <= 0) |
1555 | 2.85k | { |
1556 | 2.85k | if (yytable_value_is_error (yyn)) |
1557 | 0 | goto yyerrlab; |
1558 | 2.85k | yyn = -yyn; |
1559 | 2.85k | goto yyreduce; |
1560 | 2.85k | } |
1561 | | |
1562 | | /* Count tokens shifted since error; after three, turn off error |
1563 | | status. */ |
1564 | 188k | if (yyerrstatus) |
1565 | 0 | yyerrstatus--; |
1566 | | |
1567 | | /* Shift the lookahead token. */ |
1568 | 188k | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
1569 | 188k | yystate = yyn; |
1570 | 188k | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1571 | 188k | *++yyvsp = yylval; |
1572 | 188k | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1573 | 188k | *++yylsp = yylloc; |
1574 | | |
1575 | | /* Discard the shifted token. */ |
1576 | 188k | yychar = YYEMPTY; |
1577 | 188k | goto yynewstate; |
1578 | | |
1579 | | |
1580 | | /*-----------------------------------------------------------. |
1581 | | | yydefault -- do the default action for the current state. | |
1582 | | `-----------------------------------------------------------*/ |
1583 | 510k | yydefault: |
1584 | 510k | yyn = yydefact[yystate]; |
1585 | 510k | if (yyn == 0) |
1586 | 0 | goto yyerrlab; |
1587 | 510k | goto yyreduce; |
1588 | | |
1589 | | |
1590 | | /*-----------------------------. |
1591 | | | yyreduce -- do a reduction. | |
1592 | | `-----------------------------*/ |
1593 | 513k | yyreduce: |
1594 | | /* yyn is the number of a rule to reduce with. */ |
1595 | 513k | yylen = yyr2[yyn]; |
1596 | | |
1597 | | /* If YYLEN is nonzero, implement the default value of the action: |
1598 | | '$$ = $1'. |
1599 | | |
1600 | | Otherwise, the following line sets YYVAL to garbage. |
1601 | | This behavior is undocumented and Bison |
1602 | | users should not rely upon it. Assigning to YYVAL |
1603 | | unconditionally makes the parser a bit smaller, and it avoids a |
1604 | | GCC warning that YYVAL may be used uninitialized. */ |
1605 | 513k | yyval = yyvsp[1-yylen]; |
1606 | | |
1607 | | /* Default location. */ |
1608 | 513k | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); |
1609 | 513k | yyerror_range[1] = yyloc; |
1610 | 513k | YY_REDUCE_PRINT (yyn); |
1611 | 513k | switch (yyn) |
1612 | 513k | { |
1613 | 0 | case 6: |
1614 | 0 | #line 86 "gram.y" |
1615 | 0 | { |
1616 | 0 | if (run_last_command ()) |
1617 | 0 | { |
1618 | 0 | YYABORT; |
1619 | 0 | } |
1620 | 0 | } |
1621 | 0 | #line 1622 "gram.c" |
1622 | 0 | break; |
1623 | | |
1624 | 61.1k | case 7: |
1625 | 61.1k | #line 93 "gram.y" |
1626 | 61.1k | { |
1627 | 61.1k | if (run_command ((yyvsp[-3].cmd), &(yyvsp[-2].arglist), (yyvsp[-1].string))) |
1628 | 1.15k | { |
1629 | 1.15k | YYABORT; |
1630 | 1.15k | } |
1631 | 61.1k | } |
1632 | 60.0k | #line 1633 "gram.c" |
1633 | 60.0k | break; |
1634 | | |
1635 | 60.0k | case 10: |
1636 | 0 | #line 102 "gram.y" |
1637 | 0 | { |
1638 | 0 | if (interactive ()) |
1639 | 0 | { |
1640 | 0 | yyclearin; |
1641 | 0 | yyerrok; |
1642 | 0 | } |
1643 | 0 | else |
1644 | 0 | YYERROR; |
1645 | 0 | } |
1646 | 0 | #line 1647 "gram.c" |
1647 | 0 | break; |
1648 | | |
1649 | 0 | case 11: |
1650 | 0 | #line 111 "gram.y" |
1651 | 0 | { end_def(); } |
1652 | 0 | #line 1653 "gram.c" |
1653 | 0 | break; |
1654 | | |
1655 | 0 | case 12: |
1656 | 0 | #line 112 "gram.y" |
1657 | 0 | { |
1658 | 0 | if (interactive ()) |
1659 | 0 | { |
1660 | 0 | yyclearin; |
1661 | 0 | yyerrok; |
1662 | 0 | } |
1663 | 0 | else |
1664 | 0 | YYERROR; |
1665 | 0 | } |
1666 | 0 | #line 1667 "gram.c" |
1667 | 0 | break; |
1668 | | |
1669 | 61.1k | case 15: |
1670 | 61.1k | #line 128 "gram.y" |
1671 | 61.1k | { |
1672 | 61.1k | (yyval.string) = NULL; |
1673 | 61.1k | } |
1674 | 61.1k | #line 1675 "gram.c" |
1675 | 61.1k | break; |
1676 | | |
1677 | 46.9k | case 19: |
1678 | 46.9k | #line 139 "gram.y" |
1679 | 46.9k | { |
1680 | 46.9k | gdbmarglist_init (&(yyval.arglist), NULL); |
1681 | 46.9k | } |
1682 | 46.9k | #line 1683 "gram.c" |
1683 | 46.9k | break; |
1684 | | |
1685 | 14.2k | case 21: |
1686 | 14.2k | #line 146 "gram.y" |
1687 | 14.2k | { |
1688 | 14.2k | gdbmarglist_init (&(yyval.arglist), (yyvsp[0].arg)); |
1689 | 14.2k | } |
1690 | 14.2k | #line 1691 "gram.c" |
1691 | 14.2k | break; |
1692 | | |
1693 | 2.85k | case 22: |
1694 | 2.85k | #line 150 "gram.y" |
1695 | 2.85k | { |
1696 | 2.85k | gdbmarglist_add (&(yyvsp[-1].arglist), (yyvsp[0].arg)); |
1697 | 2.85k | (yyval.arglist) = (yyvsp[-1].arglist); |
1698 | 2.85k | } |
1699 | 2.85k | #line 1700 "gram.c" |
1700 | 2.85k | break; |
1701 | | |
1702 | 17.1k | case 23: |
1703 | 17.1k | #line 157 "gram.y" |
1704 | 17.1k | { |
1705 | 17.1k | (yyval.arg) = gdbmarg_string ((yyvsp[0].string), &(yylsp[0])); |
1706 | 17.1k | } |
1707 | 17.1k | #line 1708 "gram.c" |
1708 | 17.1k | break; |
1709 | | |
1710 | 0 | case 24: |
1711 | 0 | #line 161 "gram.y" |
1712 | 0 | { |
1713 | 0 | struct locus loc = { .beg = (yylsp[-2]).beg, .end = (yylsp[0]).end }; |
1714 | 0 | struct kvpair *kvp = kvpair_string (&loc, (yyvsp[0].string)); |
1715 | 0 | kvp->key = (yyvsp[-2].string); |
1716 | 0 | (yyval.arg) = gdbmarg_kvpair (kvp, &loc); |
1717 | 0 | } |
1718 | 0 | #line 1719 "gram.c" |
1719 | 0 | break; |
1720 | | |
1721 | 0 | case 25: |
1722 | 0 | #line 168 "gram.y" |
1723 | 0 | { |
1724 | 0 | (yyval.arg) = gdbmarg_kvpair ((yyvsp[0].kvpair), &(yylsp[0])); |
1725 | 0 | } |
1726 | 0 | #line 1727 "gram.c" |
1727 | 0 | break; |
1728 | | |
1729 | 0 | case 26: |
1730 | 0 | #line 174 "gram.y" |
1731 | 0 | { |
1732 | 0 | (yyval.kvpair) = (yyvsp[-1].kvlist).head; |
1733 | 0 | } |
1734 | 0 | #line 1735 "gram.c" |
1735 | 0 | break; |
1736 | | |
1737 | 0 | case 27: |
1738 | 0 | #line 180 "gram.y" |
1739 | 0 | { |
1740 | 0 | (yyval.kvlist).head = (yyval.kvlist).tail = (yyvsp[0].kvpair); |
1741 | 0 | } |
1742 | 0 | #line 1743 "gram.c" |
1743 | 0 | break; |
1744 | | |
1745 | 0 | case 28: |
1746 | 0 | #line 184 "gram.y" |
1747 | 0 | { |
1748 | 0 | if (kvlist_find ((yyvsp[-2].kvlist).head, (yyvsp[0].kvpair)->key)) |
1749 | 0 | { |
1750 | 0 | lerror (&(yylsp[0]), _("duplicate tag: %s"), (yyvsp[0].kvpair)->key); |
1751 | 0 | kvlist_free ((yyvsp[-2].kvlist).head); |
1752 | 0 | (yyvsp[-2].kvlist).head = (yyvsp[-2].kvlist).tail = NULL; |
1753 | 0 | YYERROR; |
1754 | 0 | } |
1755 | 0 | (yyvsp[-2].kvlist).tail->next = (yyvsp[0].kvpair); |
1756 | 0 | (yyvsp[-2].kvlist).tail = (yyvsp[0].kvpair); |
1757 | 0 | (yyval.kvlist) = (yyvsp[-2].kvlist); |
1758 | 0 | } |
1759 | 0 | #line 1760 "gram.c" |
1760 | 0 | break; |
1761 | | |
1762 | 0 | case 30: |
1763 | 0 | #line 200 "gram.y" |
1764 | 0 | { |
1765 | 0 | (yyvsp[0].kvpair)->key = (yyvsp[-2].string); |
1766 | 0 | (yyvsp[0].kvpair)->loc.beg = (yylsp[-2]).beg; |
1767 | 0 | (yyval.kvpair) = (yyvsp[0].kvpair); |
1768 | 0 | } |
1769 | 0 | #line 1770 "gram.c" |
1770 | 0 | break; |
1771 | | |
1772 | 0 | case 31: |
1773 | 0 | #line 208 "gram.y" |
1774 | 0 | { |
1775 | 0 | (yyval.kvpair) = kvpair_string (&(yylsp[0]), (yyvsp[0].string)); |
1776 | 0 | } |
1777 | 0 | #line 1778 "gram.c" |
1778 | 0 | break; |
1779 | | |
1780 | 0 | case 32: |
1781 | 0 | #line 212 "gram.y" |
1782 | 0 | { |
1783 | 0 | (yyval.kvpair) = kvpair_list (&(yylsp[-2]), (yyvsp[-1].slist).head); |
1784 | 0 | } |
1785 | 0 | #line 1786 "gram.c" |
1786 | 0 | break; |
1787 | | |
1788 | 0 | case 33: |
1789 | 0 | #line 218 "gram.y" |
1790 | 0 | { |
1791 | 0 | (yyval.slist).head = (yyval.slist).tail = slist_new_s ((yyvsp[0].string)); |
1792 | 0 | } |
1793 | 0 | #line 1794 "gram.c" |
1794 | 0 | break; |
1795 | | |
1796 | 0 | case 34: |
1797 | 0 | #line 222 "gram.y" |
1798 | 0 | { |
1799 | 0 | struct slist *s = slist_new_s ((yyvsp[0].string)); |
1800 | 0 | slist_insert (&(yyvsp[-2].slist).tail, s); |
1801 | 0 | (yyval.slist) = (yyvsp[-2].slist); |
1802 | 0 | } |
1803 | 0 | #line 1804 "gram.c" |
1804 | 0 | break; |
1805 | | |
1806 | 0 | case 37: |
1807 | 0 | #line 233 "gram.y" |
1808 | 0 | { begin_def (); } |
1809 | 0 | #line 1810 "gram.c" |
1810 | 0 | break; |
1811 | | |
1812 | 0 | case 38: |
1813 | 0 | #line 234 "gram.y" |
1814 | 0 | { |
1815 | 0 | end_def (); |
1816 | 0 | dsegm_list_free (dsdef[(yyvsp[-2].num)]); |
1817 | 0 | dsdef[(yyvsp[-2].num)] = (yyvsp[0].dsegm); |
1818 | 0 | } |
1819 | 0 | #line 1820 "gram.c" |
1820 | 0 | break; |
1821 | | |
1822 | 0 | case 39: |
1823 | 0 | #line 242 "gram.y" |
1824 | 0 | { |
1825 | 0 | (yyval.dsegm) = (yyvsp[-2].dsegmlist).head; |
1826 | 0 | } |
1827 | 0 | #line 1828 "gram.c" |
1828 | 0 | break; |
1829 | | |
1830 | 0 | case 40: |
1831 | 0 | #line 246 "gram.y" |
1832 | 0 | { |
1833 | 0 | (yyval.dsegm) = dsegm_new_field ((yyvsp[0].type), NULL, 1); |
1834 | 0 | } |
1835 | 0 | #line 1836 "gram.c" |
1836 | 0 | break; |
1837 | | |
1838 | 0 | case 43: |
1839 | 0 | #line 256 "gram.y" |
1840 | 0 | { |
1841 | 0 | if (strcmp ((yyvsp[0].string), "key") == 0) |
1842 | 0 | { |
1843 | 0 | (yyval.num) = DS_KEY; |
1844 | 0 | free ((yyvsp[0].string)); |
1845 | 0 | } |
1846 | 0 | else if (strcmp ((yyvsp[0].string), "content") == 0) |
1847 | 0 | { |
1848 | 0 | (yyval.num) = DS_CONTENT; |
1849 | 0 | free ((yyvsp[0].string)); |
1850 | 0 | } |
1851 | 0 | else |
1852 | 0 | { |
1853 | 0 | terror (_("expected \"key\" or \"content\", " |
1854 | 0 | "but found \"%s\""), (yyvsp[0].string)); |
1855 | 0 | free ((yyvsp[0].string)); |
1856 | 0 | YYERROR; |
1857 | 0 | } |
1858 | 0 | } |
1859 | 0 | #line 1860 "gram.c" |
1860 | 0 | break; |
1861 | | |
1862 | 0 | case 44: |
1863 | 0 | #line 278 "gram.y" |
1864 | 0 | { |
1865 | 0 | (yyval.dsegmlist).head = (yyval.dsegmlist).tail = (yyvsp[0].dsegm); |
1866 | 0 | } |
1867 | 0 | #line 1868 "gram.c" |
1868 | 0 | break; |
1869 | | |
1870 | 0 | case 45: |
1871 | 0 | #line 282 "gram.y" |
1872 | 0 | { |
1873 | 0 | (yyvsp[-2].dsegmlist).tail->next = (yyvsp[0].dsegm); |
1874 | 0 | (yyvsp[-2].dsegmlist).tail = (yyvsp[0].dsegm); |
1875 | 0 | (yyval.dsegmlist) = (yyvsp[-2].dsegmlist); |
1876 | 0 | } |
1877 | 0 | #line 1878 "gram.c" |
1878 | 0 | break; |
1879 | | |
1880 | 0 | case 46: |
1881 | 0 | #line 290 "gram.y" |
1882 | 0 | { |
1883 | 0 | (yyval.dsegm) = dsegm_new_field ((yyvsp[-1].type), (yyvsp[0].string), 1); |
1884 | 0 | } |
1885 | 0 | #line 1886 "gram.c" |
1886 | 0 | break; |
1887 | | |
1888 | 0 | case 47: |
1889 | 0 | #line 294 "gram.y" |
1890 | 0 | { |
1891 | 0 | (yyval.dsegm) = dsegm_new_field ((yyvsp[-4].type), (yyvsp[-3].string), (yyvsp[-1].num)); |
1892 | 0 | } |
1893 | 0 | #line 1894 "gram.c" |
1894 | 0 | break; |
1895 | | |
1896 | 0 | case 48: |
1897 | 0 | #line 298 "gram.y" |
1898 | 0 | { |
1899 | 0 | (yyval.dsegm) = dsegm_new (FDEF_OFF); |
1900 | 0 | (yyval.dsegm)->v.n = (yyvsp[0].num); |
1901 | 0 | } |
1902 | 0 | #line 1903 "gram.c" |
1903 | 0 | break; |
1904 | | |
1905 | 0 | case 49: |
1906 | 0 | #line 303 "gram.y" |
1907 | 0 | { |
1908 | 0 | (yyval.dsegm) = dsegm_new (FDEF_PAD); |
1909 | 0 | (yyval.dsegm)->v.n = (yyvsp[0].num); |
1910 | 0 | } |
1911 | 0 | #line 1912 "gram.c" |
1912 | 0 | break; |
1913 | | |
1914 | 0 | case 50: |
1915 | 0 | #line 310 "gram.y" |
1916 | 0 | { |
1917 | 0 | variable_print_all (stdout); |
1918 | 0 | } |
1919 | 0 | #line 1920 "gram.c" |
1920 | 0 | break; |
1921 | | |
1922 | 15.4k | case 55: |
1923 | 15.4k | #line 322 "gram.y" |
1924 | 15.4k | { |
1925 | 15.4k | int t = 1; |
1926 | 15.4k | int rc; |
1927 | 15.4k | char *varname = (yyvsp[0].string); |
1928 | | |
1929 | 15.4k | rc = variable_set (varname, VART_BOOL, &t); |
1930 | 15.4k | if (rc == VAR_ERR_NOTDEF && strncmp (varname, "no", 2) == 0) |
1931 | 2.85k | { |
1932 | 2.85k | t = 0; |
1933 | 2.85k | varname += 2; |
1934 | 2.85k | rc = variable_set (varname, VART_BOOL, &t); |
1935 | 2.85k | } |
1936 | | |
1937 | 15.4k | switch (rc) |
1938 | 15.4k | { |
1939 | 9.83k | case VAR_OK: |
1940 | 9.83k | break; |
1941 | | |
1942 | 0 | case VAR_ERR_NOTDEF: |
1943 | 0 | lerror (&(yylsp[0]), _("no such variable: %s"), varname); |
1944 | 0 | break; |
1945 | | |
1946 | 0 | case VAR_ERR_BADTYPE: |
1947 | 0 | lerror (&(yylsp[0]), _("%s is not a boolean variable"), varname); |
1948 | 0 | break; |
1949 | | |
1950 | 0 | case VAR_ERR_BADVALUE: |
1951 | 0 | lerror (&(yylsp[0]), _("%s: setting is not allowed"), (yyvsp[0].string)); |
1952 | 0 | break; |
1953 | | |
1954 | 5.61k | case VAR_ERR_GDBM: |
1955 | 5.61k | dberror ("%s", _("can't set variable")); |
1956 | 5.61k | break; |
1957 | | |
1958 | 0 | default: |
1959 | 0 | lerror (&(yylsp[0]), _("unexpected error setting %s: %d"), (yyvsp[0].string), rc); |
1960 | 15.4k | } |
1961 | 15.4k | free ((yyvsp[0].string)); |
1962 | 15.4k | } |
1963 | 0 | #line 1964 "gram.c" |
1964 | 0 | break; |
1965 | | |
1966 | 0 | case 56: |
1967 | 0 | #line 362 "gram.y" |
1968 | 0 | { |
1969 | 0 | int rc = variable_set ((yyvsp[-2].string), VART_STRING, (yyvsp[0].string)); |
1970 | 0 | switch (rc) |
1971 | 0 | { |
1972 | 0 | case VAR_OK: |
1973 | 0 | break; |
1974 | | |
1975 | 0 | case VAR_ERR_NOTDEF: |
1976 | 0 | lerror (&(yylsp[-2]), _("no such variable: %s"), (yyvsp[-2].string)); |
1977 | 0 | break; |
1978 | | |
1979 | 0 | case VAR_ERR_BADTYPE: |
1980 | 0 | lerror (&(yylsp[-2]), _("%s: bad variable type"), (yyvsp[-2].string)); |
1981 | 0 | break; |
1982 | | |
1983 | 0 | case VAR_ERR_BADVALUE: |
1984 | 0 | lerror (&(yylsp[-2]), _("%s: value %s is not allowed"), (yyvsp[-2].string), (yyvsp[0].string)); |
1985 | 0 | break; |
1986 | | |
1987 | 0 | default: |
1988 | 0 | lerror (&(yylsp[-2]), _("unexpected error setting %s: %d"), (yyvsp[-2].string), rc); |
1989 | 0 | } |
1990 | 0 | free ((yyvsp[-2].string)); |
1991 | 0 | free ((yyvsp[0].string)); |
1992 | 0 | } |
1993 | 0 | #line 1994 "gram.c" |
1994 | 0 | break; |
1995 | | |
1996 | 0 | case 59: |
1997 | 0 | #line 394 "gram.y" |
1998 | 0 | { |
1999 | 0 | int rc = variable_unset ((yyvsp[0].string)); |
2000 | 0 | switch (rc) |
2001 | 0 | { |
2002 | 0 | case VAR_OK: |
2003 | 0 | break; |
2004 | | |
2005 | 0 | case VAR_ERR_NOTDEF: |
2006 | 0 | lerror (&(yylsp[0]), _("no such variable: %s"), (yyvsp[0].string)); |
2007 | 0 | break; |
2008 | | |
2009 | 0 | case VAR_ERR_BADVALUE: |
2010 | 0 | lerror (&(yylsp[0]), _("%s: variable cannot be unset"), (yyvsp[0].string)); |
2011 | 0 | break; |
2012 | 0 | } |
2013 | 0 | free ((yyvsp[0].string)); |
2014 | 0 | } |
2015 | 0 | #line 2016 "gram.c" |
2016 | 0 | break; |
2017 | | |
2018 | | |
2019 | 0 | #line 2020 "gram.c" |
2020 | | |
2021 | 293k | default: break; |
2022 | 513k | } |
2023 | | /* User semantic actions sometimes alter yychar, and that requires |
2024 | | that yytoken be updated with the new translation. We take the |
2025 | | approach of translating immediately before every use of yytoken. |
2026 | | One alternative is translating here after every semantic action, |
2027 | | but that translation would be missed if the semantic action invokes |
2028 | | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
2029 | | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
2030 | | incorrect destructor might then be invoked immediately. In the |
2031 | | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
2032 | | to an incorrect destructor call or verbose syntax error message |
2033 | | before the lookahead is translated. */ |
2034 | 511k | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
2035 | | |
2036 | 511k | YYPOPSTACK (yylen); |
2037 | 511k | yylen = 0; |
2038 | 511k | YY_STACK_PRINT (yyss, yyssp); |
2039 | | |
2040 | 511k | *++yyvsp = yyval; |
2041 | 511k | *++yylsp = yyloc; |
2042 | | |
2043 | | /* Now 'shift' the result of the reduction. Determine what state |
2044 | | that goes to, based on the state we popped back to and the rule |
2045 | | number reduced by. */ |
2046 | 511k | { |
2047 | 511k | const int yylhs = yyr1[yyn] - YYNTOKENS; |
2048 | 511k | const int yyi = yypgoto[yylhs] + *yyssp; |
2049 | 511k | yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp |
2050 | 511k | ? yytable[yyi] |
2051 | 511k | : yydefgoto[yylhs]); |
2052 | 511k | } |
2053 | | |
2054 | 511k | goto yynewstate; |
2055 | | |
2056 | | |
2057 | | /*--------------------------------------. |
2058 | | | yyerrlab -- here on detecting error. | |
2059 | | `--------------------------------------*/ |
2060 | 0 | yyerrlab: |
2061 | | /* Make sure we have latest lookahead translation. See comments at |
2062 | | user semantic actions for why this is necessary. */ |
2063 | 0 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); |
2064 | | |
2065 | | /* If not already recovering from an error, report this error. */ |
2066 | 0 | if (!yyerrstatus) |
2067 | 0 | { |
2068 | 0 | ++yynerrs; |
2069 | | #if ! YYERROR_VERBOSE |
2070 | | yyerror (YY_("syntax error")); |
2071 | | #else |
2072 | 0 | # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ |
2073 | 0 | yyssp, yytoken) |
2074 | 0 | { |
2075 | 0 | char const *yymsgp = YY_("syntax error"); |
2076 | 0 | int yysyntax_error_status; |
2077 | 0 | yysyntax_error_status = YYSYNTAX_ERROR; |
2078 | 0 | if (yysyntax_error_status == 0) |
2079 | 0 | yymsgp = yymsg; |
2080 | 0 | else if (yysyntax_error_status == 1) |
2081 | 0 | { |
2082 | 0 | if (yymsg != yymsgbuf) |
2083 | 0 | YYSTACK_FREE (yymsg); |
2084 | 0 | yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); |
2085 | 0 | if (!yymsg) |
2086 | 0 | { |
2087 | 0 | yymsg = yymsgbuf; |
2088 | 0 | yymsg_alloc = sizeof yymsgbuf; |
2089 | 0 | yysyntax_error_status = 2; |
2090 | 0 | } |
2091 | 0 | else |
2092 | 0 | { |
2093 | 0 | yysyntax_error_status = YYSYNTAX_ERROR; |
2094 | 0 | yymsgp = yymsg; |
2095 | 0 | } |
2096 | 0 | } |
2097 | 0 | yyerror (yymsgp); |
2098 | 0 | if (yysyntax_error_status == 2) |
2099 | 0 | goto yyexhaustedlab; |
2100 | 0 | } |
2101 | 0 | # undef YYSYNTAX_ERROR |
2102 | 0 | #endif |
2103 | 0 | } |
2104 | | |
2105 | 0 | yyerror_range[1] = yylloc; |
2106 | |
|
2107 | 0 | if (yyerrstatus == 3) |
2108 | 0 | { |
2109 | | /* If just tried and failed to reuse lookahead token after an |
2110 | | error, discard it. */ |
2111 | |
|
2112 | 0 | if (yychar <= YYEOF) |
2113 | 0 | { |
2114 | | /* Return failure if at end of input. */ |
2115 | 0 | if (yychar == YYEOF) |
2116 | 0 | YYABORT; |
2117 | 0 | } |
2118 | 0 | else |
2119 | 0 | { |
2120 | 0 | yydestruct ("Error: discarding", |
2121 | 0 | yytoken, &yylval, &yylloc); |
2122 | 0 | yychar = YYEMPTY; |
2123 | 0 | } |
2124 | 0 | } |
2125 | | |
2126 | | /* Else will try to reuse lookahead token after shifting the error |
2127 | | token. */ |
2128 | 0 | goto yyerrlab1; |
2129 | | |
2130 | | |
2131 | | /*---------------------------------------------------. |
2132 | | | yyerrorlab -- error raised explicitly by YYERROR. | |
2133 | | `---------------------------------------------------*/ |
2134 | 0 | yyerrorlab: |
2135 | | /* Pacify compilers when the user code never invokes YYERROR and the |
2136 | | label yyerrorlab therefore never appears in user code. */ |
2137 | 0 | if (0) |
2138 | 0 | YYERROR; |
2139 | | |
2140 | | /* Do not reclaim the symbols of the rule whose action triggered |
2141 | | this YYERROR. */ |
2142 | 0 | YYPOPSTACK (yylen); |
2143 | 0 | yylen = 0; |
2144 | 0 | YY_STACK_PRINT (yyss, yyssp); |
2145 | 0 | yystate = *yyssp; |
2146 | 0 | goto yyerrlab1; |
2147 | | |
2148 | | |
2149 | | /*-------------------------------------------------------------. |
2150 | | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
2151 | | `-------------------------------------------------------------*/ |
2152 | 0 | yyerrlab1: |
2153 | 0 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
2154 | |
|
2155 | 0 | for (;;) |
2156 | 0 | { |
2157 | 0 | yyn = yypact[yystate]; |
2158 | 0 | if (!yypact_value_is_default (yyn)) |
2159 | 0 | { |
2160 | 0 | yyn += YYTERROR; |
2161 | 0 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
2162 | 0 | { |
2163 | 0 | yyn = yytable[yyn]; |
2164 | 0 | if (0 < yyn) |
2165 | 0 | break; |
2166 | 0 | } |
2167 | 0 | } |
2168 | | |
2169 | | /* Pop the current state because it cannot handle the error token. */ |
2170 | 0 | if (yyssp == yyss) |
2171 | 0 | YYABORT; |
2172 | | |
2173 | 0 | yyerror_range[1] = *yylsp; |
2174 | 0 | yydestruct ("Error: popping", |
2175 | 0 | yystos[yystate], yyvsp, yylsp); |
2176 | 0 | YYPOPSTACK (1); |
2177 | 0 | yystate = *yyssp; |
2178 | 0 | YY_STACK_PRINT (yyss, yyssp); |
2179 | 0 | } |
2180 | | |
2181 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
2182 | 0 | *++yyvsp = yylval; |
2183 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
2184 | |
|
2185 | 0 | yyerror_range[2] = yylloc; |
2186 | | /* Using YYLLOC is tempting, but would change the location of |
2187 | | the lookahead. YYLOC is available though. */ |
2188 | 0 | YYLLOC_DEFAULT (yyloc, yyerror_range, 2); |
2189 | 0 | *++yylsp = yyloc; |
2190 | | |
2191 | | /* Shift the error token. */ |
2192 | 0 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
2193 | |
|
2194 | 0 | yystate = yyn; |
2195 | 0 | goto yynewstate; |
2196 | | |
2197 | | |
2198 | | /*-------------------------------------. |
2199 | | | yyacceptlab -- YYACCEPT comes here. | |
2200 | | `-------------------------------------*/ |
2201 | 2.85k | yyacceptlab: |
2202 | 2.85k | yyresult = 0; |
2203 | 2.85k | goto yyreturn; |
2204 | | |
2205 | | |
2206 | | /*-----------------------------------. |
2207 | | | yyabortlab -- YYABORT comes here. | |
2208 | | `-----------------------------------*/ |
2209 | 1.15k | yyabortlab: |
2210 | 1.15k | yyresult = 1; |
2211 | 1.15k | goto yyreturn; |
2212 | | |
2213 | | |
2214 | 0 | #if !defined yyoverflow || YYERROR_VERBOSE |
2215 | | /*-------------------------------------------------. |
2216 | | | yyexhaustedlab -- memory exhaustion comes here. | |
2217 | | `-------------------------------------------------*/ |
2218 | 0 | yyexhaustedlab: |
2219 | 0 | yyerror (YY_("memory exhausted")); |
2220 | 0 | yyresult = 2; |
2221 | | /* Fall through. */ |
2222 | 0 | #endif |
2223 | | |
2224 | | |
2225 | | /*-----------------------------------------------------. |
2226 | | | yyreturn -- parsing is finished, return the result. | |
2227 | | `-----------------------------------------------------*/ |
2228 | 4.01k | yyreturn: |
2229 | 4.01k | if (yychar != YYEMPTY) |
2230 | 0 | { |
2231 | | /* Make sure we have latest lookahead translation. See comments at |
2232 | | user semantic actions for why this is necessary. */ |
2233 | 0 | yytoken = YYTRANSLATE (yychar); |
2234 | 0 | yydestruct ("Cleanup: discarding lookahead", |
2235 | 0 | yytoken, &yylval, &yylloc); |
2236 | 0 | } |
2237 | | /* Do not reclaim the symbols of the rule whose action triggered |
2238 | | this YYABORT or YYACCEPT. */ |
2239 | 4.01k | YYPOPSTACK (yylen); |
2240 | 4.01k | YY_STACK_PRINT (yyss, yyssp); |
2241 | 10.8k | while (yyssp != yyss) |
2242 | 6.87k | { |
2243 | 6.87k | yydestruct ("Cleanup: popping", |
2244 | 6.87k | yystos[+*yyssp], yyvsp, yylsp); |
2245 | 6.87k | YYPOPSTACK (1); |
2246 | 6.87k | } |
2247 | 4.01k | #ifndef yyoverflow |
2248 | 4.01k | if (yyss != yyssa) |
2249 | 0 | YYSTACK_FREE (yyss); |
2250 | 4.01k | #endif |
2251 | 4.01k | #if YYERROR_VERBOSE |
2252 | 4.01k | if (yymsg != yymsgbuf) |
2253 | 0 | YYSTACK_FREE (yymsg); |
2254 | 4.01k | #endif |
2255 | 4.01k | return yyresult; |
2256 | 0 | } |
2257 | | #line 413 "gram.y" |
2258 | | |
2259 | | |
2260 | | void |
2261 | | terror (const char *fmt, ...) |
2262 | 0 | { |
2263 | 0 | va_list ap; |
2264 | |
|
2265 | 0 | va_start (ap, fmt); |
2266 | 0 | vlerror (&yylloc, fmt, ap); |
2267 | 0 | va_end (ap); |
2268 | 0 | } |
2269 | | |
2270 | | /* gdbmshell-specific version of gdbm_perror */ |
2271 | | void |
2272 | | dberror (char const *fmt, ...) |
2273 | 26.1k | { |
2274 | 26.1k | int ec = errno; |
2275 | 26.1k | va_list ap; |
2276 | | |
2277 | 26.1k | if (gdbm_error_is_masked (gdbm_errno)) |
2278 | 24.9k | return; |
2279 | 1.15k | if (!interactive ()) |
2280 | 1.15k | fprintf (stderr, "%s: ", progname); |
2281 | 1.15k | YY_LOCATION_PRINT (stderr, yylloc); |
2282 | 1.15k | fprintf (stderr, ": "); |
2283 | 1.15k | va_start (ap, fmt); |
2284 | 1.15k | vfprintf (stderr, fmt, ap); |
2285 | 1.15k | va_end (ap); |
2286 | 1.15k | fprintf (stderr, ": %s", gdbm_strerror (gdbm_errno)); |
2287 | 1.15k | if (gdbm_check_syserr (gdbm_errno)) |
2288 | 0 | fprintf (stderr, ": %s", strerror (ec)); |
2289 | 1.15k | fputc ('\n', stderr); |
2290 | 1.15k | } |
2291 | | |
2292 | | void |
2293 | | yyerror (char const *s) |
2294 | 0 | { |
2295 | 0 | terror ("%s", s); |
2296 | 0 | } |
2297 | | |
2298 | | void |
2299 | | gram_trace (int n) |
2300 | 0 | { |
2301 | | #if GDBMTOOL_DEBUG |
2302 | | yydebug = 1; |
2303 | | #endif |
2304 | 0 | } |