1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
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 2, or (at your option)
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.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
112 /* Copy the first part of user declarations. */
115 /* arparse.y - Stange script language parser */
117 /* Copyright (C) 1992-2014 Free Software Foundation, Inc.
119 This file is part of GNU Binutils.
121 This program is free software; you can redistribute it and/or modify
122 it under the terms of the GNU General Public License as published by
123 the Free Software Foundation; either version 3 of the License, or
124 (at your option) any later version.
126 This program is distributed in the hope that it will be useful,
127 but WITHOUT ANY WARRANTY; without even the implied warranty of
128 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
129 GNU General Public License for more details.
131 You should have received a copy of the GNU General Public License
132 along with this program; if not, write to the Free Software
133 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
134 MA 02110-1301, USA. */
137 /* Contributed by Steve Chamberlain
141 #define DONTDECLARE_MALLOC
146 extern int yylex (void);
147 static int yyerror (const char *);
150 /* Enabling traces. */
155 /* Enabling verbose error messages. */
156 #ifdef YYERROR_VERBOSE
157 # undef YYERROR_VERBOSE
158 # define YYERROR_VERBOSE 1
160 # define YYERROR_VERBOSE 0
163 /* Enabling the token table. */
164 #ifndef YYTOKEN_TABLE
165 # define YYTOKEN_TABLE 0
168 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
169 typedef union YYSTYPE
176 /* Line 193 of yacc.c. */
177 #line 178 "arparse.c"
179 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
180 # define YYSTYPE_IS_DECLARED 1
181 # define YYSTYPE_IS_TRIVIAL 1
186 /* Copy the second part of user declarations. */
189 /* Line 216 of yacc.c. */
190 #line 191 "arparse.c"
197 typedef YYTYPE_UINT8 yytype_uint8;
199 typedef unsigned char yytype_uint8;
203 typedef YYTYPE_INT8 yytype_int8;
204 #elif (defined __STDC__ || defined __C99__FUNC__ \
205 || defined __cplusplus || defined _MSC_VER)
206 typedef signed char yytype_int8;
208 typedef short int yytype_int8;
212 typedef YYTYPE_UINT16 yytype_uint16;
214 typedef unsigned short int yytype_uint16;
218 typedef YYTYPE_INT16 yytype_int16;
220 typedef short int yytype_int16;
224 # ifdef __SIZE_TYPE__
225 # define YYSIZE_T __SIZE_TYPE__
226 # elif defined size_t
227 # define YYSIZE_T size_t
228 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
229 || defined __cplusplus || defined _MSC_VER)
230 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
231 # define YYSIZE_T size_t
233 # define YYSIZE_T unsigned int
237 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
240 # if defined YYENABLE_NLS && YYENABLE_NLS
242 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
243 # define YY_(msgid) dgettext ("bison-runtime", msgid)
247 # define YY_(msgid) msgid
251 /* Suppress unused-variable warnings by "using" E. */
252 #if ! defined lint || defined __GNUC__
253 # define YYUSE(e) ((void) (e))
255 # define YYUSE(e) /* empty */
258 /* Identity function, used to suppress warnings about constant conditions. */
262 #if (defined __STDC__ || defined __C99__FUNC__ \
263 || defined __cplusplus || defined _MSC_VER)
276 #if ! defined yyoverflow || YYERROR_VERBOSE
278 /* The parser invokes alloca or malloc; define the necessary symbols. */
280 # ifdef YYSTACK_USE_ALLOCA
281 # if YYSTACK_USE_ALLOCA
283 # define YYSTACK_ALLOC __builtin_alloca
284 # elif defined __BUILTIN_VA_ARG_INCR
285 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
287 # define YYSTACK_ALLOC __alloca
288 # elif defined _MSC_VER
289 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
290 # define alloca _alloca
292 # define YYSTACK_ALLOC alloca
293 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
294 || defined __cplusplus || defined _MSC_VER)
295 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
304 # ifdef YYSTACK_ALLOC
305 /* Pacify GCC's `empty if-body' warning. */
306 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
307 # ifndef YYSTACK_ALLOC_MAXIMUM
308 /* The OS might guarantee only one guard page at the bottom of the stack,
309 and a page size can be as small as 4096 bytes. So we cannot safely
310 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
311 to allow for a few compiler-allocated temporary stack slots. */
312 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
315 # define YYSTACK_ALLOC YYMALLOC
316 # define YYSTACK_FREE YYFREE
317 # ifndef YYSTACK_ALLOC_MAXIMUM
318 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
320 # if (defined __cplusplus && ! defined _STDLIB_H \
321 && ! ((defined YYMALLOC || defined malloc) \
322 && (defined YYFREE || defined free)))
323 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
329 # define YYMALLOC malloc
330 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
331 || defined __cplusplus || defined _MSC_VER)
332 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
337 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
338 || defined __cplusplus || defined _MSC_VER)
339 void free (void *); /* INFRINGES ON USER NAME SPACE */
343 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
346 #if (! defined yyoverflow \
347 && (! defined __cplusplus \
348 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
350 /* A type that is properly aligned for any stack member. */
357 /* The size of the maximum gap between one aligned stack and the next. */
358 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
360 /* The size of an array large to enough to hold all stacks, each with
362 # define YYSTACK_BYTES(N) \
363 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
364 + YYSTACK_GAP_MAXIMUM)
366 /* Copy COUNT objects from FROM to TO. The source and destination do
369 # if defined __GNUC__ && 1 < __GNUC__
370 # define YYCOPY(To, From, Count) \
371 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
373 # define YYCOPY(To, From, Count) \
377 for (yyi = 0; yyi < (Count); yyi++) \
378 (To)[yyi] = (From)[yyi]; \
384 /* Relocate STACK from its old location to the new one. The
385 local variables YYSIZE and YYSTACKSIZE give the old and new number of
386 elements in the stack, and YYPTR gives the new location of the
387 stack. Advance YYPTR to a properly aligned location for the next
389 # define YYSTACK_RELOCATE(Stack) \
392 YYSIZE_T yynewbytes; \
393 YYCOPY (&yyptr->Stack, Stack, yysize); \
394 Stack = &yyptr->Stack; \
395 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
396 yyptr += yynewbytes / sizeof (*yyptr); \
402 /* YYFINAL -- State number of the termination state. */
404 /* YYLAST -- Last index in YYTABLE. */
407 /* YYNTOKENS -- Number of terminals. */
409 /* YYNNTS -- Number of nonterminals. */
411 /* YYNRULES -- Number of rules. */
413 /* YYNRULES -- Number of states. */
416 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
418 #define YYMAXUTOK 275
420 #define YYTRANSLATE(YYX) \
421 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
423 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
424 static const yytype_uint8 yytranslate[] =
426 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 21, 22, 2, 2, 23, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
452 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
453 15, 16, 17, 18, 19, 20
457 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
459 static const yytype_uint8 yyprhs[] =
461 0, 0, 3, 4, 7, 10, 11, 14, 16, 18,
462 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
463 40, 42, 44, 45, 48, 51, 53, 56, 59, 61,
464 63, 66, 69, 73, 78, 80, 81, 85, 86, 90,
468 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
469 static const yytype_int8 yyrhs[] =
471 25, 0, -1, -1, 26, 27, -1, 27, 28, -1,
472 -1, 29, 3, -1, 37, -1, 38, -1, 45, -1,
473 40, -1, 39, -1, 32, -1, 34, -1, 36, -1,
474 30, -1, 31, -1, 33, -1, 35, -1, 13, -1,
475 1, -1, 5, -1, -1, 14, 43, -1, 18, 43,
476 -1, 9, -1, 11, 43, -1, 8, 43, -1, 7,
477 -1, 19, -1, 20, 5, -1, 10, 5, -1, 6,
478 5, 42, -1, 12, 5, 42, 41, -1, 5, -1,
479 -1, 21, 43, 22, -1, -1, 43, 44, 5, -1,
480 -1, 23, -1, -1, 4, -1
483 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
484 static const yytype_uint8 yyrline[] =
486 0, 68, 68, 68, 72, 73, 77, 81, 82, 83,
487 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
488 94, 95, 96, 101, 106, 111, 116, 120, 125, 130,
489 137, 142, 148, 152, 159, 161, 165, 168, 172, 178,
494 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
495 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
496 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
497 static const char *const yytname[] =
499 "$end", "error", "$undefined", "NEWLINE", "VERBOSE", "FILENAME",
500 "ADDLIB", "LIST", "ADDMOD", "CLEAR", "CREATE", "DELETE", "DIRECTORY",
501 "END", "EXTRACT", "FULLDIR", "HELP", "QUIT", "REPLACE", "SAVE", "OPEN",
502 "'('", "')'", "','", "$accept", "start", "@1", "session", "command_line",
503 "command", "extract_command", "replace_command", "clear_command",
504 "delete_command", "addmod_command", "list_command", "save_command",
505 "open_command", "create_command", "addlib_command", "directory_command",
506 "optional_filename", "modulelist", "modulename", "optcomma",
512 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
514 static const yytype_uint16 yytoknum[] =
516 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
517 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
522 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
523 static const yytype_uint8 yyr1[] =
525 0, 24, 26, 25, 27, 27, 28, 29, 29, 29,
526 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
527 29, 29, 29, 30, 31, 32, 33, 34, 35, 36,
528 37, 38, 39, 40, 41, 41, 42, 42, 43, 43,
532 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
533 static const yytype_uint8 yyr2[] =
535 0, 2, 0, 2, 2, 0, 2, 1, 1, 1,
536 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
537 1, 1, 0, 2, 2, 1, 2, 2, 1, 1,
538 2, 2, 3, 4, 1, 0, 3, 0, 3, 0,
542 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
543 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
544 means the default is an error. */
545 static const yytype_uint8 yydefact[] =
547 2, 0, 5, 1, 0, 20, 42, 21, 0, 28,
548 39, 25, 0, 39, 0, 19, 39, 39, 29, 0,
549 4, 0, 15, 16, 12, 17, 13, 18, 14, 7,
550 8, 11, 10, 9, 37, 27, 31, 26, 37, 23,
551 24, 30, 6, 39, 32, 40, 0, 35, 41, 38,
555 /* YYDEFGOTO[NTERM-NUM]. */
556 static const yytype_int8 yydefgoto[] =
558 -1, 1, 2, 4, 20, 21, 22, 23, 24, 25,
559 26, 27, 28, 29, 30, 31, 32, 51, 44, 35,
563 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
565 #define YYPACT_NINF -14
566 static const yytype_int8 yypact[] =
568 -14, 1, -14, -14, 5, -14, -14, -14, 2, -14,
569 -14, -14, 21, -14, 22, -14, -14, -14, -14, 23,
570 -14, 26, -14, -14, -14, -14, -14, -14, -14, -14,
571 -14, -14, -14, -14, 10, -3, -14, -3, 10, -3,
572 -3, -14, -14, -14, -14, -14, 27, 28, -1, -14,
576 /* YYPGOTO[NTERM-NUM]. */
577 static const yytype_int8 yypgoto[] =
579 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
580 -14, -14, -14, -14, -14, -14, -14, -14, -4, -13,
584 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
585 positive, shift that token. If negative, reduce the rule which
586 number is the opposite. If zero, do what YYDEFACT says.
587 If YYTABLE_NINF, syntax error. */
588 #define YYTABLE_NINF -42
589 static const yytype_int8 yytable[] =
591 37, 3, -41, 39, 40, -3, 5, 34, -22, 6,
592 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
593 45, 52, 45, 17, 18, 19, 36, 38, 41, 42,
597 static const yytype_uint8 yycheck[] =
599 13, 0, 5, 16, 17, 0, 1, 5, 3, 4,
600 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
601 23, 22, 23, 18, 19, 20, 5, 5, 5, 3,
605 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
606 symbol of state STATE-NUM. */
607 static const yytype_uint8 yystos[] =
609 0, 25, 26, 0, 27, 1, 4, 5, 6, 7,
610 8, 9, 10, 11, 12, 13, 14, 18, 19, 20,
611 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
612 38, 39, 40, 45, 5, 43, 5, 43, 5, 43,
613 43, 5, 3, 21, 42, 23, 44, 42, 43, 5,
617 #define yyerrok (yyerrstatus = 0)
618 #define yyclearin (yychar = YYEMPTY)
622 #define YYACCEPT goto yyacceptlab
623 #define YYABORT goto yyabortlab
624 #define YYERROR goto yyerrorlab
627 /* Like YYERROR except do call yyerror. This remains here temporarily
628 to ease the transition to the new meaning of YYERROR, for GCC.
629 Once GCC version 2 has supplanted version 1, this can go. */
631 #define YYFAIL goto yyerrlab
633 #define YYRECOVERING() (!!yyerrstatus)
635 #define YYBACKUP(Token, Value) \
637 if (yychar == YYEMPTY && yylen == 1) \
641 yytoken = YYTRANSLATE (yychar); \
647 yyerror (YY_("syntax error: cannot back up")); \
654 #define YYERRCODE 256
657 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
658 If N is 0, then set CURRENT to the empty location which ends
659 the previous symbol: RHS[0] (always defined). */
661 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
662 #ifndef YYLLOC_DEFAULT
663 # define YYLLOC_DEFAULT(Current, Rhs, N) \
667 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
668 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
669 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
670 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
674 (Current).first_line = (Current).last_line = \
675 YYRHSLOC (Rhs, 0).last_line; \
676 (Current).first_column = (Current).last_column = \
677 YYRHSLOC (Rhs, 0).last_column; \
683 /* YY_LOCATION_PRINT -- Print the location on the stream.
684 This macro was not mandated originally: define only if we know
685 we won't break user code: when these are the locations we know. */
687 #ifndef YY_LOCATION_PRINT
688 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
689 # define YY_LOCATION_PRINT(File, Loc) \
690 fprintf (File, "%d.%d-%d.%d", \
691 (Loc).first_line, (Loc).first_column, \
692 (Loc).last_line, (Loc).last_column)
694 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
699 /* YYLEX -- calling `yylex' with the right arguments. */
702 # define YYLEX yylex (YYLEX_PARAM)
704 # define YYLEX yylex ()
707 /* Enable debugging if requested. */
711 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
712 # define YYFPRINTF fprintf
715 # define YYDPRINTF(Args) \
721 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
725 YYFPRINTF (stderr, "%s ", Title); \
726 yy_symbol_print (stderr, \
728 YYFPRINTF (stderr, "\n"); \
733 /*--------------------------------.
734 | Print this symbol on YYOUTPUT. |
735 `--------------------------------*/
738 #if (defined __STDC__ || defined __C99__FUNC__ \
739 || defined __cplusplus || defined _MSC_VER)
741 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
744 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
747 YYSTYPE const * const yyvaluep;
753 if (yytype < YYNTOKENS)
754 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
766 /*--------------------------------.
767 | Print this symbol on YYOUTPUT. |
768 `--------------------------------*/
770 #if (defined __STDC__ || defined __C99__FUNC__ \
771 || defined __cplusplus || defined _MSC_VER)
773 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
776 yy_symbol_print (yyoutput, yytype, yyvaluep)
779 YYSTYPE const * const yyvaluep;
782 if (yytype < YYNTOKENS)
783 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
785 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
787 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
788 YYFPRINTF (yyoutput, ")");
791 /*------------------------------------------------------------------.
792 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
794 `------------------------------------------------------------------*/
796 #if (defined __STDC__ || defined __C99__FUNC__ \
797 || defined __cplusplus || defined _MSC_VER)
799 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
802 yy_stack_print (bottom, top)
803 yytype_int16 *bottom;
807 YYFPRINTF (stderr, "Stack now");
808 for (; bottom <= top; ++bottom)
809 YYFPRINTF (stderr, " %d", *bottom);
810 YYFPRINTF (stderr, "\n");
813 # define YY_STACK_PRINT(Bottom, Top) \
816 yy_stack_print ((Bottom), (Top)); \
820 /*------------------------------------------------.
821 | Report that the YYRULE is going to be reduced. |
822 `------------------------------------------------*/
824 #if (defined __STDC__ || defined __C99__FUNC__ \
825 || defined __cplusplus || defined _MSC_VER)
827 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
830 yy_reduce_print (yyvsp, yyrule)
835 int yynrhs = yyr2[yyrule];
837 unsigned long int yylno = yyrline[yyrule];
838 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
840 /* The symbols being reduced. */
841 for (yyi = 0; yyi < yynrhs; yyi++)
843 fprintf (stderr, " $%d = ", yyi + 1);
844 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
845 &(yyvsp[(yyi + 1) - (yynrhs)])
847 fprintf (stderr, "\n");
851 # define YY_REDUCE_PRINT(Rule) \
854 yy_reduce_print (yyvsp, Rule); \
857 /* Nonzero means print parse trace. It is left uninitialized so that
858 multiple parsers can coexist. */
861 # define YYDPRINTF(Args)
862 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
863 # define YY_STACK_PRINT(Bottom, Top)
864 # define YY_REDUCE_PRINT(Rule)
865 #endif /* !YYDEBUG */
868 /* YYINITDEPTH -- initial size of the parser's stacks. */
870 # define YYINITDEPTH 200
873 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
874 if the built-in stack extension method is used).
876 Do not make this value too large; the results are undefined if
877 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
878 evaluated with infinite-precision integer arithmetic. */
881 # define YYMAXDEPTH 10000
889 # if defined __GLIBC__ && defined _STRING_H
890 # define yystrlen strlen
892 /* Return the length of YYSTR. */
893 #if (defined __STDC__ || defined __C99__FUNC__ \
894 || defined __cplusplus || defined _MSC_VER)
896 yystrlen (const char *yystr)
904 for (yylen = 0; yystr[yylen]; yylen++)
912 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
913 # define yystpcpy stpcpy
915 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
917 #if (defined __STDC__ || defined __C99__FUNC__ \
918 || defined __cplusplus || defined _MSC_VER)
920 yystpcpy (char *yydest, const char *yysrc)
923 yystpcpy (yydest, yysrc)
929 const char *yys = yysrc;
931 while ((*yyd++ = *yys++) != '\0')
940 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
941 quotes and backslashes, so that it's suitable for yyerror. The
942 heuristic is that double-quoting is unnecessary unless the string
943 contains an apostrophe, a comma, or backslash (other than
944 backslash-backslash). YYSTR is taken from yytname. If YYRES is
945 null, do not copy; instead, return the length of what the result
948 yytnamerr (char *yyres, const char *yystr)
953 char const *yyp = yystr;
960 goto do_not_strip_quotes;
964 goto do_not_strip_quotes;
977 do_not_strip_quotes: ;
981 return yystrlen (yystr);
983 return yystpcpy (yyres, yystr) - yyres;
987 /* Copy into YYRESULT an error message about the unexpected token
988 YYCHAR while in state YYSTATE. Return the number of bytes copied,
989 including the terminating null byte. If YYRESULT is null, do not
990 copy anything; just return the number of bytes that would be
991 copied. As a special case, return 0 if an ordinary "syntax error"
992 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
995 yysyntax_error (char *yyresult, int yystate, int yychar)
997 int yyn = yypact[yystate];
999 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1003 int yytype = YYTRANSLATE (yychar);
1004 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1005 YYSIZE_T yysize = yysize0;
1007 int yysize_overflow = 0;
1008 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1009 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1013 /* This is so xgettext sees the translatable formats that are
1014 constructed on the fly. */
1015 YY_("syntax error, unexpected %s");
1016 YY_("syntax error, unexpected %s, expecting %s");
1017 YY_("syntax error, unexpected %s, expecting %s or %s");
1018 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1019 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1023 static char const yyunexpected[] = "syntax error, unexpected %s";
1024 static char const yyexpecting[] = ", expecting %s";
1025 static char const yyor[] = " or %s";
1026 char yyformat[sizeof yyunexpected
1027 + sizeof yyexpecting - 1
1028 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1029 * (sizeof yyor - 1))];
1030 char const *yyprefix = yyexpecting;
1032 /* Start YYX at -YYN if negative to avoid negative indexes in
1034 int yyxbegin = yyn < 0 ? -yyn : 0;
1036 /* Stay within bounds of both yycheck and yytname. */
1037 int yychecklim = YYLAST - yyn + 1;
1038 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1041 yyarg[0] = yytname[yytype];
1042 yyfmt = yystpcpy (yyformat, yyunexpected);
1044 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1045 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1047 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1051 yyformat[sizeof yyunexpected - 1] = '\0';
1054 yyarg[yycount++] = yytname[yyx];
1055 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1056 yysize_overflow |= (yysize1 < yysize);
1058 yyfmt = yystpcpy (yyfmt, yyprefix);
1062 yyf = YY_(yyformat);
1063 yysize1 = yysize + yystrlen (yyf);
1064 yysize_overflow |= (yysize1 < yysize);
1067 if (yysize_overflow)
1068 return YYSIZE_MAXIMUM;
1072 /* Avoid sprintf, as that infringes on the user's name space.
1073 Don't have undefined behavior even if the translation
1074 produced a string with the wrong number of "%s"s. */
1075 char *yyp = yyresult;
1077 while ((*yyp = *yyf) != '\0')
1079 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1081 yyp += yytnamerr (yyp, yyarg[yyi++]);
1094 #endif /* YYERROR_VERBOSE */
1097 /*-----------------------------------------------.
1098 | Release the memory associated to this symbol. |
1099 `-----------------------------------------------*/
1102 #if (defined __STDC__ || defined __C99__FUNC__ \
1103 || defined __cplusplus || defined _MSC_VER)
1105 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1108 yydestruct (yymsg, yytype, yyvaluep)
1118 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1129 /* Prevent warnings from -Wmissing-prototypes. */
1131 #ifdef YYPARSE_PARAM
1132 #if defined __STDC__ || defined __cplusplus
1133 int yyparse (void *YYPARSE_PARAM);
1137 #else /* ! YYPARSE_PARAM */
1138 #if defined __STDC__ || defined __cplusplus
1143 #endif /* ! YYPARSE_PARAM */
1147 /* The look-ahead symbol. */
1150 /* The semantic value of the look-ahead symbol. */
1153 /* Number of syntax errors so far. */
1162 #ifdef YYPARSE_PARAM
1163 #if (defined __STDC__ || defined __C99__FUNC__ \
1164 || defined __cplusplus || defined _MSC_VER)
1166 yyparse (void *YYPARSE_PARAM)
1169 yyparse (YYPARSE_PARAM)
1170 void *YYPARSE_PARAM;
1172 #else /* ! YYPARSE_PARAM */
1173 #if (defined __STDC__ || defined __C99__FUNC__ \
1174 || defined __cplusplus || defined _MSC_VER)
1188 /* Number of tokens to shift before error messages enabled. */
1190 /* Look-ahead token as an internal (translated) token number. */
1193 /* Buffer for error messages, and its allocated size. */
1195 char *yymsg = yymsgbuf;
1196 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1199 /* Three stacks and their tools:
1200 `yyss': related to states,
1201 `yyvs': related to semantic values,
1202 `yyls': related to locations.
1204 Refer to the stacks thru separate pointers, to allow yyoverflow
1205 to reallocate them elsewhere. */
1207 /* The state stack. */
1208 yytype_int16 yyssa[YYINITDEPTH];
1209 yytype_int16 *yyss = yyssa;
1210 yytype_int16 *yyssp;
1212 /* The semantic value stack. */
1213 YYSTYPE yyvsa[YYINITDEPTH];
1214 YYSTYPE *yyvs = yyvsa;
1219 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1221 YYSIZE_T yystacksize = YYINITDEPTH;
1223 /* The variables used to return semantic value and location from the
1228 /* The number of symbols on the RHS of the reduced rule.
1229 Keep to zero when no symbol should be popped. */
1232 YYDPRINTF ((stderr, "Starting parse\n"));
1237 yychar = YYEMPTY; /* Cause a token to be read. */
1239 /* Initialize stack pointers.
1240 Waste one element of value and location stack
1241 so that they stay on the same level as the state stack.
1242 The wasted elements are never initialized. */
1249 /*------------------------------------------------------------.
1250 | yynewstate -- Push a new state, which is found in yystate. |
1251 `------------------------------------------------------------*/
1253 /* In all cases, when you get here, the value and location stacks
1254 have just been pushed. So pushing a state here evens the stacks. */
1260 if (yyss + yystacksize - 1 <= yyssp)
1262 /* Get the current used size of the three stacks, in elements. */
1263 YYSIZE_T yysize = yyssp - yyss + 1;
1267 /* Give user a chance to reallocate the stack. Use copies of
1268 these so that the &'s don't force the real ones into
1270 YYSTYPE *yyvs1 = yyvs;
1271 yytype_int16 *yyss1 = yyss;
1274 /* Each stack pointer address is followed by the size of the
1275 data in use in that stack, in bytes. This used to be a
1276 conditional around just the two extra args, but that might
1277 be undefined if yyoverflow is a macro. */
1278 yyoverflow (YY_("memory exhausted"),
1279 &yyss1, yysize * sizeof (*yyssp),
1280 &yyvs1, yysize * sizeof (*yyvsp),
1287 #else /* no yyoverflow */
1288 # ifndef YYSTACK_RELOCATE
1289 goto yyexhaustedlab;
1291 /* Extend the stack our own way. */
1292 if (YYMAXDEPTH <= yystacksize)
1293 goto yyexhaustedlab;
1295 if (YYMAXDEPTH < yystacksize)
1296 yystacksize = YYMAXDEPTH;
1299 yytype_int16 *yyss1 = yyss;
1300 union yyalloc *yyptr =
1301 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1303 goto yyexhaustedlab;
1304 YYSTACK_RELOCATE (yyss);
1305 YYSTACK_RELOCATE (yyvs);
1307 # undef YYSTACK_RELOCATE
1309 YYSTACK_FREE (yyss1);
1312 #endif /* no yyoverflow */
1314 yyssp = yyss + yysize - 1;
1315 yyvsp = yyvs + yysize - 1;
1318 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1319 (unsigned long int) yystacksize));
1321 if (yyss + yystacksize - 1 <= yyssp)
1325 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1334 /* Do appropriate processing given the current state. Read a
1335 look-ahead token if we need one and don't already have one. */
1337 /* First try to decide what to do without reference to look-ahead token. */
1338 yyn = yypact[yystate];
1339 if (yyn == YYPACT_NINF)
1342 /* Not known => get a look-ahead token if don't already have one. */
1344 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1345 if (yychar == YYEMPTY)
1347 YYDPRINTF ((stderr, "Reading a token: "));
1351 if (yychar <= YYEOF)
1353 yychar = yytoken = YYEOF;
1354 YYDPRINTF ((stderr, "Now at end of input.\n"));
1358 yytoken = YYTRANSLATE (yychar);
1359 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1362 /* If the proper action on seeing token YYTOKEN is to reduce or to
1363 detect an error, take that action. */
1365 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1370 if (yyn == 0 || yyn == YYTABLE_NINF)
1379 /* Count tokens shifted since error; after three, turn off error
1384 /* Shift the look-ahead token. */
1385 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1387 /* Discard the shifted token unless it is eof. */
1388 if (yychar != YYEOF)
1397 /*-----------------------------------------------------------.
1398 | yydefault -- do the default action for the current state. |
1399 `-----------------------------------------------------------*/
1401 yyn = yydefact[yystate];
1407 /*-----------------------------.
1408 | yyreduce -- Do a reduction. |
1409 `-----------------------------*/
1411 /* yyn is the number of a rule to reduce with. */
1414 /* If YYLEN is nonzero, implement the default value of the action:
1417 Otherwise, the following line sets YYVAL to garbage.
1418 This behavior is undocumented and Bison
1419 users should not rely upon it. Assigning to YYVAL
1420 unconditionally makes the parser a bit smaller, and it avoids a
1421 GCC warning that YYVAL may be used uninitialized. */
1422 yyval = yyvsp[1-yylen];
1425 YY_REDUCE_PRINT (yyn);
1429 #line 68 "arparse.y"
1434 #line 77 "arparse.y"
1439 #line 93 "arparse.y"
1440 { ar_end(); return 0; }
1444 #line 95 "arparse.y"
1449 #line 102 "arparse.y"
1450 { ar_extract((yyvsp[(2) - (2)].list)); }
1454 #line 107 "arparse.y"
1455 { ar_replace((yyvsp[(2) - (2)].list)); }
1459 #line 112 "arparse.y"
1464 #line 117 "arparse.y"
1465 { ar_delete((yyvsp[(2) - (2)].list)); }
1469 #line 121 "arparse.y"
1470 { ar_addmod((yyvsp[(2) - (2)].list)); }
1474 #line 126 "arparse.y"
1479 #line 131 "arparse.y"
1484 #line 138 "arparse.y"
1485 { ar_open((yyvsp[(2) - (2)].name),0); }
1489 #line 143 "arparse.y"
1490 { ar_open((yyvsp[(2) - (2)].name),1); }
1494 #line 149 "arparse.y"
1495 { ar_addlib((yyvsp[(2) - (3)].name),(yyvsp[(3) - (3)].list)); }
1499 #line 153 "arparse.y"
1500 { ar_directory((yyvsp[(2) - (4)].name), (yyvsp[(3) - (4)].list), (yyvsp[(4) - (4)].name)); }
1504 #line 160 "arparse.y"
1505 { (yyval.name) = (yyvsp[(1) - (1)].name); }
1509 #line 161 "arparse.y"
1510 { (yyval.name) = 0; }
1514 #line 166 "arparse.y"
1515 { (yyval.list) = (yyvsp[(2) - (3)].list); }
1519 #line 168 "arparse.y"
1520 { (yyval.list) = 0; }
1524 #line 173 "arparse.y"
1525 { struct list *n = (struct list *) malloc(sizeof(struct list));
1526 n->next = (yyvsp[(1) - (3)].list);
1527 n->name = (yyvsp[(3) - (3)].name);
1533 #line 178 "arparse.y"
1534 { (yyval.list) = 0; }
1538 #line 190 "arparse.y"
1539 { verbose = !verbose; }
1543 /* Line 1267 of yacc.c. */
1544 #line 1545 "arparse.c"
1547 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1551 YY_STACK_PRINT (yyss, yyssp);
1556 /* Now `shift' the result of the reduction. Determine what state
1557 that goes to, based on the state we popped back to and the rule
1558 number reduced by. */
1562 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1563 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1564 yystate = yytable[yystate];
1566 yystate = yydefgoto[yyn - YYNTOKENS];
1571 /*------------------------------------.
1572 | yyerrlab -- here on detecting error |
1573 `------------------------------------*/
1575 /* If not already recovering from an error, report this error. */
1579 #if ! YYERROR_VERBOSE
1580 yyerror (YY_("syntax error"));
1583 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1584 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1586 YYSIZE_T yyalloc = 2 * yysize;
1587 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1588 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1589 if (yymsg != yymsgbuf)
1590 YYSTACK_FREE (yymsg);
1591 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1593 yymsg_alloc = yyalloc;
1597 yymsg_alloc = sizeof yymsgbuf;
1601 if (0 < yysize && yysize <= yymsg_alloc)
1603 (void) yysyntax_error (yymsg, yystate, yychar);
1608 yyerror (YY_("syntax error"));
1610 goto yyexhaustedlab;
1618 if (yyerrstatus == 3)
1620 /* If just tried and failed to reuse look-ahead token after an
1621 error, discard it. */
1623 if (yychar <= YYEOF)
1625 /* Return failure if at end of input. */
1626 if (yychar == YYEOF)
1631 yydestruct ("Error: discarding",
1637 /* Else will try to reuse look-ahead token after shifting the error
1642 /*---------------------------------------------------.
1643 | yyerrorlab -- error raised explicitly by YYERROR. |
1644 `---------------------------------------------------*/
1647 /* Pacify compilers like GCC when the user code never invokes
1648 YYERROR and the label yyerrorlab therefore never appears in user
1650 if (/*CONSTCOND*/ 0)
1653 /* Do not reclaim the symbols of the rule which action triggered
1657 YY_STACK_PRINT (yyss, yyssp);
1662 /*-------------------------------------------------------------.
1663 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1664 `-------------------------------------------------------------*/
1666 yyerrstatus = 3; /* Each real token shifted decrements this. */
1670 yyn = yypact[yystate];
1671 if (yyn != YYPACT_NINF)
1674 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1682 /* Pop the current state because it cannot handle the error token. */
1687 yydestruct ("Error: popping",
1688 yystos[yystate], yyvsp);
1691 YY_STACK_PRINT (yyss, yyssp);
1700 /* Shift the error token. */
1701 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1707 /*-------------------------------------.
1708 | yyacceptlab -- YYACCEPT comes here. |
1709 `-------------------------------------*/
1714 /*-----------------------------------.
1715 | yyabortlab -- YYABORT comes here. |
1716 `-----------------------------------*/
1722 /*-------------------------------------------------.
1723 | yyexhaustedlab -- memory exhaustion comes here. |
1724 `-------------------------------------------------*/
1726 yyerror (YY_("memory exhausted"));
1732 if (yychar != YYEOF && yychar != YYEMPTY)
1733 yydestruct ("Cleanup: discarding lookahead",
1735 /* Do not reclaim the symbols of the rule which action triggered
1736 this YYABORT or YYACCEPT. */
1738 YY_STACK_PRINT (yyss, yyssp);
1739 while (yyssp != yyss)
1741 yydestruct ("Cleanup: popping",
1742 yystos[*yyssp], yyvsp);
1747 YYSTACK_FREE (yyss);
1750 if (yymsg != yymsgbuf)
1751 YYSTACK_FREE (yymsg);
1753 /* Make sure YYID is used. */
1754 return YYID (yyresult);
1758 #line 194 "arparse.y"
1762 yyerror (const char *x ATTRIBUTE_UNUSED)
1764 extern int linenumber;
1766 printf (_("Syntax error in archive script, line %d\n"), linenumber + 1);