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