1 /* A Bison parser, made by GNU Bison 3.8.2. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 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 <https://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 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 especially those whose name start with YY_ or yy_. They are
39 private implementation details that can be changed or removed. */
40
41 /* All symbols defined below should begin with yy or YY, to avoid
42 infringing on user name space. This should be done even for local
43 variables, as they might otherwise be expanded by user macros.
44 There are some unavoidable exceptions within include files to
45 define necessary library symbols; they are noted "INFRINGES ON
46 USER NAME SPACE" below. */
47
48 /* Identify Bison output, and Bison version. */
49 #define YYBISON 30802
50
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.8.2"
53
54 /* Skeleton name. */
55 #define YYSKELETON_NAME "yacc.c"
56
57 /* Pure parsers. */
58 #define YYPURE 0
59
60 /* Push parsers. */
61 #define YYPUSH 0
62
63 /* Pull parsers. */
64 #define YYPULL 1
65
66
67
68
69 /* First part of user prologue. */
70 #line 1 "arparse.y"
71
72 /* arparse.y - Strange script language parser */
73
74 /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
75
76 This file is part of GNU Binutils.
77
78 This program is free software; you can redistribute it and/or modify
79 it under the terms of the GNU General Public License as published by
80 the Free Software Foundation; either version 3 of the License, or
81 (at your option) any later version.
82
83 This program is distributed in the hope that it will be useful,
84 but WITHOUT ANY WARRANTY; without even the implied warranty of
85 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
86 GNU General Public License for more details.
87
88 You should have received a copy of the GNU General Public License
89 along with this program; if not, write to the Free Software
90 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
91 MA 02110-1301, USA. */
92
93
94 /* Contributed by Steve Chamberlain
95 sac@cygnus.com
96
97 */
98 #define DONTDECLARE_MALLOC
99 #include "sysdep.h"
100 #include "bfd.h"
101 #include "arsup.h"
102 extern int verbose;
103 extern int yylex (void);
104 static void yyerror (const char *);
105
106 #line 107 "arparse.c"
107
108 # ifndef YY_CAST
109 # ifdef __cplusplus
110 # define YY_CAST(Type, Val) static_cast<Type> (Val)
111 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
112 # else
113 # define YY_CAST(Type, Val) ((Type) (Val))
114 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
115 # endif
116 # endif
117 # ifndef YY_NULLPTR
118 # if defined __cplusplus
119 # if 201103L <= __cplusplus
120 # define YY_NULLPTR nullptr
121 # else
122 # define YY_NULLPTR 0
123 # endif
124 # else
125 # define YY_NULLPTR ((void*)0)
126 # endif
127 # endif
128
129 /* Use api.header.include to #include this header
130 instead of duplicating it here. */
131 #ifndef YY_YY_ARPARSE_H_INCLUDED
132 # define YY_YY_ARPARSE_H_INCLUDED
133 /* Debug traces. */
134 #ifndef YYDEBUG
135 # define YYDEBUG 0
136 #endif
137 #if YYDEBUG
138 extern int yydebug;
139 #endif
140
141 /* Token kinds. */
142 #ifndef YYTOKENTYPE
143 # define YYTOKENTYPE
144 enum yytokentype
145 {
146 YYEMPTY = -2,
147 YYEOF = 0, /* "end of file" */
148 YYerror = 256, /* error */
149 YYUNDEF = 257, /* "invalid token" */
150 NEWLINE = 258, /* NEWLINE */
151 VERBOSE = 259, /* VERBOSE */
152 FILENAME = 260, /* FILENAME */
153 ADDLIB = 261, /* ADDLIB */
154 LIST = 262, /* LIST */
155 ADDMOD = 263, /* ADDMOD */
156 CLEAR = 264, /* CLEAR */
157 CREATE = 265, /* CREATE */
158 DELETE = 266, /* DELETE */
159 DIRECTORY = 267, /* DIRECTORY */
160 END = 268, /* END */
161 EXTRACT = 269, /* EXTRACT */
162 FULLDIR = 270, /* FULLDIR */
163 HELP = 271, /* HELP */
164 QUIT = 272, /* QUIT */
165 REPLACE = 273, /* REPLACE */
166 SAVE = 274, /* SAVE */
167 OPEN = 275 /* OPEN */
168 };
169 typedef enum yytokentype yytoken_kind_t;
170 #endif
171 /* Token kinds. */
172 #define YYEMPTY -2
173 #define YYEOF 0
174 #define YYerror 256
175 #define YYUNDEF 257
176 #define NEWLINE 258
177 #define VERBOSE 259
178 #define FILENAME 260
179 #define ADDLIB 261
180 #define LIST 262
181 #define ADDMOD 263
182 #define CLEAR 264
183 #define CREATE 265
184 #define DELETE 266
185 #define DIRECTORY 267
186 #define END 268
187 #define EXTRACT 269
188 #define FULLDIR 270
189 #define HELP 271
190 #define QUIT 272
191 #define REPLACE 273
192 #define SAVE 274
193 #define OPEN 275
194
195 /* Value type. */
196 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
197 union YYSTYPE
198 {
199 #line 37 "arparse.y"
200
201 char *name;
202 struct list *list ;
203
204
205 #line 206 "arparse.c"
206
207 };
208 typedef union YYSTYPE YYSTYPE;
209 # define YYSTYPE_IS_TRIVIAL 1
210 # define YYSTYPE_IS_DECLARED 1
211 #endif
212
213
214 extern YYSTYPE yylval;
215
216
217 int yyparse (void);
218
219
220 #endif /* !YY_YY_ARPARSE_H_INCLUDED */
221 /* Symbol kind. */
222 enum yysymbol_kind_t
223 {
224 YYSYMBOL_YYEMPTY = -2,
225 YYSYMBOL_YYEOF = 0, /* "end of file" */
226 YYSYMBOL_YYerror = 1, /* error */
227 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
228 YYSYMBOL_NEWLINE = 3, /* NEWLINE */
229 YYSYMBOL_VERBOSE = 4, /* VERBOSE */
230 YYSYMBOL_FILENAME = 5, /* FILENAME */
231 YYSYMBOL_ADDLIB = 6, /* ADDLIB */
232 YYSYMBOL_LIST = 7, /* LIST */
233 YYSYMBOL_ADDMOD = 8, /* ADDMOD */
234 YYSYMBOL_CLEAR = 9, /* CLEAR */
235 YYSYMBOL_CREATE = 10, /* CREATE */
236 YYSYMBOL_DELETE = 11, /* DELETE */
237 YYSYMBOL_DIRECTORY = 12, /* DIRECTORY */
238 YYSYMBOL_END = 13, /* END */
239 YYSYMBOL_EXTRACT = 14, /* EXTRACT */
240 YYSYMBOL_FULLDIR = 15, /* FULLDIR */
241 YYSYMBOL_HELP = 16, /* HELP */
242 YYSYMBOL_QUIT = 17, /* QUIT */
243 YYSYMBOL_REPLACE = 18, /* REPLACE */
244 YYSYMBOL_SAVE = 19, /* SAVE */
245 YYSYMBOL_OPEN = 20, /* OPEN */
246 YYSYMBOL_21_ = 21, /* '(' */
247 YYSYMBOL_22_ = 22, /* ')' */
248 YYSYMBOL_23_ = 23, /* ',' */
249 YYSYMBOL_YYACCEPT = 24, /* $accept */
250 YYSYMBOL_start = 25, /* start */
251 YYSYMBOL_26_1 = 26, /* $@1 */
252 YYSYMBOL_session = 27, /* session */
253 YYSYMBOL_command_line = 28, /* command_line */
254 YYSYMBOL_command = 29, /* command */
255 YYSYMBOL_extract_command = 30, /* extract_command */
256 YYSYMBOL_replace_command = 31, /* replace_command */
257 YYSYMBOL_clear_command = 32, /* clear_command */
258 YYSYMBOL_delete_command = 33, /* delete_command */
259 YYSYMBOL_addmod_command = 34, /* addmod_command */
260 YYSYMBOL_list_command = 35, /* list_command */
261 YYSYMBOL_save_command = 36, /* save_command */
262 YYSYMBOL_open_command = 37, /* open_command */
263 YYSYMBOL_create_command = 38, /* create_command */
264 YYSYMBOL_addlib_command = 39, /* addlib_command */
265 YYSYMBOL_directory_command = 40, /* directory_command */
266 YYSYMBOL_optional_filename = 41, /* optional_filename */
267 YYSYMBOL_modulelist = 42, /* modulelist */
268 YYSYMBOL_modulename = 43, /* modulename */
269 YYSYMBOL_optcomma = 44, /* optcomma */
270 YYSYMBOL_verbose_command = 45 /* verbose_command */
271 };
272 typedef enum yysymbol_kind_t yysymbol_kind_t;
273
274
275
276
277 #ifdef short
278 # undef short
279 #endif
280
281 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
282 <limits.h> and (if available) <stdint.h> are included
283 so that the code can choose integer types of a good width. */
284
285 #ifndef __PTRDIFF_MAX__
286 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
287 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
288 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
289 # define YY_STDINT_H
290 # endif
291 #endif
292
293 /* Narrow types that promote to a signed type and that can represent a
294 signed or unsigned integer of at least N bits. In tables they can
295 save space and decrease cache pressure. Promoting to a signed type
296 helps avoid bugs in integer arithmetic. */
297
298 #ifdef __INT_LEAST8_MAX__
299 typedef __INT_LEAST8_TYPE__ yytype_int8;
300 #elif defined YY_STDINT_H
301 typedef int_least8_t yytype_int8;
302 #else
303 typedef signed char yytype_int8;
304 #endif
305
306 #ifdef __INT_LEAST16_MAX__
307 typedef __INT_LEAST16_TYPE__ yytype_int16;
308 #elif defined YY_STDINT_H
309 typedef int_least16_t yytype_int16;
310 #else
311 typedef short yytype_int16;
312 #endif
313
314 /* Work around bug in HP-UX 11.23, which defines these macros
315 incorrectly for preprocessor constants. This workaround can likely
316 be removed in 2023, as HPE has promised support for HP-UX 11.23
317 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
318 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
319 #ifdef __hpux
320 # undef UINT_LEAST8_MAX
321 # undef UINT_LEAST16_MAX
322 # define UINT_LEAST8_MAX 255
323 # define UINT_LEAST16_MAX 65535
324 #endif
325
326 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
327 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
328 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
329 && UINT_LEAST8_MAX <= INT_MAX)
330 typedef uint_least8_t yytype_uint8;
331 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
332 typedef unsigned char yytype_uint8;
333 #else
334 typedef short yytype_uint8;
335 #endif
336
337 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
338 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
339 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
340 && UINT_LEAST16_MAX <= INT_MAX)
341 typedef uint_least16_t yytype_uint16;
342 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
343 typedef unsigned short yytype_uint16;
344 #else
345 typedef int yytype_uint16;
346 #endif
347
348 #ifndef YYPTRDIFF_T
349 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
350 # define YYPTRDIFF_T __PTRDIFF_TYPE__
351 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
352 # elif defined PTRDIFF_MAX
353 # ifndef ptrdiff_t
354 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
355 # endif
356 # define YYPTRDIFF_T ptrdiff_t
357 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
358 # else
359 # define YYPTRDIFF_T long
360 # define YYPTRDIFF_MAXIMUM LONG_MAX
361 # endif
362 #endif
363
364 #ifndef YYSIZE_T
365 # ifdef __SIZE_TYPE__
366 # define YYSIZE_T __SIZE_TYPE__
367 # elif defined size_t
368 # define YYSIZE_T size_t
369 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
370 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
371 # define YYSIZE_T size_t
372 # else
373 # define YYSIZE_T unsigned
374 # endif
375 #endif
376
377 #define YYSIZE_MAXIMUM \
378 YY_CAST (YYPTRDIFF_T, \
379 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
380 ? YYPTRDIFF_MAXIMUM \
381 : YY_CAST (YYSIZE_T, -1)))
382
383 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
384
385
386 /* Stored state numbers (used for stacks). */
387 typedef yytype_int8 yy_state_t;
388
389 /* State numbers in computations. */
390 typedef int yy_state_fast_t;
391
392 #ifndef YY_
393 # if defined YYENABLE_NLS && YYENABLE_NLS
394 # if ENABLE_NLS
395 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
396 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
397 # endif
398 # endif
399 # ifndef YY_
400 # define YY_(Msgid) Msgid
401 # endif
402 #endif
403
404
405 #ifndef YY_ATTRIBUTE_PURE
406 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
407 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
408 # else
409 # define YY_ATTRIBUTE_PURE
410 # endif
411 #endif
412
413 #ifndef YY_ATTRIBUTE_UNUSED
414 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
415 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
416 # else
417 # define YY_ATTRIBUTE_UNUSED
418 # endif
419 #endif
420
421 /* Suppress unused-variable warnings by "using" E. */
422 #if ! defined lint || defined __GNUC__
423 # define YY_USE(E) ((void) (E))
424 #else
425 # define YY_USE(E) /* empty */
426 #endif
427
428 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
429 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
430 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
431 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
432 _Pragma ("GCC diagnostic push") \
433 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
434 # else
435 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
436 _Pragma ("GCC diagnostic push") \
437 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
438 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
439 # endif
440 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
441 _Pragma ("GCC diagnostic pop")
442 #else
443 # define YY_INITIAL_VALUE(Value) Value
444 #endif
445 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
446 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
447 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
448 #endif
449 #ifndef YY_INITIAL_VALUE
450 # define YY_INITIAL_VALUE(Value) /* Nothing. */
451 #endif
452
453 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
454 # define YY_IGNORE_USELESS_CAST_BEGIN \
455 _Pragma ("GCC diagnostic push") \
456 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
457 # define YY_IGNORE_USELESS_CAST_END \
458 _Pragma ("GCC diagnostic pop")
459 #endif
460 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
461 # define YY_IGNORE_USELESS_CAST_BEGIN
462 # define YY_IGNORE_USELESS_CAST_END
463 #endif
464
465
466 #define YY_ASSERT(E) ((void) (0 && (E)))
467
468 #if !defined yyoverflow
469
470 /* The parser invokes alloca or malloc; define the necessary symbols. */
471
472 # ifdef YYSTACK_USE_ALLOCA
473 # if YYSTACK_USE_ALLOCA
474 # ifdef __GNUC__
475 # define YYSTACK_ALLOC __builtin_alloca
476 # elif defined __BUILTIN_VA_ARG_INCR
477 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
478 # elif defined _AIX
479 # define YYSTACK_ALLOC __alloca
480 # elif defined _MSC_VER
481 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
482 # define alloca _alloca
483 # else
484 # define YYSTACK_ALLOC alloca
485 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
486 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
487 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
488 # ifndef EXIT_SUCCESS
489 # define EXIT_SUCCESS 0
490 # endif
491 # endif
492 # endif
493 # endif
494 # endif
495
496 # ifdef YYSTACK_ALLOC
497 /* Pacify GCC's 'empty if-body' warning. */
498 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
499 # ifndef YYSTACK_ALLOC_MAXIMUM
500 /* The OS might guarantee only one guard page at the bottom of the stack,
501 and a page size can be as small as 4096 bytes. So we cannot safely
502 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
503 to allow for a few compiler-allocated temporary stack slots. */
504 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
505 # endif
506 # else
507 # define YYSTACK_ALLOC YYMALLOC
508 # define YYSTACK_FREE YYFREE
509 # ifndef YYSTACK_ALLOC_MAXIMUM
510 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
511 # endif
512 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
513 && ! ((defined YYMALLOC || defined malloc) \
514 && (defined YYFREE || defined free)))
515 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
516 # ifndef EXIT_SUCCESS
517 # define EXIT_SUCCESS 0
518 # endif
519 # endif
520 # ifndef YYMALLOC
521 # define YYMALLOC malloc
522 # if ! defined malloc && ! defined EXIT_SUCCESS
523 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
524 # endif
525 # endif
526 # ifndef YYFREE
527 # define YYFREE free
528 # if ! defined free && ! defined EXIT_SUCCESS
529 void free (void *); /* INFRINGES ON USER NAME SPACE */
530 # endif
531 # endif
532 # endif
533 #endif /* !defined yyoverflow */
534
535 #if (! defined yyoverflow \
536 && (! defined __cplusplus \
537 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
538
539 /* A type that is properly aligned for any stack member. */
540 union yyalloc
541 {
542 yy_state_t yyss_alloc;
543 YYSTYPE yyvs_alloc;
544 };
545
546 /* The size of the maximum gap between one aligned stack and the next. */
547 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
548
549 /* The size of an array large to enough to hold all stacks, each with
550 N elements. */
551 # define YYSTACK_BYTES(N) \
552 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
553 + YYSTACK_GAP_MAXIMUM)
554
555 # define YYCOPY_NEEDED 1
556
557 /* Relocate STACK from its old location to the new one. The
558 local variables YYSIZE and YYSTACKSIZE give the old and new number of
559 elements in the stack, and YYPTR gives the new location of the
560 stack. Advance YYPTR to a properly aligned location for the next
561 stack. */
562 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
563 do \
564 { \
565 YYPTRDIFF_T yynewbytes; \
566 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
567 Stack = &yyptr->Stack_alloc; \
568 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
569 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
570 } \
571 while (0)
572
573 #endif
574
575 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
576 /* Copy COUNT objects from SRC to DST. The source and destination do
577 not overlap. */
578 # ifndef YYCOPY
579 # if defined __GNUC__ && 1 < __GNUC__
580 # define YYCOPY(Dst, Src, Count) \
581 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
582 # else
583 # define YYCOPY(Dst, Src, Count) \
584 do \
585 { \
586 YYPTRDIFF_T yyi; \
587 for (yyi = 0; yyi < (Count); yyi++) \
588 (Dst)[yyi] = (Src)[yyi]; \
589 } \
590 while (0)
591 # endif
592 # endif
593 #endif /* !YYCOPY_NEEDED */
594
595 /* YYFINAL -- State number of the termination state. */
596 #define YYFINAL 3
597 /* YYLAST -- Last index in YYTABLE. */
598 #define YYLAST 34
599
600 /* YYNTOKENS -- Number of terminals. */
601 #define YYNTOKENS 24
602 /* YYNNTS -- Number of nonterminals. */
603 #define YYNNTS 22
604 /* YYNRULES -- Number of rules. */
605 #define YYNRULES 42
606 /* YYNSTATES -- Number of states. */
607 #define YYNSTATES 53
608
609 /* YYMAXUTOK -- Last valid token kind. */
610 #define YYMAXUTOK 275
611
612
613 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
614 as returned by yylex, with out-of-bounds checking. */
615 #define YYTRANSLATE(YYX) \
616 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
617 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
618 : YYSYMBOL_YYUNDEF)
619
620 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
621 as returned by yylex. */
622 static const yytype_int8 yytranslate[] =
623 {
624 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
628 21, 22, 2, 2, 23, 2, 2, 2, 2, 2,
629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
630 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
635 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
649 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
650 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
651 15, 16, 17, 18, 19, 20
652 };
653
654 #if YYDEBUG
655 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
656 static const yytype_uint8 yyrline[] =
657 {
658 0, 68, 68, 68, 72, 73, 77, 81, 82, 83,
659 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
660 94, 95, 96, 101, 106, 111, 116, 120, 125, 130,
661 137, 142, 148, 152, 159, 161, 165, 168, 172, 178,
662 183, 184, 189
663 };
664 #endif
665
666 /** Accessing symbol of state STATE. */
667 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
668
669 #if YYDEBUG || 0
670 /* The user-facing name of the symbol whose (internal) number is
671 YYSYMBOL. No bounds checking. */
672 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
673
674 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
675 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
676 static const char *const yytname[] =
677 {
678 "\"end of file\"", "error", "\"invalid token\"", "NEWLINE", "VERBOSE",
679 "FILENAME", "ADDLIB", "LIST", "ADDMOD", "CLEAR", "CREATE", "DELETE",
680 "DIRECTORY", "END", "EXTRACT", "FULLDIR", "HELP", "QUIT", "REPLACE",
681 "SAVE", "OPEN", "'('", "')'", "','", "$accept", "start", "$@1",
682 "session", "command_line", "command", "extract_command",
683 "replace_command", "clear_command", "delete_command", "addmod_command",
684 "list_command", "save_command", "open_command", "create_command",
685 "addlib_command", "directory_command", "optional_filename", "modulelist",
686 "modulename", "optcomma", "verbose_command", YY_NULLPTR
687 };
688
689 static const char *
yysymbol_name(yysymbol_kind_t yysymbol)690 yysymbol_name (yysymbol_kind_t yysymbol)
691 {
692 return yytname[yysymbol];
693 }
694 #endif
695
696 #define YYPACT_NINF (-14)
697
698 #define yypact_value_is_default(Yyn) \
699 ((Yyn) == YYPACT_NINF)
700
701 #define YYTABLE_NINF (-42)
702
703 #define yytable_value_is_error(Yyn) \
704 0
705
706 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
707 STATE-NUM. */
708 static const yytype_int8 yypact[] =
709 {
710 -14, 1, -14, -14, 5, -14, -14, -14, 2, -14,
711 -14, -14, 21, -14, 22, -14, -14, -14, -14, 23,
712 -14, 26, -14, -14, -14, -14, -14, -14, -14, -14,
713 -14, -14, -14, -14, 10, -3, -14, -3, 10, -3,
714 -3, -14, -14, -14, -14, -14, 27, 28, -1, -14,
715 -14, -14, -14
716 };
717
718 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
719 Performed when YYTABLE does not specify something else to do. Zero
720 means the default is an error. */
721 static const yytype_int8 yydefact[] =
722 {
723 2, 0, 5, 1, 0, 20, 42, 21, 0, 28,
724 39, 25, 0, 39, 0, 19, 39, 39, 29, 0,
725 4, 0, 15, 16, 12, 17, 13, 18, 14, 7,
726 8, 11, 10, 9, 37, 27, 31, 26, 37, 23,
727 24, 30, 6, 39, 32, 40, 0, 35, 41, 38,
728 34, 33, 36
729 };
730
731 /* YYPGOTO[NTERM-NUM]. */
732 static const yytype_int8 yypgoto[] =
733 {
734 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
735 -14, -14, -14, -14, -14, -14, -14, -14, -4, -13,
736 -14, -14
737 };
738
739 /* YYDEFGOTO[NTERM-NUM]. */
740 static const yytype_int8 yydefgoto[] =
741 {
742 0, 1, 2, 4, 20, 21, 22, 23, 24, 25,
743 26, 27, 28, 29, 30, 31, 32, 51, 44, 35,
744 46, 33
745 };
746
747 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
748 positive, shift that token. If negative, reduce the rule whose
749 number is the opposite. If YYTABLE_NINF, syntax error. */
750 static const yytype_int8 yytable[] =
751 {
752 37, 3, -41, 39, 40, -3, 5, 34, -22, 6,
753 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
754 45, 52, 45, 17, 18, 19, 36, 38, 41, 42,
755 48, 43, 49, 50, 47
756 };
757
758 static const yytype_int8 yycheck[] =
759 {
760 13, 0, 5, 16, 17, 0, 1, 5, 3, 4,
761 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
762 23, 22, 23, 18, 19, 20, 5, 5, 5, 3,
763 43, 21, 5, 5, 38
764 };
765
766 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
767 state STATE-NUM. */
768 static const yytype_int8 yystos[] =
769 {
770 0, 25, 26, 0, 27, 1, 4, 5, 6, 7,
771 8, 9, 10, 11, 12, 13, 14, 18, 19, 20,
772 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
773 38, 39, 40, 45, 5, 43, 5, 43, 5, 43,
774 43, 5, 3, 21, 42, 23, 44, 42, 43, 5,
775 5, 41, 22
776 };
777
778 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
779 static const yytype_int8 yyr1[] =
780 {
781 0, 24, 26, 25, 27, 27, 28, 29, 29, 29,
782 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
783 29, 29, 29, 30, 31, 32, 33, 34, 35, 36,
784 37, 38, 39, 40, 41, 41, 42, 42, 43, 43,
785 44, 44, 45
786 };
787
788 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
789 static const yytype_int8 yyr2[] =
790 {
791 0, 2, 0, 2, 2, 0, 2, 1, 1, 1,
792 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
793 1, 1, 0, 2, 2, 1, 2, 2, 1, 1,
794 2, 2, 3, 4, 1, 0, 3, 0, 3, 0,
795 1, 0, 1
796 };
797
798
799 enum { YYENOMEM = -2 };
800
801 #define yyerrok (yyerrstatus = 0)
802 #define yyclearin (yychar = YYEMPTY)
803
804 #define YYACCEPT goto yyacceptlab
805 #define YYABORT goto yyabortlab
806 #define YYERROR goto yyerrorlab
807 #define YYNOMEM goto yyexhaustedlab
808
809
810 #define YYRECOVERING() (!!yyerrstatus)
811
812 #define YYBACKUP(Token, Value) \
813 do \
814 if (yychar == YYEMPTY) \
815 { \
816 yychar = (Token); \
817 yylval = (Value); \
818 YYPOPSTACK (yylen); \
819 yystate = *yyssp; \
820 goto yybackup; \
821 } \
822 else \
823 { \
824 yyerror (YY_("syntax error: cannot back up")); \
825 YYERROR; \
826 } \
827 while (0)
828
829 /* Backward compatibility with an undocumented macro.
830 Use YYerror or YYUNDEF. */
831 #define YYERRCODE YYUNDEF
832
833
834 /* Enable debugging if requested. */
835 #if YYDEBUG
836
837 # ifndef YYFPRINTF
838 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
839 # define YYFPRINTF fprintf
840 # endif
841
842 # define YYDPRINTF(Args) \
843 do { \
844 if (yydebug) \
845 YYFPRINTF Args; \
846 } while (0)
847
848
849
850
851 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
852 do { \
853 if (yydebug) \
854 { \
855 YYFPRINTF (stderr, "%s ", Title); \
856 yy_symbol_print (stderr, \
857 Kind, Value); \
858 YYFPRINTF (stderr, "\n"); \
859 } \
860 } while (0)
861
862
863 /*-----------------------------------.
864 | Print this symbol's value on YYO. |
865 `-----------------------------------*/
866
867 static void
yy_symbol_value_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep)868 yy_symbol_value_print (FILE *yyo,
869 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
870 {
871 FILE *yyoutput = yyo;
872 YY_USE (yyoutput);
873 if (!yyvaluep)
874 return;
875 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
876 YY_USE (yykind);
877 YY_IGNORE_MAYBE_UNINITIALIZED_END
878 }
879
880
881 /*---------------------------.
882 | Print this symbol on YYO. |
883 `---------------------------*/
884
885 static void
yy_symbol_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep)886 yy_symbol_print (FILE *yyo,
887 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
888 {
889 YYFPRINTF (yyo, "%s %s (",
890 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
891
892 yy_symbol_value_print (yyo, yykind, yyvaluep);
893 YYFPRINTF (yyo, ")");
894 }
895
896 /*------------------------------------------------------------------.
897 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
898 | TOP (included). |
899 `------------------------------------------------------------------*/
900
901 static void
yy_stack_print(yy_state_t * yybottom,yy_state_t * yytop)902 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
903 {
904 YYFPRINTF (stderr, "Stack now");
905 for (; yybottom <= yytop; yybottom++)
906 {
907 int yybot = *yybottom;
908 YYFPRINTF (stderr, " %d", yybot);
909 }
910 YYFPRINTF (stderr, "\n");
911 }
912
913 # define YY_STACK_PRINT(Bottom, Top) \
914 do { \
915 if (yydebug) \
916 yy_stack_print ((Bottom), (Top)); \
917 } while (0)
918
919
920 /*------------------------------------------------.
921 | Report that the YYRULE is going to be reduced. |
922 `------------------------------------------------*/
923
924 static void
yy_reduce_print(yy_state_t * yyssp,YYSTYPE * yyvsp,int yyrule)925 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
926 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 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
939 &yyvsp[(yyi + 1) - (yynrhs)]);
940 YYFPRINTF (stderr, "\n");
941 }
942 }
943
944 # define YY_REDUCE_PRINT(Rule) \
945 do { \
946 if (yydebug) \
947 yy_reduce_print (yyssp, yyvsp, Rule); \
948 } while (0)
949
950 /* Nonzero means print parse trace. It is left uninitialized so that
951 multiple parsers can coexist. */
952 int yydebug;
953 #else /* !YYDEBUG */
954 # define YYDPRINTF(Args) ((void) 0)
955 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
956 # define YY_STACK_PRINT(Bottom, Top)
957 # define YY_REDUCE_PRINT(Rule)
958 #endif /* !YYDEBUG */
959
960
961 /* YYINITDEPTH -- initial size of the parser's stacks. */
962 #ifndef YYINITDEPTH
963 # define YYINITDEPTH 200
964 #endif
965
966 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
967 if the built-in stack extension method is used).
968
969 Do not make this value too large; the results are undefined if
970 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
971 evaluated with infinite-precision integer arithmetic. */
972
973 #ifndef YYMAXDEPTH
974 # define YYMAXDEPTH 10000
975 #endif
976
977
978
979
980
981
982 /*-----------------------------------------------.
983 | Release the memory associated to this symbol. |
984 `-----------------------------------------------*/
985
986 static void
yydestruct(const char * yymsg,yysymbol_kind_t yykind,YYSTYPE * yyvaluep)987 yydestruct (const char *yymsg,
988 yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
989 {
990 YY_USE (yyvaluep);
991 if (!yymsg)
992 yymsg = "Deleting";
993 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
994
995 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
996 YY_USE (yykind);
997 YY_IGNORE_MAYBE_UNINITIALIZED_END
998 }
999
1000
1001 /* Lookahead token kind. */
1002 int yychar;
1003
1004 /* The semantic value of the lookahead symbol. */
1005 YYSTYPE yylval;
1006 /* Number of syntax errors so far. */
1007 int yynerrs;
1008
1009
1010
1011
1012 /*----------.
1013 | yyparse. |
1014 `----------*/
1015
1016 int
yyparse(void)1017 yyparse (void)
1018 {
1019 yy_state_fast_t yystate = 0;
1020 /* Number of tokens to shift before error messages enabled. */
1021 int yyerrstatus = 0;
1022
1023 /* Refer to the stacks through separate pointers, to allow yyoverflow
1024 to reallocate them elsewhere. */
1025
1026 /* Their size. */
1027 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1028
1029 /* The state stack: array, bottom, top. */
1030 yy_state_t yyssa[YYINITDEPTH];
1031 yy_state_t *yyss = yyssa;
1032 yy_state_t *yyssp = yyss;
1033
1034 /* The semantic value stack: array, bottom, top. */
1035 YYSTYPE yyvsa[YYINITDEPTH];
1036 YYSTYPE *yyvs = yyvsa;
1037 YYSTYPE *yyvsp = yyvs;
1038
1039 int yyn;
1040 /* The return value of yyparse. */
1041 int yyresult;
1042 /* Lookahead symbol kind. */
1043 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1044 /* The variables used to return semantic value and location from the
1045 action routines. */
1046 YYSTYPE yyval;
1047
1048
1049
1050 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1051
1052 /* The number of symbols on the RHS of the reduced rule.
1053 Keep to zero when no symbol should be popped. */
1054 int yylen = 0;
1055
1056 YYDPRINTF ((stderr, "Starting parse\n"));
1057
1058 yychar = YYEMPTY; /* Cause a token to be read. */
1059
1060 goto yysetstate;
1061
1062
1063 /*------------------------------------------------------------.
1064 | yynewstate -- push a new state, which is found in yystate. |
1065 `------------------------------------------------------------*/
1066 yynewstate:
1067 /* In all cases, when you get here, the value and location stacks
1068 have just been pushed. So pushing a state here evens the stacks. */
1069 yyssp++;
1070
1071
1072 /*--------------------------------------------------------------------.
1073 | yysetstate -- set current state (the top of the stack) to yystate. |
1074 `--------------------------------------------------------------------*/
1075 yysetstate:
1076 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1077 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1078 YY_IGNORE_USELESS_CAST_BEGIN
1079 *yyssp = YY_CAST (yy_state_t, yystate);
1080 YY_IGNORE_USELESS_CAST_END
1081 YY_STACK_PRINT (yyss, yyssp);
1082
1083 if (yyss + yystacksize - 1 <= yyssp)
1084 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1085 YYNOMEM;
1086 #else
1087 {
1088 /* Get the current used size of the three stacks, in elements. */
1089 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1090
1091 # if defined yyoverflow
1092 {
1093 /* Give user a chance to reallocate the stack. Use copies of
1094 these so that the &'s don't force the real ones into
1095 memory. */
1096 yy_state_t *yyss1 = yyss;
1097 YYSTYPE *yyvs1 = yyvs;
1098
1099 /* Each stack pointer address is followed by the size of the
1100 data in use in that stack, in bytes. This used to be a
1101 conditional around just the two extra args, but that might
1102 be undefined if yyoverflow is a macro. */
1103 yyoverflow (YY_("memory exhausted"),
1104 &yyss1, yysize * YYSIZEOF (*yyssp),
1105 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1106 &yystacksize);
1107 yyss = yyss1;
1108 yyvs = yyvs1;
1109 }
1110 # else /* defined YYSTACK_RELOCATE */
1111 /* Extend the stack our own way. */
1112 if (YYMAXDEPTH <= yystacksize)
1113 YYNOMEM;
1114 yystacksize *= 2;
1115 if (YYMAXDEPTH < yystacksize)
1116 yystacksize = YYMAXDEPTH;
1117
1118 {
1119 yy_state_t *yyss1 = yyss;
1120 union yyalloc *yyptr =
1121 YY_CAST (union yyalloc *,
1122 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1123 if (! yyptr)
1124 YYNOMEM;
1125 YYSTACK_RELOCATE (yyss_alloc, yyss);
1126 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1127 # undef YYSTACK_RELOCATE
1128 if (yyss1 != yyssa)
1129 YYSTACK_FREE (yyss1);
1130 }
1131 # endif
1132
1133 yyssp = yyss + yysize - 1;
1134 yyvsp = yyvs + yysize - 1;
1135
1136 YY_IGNORE_USELESS_CAST_BEGIN
1137 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1138 YY_CAST (long, yystacksize)));
1139 YY_IGNORE_USELESS_CAST_END
1140
1141 if (yyss + yystacksize - 1 <= yyssp)
1142 YYABORT;
1143 }
1144 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1145
1146
1147 if (yystate == YYFINAL)
1148 YYACCEPT;
1149
1150 goto yybackup;
1151
1152
1153 /*-----------.
1154 | yybackup. |
1155 `-----------*/
1156 yybackup:
1157 /* Do appropriate processing given the current state. Read a
1158 lookahead token if we need one and don't already have one. */
1159
1160 /* First try to decide what to do without reference to lookahead token. */
1161 yyn = yypact[yystate];
1162 if (yypact_value_is_default (yyn))
1163 goto yydefault;
1164
1165 /* Not known => get a lookahead token if don't already have one. */
1166
1167 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1168 if (yychar == YYEMPTY)
1169 {
1170 YYDPRINTF ((stderr, "Reading a token\n"));
1171 yychar = yylex ();
1172 }
1173
1174 if (yychar <= YYEOF)
1175 {
1176 yychar = YYEOF;
1177 yytoken = YYSYMBOL_YYEOF;
1178 YYDPRINTF ((stderr, "Now at end of input.\n"));
1179 }
1180 else if (yychar == YYerror)
1181 {
1182 /* The scanner already issued an error message, process directly
1183 to error recovery. But do not keep the error token as
1184 lookahead, it is too special and may lead us to an endless
1185 loop in error recovery. */
1186 yychar = YYUNDEF;
1187 yytoken = YYSYMBOL_YYerror;
1188 goto yyerrlab1;
1189 }
1190 else
1191 {
1192 yytoken = YYTRANSLATE (yychar);
1193 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1194 }
1195
1196 /* If the proper action on seeing token YYTOKEN is to reduce or to
1197 detect an error, take that action. */
1198 yyn += yytoken;
1199 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1200 goto yydefault;
1201 yyn = yytable[yyn];
1202 if (yyn <= 0)
1203 {
1204 if (yytable_value_is_error (yyn))
1205 goto yyerrlab;
1206 yyn = -yyn;
1207 goto yyreduce;
1208 }
1209
1210 /* Count tokens shifted since error; after three, turn off error
1211 status. */
1212 if (yyerrstatus)
1213 yyerrstatus--;
1214
1215 /* Shift the lookahead token. */
1216 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1217 yystate = yyn;
1218 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1219 *++yyvsp = yylval;
1220 YY_IGNORE_MAYBE_UNINITIALIZED_END
1221
1222 /* Discard the shifted token. */
1223 yychar = YYEMPTY;
1224 goto yynewstate;
1225
1226
1227 /*-----------------------------------------------------------.
1228 | yydefault -- do the default action for the current state. |
1229 `-----------------------------------------------------------*/
1230 yydefault:
1231 yyn = yydefact[yystate];
1232 if (yyn == 0)
1233 goto yyerrlab;
1234 goto yyreduce;
1235
1236
1237 /*-----------------------------.
1238 | yyreduce -- do a reduction. |
1239 `-----------------------------*/
1240 yyreduce:
1241 /* yyn is the number of a rule to reduce with. */
1242 yylen = yyr2[yyn];
1243
1244 /* If YYLEN is nonzero, implement the default value of the action:
1245 '$$ = $1'.
1246
1247 Otherwise, the following line sets YYVAL to garbage.
1248 This behavior is undocumented and Bison
1249 users should not rely upon it. Assigning to YYVAL
1250 unconditionally makes the parser a bit smaller, and it avoids a
1251 GCC warning that YYVAL may be used uninitialized. */
1252 yyval = yyvsp[1-yylen];
1253
1254
1255 YY_REDUCE_PRINT (yyn);
1256 switch (yyn)
1257 {
1258 case 2: /* $@1: %empty */
1259 #line 68 "arparse.y"
1260 { prompt(); }
1261 #line 1262 "arparse.c"
1262 break;
1263
1264 case 6: /* command_line: command NEWLINE */
1265 #line 77 "arparse.y"
1266 { prompt(); }
1267 #line 1268 "arparse.c"
1268 break;
1269
1270 case 19: /* command: END */
1271 #line 93 "arparse.y"
1272 { ar_end(); return 0; }
1273 #line 1274 "arparse.c"
1274 break;
1275
1276 case 21: /* command: FILENAME */
1277 #line 95 "arparse.y"
1278 { yyerror("foo"); }
1279 #line 1280 "arparse.c"
1280 break;
1281
1282 case 23: /* extract_command: EXTRACT modulename */
1283 #line 102 "arparse.y"
1284 { ar_extract((yyvsp[0].list)); }
1285 #line 1286 "arparse.c"
1286 break;
1287
1288 case 24: /* replace_command: REPLACE modulename */
1289 #line 107 "arparse.y"
1290 { ar_replace((yyvsp[0].list)); }
1291 #line 1292 "arparse.c"
1292 break;
1293
1294 case 25: /* clear_command: CLEAR */
1295 #line 112 "arparse.y"
1296 { ar_clear(); }
1297 #line 1298 "arparse.c"
1298 break;
1299
1300 case 26: /* delete_command: DELETE modulename */
1301 #line 117 "arparse.y"
1302 { ar_delete((yyvsp[0].list)); }
1303 #line 1304 "arparse.c"
1304 break;
1305
1306 case 27: /* addmod_command: ADDMOD modulename */
1307 #line 121 "arparse.y"
1308 { ar_addmod((yyvsp[0].list)); }
1309 #line 1310 "arparse.c"
1310 break;
1311
1312 case 28: /* list_command: LIST */
1313 #line 126 "arparse.y"
1314 { ar_list(); }
1315 #line 1316 "arparse.c"
1316 break;
1317
1318 case 29: /* save_command: SAVE */
1319 #line 131 "arparse.y"
1320 { ar_save(); }
1321 #line 1322 "arparse.c"
1322 break;
1323
1324 case 30: /* open_command: OPEN FILENAME */
1325 #line 138 "arparse.y"
1326 { ar_open((yyvsp[0].name),0); }
1327 #line 1328 "arparse.c"
1328 break;
1329
1330 case 31: /* create_command: CREATE FILENAME */
1331 #line 143 "arparse.y"
1332 { ar_open((yyvsp[0].name),1); }
1333 #line 1334 "arparse.c"
1334 break;
1335
1336 case 32: /* addlib_command: ADDLIB FILENAME modulelist */
1337 #line 149 "arparse.y"
1338 { ar_addlib((yyvsp[-1].name),(yyvsp[0].list)); }
1339 #line 1340 "arparse.c"
1340 break;
1341
1342 case 33: /* directory_command: DIRECTORY FILENAME modulelist optional_filename */
1343 #line 153 "arparse.y"
1344 { ar_directory((yyvsp[-2].name), (yyvsp[-1].list), (yyvsp[0].name)); }
1345 #line 1346 "arparse.c"
1346 break;
1347
1348 case 34: /* optional_filename: FILENAME */
1349 #line 160 "arparse.y"
1350 { (yyval.name) = (yyvsp[0].name); }
1351 #line 1352 "arparse.c"
1352 break;
1353
1354 case 35: /* optional_filename: %empty */
1355 #line 161 "arparse.y"
1356 { (yyval.name) = 0; }
1357 #line 1358 "arparse.c"
1358 break;
1359
1360 case 36: /* modulelist: '(' modulename ')' */
1361 #line 166 "arparse.y"
1362 { (yyval.list) = (yyvsp[-1].list); }
1363 #line 1364 "arparse.c"
1364 break;
1365
1366 case 37: /* modulelist: %empty */
1367 #line 168 "arparse.y"
1368 { (yyval.list) = 0; }
1369 #line 1370 "arparse.c"
1370 break;
1371
1372 case 38: /* modulename: modulename optcomma FILENAME */
1373 #line 173 "arparse.y"
1374 { struct list *n = (struct list *) malloc(sizeof(struct list));
1375 n->next = (yyvsp[-2].list);
1376 n->name = (yyvsp[0].name);
1377 (yyval.list) = n;
1378 }
1379 #line 1380 "arparse.c"
1380 break;
1381
1382 case 39: /* modulename: %empty */
1383 #line 178 "arparse.y"
1384 { (yyval.list) = 0; }
1385 #line 1386 "arparse.c"
1386 break;
1387
1388 case 42: /* verbose_command: VERBOSE */
1389 #line 190 "arparse.y"
1390 { verbose = !verbose; }
1391 #line 1392 "arparse.c"
1392 break;
1393
1394
1395 #line 1396 "arparse.c"
1396
1397 default: break;
1398 }
1399 /* User semantic actions sometimes alter yychar, and that requires
1400 that yytoken be updated with the new translation. We take the
1401 approach of translating immediately before every use of yytoken.
1402 One alternative is translating here after every semantic action,
1403 but that translation would be missed if the semantic action invokes
1404 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1405 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1406 incorrect destructor might then be invoked immediately. In the
1407 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1408 to an incorrect destructor call or verbose syntax error message
1409 before the lookahead is translated. */
1410 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1411
1412 YYPOPSTACK (yylen);
1413 yylen = 0;
1414
1415 *++yyvsp = yyval;
1416
1417 /* Now 'shift' the result of the reduction. Determine what state
1418 that goes to, based on the state we popped back to and the rule
1419 number reduced by. */
1420 {
1421 const int yylhs = yyr1[yyn] - YYNTOKENS;
1422 const int yyi = yypgoto[yylhs] + *yyssp;
1423 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1424 ? yytable[yyi]
1425 : yydefgoto[yylhs]);
1426 }
1427
1428 goto yynewstate;
1429
1430
1431 /*--------------------------------------.
1432 | yyerrlab -- here on detecting error. |
1433 `--------------------------------------*/
1434 yyerrlab:
1435 /* Make sure we have latest lookahead translation. See comments at
1436 user semantic actions for why this is necessary. */
1437 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1438 /* If not already recovering from an error, report this error. */
1439 if (!yyerrstatus)
1440 {
1441 ++yynerrs;
1442 yyerror (YY_("syntax error"));
1443 }
1444
1445 if (yyerrstatus == 3)
1446 {
1447 /* If just tried and failed to reuse lookahead token after an
1448 error, discard it. */
1449
1450 if (yychar <= YYEOF)
1451 {
1452 /* Return failure if at end of input. */
1453 if (yychar == YYEOF)
1454 YYABORT;
1455 }
1456 else
1457 {
1458 yydestruct ("Error: discarding",
1459 yytoken, &yylval);
1460 yychar = YYEMPTY;
1461 }
1462 }
1463
1464 /* Else will try to reuse lookahead token after shifting the error
1465 token. */
1466 goto yyerrlab1;
1467
1468
1469 /*---------------------------------------------------.
1470 | yyerrorlab -- error raised explicitly by YYERROR. |
1471 `---------------------------------------------------*/
1472 yyerrorlab:
1473 /* Pacify compilers when the user code never invokes YYERROR and the
1474 label yyerrorlab therefore never appears in user code. */
1475 if (0)
1476 YYERROR;
1477 ++yynerrs;
1478
1479 /* Do not reclaim the symbols of the rule whose action triggered
1480 this YYERROR. */
1481 YYPOPSTACK (yylen);
1482 yylen = 0;
1483 YY_STACK_PRINT (yyss, yyssp);
1484 yystate = *yyssp;
1485 goto yyerrlab1;
1486
1487
1488 /*-------------------------------------------------------------.
1489 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1490 `-------------------------------------------------------------*/
1491 yyerrlab1:
1492 yyerrstatus = 3; /* Each real token shifted decrements this. */
1493
1494 /* Pop stack until we find a state that shifts the error token. */
1495 for (;;)
1496 {
1497 yyn = yypact[yystate];
1498 if (!yypact_value_is_default (yyn))
1499 {
1500 yyn += YYSYMBOL_YYerror;
1501 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1502 {
1503 yyn = yytable[yyn];
1504 if (0 < yyn)
1505 break;
1506 }
1507 }
1508
1509 /* Pop the current state because it cannot handle the error token. */
1510 if (yyssp == yyss)
1511 YYABORT;
1512
1513
1514 yydestruct ("Error: popping",
1515 YY_ACCESSING_SYMBOL (yystate), yyvsp);
1516 YYPOPSTACK (1);
1517 yystate = *yyssp;
1518 YY_STACK_PRINT (yyss, yyssp);
1519 }
1520
1521 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1522 *++yyvsp = yylval;
1523 YY_IGNORE_MAYBE_UNINITIALIZED_END
1524
1525
1526 /* Shift the error token. */
1527 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1528
1529 yystate = yyn;
1530 goto yynewstate;
1531
1532
1533 /*-------------------------------------.
1534 | yyacceptlab -- YYACCEPT comes here. |
1535 `-------------------------------------*/
1536 yyacceptlab:
1537 yyresult = 0;
1538 goto yyreturnlab;
1539
1540
1541 /*-----------------------------------.
1542 | yyabortlab -- YYABORT comes here. |
1543 `-----------------------------------*/
1544 yyabortlab:
1545 yyresult = 1;
1546 goto yyreturnlab;
1547
1548
1549 /*-----------------------------------------------------------.
1550 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1551 `-----------------------------------------------------------*/
1552 yyexhaustedlab:
1553 yyerror (YY_("memory exhausted"));
1554 yyresult = 2;
1555 goto yyreturnlab;
1556
1557
1558 /*----------------------------------------------------------.
1559 | yyreturnlab -- parsing is finished, clean up and return. |
1560 `----------------------------------------------------------*/
1561 yyreturnlab:
1562 if (yychar != YYEMPTY)
1563 {
1564 /* Make sure we have latest lookahead translation. See comments at
1565 user semantic actions for why this is necessary. */
1566 yytoken = YYTRANSLATE (yychar);
1567 yydestruct ("Cleanup: discarding lookahead",
1568 yytoken, &yylval);
1569 }
1570 /* Do not reclaim the symbols of the rule whose action triggered
1571 this YYABORT or YYACCEPT. */
1572 YYPOPSTACK (yylen);
1573 YY_STACK_PRINT (yyss, yyssp);
1574 while (yyssp != yyss)
1575 {
1576 yydestruct ("Cleanup: popping",
1577 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
1578 YYPOPSTACK (1);
1579 }
1580 #ifndef yyoverflow
1581 if (yyss != yyssa)
1582 YYSTACK_FREE (yyss);
1583 #endif
1584
1585 return yyresult;
1586 }
1587
1588 #line 194 "arparse.y"
1589
1590
1591 static void
yyerror(const char * x ATTRIBUTE_UNUSED)1592 yyerror (const char *x ATTRIBUTE_UNUSED)
1593 {
1594 extern int linenumber;
1595
1596 printf (_("Syntax error in archive script, line %d\n"), linenumber + 1);
1597 }
1598