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