1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
56 /* Put the tokens into the symbol table, so that GDB and other debuggers
102 /* Copy the first part of user declarations. */
105 /* arparse.y - Stange script language parser */
107 /* Copyright 1992, 1993, 1995, 1997, 1999, 2002, 2003
108 Free Software Foundation, Inc.
110 This file is part of GNU Binutils.
112 This program is free software; you can redistribute it and/or modify
113 it under the terms of the GNU General Public License as published by
114 the Free Software Foundation; either version 2 of the License, or
115 (at your option) any later version.
117 This program is distributed in the hope that it will be useful,
118 but WITHOUT ANY WARRANTY; without even the implied warranty of
119 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
120 GNU General Public License for more details.
122 You should have received a copy of the GNU General Public License
123 along with this program; if not, write to the Free Software
124 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
127 /* Contributed by Steve Chamberlain
131 #define DONTDECLARE_MALLOC
136 extern int yylex (void);
137 static int yyerror (const char *);
140 /* Enabling traces. */
145 /* Enabling verbose error messages. */
146 #ifdef YYERROR_VERBOSE
147 # undef YYERROR_VERBOSE
148 # define YYERROR_VERBOSE 1
150 # define YYERROR_VERBOSE 0
153 /* Enabling the token table. */
154 #ifndef YYTOKEN_TABLE
155 # define YYTOKEN_TABLE 0
158 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
160 typedef union YYSTYPE {
165 /* Line 196 of yacc.c. */
166 #line 167 "arparse.c"
167 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
168 # define YYSTYPE_IS_DECLARED 1
169 # define YYSTYPE_IS_TRIVIAL 1
174 /* Copy the second part of user declarations. */
177 /* Line 219 of yacc.c. */
178 #line 179 "arparse.c"
180 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
181 # define YYSIZE_T __SIZE_TYPE__
183 #if ! defined (YYSIZE_T) && defined (size_t)
184 # define YYSIZE_T size_t
186 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
187 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
188 # define YYSIZE_T size_t
190 #if ! defined (YYSIZE_T)
191 # define YYSIZE_T unsigned int
197 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
198 # define YY_(msgid) dgettext ("bison-runtime", msgid)
202 # define YY_(msgid) msgid
206 #if ! defined (yyoverflow) || YYERROR_VERBOSE
208 /* The parser invokes alloca or malloc; define the necessary symbols. */
210 # ifdef YYSTACK_USE_ALLOCA
211 # if YYSTACK_USE_ALLOCA
213 # define YYSTACK_ALLOC __builtin_alloca
215 # define YYSTACK_ALLOC alloca
216 # if defined (__STDC__) || defined (__cplusplus)
217 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
218 # define YYINCLUDED_STDLIB_H
224 # ifdef YYSTACK_ALLOC
225 /* Pacify GCC's `empty if-body' warning. */
226 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
227 # ifndef YYSTACK_ALLOC_MAXIMUM
228 /* The OS might guarantee only one guard page at the bottom of the stack,
229 and a page size can be as small as 4096 bytes. So we cannot safely
230 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
231 to allow for a few compiler-allocated temporary stack slots. */
232 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
235 # define YYSTACK_ALLOC YYMALLOC
236 # define YYSTACK_FREE YYFREE
237 # ifndef YYSTACK_ALLOC_MAXIMUM
238 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
244 # define YYMALLOC malloc
245 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
246 && (defined (__STDC__) || defined (__cplusplus)))
247 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
252 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
253 && (defined (__STDC__) || defined (__cplusplus)))
254 void free (void *); /* INFRINGES ON USER NAME SPACE */
261 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
264 #if (! defined (yyoverflow) \
265 && (! defined (__cplusplus) \
266 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
268 /* A type that is properly aligned for any stack member. */
275 /* The size of the maximum gap between one aligned stack and the next. */
276 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
278 /* The size of an array large to enough to hold all stacks, each with
280 # define YYSTACK_BYTES(N) \
281 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
282 + YYSTACK_GAP_MAXIMUM)
284 /* Copy COUNT objects from FROM to TO. The source and destination do
287 # if defined (__GNUC__) && 1 < __GNUC__
288 # define YYCOPY(To, From, Count) \
289 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
291 # define YYCOPY(To, From, Count) \
295 for (yyi = 0; yyi < (Count); yyi++) \
296 (To)[yyi] = (From)[yyi]; \
302 /* Relocate STACK from its old location to the new one. The
303 local variables YYSIZE and YYSTACKSIZE give the old and new number of
304 elements in the stack, and YYPTR gives the new location of the
305 stack. Advance YYPTR to a properly aligned location for the next
307 # define YYSTACK_RELOCATE(Stack) \
310 YYSIZE_T yynewbytes; \
311 YYCOPY (&yyptr->Stack, Stack, yysize); \
312 Stack = &yyptr->Stack; \
313 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
314 yyptr += yynewbytes / sizeof (*yyptr); \
320 #if defined (__STDC__) || defined (__cplusplus)
321 typedef signed char yysigned_char;
323 typedef short int yysigned_char;
326 /* YYFINAL -- State number of the termination state. */
328 /* YYLAST -- Last index in YYTABLE. */
331 /* YYNTOKENS -- Number of terminals. */
333 /* YYNNTS -- Number of nonterminals. */
335 /* YYNRULES -- Number of rules. */
337 /* YYNRULES -- Number of states. */
340 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
342 #define YYMAXUTOK 275
344 #define YYTRANSLATE(YYX) \
345 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
347 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
348 static const unsigned char yytranslate[] =
350 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
351 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
352 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
353 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
354 21, 22, 2, 2, 23, 2, 2, 2, 2, 2,
355 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
356 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
357 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
358 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
359 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
360 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
361 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
362 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
363 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
364 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
365 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
366 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
367 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
368 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
369 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
370 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
371 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
372 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
373 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
374 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
375 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
376 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
377 15, 16, 17, 18, 19, 20
381 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
383 static const unsigned char yyprhs[] =
385 0, 0, 3, 4, 7, 10, 11, 14, 16, 18,
386 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
387 40, 42, 44, 45, 48, 51, 53, 56, 59, 61,
388 63, 66, 69, 73, 78, 80, 81, 85, 86, 90,
392 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
393 static const yysigned_char yyrhs[] =
395 25, 0, -1, -1, 26, 27, -1, 27, 28, -1,
396 -1, 29, 3, -1, 37, -1, 38, -1, 45, -1,
397 40, -1, 39, -1, 32, -1, 34, -1, 36, -1,
398 30, -1, 31, -1, 33, -1, 35, -1, 13, -1,
399 1, -1, 5, -1, -1, 14, 43, -1, 18, 43,
400 -1, 9, -1, 11, 43, -1, 8, 43, -1, 7,
401 -1, 19, -1, 20, 5, -1, 10, 5, -1, 6,
402 5, 42, -1, 12, 5, 42, 41, -1, 5, -1,
403 -1, 21, 43, 22, -1, -1, 43, 44, 5, -1,
404 -1, 23, -1, -1, 4, -1
407 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
408 static const unsigned char yyrline[] =
410 0, 68, 68, 68, 72, 73, 77, 81, 82, 83,
411 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
412 94, 95, 96, 101, 106, 111, 116, 120, 125, 130,
413 137, 142, 148, 152, 159, 161, 165, 168, 172, 178,
418 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
419 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
420 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
421 static const char *const yytname[] =
423 "$end", "error", "$undefined", "NEWLINE", "VERBOSE", "FILENAME",
424 "ADDLIB", "LIST", "ADDMOD", "CLEAR", "CREATE", "DELETE", "DIRECTORY",
425 "END", "EXTRACT", "FULLDIR", "HELP", "QUIT", "REPLACE", "SAVE", "OPEN",
426 "'('", "')'", "','", "$accept", "start", "@1", "session", "command_line",
427 "command", "extract_command", "replace_command", "clear_command",
428 "delete_command", "addmod_command", "list_command", "save_command",
429 "open_command", "create_command", "addlib_command", "directory_command",
430 "optional_filename", "modulelist", "modulename", "optcomma",
436 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
438 static const unsigned short int yytoknum[] =
440 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
441 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
446 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
447 static const unsigned char yyr1[] =
449 0, 24, 26, 25, 27, 27, 28, 29, 29, 29,
450 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
451 29, 29, 29, 30, 31, 32, 33, 34, 35, 36,
452 37, 38, 39, 40, 41, 41, 42, 42, 43, 43,
456 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
457 static const unsigned char yyr2[] =
459 0, 2, 0, 2, 2, 0, 2, 1, 1, 1,
460 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
461 1, 1, 0, 2, 2, 1, 2, 2, 1, 1,
462 2, 2, 3, 4, 1, 0, 3, 0, 3, 0,
466 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
467 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
468 means the default is an error. */
469 static const unsigned char yydefact[] =
471 2, 0, 5, 1, 0, 20, 42, 21, 0, 28,
472 39, 25, 0, 39, 0, 19, 39, 39, 29, 0,
473 4, 0, 15, 16, 12, 17, 13, 18, 14, 7,
474 8, 11, 10, 9, 37, 27, 31, 26, 37, 23,
475 24, 30, 6, 39, 32, 40, 0, 35, 41, 38,
479 /* YYDEFGOTO[NTERM-NUM]. */
480 static const yysigned_char yydefgoto[] =
482 -1, 1, 2, 4, 20, 21, 22, 23, 24, 25,
483 26, 27, 28, 29, 30, 31, 32, 51, 44, 35,
487 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
489 #define YYPACT_NINF -14
490 static const yysigned_char yypact[] =
492 -14, 1, -14, -14, 5, -14, -14, -14, 2, -14,
493 -14, -14, 21, -14, 22, -14, -14, -14, -14, 23,
494 -14, 26, -14, -14, -14, -14, -14, -14, -14, -14,
495 -14, -14, -14, -14, 10, -3, -14, -3, 10, -3,
496 -3, -14, -14, -14, -14, -14, 27, 28, -1, -14,
500 /* YYPGOTO[NTERM-NUM]. */
501 static const yysigned_char yypgoto[] =
503 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
504 -14, -14, -14, -14, -14, -14, -14, -14, -4, -13,
508 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
509 positive, shift that token. If negative, reduce the rule which
510 number is the opposite. If zero, do what YYDEFACT says.
511 If YYTABLE_NINF, syntax error. */
512 #define YYTABLE_NINF -42
513 static const yysigned_char yytable[] =
515 37, 3, -41, 39, 40, -3, 5, 34, -22, 6,
516 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
517 45, 52, 45, 17, 18, 19, 36, 38, 41, 42,
521 static const unsigned char yycheck[] =
523 13, 0, 5, 16, 17, 0, 1, 5, 3, 4,
524 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
525 23, 22, 23, 18, 19, 20, 5, 5, 5, 3,
529 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
530 symbol of state STATE-NUM. */
531 static const unsigned char yystos[] =
533 0, 25, 26, 0, 27, 1, 4, 5, 6, 7,
534 8, 9, 10, 11, 12, 13, 14, 18, 19, 20,
535 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
536 38, 39, 40, 45, 5, 43, 5, 43, 5, 43,
537 43, 5, 3, 21, 42, 23, 44, 42, 43, 5,
541 #define yyerrok (yyerrstatus = 0)
542 #define yyclearin (yychar = YYEMPTY)
546 #define YYACCEPT goto yyacceptlab
547 #define YYABORT goto yyabortlab
548 #define YYERROR goto yyerrorlab
551 /* Like YYERROR except do call yyerror. This remains here temporarily
552 to ease the transition to the new meaning of YYERROR, for GCC.
553 Once GCC version 2 has supplanted version 1, this can go. */
555 #define YYFAIL goto yyerrlab
557 #define YYRECOVERING() (!!yyerrstatus)
559 #define YYBACKUP(Token, Value) \
561 if (yychar == YYEMPTY && yylen == 1) \
565 yytoken = YYTRANSLATE (yychar); \
571 yyerror (YY_("syntax error: cannot back up")); \
578 #define YYERRCODE 256
581 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
582 If N is 0, then set CURRENT to the empty location which ends
583 the previous symbol: RHS[0] (always defined). */
585 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
586 #ifndef YYLLOC_DEFAULT
587 # define YYLLOC_DEFAULT(Current, Rhs, N) \
591 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
592 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
593 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
594 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
598 (Current).first_line = (Current).last_line = \
599 YYRHSLOC (Rhs, 0).last_line; \
600 (Current).first_column = (Current).last_column = \
601 YYRHSLOC (Rhs, 0).last_column; \
607 /* YY_LOCATION_PRINT -- Print the location on the stream.
608 This macro was not mandated originally: define only if we know
609 we won't break user code: when these are the locations we know. */
611 #ifndef YY_LOCATION_PRINT
612 # if YYLTYPE_IS_TRIVIAL
613 # define YY_LOCATION_PRINT(File, Loc) \
614 fprintf (File, "%d.%d-%d.%d", \
615 (Loc).first_line, (Loc).first_column, \
616 (Loc).last_line, (Loc).last_column)
618 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
623 /* YYLEX -- calling `yylex' with the right arguments. */
626 # define YYLEX yylex (YYLEX_PARAM)
628 # define YYLEX yylex ()
631 /* Enable debugging if requested. */
635 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
636 # define YYFPRINTF fprintf
639 # define YYDPRINTF(Args) \
645 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
649 YYFPRINTF (stderr, "%s ", Title); \
650 yysymprint (stderr, \
652 YYFPRINTF (stderr, "\n"); \
656 /*------------------------------------------------------------------.
657 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
659 `------------------------------------------------------------------*/
661 #if defined (__STDC__) || defined (__cplusplus)
663 yy_stack_print (short int *bottom, short int *top)
666 yy_stack_print (bottom, top)
671 YYFPRINTF (stderr, "Stack now");
672 for (/* Nothing. */; bottom <= top; ++bottom)
673 YYFPRINTF (stderr, " %d", *bottom);
674 YYFPRINTF (stderr, "\n");
677 # define YY_STACK_PRINT(Bottom, Top) \
680 yy_stack_print ((Bottom), (Top)); \
684 /*------------------------------------------------.
685 | Report that the YYRULE is going to be reduced. |
686 `------------------------------------------------*/
688 #if defined (__STDC__) || defined (__cplusplus)
690 yy_reduce_print (int yyrule)
693 yy_reduce_print (yyrule)
698 unsigned long int yylno = yyrline[yyrule];
699 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
701 /* Print the symbols being reduced, and their result. */
702 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
703 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
704 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
707 # define YY_REDUCE_PRINT(Rule) \
710 yy_reduce_print (Rule); \
713 /* Nonzero means print parse trace. It is left uninitialized so that
714 multiple parsers can coexist. */
717 # define YYDPRINTF(Args)
718 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
719 # define YY_STACK_PRINT(Bottom, Top)
720 # define YY_REDUCE_PRINT(Rule)
721 #endif /* !YYDEBUG */
724 /* YYINITDEPTH -- initial size of the parser's stacks. */
726 # define YYINITDEPTH 200
729 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
730 if the built-in stack extension method is used).
732 Do not make this value too large; the results are undefined if
733 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
734 evaluated with infinite-precision integer arithmetic. */
737 # define YYMAXDEPTH 10000
745 # if defined (__GLIBC__) && defined (_STRING_H)
746 # define yystrlen strlen
748 /* Return the length of YYSTR. */
750 # if defined (__STDC__) || defined (__cplusplus)
751 yystrlen (const char *yystr)
757 const char *yys = yystr;
759 while (*yys++ != '\0')
762 return yys - yystr - 1;
768 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
769 # define yystpcpy stpcpy
771 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
774 # if defined (__STDC__) || defined (__cplusplus)
775 yystpcpy (char *yydest, const char *yysrc)
777 yystpcpy (yydest, yysrc)
783 const char *yys = yysrc;
785 while ((*yyd++ = *yys++) != '\0')
794 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
795 quotes and backslashes, so that it's suitable for yyerror. The
796 heuristic is that double-quoting is unnecessary unless the string
797 contains an apostrophe, a comma, or backslash (other than
798 backslash-backslash). YYSTR is taken from yytname. If YYRES is
799 null, do not copy; instead, return the length of what the result
802 yytnamerr (char *yyres, const char *yystr)
807 char const *yyp = yystr;
814 goto do_not_strip_quotes;
818 goto do_not_strip_quotes;
831 do_not_strip_quotes: ;
835 return yystrlen (yystr);
837 return yystpcpy (yyres, yystr) - yyres;
841 #endif /* YYERROR_VERBOSE */
846 /*--------------------------------.
847 | Print this symbol on YYOUTPUT. |
848 `--------------------------------*/
850 #if defined (__STDC__) || defined (__cplusplus)
852 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
855 yysymprint (yyoutput, yytype, yyvaluep)
861 /* Pacify ``unused variable'' warnings. */
864 if (yytype < YYNTOKENS)
865 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
867 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
871 if (yytype < YYNTOKENS)
872 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
879 YYFPRINTF (yyoutput, ")");
882 #endif /* ! YYDEBUG */
883 /*-----------------------------------------------.
884 | Release the memory associated to this symbol. |
885 `-----------------------------------------------*/
887 #if defined (__STDC__) || defined (__cplusplus)
889 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
892 yydestruct (yymsg, yytype, yyvaluep)
898 /* Pacify ``unused variable'' warnings. */
903 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
914 /* Prevent warnings from -Wmissing-prototypes. */
917 # if defined (__STDC__) || defined (__cplusplus)
918 int yyparse (void *YYPARSE_PARAM);
922 #else /* ! YYPARSE_PARAM */
923 #if defined (__STDC__) || defined (__cplusplus)
928 #endif /* ! YYPARSE_PARAM */
932 /* The look-ahead symbol. */
935 /* The semantic value of the look-ahead symbol. */
938 /* Number of syntax errors so far. */
948 # if defined (__STDC__) || defined (__cplusplus)
949 int yyparse (void *YYPARSE_PARAM)
951 int yyparse (YYPARSE_PARAM)
954 #else /* ! YYPARSE_PARAM */
955 #if defined (__STDC__) || defined (__cplusplus)
969 /* Number of tokens to shift before error messages enabled. */
971 /* Look-ahead token as an internal (translated) token number. */
974 /* Three stacks and their tools:
975 `yyss': related to states,
976 `yyvs': related to semantic values,
977 `yyls': related to locations.
979 Refer to the stacks thru separate pointers, to allow yyoverflow
980 to reallocate them elsewhere. */
982 /* The state stack. */
983 short int yyssa[YYINITDEPTH];
984 short int *yyss = yyssa;
987 /* The semantic value stack. */
988 YYSTYPE yyvsa[YYINITDEPTH];
989 YYSTYPE *yyvs = yyvsa;
994 #define YYPOPSTACK (yyvsp--, yyssp--)
996 YYSIZE_T yystacksize = YYINITDEPTH;
998 /* The variables used to return semantic value and location from the
1003 /* When reducing, the number of symbols on the RHS of the reduced
1007 YYDPRINTF ((stderr, "Starting parse\n"));
1012 yychar = YYEMPTY; /* Cause a token to be read. */
1014 /* Initialize stack pointers.
1015 Waste one element of value and location stack
1016 so that they stay on the same level as the state stack.
1017 The wasted elements are never initialized. */
1024 /*------------------------------------------------------------.
1025 | yynewstate -- Push a new state, which is found in yystate. |
1026 `------------------------------------------------------------*/
1028 /* In all cases, when you get here, the value and location stacks
1029 have just been pushed. so pushing a state here evens the stacks.
1036 if (yyss + yystacksize - 1 <= yyssp)
1038 /* Get the current used size of the three stacks, in elements. */
1039 YYSIZE_T yysize = yyssp - yyss + 1;
1043 /* Give user a chance to reallocate the stack. Use copies of
1044 these so that the &'s don't force the real ones into
1046 YYSTYPE *yyvs1 = yyvs;
1047 short int *yyss1 = yyss;
1050 /* Each stack pointer address is followed by the size of the
1051 data in use in that stack, in bytes. This used to be a
1052 conditional around just the two extra args, but that might
1053 be undefined if yyoverflow is a macro. */
1054 yyoverflow (YY_("memory exhausted"),
1055 &yyss1, yysize * sizeof (*yyssp),
1056 &yyvs1, yysize * sizeof (*yyvsp),
1063 #else /* no yyoverflow */
1064 # ifndef YYSTACK_RELOCATE
1065 goto yyexhaustedlab;
1067 /* Extend the stack our own way. */
1068 if (YYMAXDEPTH <= yystacksize)
1069 goto yyexhaustedlab;
1071 if (YYMAXDEPTH < yystacksize)
1072 yystacksize = YYMAXDEPTH;
1075 short int *yyss1 = yyss;
1076 union yyalloc *yyptr =
1077 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1079 goto yyexhaustedlab;
1080 YYSTACK_RELOCATE (yyss);
1081 YYSTACK_RELOCATE (yyvs);
1083 # undef YYSTACK_RELOCATE
1085 YYSTACK_FREE (yyss1);
1088 #endif /* no yyoverflow */
1090 yyssp = yyss + yysize - 1;
1091 yyvsp = yyvs + yysize - 1;
1094 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1095 (unsigned long int) yystacksize));
1097 if (yyss + yystacksize - 1 <= yyssp)
1101 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1110 /* Do appropriate processing given the current state. */
1111 /* Read a look-ahead token if we need one and don't already have one. */
1114 /* First try to decide what to do without reference to look-ahead token. */
1116 yyn = yypact[yystate];
1117 if (yyn == YYPACT_NINF)
1120 /* Not known => get a look-ahead token if don't already have one. */
1122 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1123 if (yychar == YYEMPTY)
1125 YYDPRINTF ((stderr, "Reading a token: "));
1129 if (yychar <= YYEOF)
1131 yychar = yytoken = YYEOF;
1132 YYDPRINTF ((stderr, "Now at end of input.\n"));
1136 yytoken = YYTRANSLATE (yychar);
1137 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1140 /* If the proper action on seeing token YYTOKEN is to reduce or to
1141 detect an error, take that action. */
1143 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1148 if (yyn == 0 || yyn == YYTABLE_NINF)
1157 /* Shift the look-ahead token. */
1158 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1160 /* Discard the token being shifted unless it is eof. */
1161 if (yychar != YYEOF)
1167 /* Count tokens shifted since error; after three, turn off error
1176 /*-----------------------------------------------------------.
1177 | yydefault -- do the default action for the current state. |
1178 `-----------------------------------------------------------*/
1180 yyn = yydefact[yystate];
1186 /*-----------------------------.
1187 | yyreduce -- Do a reduction. |
1188 `-----------------------------*/
1190 /* yyn is the number of a rule to reduce with. */
1193 /* If YYLEN is nonzero, implement the default value of the action:
1196 Otherwise, the following line sets YYVAL to garbage.
1197 This behavior is undocumented and Bison
1198 users should not rely upon it. Assigning to YYVAL
1199 unconditionally makes the parser a bit smaller, and it avoids a
1200 GCC warning that YYVAL may be used uninitialized. */
1201 yyval = yyvsp[1-yylen];
1204 YY_REDUCE_PRINT (yyn);
1208 #line 68 "arparse.y"
1213 #line 77 "arparse.y"
1218 #line 93 "arparse.y"
1219 { ar_end(); return 0; }
1223 #line 95 "arparse.y"
1228 #line 102 "arparse.y"
1229 { ar_extract((yyvsp[0].list)); }
1233 #line 107 "arparse.y"
1234 { ar_replace((yyvsp[0].list)); }
1238 #line 112 "arparse.y"
1243 #line 117 "arparse.y"
1244 { ar_delete((yyvsp[0].list)); }
1248 #line 121 "arparse.y"
1249 { ar_addmod((yyvsp[0].list)); }
1253 #line 126 "arparse.y"
1258 #line 131 "arparse.y"
1263 #line 138 "arparse.y"
1264 { ar_open((yyvsp[0].name),0); }
1268 #line 143 "arparse.y"
1269 { ar_open((yyvsp[0].name),1); }
1273 #line 149 "arparse.y"
1274 { ar_addlib((yyvsp[-1].name),(yyvsp[0].list)); }
1278 #line 153 "arparse.y"
1279 { ar_directory((yyvsp[-2].name), (yyvsp[-1].list), (yyvsp[0].name)); }
1283 #line 160 "arparse.y"
1284 { (yyval.name) = (yyvsp[0].name); }
1288 #line 161 "arparse.y"
1289 { (yyval.name) = 0; }
1293 #line 166 "arparse.y"
1294 { (yyval.list) = (yyvsp[-1].list); }
1298 #line 168 "arparse.y"
1299 { (yyval.list) = 0; }
1303 #line 173 "arparse.y"
1304 { struct list *n = (struct list *) malloc(sizeof(struct list));
1305 n->next = (yyvsp[-2].list);
1306 n->name = (yyvsp[0].name);
1312 #line 178 "arparse.y"
1313 { (yyval.list) = 0; }
1317 #line 190 "arparse.y"
1318 { verbose = !verbose; }
1325 /* Line 1126 of yacc.c. */
1326 #line 1327 "arparse.c"
1332 YY_STACK_PRINT (yyss, yyssp);
1337 /* Now `shift' the result of the reduction. Determine what state
1338 that goes to, based on the state we popped back to and the rule
1339 number reduced by. */
1343 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1344 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1345 yystate = yytable[yystate];
1347 yystate = yydefgoto[yyn - YYNTOKENS];
1352 /*------------------------------------.
1353 | yyerrlab -- here on detecting error |
1354 `------------------------------------*/
1356 /* If not already recovering from an error, report this error. */
1361 yyn = yypact[yystate];
1363 if (YYPACT_NINF < yyn && yyn < YYLAST)
1365 int yytype = YYTRANSLATE (yychar);
1366 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1367 YYSIZE_T yysize = yysize0;
1369 int yysize_overflow = 0;
1371 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
1372 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1376 /* This is so xgettext sees the translatable formats that are
1377 constructed on the fly. */
1378 YY_("syntax error, unexpected %s");
1379 YY_("syntax error, unexpected %s, expecting %s");
1380 YY_("syntax error, unexpected %s, expecting %s or %s");
1381 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1382 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1386 static char const yyunexpected[] = "syntax error, unexpected %s";
1387 static char const yyexpecting[] = ", expecting %s";
1388 static char const yyor[] = " or %s";
1389 char yyformat[sizeof yyunexpected
1390 + sizeof yyexpecting - 1
1391 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1392 * (sizeof yyor - 1))];
1393 char const *yyprefix = yyexpecting;
1395 /* Start YYX at -YYN if negative to avoid negative indexes in
1397 int yyxbegin = yyn < 0 ? -yyn : 0;
1399 /* Stay within bounds of both yycheck and yytname. */
1400 int yychecklim = YYLAST - yyn;
1401 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1404 yyarg[0] = yytname[yytype];
1405 yyfmt = yystpcpy (yyformat, yyunexpected);
1407 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1408 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1410 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1414 yyformat[sizeof yyunexpected - 1] = '\0';
1417 yyarg[yycount++] = yytname[yyx];
1418 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1419 yysize_overflow |= yysize1 < yysize;
1421 yyfmt = yystpcpy (yyfmt, yyprefix);
1425 yyf = YY_(yyformat);
1426 yysize1 = yysize + yystrlen (yyf);
1427 yysize_overflow |= yysize1 < yysize;
1430 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
1431 yymsg = (char *) YYSTACK_ALLOC (yysize);
1434 /* Avoid sprintf, as that infringes on the user's name space.
1435 Don't have undefined behavior even if the translation
1436 produced a string with the wrong number of "%s"s. */
1439 while ((*yyp = *yyf))
1441 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1443 yyp += yytnamerr (yyp, yyarg[yyi++]);
1453 YYSTACK_FREE (yymsg);
1457 yyerror (YY_("syntax error"));
1458 goto yyexhaustedlab;
1462 #endif /* YYERROR_VERBOSE */
1463 yyerror (YY_("syntax error"));
1468 if (yyerrstatus == 3)
1470 /* If just tried and failed to reuse look-ahead token after an
1471 error, discard it. */
1473 if (yychar <= YYEOF)
1475 /* Return failure if at end of input. */
1476 if (yychar == YYEOF)
1481 yydestruct ("Error: discarding", yytoken, &yylval);
1486 /* Else will try to reuse look-ahead token after shifting the error
1491 /*---------------------------------------------------.
1492 | yyerrorlab -- error raised explicitly by YYERROR. |
1493 `---------------------------------------------------*/
1496 /* Pacify compilers like GCC when the user code never invokes
1497 YYERROR and the label yyerrorlab therefore never appears in user
1508 /*-------------------------------------------------------------.
1509 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1510 `-------------------------------------------------------------*/
1512 yyerrstatus = 3; /* Each real token shifted decrements this. */
1516 yyn = yypact[yystate];
1517 if (yyn != YYPACT_NINF)
1520 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1528 /* Pop the current state because it cannot handle the error token. */
1533 yydestruct ("Error: popping", yystos[yystate], yyvsp);
1536 YY_STACK_PRINT (yyss, yyssp);
1545 /* Shift the error token. */
1546 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1552 /*-------------------------------------.
1553 | yyacceptlab -- YYACCEPT comes here. |
1554 `-------------------------------------*/
1559 /*-----------------------------------.
1560 | yyabortlab -- YYABORT comes here. |
1561 `-----------------------------------*/
1567 /*-------------------------------------------------.
1568 | yyexhaustedlab -- memory exhaustion comes here. |
1569 `-------------------------------------------------*/
1571 yyerror (YY_("memory exhausted"));
1577 if (yychar != YYEOF && yychar != YYEMPTY)
1578 yydestruct ("Cleanup: discarding lookahead",
1580 while (yyssp != yyss)
1582 yydestruct ("Cleanup: popping",
1583 yystos[*yyssp], yyvsp);
1588 YYSTACK_FREE (yyss);
1594 #line 194 "arparse.y"
1598 yyerror (const char *x ATTRIBUTE_UNUSED)
1600 extern int linenumber;
1602 printf (_("Syntax error in archive script, line %d\n"), linenumber + 1);