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 1992, 1993, 1995, 1997, 1999, 2002, 2003, 2007
118 Free Software Foundation, Inc.
120 This file is part of GNU Binutils.
122 This program is free software; you can redistribute it and/or modify
123 it under the terms of the GNU General Public License as published by
124 the Free Software Foundation; either version 3 of the License, or
125 (at your option) any later version.
127 This program is distributed in the hope that it will be useful,
128 but WITHOUT ANY WARRANTY; without even the implied warranty of
129 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
130 GNU General Public License for more details.
132 You should have received a copy of the GNU General Public License
133 along with this program; if not, write to the Free Software
134 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
135 MA 02110-1301, USA. */
138 /* Contributed by Steve Chamberlain
142 #define DONTDECLARE_MALLOC
147 extern int yylex (void);
148 static int yyerror (const char *);
151 /* Enabling traces. */
156 /* Enabling verbose error messages. */
157 #ifdef YYERROR_VERBOSE
158 # undef YYERROR_VERBOSE
159 # define YYERROR_VERBOSE 1
161 # define YYERROR_VERBOSE 0
164 /* Enabling the token table. */
165 #ifndef YYTOKEN_TABLE
166 # define YYTOKEN_TABLE 0
169 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
170 typedef union YYSTYPE
177 /* Line 187 of yacc.c. */
178 #line 179 "arparse.c"
180 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
181 # define YYSTYPE_IS_DECLARED 1
182 # define YYSTYPE_IS_TRIVIAL 1
187 /* Copy the second part of user declarations. */
190 /* Line 216 of yacc.c. */
191 #line 192 "arparse.c"
198 typedef YYTYPE_UINT8 yytype_uint8
;
200 typedef unsigned char yytype_uint8
;
204 typedef YYTYPE_INT8 yytype_int8
;
205 #elif (defined __STDC__ || defined __C99__FUNC__ \
206 || defined __cplusplus || defined _MSC_VER)
207 typedef signed char yytype_int8
;
209 typedef short int yytype_int8
;
213 typedef YYTYPE_UINT16 yytype_uint16
;
215 typedef unsigned short int yytype_uint16
;
219 typedef YYTYPE_INT16 yytype_int16
;
221 typedef short int yytype_int16
;
225 # ifdef __SIZE_TYPE__
226 # define YYSIZE_T __SIZE_TYPE__
227 # elif defined size_t
228 # define YYSIZE_T size_t
229 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
230 || defined __cplusplus || defined _MSC_VER)
231 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
232 # define YYSIZE_T size_t
234 # define YYSIZE_T unsigned int
238 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
243 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
244 # define YY_(msgid) dgettext ("bison-runtime", msgid)
248 # define YY_(msgid) msgid
252 /* Suppress unused-variable warnings by "using" E. */
253 #if ! defined lint || defined __GNUC__
254 # define YYUSE(e) ((void) (e))
256 # define YYUSE(e) /* empty */
259 /* Identity function, used to suppress warnings about constant conditions. */
263 #if (defined __STDC__ || defined __C99__FUNC__ \
264 || defined __cplusplus || defined _MSC_VER)
277 #if ! defined yyoverflow || YYERROR_VERBOSE
279 /* The parser invokes alloca or malloc; define the necessary symbols. */
281 # ifdef YYSTACK_USE_ALLOCA
282 # if YYSTACK_USE_ALLOCA
284 # define YYSTACK_ALLOC __builtin_alloca
285 # elif defined __BUILTIN_VA_ARG_INCR
286 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
288 # define YYSTACK_ALLOC __alloca
289 # elif defined _MSC_VER
290 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
291 # define alloca _alloca
293 # define YYSTACK_ALLOC alloca
294 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
295 || defined __cplusplus || defined _MSC_VER)
296 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
305 # ifdef YYSTACK_ALLOC
306 /* Pacify GCC's `empty if-body' warning. */
307 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
308 # ifndef YYSTACK_ALLOC_MAXIMUM
309 /* The OS might guarantee only one guard page at the bottom of the stack,
310 and a page size can be as small as 4096 bytes. So we cannot safely
311 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
312 to allow for a few compiler-allocated temporary stack slots. */
313 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
316 # define YYSTACK_ALLOC YYMALLOC
317 # define YYSTACK_FREE YYFREE
318 # ifndef YYSTACK_ALLOC_MAXIMUM
319 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
321 # if (defined __cplusplus && ! defined _STDLIB_H \
322 && ! ((defined YYMALLOC || defined malloc) \
323 && (defined YYFREE || defined free)))
324 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
330 # define YYMALLOC malloc
331 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
332 || defined __cplusplus || defined _MSC_VER)
333 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
338 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
339 || defined __cplusplus || defined _MSC_VER)
340 void free (void *); /* INFRINGES ON USER NAME SPACE */
344 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
347 #if (! defined yyoverflow \
348 && (! defined __cplusplus \
349 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
351 /* A type that is properly aligned for any stack member. */
358 /* The size of the maximum gap between one aligned stack and the next. */
359 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
361 /* The size of an array large to enough to hold all stacks, each with
363 # define YYSTACK_BYTES(N) \
364 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
365 + YYSTACK_GAP_MAXIMUM)
367 /* Copy COUNT objects from FROM to TO. The source and destination do
370 # if defined __GNUC__ && 1 < __GNUC__
371 # define YYCOPY(To, From, Count) \
372 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
374 # define YYCOPY(To, From, Count) \
378 for (yyi = 0; yyi < (Count); yyi++) \
379 (To)[yyi] = (From)[yyi]; \
385 /* Relocate STACK from its old location to the new one. The
386 local variables YYSIZE and YYSTACKSIZE give the old and new number of
387 elements in the stack, and YYPTR gives the new location of the
388 stack. Advance YYPTR to a properly aligned location for the next
390 # define YYSTACK_RELOCATE(Stack) \
393 YYSIZE_T yynewbytes; \
394 YYCOPY (&yyptr->Stack, Stack, yysize); \
395 Stack = &yyptr->Stack; \
396 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
397 yyptr += yynewbytes / sizeof (*yyptr); \
403 /* YYFINAL -- State number of the termination state. */
405 /* YYLAST -- Last index in YYTABLE. */
408 /* YYNTOKENS -- Number of terminals. */
410 /* YYNNTS -- Number of nonterminals. */
412 /* YYNRULES -- Number of rules. */
414 /* YYNRULES -- Number of states. */
417 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
419 #define YYMAXUTOK 275
421 #define YYTRANSLATE(YYX) \
422 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
424 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
425 static const yytype_uint8 yytranslate
[] =
427 0, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 21, 22, 2, 2, 23, 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, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
453 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
454 15, 16, 17, 18, 19, 20
458 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
460 static const yytype_uint8 yyprhs
[] =
462 0, 0, 3, 4, 7, 10, 11, 14, 16, 18,
463 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
464 40, 42, 44, 45, 48, 51, 53, 56, 59, 61,
465 63, 66, 69, 73, 78, 80, 81, 85, 86, 90,
469 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
470 static const yytype_int8 yyrhs
[] =
472 25, 0, -1, -1, 26, 27, -1, 27, 28, -1,
473 -1, 29, 3, -1, 37, -1, 38, -1, 45, -1,
474 40, -1, 39, -1, 32, -1, 34, -1, 36, -1,
475 30, -1, 31, -1, 33, -1, 35, -1, 13, -1,
476 1, -1, 5, -1, -1, 14, 43, -1, 18, 43,
477 -1, 9, -1, 11, 43, -1, 8, 43, -1, 7,
478 -1, 19, -1, 20, 5, -1, 10, 5, -1, 6,
479 5, 42, -1, 12, 5, 42, 41, -1, 5, -1,
480 -1, 21, 43, 22, -1, -1, 43, 44, 5, -1,
481 -1, 23, -1, -1, 4, -1
484 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
485 static const yytype_uint8 yyrline
[] =
487 0, 69, 69, 69, 73, 74, 78, 82, 83, 84,
488 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
489 95, 96, 97, 102, 107, 112, 117, 121, 126, 131,
490 138, 143, 149, 153, 160, 162, 166, 169, 173, 179,
495 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
496 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
497 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
498 static const char *const yytname
[] =
500 "$end", "error", "$undefined", "NEWLINE", "VERBOSE", "FILENAME",
501 "ADDLIB", "LIST", "ADDMOD", "CLEAR", "CREATE", "DELETE", "DIRECTORY",
502 "END", "EXTRACT", "FULLDIR", "HELP", "QUIT", "REPLACE", "SAVE", "OPEN",
503 "'('", "')'", "','", "$accept", "start", "@1", "session", "command_line",
504 "command", "extract_command", "replace_command", "clear_command",
505 "delete_command", "addmod_command", "list_command", "save_command",
506 "open_command", "create_command", "addlib_command", "directory_command",
507 "optional_filename", "modulelist", "modulename", "optcomma",
513 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
515 static const yytype_uint16 yytoknum
[] =
517 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
518 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
523 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
524 static const yytype_uint8 yyr1
[] =
526 0, 24, 26, 25, 27, 27, 28, 29, 29, 29,
527 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
528 29, 29, 29, 30, 31, 32, 33, 34, 35, 36,
529 37, 38, 39, 40, 41, 41, 42, 42, 43, 43,
533 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
534 static const yytype_uint8 yyr2
[] =
536 0, 2, 0, 2, 2, 0, 2, 1, 1, 1,
537 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
538 1, 1, 0, 2, 2, 1, 2, 2, 1, 1,
539 2, 2, 3, 4, 1, 0, 3, 0, 3, 0,
543 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
544 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
545 means the default is an error. */
546 static const yytype_uint8 yydefact
[] =
548 2, 0, 5, 1, 0, 20, 42, 21, 0, 28,
549 39, 25, 0, 39, 0, 19, 39, 39, 29, 0,
550 4, 0, 15, 16, 12, 17, 13, 18, 14, 7,
551 8, 11, 10, 9, 37, 27, 31, 26, 37, 23,
552 24, 30, 6, 39, 32, 40, 0, 35, 41, 38,
556 /* YYDEFGOTO[NTERM-NUM]. */
557 static const yytype_int8 yydefgoto
[] =
559 -1, 1, 2, 4, 20, 21, 22, 23, 24, 25,
560 26, 27, 28, 29, 30, 31, 32, 51, 44, 35,
564 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
566 #define YYPACT_NINF -14
567 static const yytype_int8 yypact
[] =
569 -14, 1, -14, -14, 5, -14, -14, -14, 2, -14,
570 -14, -14, 21, -14, 22, -14, -14, -14, -14, 23,
571 -14, 26, -14, -14, -14, -14, -14, -14, -14, -14,
572 -14, -14, -14, -14, 10, -3, -14, -3, 10, -3,
573 -3, -14, -14, -14, -14, -14, 27, 28, -1, -14,
577 /* YYPGOTO[NTERM-NUM]. */
578 static const yytype_int8 yypgoto
[] =
580 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
581 -14, -14, -14, -14, -14, -14, -14, -14, -4, -13,
585 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
586 positive, shift that token. If negative, reduce the rule which
587 number is the opposite. If zero, do what YYDEFACT says.
588 If YYTABLE_NINF, syntax error. */
589 #define YYTABLE_NINF -42
590 static const yytype_int8 yytable
[] =
592 37, 3, -41, 39, 40, -3, 5, 34, -22, 6,
593 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
594 45, 52, 45, 17, 18, 19, 36, 38, 41, 42,
598 static const yytype_uint8 yycheck
[] =
600 13, 0, 5, 16, 17, 0, 1, 5, 3, 4,
601 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
602 23, 22, 23, 18, 19, 20, 5, 5, 5, 3,
606 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
607 symbol of state STATE-NUM. */
608 static const yytype_uint8 yystos
[] =
610 0, 25, 26, 0, 27, 1, 4, 5, 6, 7,
611 8, 9, 10, 11, 12, 13, 14, 18, 19, 20,
612 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
613 38, 39, 40, 45, 5, 43, 5, 43, 5, 43,
614 43, 5, 3, 21, 42, 23, 44, 42, 43, 5,
618 #define yyerrok (yyerrstatus = 0)
619 #define yyclearin (yychar = YYEMPTY)
623 #define YYACCEPT goto yyacceptlab
624 #define YYABORT goto yyabortlab
625 #define YYERROR goto yyerrorlab
628 /* Like YYERROR except do call yyerror. This remains here temporarily
629 to ease the transition to the new meaning of YYERROR, for GCC.
630 Once GCC version 2 has supplanted version 1, this can go. */
632 #define YYFAIL goto yyerrlab
634 #define YYRECOVERING() (!!yyerrstatus)
636 #define YYBACKUP(Token, Value) \
638 if (yychar == YYEMPTY && yylen == 1) \
642 yytoken = YYTRANSLATE (yychar); \
648 yyerror (YY_("syntax error: cannot back up")); \
655 #define YYERRCODE 256
658 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
659 If N is 0, then set CURRENT to the empty location which ends
660 the previous symbol: RHS[0] (always defined). */
662 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
663 #ifndef YYLLOC_DEFAULT
664 # define YYLLOC_DEFAULT(Current, Rhs, N) \
668 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
669 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
670 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
671 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
675 (Current).first_line = (Current).last_line = \
676 YYRHSLOC (Rhs, 0).last_line; \
677 (Current).first_column = (Current).last_column = \
678 YYRHSLOC (Rhs, 0).last_column; \
684 /* YY_LOCATION_PRINT -- Print the location on the stream.
685 This macro was not mandated originally: define only if we know
686 we won't break user code: when these are the locations we know. */
688 #ifndef YY_LOCATION_PRINT
689 # if YYLTYPE_IS_TRIVIAL
690 # define YY_LOCATION_PRINT(File, Loc) \
691 fprintf (File, "%d.%d-%d.%d", \
692 (Loc).first_line, (Loc).first_column, \
693 (Loc).last_line, (Loc).last_column)
695 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
700 /* YYLEX -- calling `yylex' with the right arguments. */
703 # define YYLEX yylex (YYLEX_PARAM)
705 # define YYLEX yylex ()
708 /* Enable debugging if requested. */
712 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
713 # define YYFPRINTF fprintf
716 # define YYDPRINTF(Args) \
722 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
726 YYFPRINTF (stderr, "%s ", Title); \
727 yy_symbol_print (stderr, \
729 YYFPRINTF (stderr, "\n"); \
734 /*--------------------------------.
735 | Print this symbol on YYOUTPUT. |
736 `--------------------------------*/
739 #if (defined __STDC__ || defined __C99__FUNC__ \
740 || defined __cplusplus || defined _MSC_VER)
742 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
745 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
)
748 YYSTYPE
const * const yyvaluep
;
754 if (yytype
< YYNTOKENS
)
755 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
767 /*--------------------------------.
768 | Print this symbol on YYOUTPUT. |
769 `--------------------------------*/
771 #if (defined __STDC__ || defined __C99__FUNC__ \
772 || defined __cplusplus || defined _MSC_VER)
774 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
777 yy_symbol_print (yyoutput
, yytype
, yyvaluep
)
780 YYSTYPE
const * const yyvaluep
;
783 if (yytype
< YYNTOKENS
)
784 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
786 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
788 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
789 YYFPRINTF (yyoutput
, ")");
792 /*------------------------------------------------------------------.
793 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
795 `------------------------------------------------------------------*/
797 #if (defined __STDC__ || defined __C99__FUNC__ \
798 || defined __cplusplus || defined _MSC_VER)
800 yy_stack_print (yytype_int16
*bottom
, yytype_int16
*top
)
803 yy_stack_print (bottom
, top
)
804 yytype_int16
*bottom
;
808 YYFPRINTF (stderr
, "Stack now");
809 for (; bottom
<= top
; ++bottom
)
810 YYFPRINTF (stderr
, " %d", *bottom
);
811 YYFPRINTF (stderr
, "\n");
814 # define YY_STACK_PRINT(Bottom, Top) \
817 yy_stack_print ((Bottom), (Top)); \
821 /*------------------------------------------------.
822 | Report that the YYRULE is going to be reduced. |
823 `------------------------------------------------*/
825 #if (defined __STDC__ || defined __C99__FUNC__ \
826 || defined __cplusplus || defined _MSC_VER)
828 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
)
831 yy_reduce_print (yyvsp
, yyrule
)
836 int yynrhs
= yyr2
[yyrule
];
838 unsigned long int yylno
= yyrline
[yyrule
];
839 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
841 /* The symbols being reduced. */
842 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
844 fprintf (stderr
, " $%d = ", yyi
+ 1);
845 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
846 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
848 fprintf (stderr
, "\n");
852 # define YY_REDUCE_PRINT(Rule) \
855 yy_reduce_print (yyvsp, Rule); \
858 /* Nonzero means print parse trace. It is left uninitialized so that
859 multiple parsers can coexist. */
862 # define YYDPRINTF(Args)
863 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
864 # define YY_STACK_PRINT(Bottom, Top)
865 # define YY_REDUCE_PRINT(Rule)
866 #endif /* !YYDEBUG */
869 /* YYINITDEPTH -- initial size of the parser's stacks. */
871 # define YYINITDEPTH 200
874 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
875 if the built-in stack extension method is used).
877 Do not make this value too large; the results are undefined if
878 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
879 evaluated with infinite-precision integer arithmetic. */
882 # define YYMAXDEPTH 10000
890 # if defined __GLIBC__ && defined _STRING_H
891 # define yystrlen strlen
893 /* Return the length of YYSTR. */
894 #if (defined __STDC__ || defined __C99__FUNC__ \
895 || defined __cplusplus || defined _MSC_VER)
897 yystrlen (const char *yystr
)
905 for (yylen
= 0; yystr
[yylen
]; yylen
++)
913 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
914 # define yystpcpy stpcpy
916 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
918 #if (defined __STDC__ || defined __C99__FUNC__ \
919 || defined __cplusplus || defined _MSC_VER)
921 yystpcpy (char *yydest
, const char *yysrc
)
924 yystpcpy (yydest
, yysrc
)
930 const char *yys
= yysrc
;
932 while ((*yyd
++ = *yys
++) != '\0')
941 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
942 quotes and backslashes, so that it's suitable for yyerror. The
943 heuristic is that double-quoting is unnecessary unless the string
944 contains an apostrophe, a comma, or backslash (other than
945 backslash-backslash). YYSTR is taken from yytname. If YYRES is
946 null, do not copy; instead, return the length of what the result
949 yytnamerr (char *yyres
, const char *yystr
)
954 char const *yyp
= yystr
;
961 goto do_not_strip_quotes
;
965 goto do_not_strip_quotes
;
978 do_not_strip_quotes
: ;
982 return yystrlen (yystr
);
984 return yystpcpy (yyres
, yystr
) - yyres
;
988 /* Copy into YYRESULT an error message about the unexpected token
989 YYCHAR while in state YYSTATE. Return the number of bytes copied,
990 including the terminating null byte. If YYRESULT is null, do not
991 copy anything; just return the number of bytes that would be
992 copied. As a special case, return 0 if an ordinary "syntax error"
993 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
996 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
998 int yyn
= yypact
[yystate
];
1000 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1004 int yytype
= YYTRANSLATE (yychar
);
1005 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1006 YYSIZE_T yysize
= yysize0
;
1008 int yysize_overflow
= 0;
1009 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1010 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1014 /* This is so xgettext sees the translatable formats that are
1015 constructed on the fly. */
1016 YY_("syntax error, unexpected %s");
1017 YY_("syntax error, unexpected %s, expecting %s");
1018 YY_("syntax error, unexpected %s, expecting %s or %s");
1019 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1020 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1024 static char const yyunexpected
[] = "syntax error, unexpected %s";
1025 static char const yyexpecting
[] = ", expecting %s";
1026 static char const yyor
[] = " or %s";
1027 char yyformat
[sizeof yyunexpected
1028 + sizeof yyexpecting
- 1
1029 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1030 * (sizeof yyor
- 1))];
1031 char const *yyprefix
= yyexpecting
;
1033 /* Start YYX at -YYN if negative to avoid negative indexes in
1035 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1037 /* Stay within bounds of both yycheck and yytname. */
1038 int yychecklim
= YYLAST
- yyn
+ 1;
1039 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1042 yyarg
[0] = yytname
[yytype
];
1043 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1045 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1046 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1048 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1052 yyformat
[sizeof yyunexpected
- 1] = '\0';
1055 yyarg
[yycount
++] = yytname
[yyx
];
1056 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1057 yysize_overflow
|= (yysize1
< yysize
);
1059 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1063 yyf
= YY_(yyformat
);
1064 yysize1
= yysize
+ yystrlen (yyf
);
1065 yysize_overflow
|= (yysize1
< yysize
);
1068 if (yysize_overflow
)
1069 return YYSIZE_MAXIMUM
;
1073 /* Avoid sprintf, as that infringes on the user's name space.
1074 Don't have undefined behavior even if the translation
1075 produced a string with the wrong number of "%s"s. */
1076 char *yyp
= yyresult
;
1078 while ((*yyp
= *yyf
) != '\0')
1080 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1082 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1095 #endif /* YYERROR_VERBOSE */
1098 /*-----------------------------------------------.
1099 | Release the memory associated to this symbol. |
1100 `-----------------------------------------------*/
1103 #if (defined __STDC__ || defined __C99__FUNC__ \
1104 || defined __cplusplus || defined _MSC_VER)
1106 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1109 yydestruct (yymsg
, yytype
, yyvaluep
)
1119 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1130 /* Prevent warnings from -Wmissing-prototypes. */
1132 #ifdef YYPARSE_PARAM
1133 #if defined __STDC__ || defined __cplusplus
1134 int yyparse (void *YYPARSE_PARAM
);
1138 #else /* ! YYPARSE_PARAM */
1139 #if defined __STDC__ || defined __cplusplus
1144 #endif /* ! YYPARSE_PARAM */
1148 /* The look-ahead symbol. */
1151 /* The semantic value of the look-ahead symbol. */
1154 /* Number of syntax errors so far. */
1163 #ifdef YYPARSE_PARAM
1164 #if (defined __STDC__ || defined __C99__FUNC__ \
1165 || defined __cplusplus || defined _MSC_VER)
1167 yyparse (void *YYPARSE_PARAM
)
1170 yyparse (YYPARSE_PARAM
)
1171 void *YYPARSE_PARAM
;
1173 #else /* ! YYPARSE_PARAM */
1174 #if (defined __STDC__ || defined __C99__FUNC__ \
1175 || defined __cplusplus || defined _MSC_VER)
1189 /* Number of tokens to shift before error messages enabled. */
1191 /* Look-ahead token as an internal (translated) token number. */
1194 /* Buffer for error messages, and its allocated size. */
1196 char *yymsg
= yymsgbuf
;
1197 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1200 /* Three stacks and their tools:
1201 `yyss': related to states,
1202 `yyvs': related to semantic values,
1203 `yyls': related to locations.
1205 Refer to the stacks thru separate pointers, to allow yyoverflow
1206 to reallocate them elsewhere. */
1208 /* The state stack. */
1209 yytype_int16 yyssa
[YYINITDEPTH
];
1210 yytype_int16
*yyss
= yyssa
;
1211 yytype_int16
*yyssp
;
1213 /* The semantic value stack. */
1214 YYSTYPE yyvsa
[YYINITDEPTH
];
1215 YYSTYPE
*yyvs
= yyvsa
;
1220 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1222 YYSIZE_T yystacksize
= YYINITDEPTH
;
1224 /* The variables used to return semantic value and location from the
1229 /* The number of symbols on the RHS of the reduced rule.
1230 Keep to zero when no symbol should be popped. */
1233 YYDPRINTF ((stderr
, "Starting parse\n"));
1238 yychar
= YYEMPTY
; /* Cause a token to be read. */
1240 /* Initialize stack pointers.
1241 Waste one element of value and location stack
1242 so that they stay on the same level as the state stack.
1243 The wasted elements are never initialized. */
1250 /*------------------------------------------------------------.
1251 | yynewstate -- Push a new state, which is found in yystate. |
1252 `------------------------------------------------------------*/
1254 /* In all cases, when you get here, the value and location stacks
1255 have just been pushed. So pushing a state here evens the stacks. */
1261 if (yyss
+ yystacksize
- 1 <= yyssp
)
1263 /* Get the current used size of the three stacks, in elements. */
1264 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1268 /* Give user a chance to reallocate the stack. Use copies of
1269 these so that the &'s don't force the real ones into
1271 YYSTYPE
*yyvs1
= yyvs
;
1272 yytype_int16
*yyss1
= yyss
;
1275 /* Each stack pointer address is followed by the size of the
1276 data in use in that stack, in bytes. This used to be a
1277 conditional around just the two extra args, but that might
1278 be undefined if yyoverflow is a macro. */
1279 yyoverflow (YY_("memory exhausted"),
1280 &yyss1
, yysize
* sizeof (*yyssp
),
1281 &yyvs1
, yysize
* sizeof (*yyvsp
),
1288 #else /* no yyoverflow */
1289 # ifndef YYSTACK_RELOCATE
1290 goto yyexhaustedlab
;
1292 /* Extend the stack our own way. */
1293 if (YYMAXDEPTH
<= yystacksize
)
1294 goto yyexhaustedlab
;
1296 if (YYMAXDEPTH
< yystacksize
)
1297 yystacksize
= YYMAXDEPTH
;
1300 yytype_int16
*yyss1
= yyss
;
1301 union yyalloc
*yyptr
=
1302 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1304 goto yyexhaustedlab
;
1305 YYSTACK_RELOCATE (yyss
);
1306 YYSTACK_RELOCATE (yyvs
);
1308 # undef YYSTACK_RELOCATE
1310 YYSTACK_FREE (yyss1
);
1313 #endif /* no yyoverflow */
1315 yyssp
= yyss
+ yysize
- 1;
1316 yyvsp
= yyvs
+ yysize
- 1;
1319 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1320 (unsigned long int) yystacksize
));
1322 if (yyss
+ yystacksize
- 1 <= yyssp
)
1326 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1335 /* Do appropriate processing given the current state. Read a
1336 look-ahead token if we need one and don't already have one. */
1338 /* First try to decide what to do without reference to look-ahead token. */
1339 yyn
= yypact
[yystate
];
1340 if (yyn
== YYPACT_NINF
)
1343 /* Not known => get a look-ahead token if don't already have one. */
1345 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1346 if (yychar
== YYEMPTY
)
1348 YYDPRINTF ((stderr
, "Reading a token: "));
1352 if (yychar
<= YYEOF
)
1354 yychar
= yytoken
= YYEOF
;
1355 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1359 yytoken
= YYTRANSLATE (yychar
);
1360 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1363 /* If the proper action on seeing token YYTOKEN is to reduce or to
1364 detect an error, take that action. */
1366 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1371 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1380 /* Count tokens shifted since error; after three, turn off error
1385 /* Shift the look-ahead token. */
1386 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1388 /* Discard the shifted token unless it is eof. */
1389 if (yychar
!= YYEOF
)
1398 /*-----------------------------------------------------------.
1399 | yydefault -- do the default action for the current state. |
1400 `-----------------------------------------------------------*/
1402 yyn
= yydefact
[yystate
];
1408 /*-----------------------------.
1409 | yyreduce -- Do a reduction. |
1410 `-----------------------------*/
1412 /* yyn is the number of a rule to reduce with. */
1415 /* If YYLEN is nonzero, implement the default value of the action:
1418 Otherwise, the following line sets YYVAL to garbage.
1419 This behavior is undocumented and Bison
1420 users should not rely upon it. Assigning to YYVAL
1421 unconditionally makes the parser a bit smaller, and it avoids a
1422 GCC warning that YYVAL may be used uninitialized. */
1423 yyval
= yyvsp
[1-yylen
];
1426 YY_REDUCE_PRINT (yyn
);
1430 #line 69 "arparse.y"
1435 #line 78 "arparse.y"
1440 #line 94 "arparse.y"
1441 { ar_end(); return 0; }
1445 #line 96 "arparse.y"
1450 #line 103 "arparse.y"
1451 { ar_extract((yyvsp
[(2) - (2)].list
)); }
1455 #line 108 "arparse.y"
1456 { ar_replace((yyvsp
[(2) - (2)].list
)); }
1460 #line 113 "arparse.y"
1465 #line 118 "arparse.y"
1466 { ar_delete((yyvsp
[(2) - (2)].list
)); }
1470 #line 122 "arparse.y"
1471 { ar_addmod((yyvsp
[(2) - (2)].list
)); }
1475 #line 127 "arparse.y"
1480 #line 132 "arparse.y"
1485 #line 139 "arparse.y"
1486 { ar_open((yyvsp
[(2) - (2)].name
),0); }
1490 #line 144 "arparse.y"
1491 { ar_open((yyvsp
[(2) - (2)].name
),1); }
1495 #line 150 "arparse.y"
1496 { ar_addlib((yyvsp
[(2) - (3)].name
),(yyvsp
[(3) - (3)].list
)); }
1500 #line 154 "arparse.y"
1501 { ar_directory((yyvsp
[(2) - (4)].name
), (yyvsp
[(3) - (4)].list
), (yyvsp
[(4) - (4)].name
)); }
1505 #line 161 "arparse.y"
1506 { (yyval
.name
) = (yyvsp
[(1) - (1)].name
); }
1510 #line 162 "arparse.y"
1511 { (yyval
.name
) = 0; }
1515 #line 167 "arparse.y"
1516 { (yyval
.list
) = (yyvsp
[(2) - (3)].list
); }
1520 #line 169 "arparse.y"
1521 { (yyval
.list
) = 0; }
1525 #line 174 "arparse.y"
1526 { struct list
*n
= (struct list
*) malloc(sizeof(struct list
));
1527 n
->next
= (yyvsp
[(1) - (3)].list
);
1528 n
->name
= (yyvsp
[(3) - (3)].name
);
1534 #line 179 "arparse.y"
1535 { (yyval
.list
) = 0; }
1539 #line 191 "arparse.y"
1540 { verbose
= !verbose
; }
1544 /* Line 1267 of yacc.c. */
1545 #line 1546 "arparse.c"
1548 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
1552 YY_STACK_PRINT (yyss
, yyssp
);
1557 /* Now `shift' the result of the reduction. Determine what state
1558 that goes to, based on the state we popped back to and the rule
1559 number reduced by. */
1563 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1564 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1565 yystate
= yytable
[yystate
];
1567 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1572 /*------------------------------------.
1573 | yyerrlab -- here on detecting error |
1574 `------------------------------------*/
1576 /* If not already recovering from an error, report this error. */
1580 #if ! YYERROR_VERBOSE
1581 yyerror (YY_("syntax error"));
1584 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
1585 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
1587 YYSIZE_T yyalloc
= 2 * yysize
;
1588 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
1589 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
1590 if (yymsg
!= yymsgbuf
)
1591 YYSTACK_FREE (yymsg
);
1592 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
1594 yymsg_alloc
= yyalloc
;
1598 yymsg_alloc
= sizeof yymsgbuf
;
1602 if (0 < yysize
&& yysize
<= yymsg_alloc
)
1604 (void) yysyntax_error (yymsg
, yystate
, yychar
);
1609 yyerror (YY_("syntax error"));
1611 goto yyexhaustedlab
;
1619 if (yyerrstatus
== 3)
1621 /* If just tried and failed to reuse look-ahead token after an
1622 error, discard it. */
1624 if (yychar
<= YYEOF
)
1626 /* Return failure if at end of input. */
1627 if (yychar
== YYEOF
)
1632 yydestruct ("Error: discarding",
1638 /* Else will try to reuse look-ahead token after shifting the error
1643 /*---------------------------------------------------.
1644 | yyerrorlab -- error raised explicitly by YYERROR. |
1645 `---------------------------------------------------*/
1648 /* Pacify compilers like GCC when the user code never invokes
1649 YYERROR and the label yyerrorlab therefore never appears in user
1651 if (/*CONSTCOND*/ 0)
1654 /* Do not reclaim the symbols of the rule which action triggered
1658 YY_STACK_PRINT (yyss
, yyssp
);
1663 /*-------------------------------------------------------------.
1664 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1665 `-------------------------------------------------------------*/
1667 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1671 yyn
= yypact
[yystate
];
1672 if (yyn
!= YYPACT_NINF
)
1675 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1683 /* Pop the current state because it cannot handle the error token. */
1688 yydestruct ("Error: popping",
1689 yystos
[yystate
], yyvsp
);
1692 YY_STACK_PRINT (yyss
, yyssp
);
1701 /* Shift the error token. */
1702 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
1708 /*-------------------------------------.
1709 | yyacceptlab -- YYACCEPT comes here. |
1710 `-------------------------------------*/
1715 /*-----------------------------------.
1716 | yyabortlab -- YYABORT comes here. |
1717 `-----------------------------------*/
1723 /*-------------------------------------------------.
1724 | yyexhaustedlab -- memory exhaustion comes here. |
1725 `-------------------------------------------------*/
1727 yyerror (YY_("memory exhausted"));
1733 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
1734 yydestruct ("Cleanup: discarding lookahead",
1736 /* Do not reclaim the symbols of the rule which action triggered
1737 this YYABORT or YYACCEPT. */
1739 YY_STACK_PRINT (yyss
, yyssp
);
1740 while (yyssp
!= yyss
)
1742 yydestruct ("Cleanup: popping",
1743 yystos
[*yyssp
], yyvsp
);
1748 YYSTACK_FREE (yyss
);
1751 if (yymsg
!= yymsgbuf
)
1752 YYSTACK_FREE (yymsg
);
1754 /* Make sure YYID is used. */
1755 return YYID (yyresult
);
1759 #line 195 "arparse.y"
1763 yyerror (const char *x ATTRIBUTE_UNUSED
)
1765 extern int linenumber
;
1767 printf (_("Syntax error in archive script, line %d\n"), linenumber
+ 1);