1 /* A Bison parser, made by GNU Bison 3.0.4. */ 2 3 /* Bison implementation for Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989-1990, 2000-2015 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.4" 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-2018 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 YYCASE_(0, YY_("syntax error")); 1000 YYCASE_(1, YY_("syntax error, unexpected %s")); 1001 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 1002 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 1003 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 1004 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 1005 # undef YYCASE_ 1006 } 1007 1008 { 1009 YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 1010 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1011 return 2; 1012 yysize = yysize1; 1013 } 1014 1015 if (*yymsg_alloc < yysize) 1016 { 1017 *yymsg_alloc = 2 * yysize; 1018 if (! (yysize <= *yymsg_alloc 1019 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 1020 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 1021 return 1; 1022 } 1023 1024 /* Avoid sprintf, as that infringes on the user's name space. 1025 Don't have undefined behavior even if the translation 1026 produced a string with the wrong number of "%s"s. */ 1027 { 1028 char *yyp = *yymsg; 1029 int yyi = 0; 1030 while ((*yyp = *yyformat) != '\0') 1031 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 1032 { 1033 yyp += yytnamerr (yyp, yyarg[yyi++]); 1034 yyformat += 2; 1035 } 1036 else 1037 { 1038 yyp++; 1039 yyformat++; 1040 } 1041 } 1042 return 0; 1043 } 1044 #endif /* YYERROR_VERBOSE */ 1045 1046 /*-----------------------------------------------. 1047 | Release the memory associated to this symbol. | 1048 `-----------------------------------------------*/ 1049 1050 static void 1051 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1052 { 1053 YYUSE (yyvaluep); 1054 if (!yymsg) 1055 yymsg = "Deleting"; 1056 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1057 1058 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1059 YYUSE (yytype); 1060 YY_IGNORE_MAYBE_UNINITIALIZED_END 1061 } 1062 1063 1064 1065 1066 /* The lookahead symbol. */ 1067 int yychar; 1068 1069 /* The semantic value of the lookahead symbol. */ 1070 YYSTYPE yylval; 1071 /* Number of syntax errors so far. */ 1072 int yynerrs; 1073 1074 1075 /*----------. 1076 | yyparse. | 1077 `----------*/ 1078 1079 int 1080 yyparse (void) 1081 { 1082 int yystate; 1083 /* Number of tokens to shift before error messages enabled. */ 1084 int yyerrstatus; 1085 1086 /* The stacks and their tools: 1087 'yyss': related to states. 1088 'yyvs': related to semantic values. 1089 1090 Refer to the stacks through separate pointers, to allow yyoverflow 1091 to reallocate them elsewhere. */ 1092 1093 /* The state stack. */ 1094 yytype_int16 yyssa[YYINITDEPTH]; 1095 yytype_int16 *yyss; 1096 yytype_int16 *yyssp; 1097 1098 /* The semantic value stack. */ 1099 YYSTYPE yyvsa[YYINITDEPTH]; 1100 YYSTYPE *yyvs; 1101 YYSTYPE *yyvsp; 1102 1103 YYSIZE_T yystacksize; 1104 1105 int yyn; 1106 int yyresult; 1107 /* Lookahead token as an internal (translated) token number. */ 1108 int yytoken = 0; 1109 /* The variables used to return semantic value and location from the 1110 action routines. */ 1111 YYSTYPE yyval; 1112 1113 #if YYERROR_VERBOSE 1114 /* Buffer for error messages, and its allocated size. */ 1115 char yymsgbuf[128]; 1116 char *yymsg = yymsgbuf; 1117 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1118 #endif 1119 1120 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1121 1122 /* The number of symbols on the RHS of the reduced rule. 1123 Keep to zero when no symbol should be popped. */ 1124 int yylen = 0; 1125 1126 yyssp = yyss = yyssa; 1127 yyvsp = yyvs = yyvsa; 1128 yystacksize = YYINITDEPTH; 1129 1130 YYDPRINTF ((stderr, "Starting parse\n")); 1131 1132 yystate = 0; 1133 yyerrstatus = 0; 1134 yynerrs = 0; 1135 yychar = YYEMPTY; /* Cause a token to be read. */ 1136 goto yysetstate; 1137 1138 /*------------------------------------------------------------. 1139 | yynewstate -- Push a new state, which is found in yystate. | 1140 `------------------------------------------------------------*/ 1141 yynewstate: 1142 /* In all cases, when you get here, the value and location stacks 1143 have just been pushed. So pushing a state here evens the stacks. */ 1144 yyssp++; 1145 1146 yysetstate: 1147 *yyssp = yystate; 1148 1149 if (yyss + yystacksize - 1 <= yyssp) 1150 { 1151 /* Get the current used size of the three stacks, in elements. */ 1152 YYSIZE_T yysize = yyssp - yyss + 1; 1153 1154 #ifdef yyoverflow 1155 { 1156 /* Give user a chance to reallocate the stack. Use copies of 1157 these so that the &'s don't force the real ones into 1158 memory. */ 1159 YYSTYPE *yyvs1 = yyvs; 1160 yytype_int16 *yyss1 = yyss; 1161 1162 /* Each stack pointer address is followed by the size of the 1163 data in use in that stack, in bytes. This used to be a 1164 conditional around just the two extra args, but that might 1165 be undefined if yyoverflow is a macro. */ 1166 yyoverflow (YY_("memory exhausted"), 1167 &yyss1, yysize * sizeof (*yyssp), 1168 &yyvs1, yysize * sizeof (*yyvsp), 1169 &yystacksize); 1170 1171 yyss = yyss1; 1172 yyvs = yyvs1; 1173 } 1174 #else /* no yyoverflow */ 1175 # ifndef YYSTACK_RELOCATE 1176 goto yyexhaustedlab; 1177 # else 1178 /* Extend the stack our own way. */ 1179 if (YYMAXDEPTH <= yystacksize) 1180 goto yyexhaustedlab; 1181 yystacksize *= 2; 1182 if (YYMAXDEPTH < yystacksize) 1183 yystacksize = YYMAXDEPTH; 1184 1185 { 1186 yytype_int16 *yyss1 = yyss; 1187 union yyalloc *yyptr = 1188 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1189 if (! yyptr) 1190 goto yyexhaustedlab; 1191 YYSTACK_RELOCATE (yyss_alloc, yyss); 1192 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1193 # undef YYSTACK_RELOCATE 1194 if (yyss1 != yyssa) 1195 YYSTACK_FREE (yyss1); 1196 } 1197 # endif 1198 #endif /* no yyoverflow */ 1199 1200 yyssp = yyss + yysize - 1; 1201 yyvsp = yyvs + yysize - 1; 1202 1203 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1204 (unsigned long int) yystacksize)); 1205 1206 if (yyss + yystacksize - 1 <= yyssp) 1207 YYABORT; 1208 } 1209 1210 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1211 1212 if (yystate == YYFINAL) 1213 YYACCEPT; 1214 1215 goto yybackup; 1216 1217 /*-----------. 1218 | yybackup. | 1219 `-----------*/ 1220 yybackup: 1221 1222 /* Do appropriate processing given the current state. Read a 1223 lookahead token if we need one and don't already have one. */ 1224 1225 /* First try to decide what to do without reference to lookahead token. */ 1226 yyn = yypact[yystate]; 1227 if (yypact_value_is_default (yyn)) 1228 goto yydefault; 1229 1230 /* Not known => get a lookahead token if don't already have one. */ 1231 1232 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1233 if (yychar == YYEMPTY) 1234 { 1235 YYDPRINTF ((stderr, "Reading a token: ")); 1236 yychar = yylex (); 1237 } 1238 1239 if (yychar <= YYEOF) 1240 { 1241 yychar = yytoken = YYEOF; 1242 YYDPRINTF ((stderr, "Now at end of input.\n")); 1243 } 1244 else 1245 { 1246 yytoken = YYTRANSLATE (yychar); 1247 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1248 } 1249 1250 /* If the proper action on seeing token YYTOKEN is to reduce or to 1251 detect an error, take that action. */ 1252 yyn += yytoken; 1253 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1254 goto yydefault; 1255 yyn = yytable[yyn]; 1256 if (yyn <= 0) 1257 { 1258 if (yytable_value_is_error (yyn)) 1259 goto yyerrlab; 1260 yyn = -yyn; 1261 goto yyreduce; 1262 } 1263 1264 /* Count tokens shifted since error; after three, turn off error 1265 status. */ 1266 if (yyerrstatus) 1267 yyerrstatus--; 1268 1269 /* Shift the lookahead token. */ 1270 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1271 1272 /* Discard the shifted token. */ 1273 yychar = YYEMPTY; 1274 1275 yystate = yyn; 1276 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1277 *++yyvsp = yylval; 1278 YY_IGNORE_MAYBE_UNINITIALIZED_END 1279 1280 goto yynewstate; 1281 1282 1283 /*-----------------------------------------------------------. 1284 | yydefault -- do the default action for the current state. | 1285 `-----------------------------------------------------------*/ 1286 yydefault: 1287 yyn = yydefact[yystate]; 1288 if (yyn == 0) 1289 goto yyerrlab; 1290 goto yyreduce; 1291 1292 1293 /*-----------------------------. 1294 | yyreduce -- Do a reduction. | 1295 `-----------------------------*/ 1296 yyreduce: 1297 /* yyn is the number of a rule to reduce with. */ 1298 yylen = yyr2[yyn]; 1299 1300 /* If YYLEN is nonzero, implement the default value of the action: 1301 '$$ = $1'. 1302 1303 Otherwise, the following line sets YYVAL to garbage. 1304 This behavior is undocumented and Bison 1305 users should not rely upon it. Assigning to YYVAL 1306 unconditionally makes the parser a bit smaller, and it avoids a 1307 GCC warning that YYVAL may be used uninitialized. */ 1308 yyval = yyvsp[1-yylen]; 1309 1310 1311 YY_REDUCE_PRINT (yyn); 1312 switch (yyn) 1313 { 1314 case 2: 1315 #line 68 "arparse.y" /* yacc.c:1646 */ 1316 { prompt(); } 1317 #line 1318 "arparse.c" /* yacc.c:1646 */ 1318 break; 1319 1320 case 6: 1321 #line 77 "arparse.y" /* yacc.c:1646 */ 1322 { prompt(); } 1323 #line 1324 "arparse.c" /* yacc.c:1646 */ 1324 break; 1325 1326 case 19: 1327 #line 93 "arparse.y" /* yacc.c:1646 */ 1328 { ar_end(); return 0; } 1329 #line 1330 "arparse.c" /* yacc.c:1646 */ 1330 break; 1331 1332 case 21: 1333 #line 95 "arparse.y" /* yacc.c:1646 */ 1334 { yyerror("foo"); } 1335 #line 1336 "arparse.c" /* yacc.c:1646 */ 1336 break; 1337 1338 case 23: 1339 #line 102 "arparse.y" /* yacc.c:1646 */ 1340 { ar_extract((yyvsp[0].list)); } 1341 #line 1342 "arparse.c" /* yacc.c:1646 */ 1342 break; 1343 1344 case 24: 1345 #line 107 "arparse.y" /* yacc.c:1646 */ 1346 { ar_replace((yyvsp[0].list)); } 1347 #line 1348 "arparse.c" /* yacc.c:1646 */ 1348 break; 1349 1350 case 25: 1351 #line 112 "arparse.y" /* yacc.c:1646 */ 1352 { ar_clear(); } 1353 #line 1354 "arparse.c" /* yacc.c:1646 */ 1354 break; 1355 1356 case 26: 1357 #line 117 "arparse.y" /* yacc.c:1646 */ 1358 { ar_delete((yyvsp[0].list)); } 1359 #line 1360 "arparse.c" /* yacc.c:1646 */ 1360 break; 1361 1362 case 27: 1363 #line 121 "arparse.y" /* yacc.c:1646 */ 1364 { ar_addmod((yyvsp[0].list)); } 1365 #line 1366 "arparse.c" /* yacc.c:1646 */ 1366 break; 1367 1368 case 28: 1369 #line 126 "arparse.y" /* yacc.c:1646 */ 1370 { ar_list(); } 1371 #line 1372 "arparse.c" /* yacc.c:1646 */ 1372 break; 1373 1374 case 29: 1375 #line 131 "arparse.y" /* yacc.c:1646 */ 1376 { ar_save(); } 1377 #line 1378 "arparse.c" /* yacc.c:1646 */ 1378 break; 1379 1380 case 30: 1381 #line 138 "arparse.y" /* yacc.c:1646 */ 1382 { ar_open((yyvsp[0].name),0); } 1383 #line 1384 "arparse.c" /* yacc.c:1646 */ 1384 break; 1385 1386 case 31: 1387 #line 143 "arparse.y" /* yacc.c:1646 */ 1388 { ar_open((yyvsp[0].name),1); } 1389 #line 1390 "arparse.c" /* yacc.c:1646 */ 1390 break; 1391 1392 case 32: 1393 #line 149 "arparse.y" /* yacc.c:1646 */ 1394 { ar_addlib((yyvsp[-1].name),(yyvsp[0].list)); } 1395 #line 1396 "arparse.c" /* yacc.c:1646 */ 1396 break; 1397 1398 case 33: 1399 #line 153 "arparse.y" /* yacc.c:1646 */ 1400 { ar_directory((yyvsp[-2].name), (yyvsp[-1].list), (yyvsp[0].name)); } 1401 #line 1402 "arparse.c" /* yacc.c:1646 */ 1402 break; 1403 1404 case 34: 1405 #line 160 "arparse.y" /* yacc.c:1646 */ 1406 { (yyval.name) = (yyvsp[0].name); } 1407 #line 1408 "arparse.c" /* yacc.c:1646 */ 1408 break; 1409 1410 case 35: 1411 #line 161 "arparse.y" /* yacc.c:1646 */ 1412 { (yyval.name) = 0; } 1413 #line 1414 "arparse.c" /* yacc.c:1646 */ 1414 break; 1415 1416 case 36: 1417 #line 166 "arparse.y" /* yacc.c:1646 */ 1418 { (yyval.list) = (yyvsp[-1].list); } 1419 #line 1420 "arparse.c" /* yacc.c:1646 */ 1420 break; 1421 1422 case 37: 1423 #line 168 "arparse.y" /* yacc.c:1646 */ 1424 { (yyval.list) = 0; } 1425 #line 1426 "arparse.c" /* yacc.c:1646 */ 1426 break; 1427 1428 case 38: 1429 #line 173 "arparse.y" /* yacc.c:1646 */ 1430 { struct list *n = (struct list *) malloc(sizeof(struct list)); 1431 n->next = (yyvsp[-2].list); 1432 n->name = (yyvsp[0].name); 1433 (yyval.list) = n; 1434 } 1435 #line 1436 "arparse.c" /* yacc.c:1646 */ 1436 break; 1437 1438 case 39: 1439 #line 178 "arparse.y" /* yacc.c:1646 */ 1440 { (yyval.list) = 0; } 1441 #line 1442 "arparse.c" /* yacc.c:1646 */ 1442 break; 1443 1444 case 42: 1445 #line 190 "arparse.y" /* yacc.c:1646 */ 1446 { verbose = !verbose; } 1447 #line 1448 "arparse.c" /* yacc.c:1646 */ 1448 break; 1449 1450 1451 #line 1452 "arparse.c" /* yacc.c:1646 */ 1452 default: break; 1453 } 1454 /* User semantic actions sometimes alter yychar, and that requires 1455 that yytoken be updated with the new translation. We take the 1456 approach of translating immediately before every use of yytoken. 1457 One alternative is translating here after every semantic action, 1458 but that translation would be missed if the semantic action invokes 1459 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 1460 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 1461 incorrect destructor might then be invoked immediately. In the 1462 case of YYERROR or YYBACKUP, subsequent parser actions might lead 1463 to an incorrect destructor call or verbose syntax error message 1464 before the lookahead is translated. */ 1465 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1466 1467 YYPOPSTACK (yylen); 1468 yylen = 0; 1469 YY_STACK_PRINT (yyss, yyssp); 1470 1471 *++yyvsp = yyval; 1472 1473 /* Now 'shift' the result of the reduction. Determine what state 1474 that goes to, based on the state we popped back to and the rule 1475 number reduced by. */ 1476 1477 yyn = yyr1[yyn]; 1478 1479 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 1480 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1481 yystate = yytable[yystate]; 1482 else 1483 yystate = yydefgoto[yyn - YYNTOKENS]; 1484 1485 goto yynewstate; 1486 1487 1488 /*--------------------------------------. 1489 | yyerrlab -- here on detecting error. | 1490 `--------------------------------------*/ 1491 yyerrlab: 1492 /* Make sure we have latest lookahead translation. See comments at 1493 user semantic actions for why this is necessary. */ 1494 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 1495 1496 /* If not already recovering from an error, report this error. */ 1497 if (!yyerrstatus) 1498 { 1499 ++yynerrs; 1500 #if ! YYERROR_VERBOSE 1501 yyerror (YY_("syntax error")); 1502 #else 1503 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 1504 yyssp, yytoken) 1505 { 1506 char const *yymsgp = YY_("syntax error"); 1507 int yysyntax_error_status; 1508 yysyntax_error_status = YYSYNTAX_ERROR; 1509 if (yysyntax_error_status == 0) 1510 yymsgp = yymsg; 1511 else if (yysyntax_error_status == 1) 1512 { 1513 if (yymsg != yymsgbuf) 1514 YYSTACK_FREE (yymsg); 1515 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 1516 if (!yymsg) 1517 { 1518 yymsg = yymsgbuf; 1519 yymsg_alloc = sizeof yymsgbuf; 1520 yysyntax_error_status = 2; 1521 } 1522 else 1523 { 1524 yysyntax_error_status = YYSYNTAX_ERROR; 1525 yymsgp = yymsg; 1526 } 1527 } 1528 yyerror (yymsgp); 1529 if (yysyntax_error_status == 2) 1530 goto yyexhaustedlab; 1531 } 1532 # undef YYSYNTAX_ERROR 1533 #endif 1534 } 1535 1536 1537 1538 if (yyerrstatus == 3) 1539 { 1540 /* If just tried and failed to reuse lookahead token after an 1541 error, discard it. */ 1542 1543 if (yychar <= YYEOF) 1544 { 1545 /* Return failure if at end of input. */ 1546 if (yychar == YYEOF) 1547 YYABORT; 1548 } 1549 else 1550 { 1551 yydestruct ("Error: discarding", 1552 yytoken, &yylval); 1553 yychar = YYEMPTY; 1554 } 1555 } 1556 1557 /* Else will try to reuse lookahead token after shifting the error 1558 token. */ 1559 goto yyerrlab1; 1560 1561 1562 /*---------------------------------------------------. 1563 | yyerrorlab -- error raised explicitly by YYERROR. | 1564 `---------------------------------------------------*/ 1565 yyerrorlab: 1566 1567 /* Pacify compilers like GCC when the user code never invokes 1568 YYERROR and the label yyerrorlab therefore never appears in user 1569 code. */ 1570 if (/*CONSTCOND*/ 0) 1571 goto yyerrorlab; 1572 1573 /* Do not reclaim the symbols of the rule whose action triggered 1574 this YYERROR. */ 1575 YYPOPSTACK (yylen); 1576 yylen = 0; 1577 YY_STACK_PRINT (yyss, yyssp); 1578 yystate = *yyssp; 1579 goto yyerrlab1; 1580 1581 1582 /*-------------------------------------------------------------. 1583 | yyerrlab1 -- common code for both syntax error and YYERROR. | 1584 `-------------------------------------------------------------*/ 1585 yyerrlab1: 1586 yyerrstatus = 3; /* Each real token shifted decrements this. */ 1587 1588 for (;;) 1589 { 1590 yyn = yypact[yystate]; 1591 if (!yypact_value_is_default (yyn)) 1592 { 1593 yyn += YYTERROR; 1594 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 1595 { 1596 yyn = yytable[yyn]; 1597 if (0 < yyn) 1598 break; 1599 } 1600 } 1601 1602 /* Pop the current state because it cannot handle the error token. */ 1603 if (yyssp == yyss) 1604 YYABORT; 1605 1606 1607 yydestruct ("Error: popping", 1608 yystos[yystate], yyvsp); 1609 YYPOPSTACK (1); 1610 yystate = *yyssp; 1611 YY_STACK_PRINT (yyss, yyssp); 1612 } 1613 1614 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1615 *++yyvsp = yylval; 1616 YY_IGNORE_MAYBE_UNINITIALIZED_END 1617 1618 1619 /* Shift the error token. */ 1620 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 1621 1622 yystate = yyn; 1623 goto yynewstate; 1624 1625 1626 /*-------------------------------------. 1627 | yyacceptlab -- YYACCEPT comes here. | 1628 `-------------------------------------*/ 1629 yyacceptlab: 1630 yyresult = 0; 1631 goto yyreturn; 1632 1633 /*-----------------------------------. 1634 | yyabortlab -- YYABORT comes here. | 1635 `-----------------------------------*/ 1636 yyabortlab: 1637 yyresult = 1; 1638 goto yyreturn; 1639 1640 #if !defined yyoverflow || YYERROR_VERBOSE 1641 /*-------------------------------------------------. 1642 | yyexhaustedlab -- memory exhaustion comes here. | 1643 `-------------------------------------------------*/ 1644 yyexhaustedlab: 1645 yyerror (YY_("memory exhausted")); 1646 yyresult = 2; 1647 /* Fall through. */ 1648 #endif 1649 1650 yyreturn: 1651 if (yychar != YYEMPTY) 1652 { 1653 /* Make sure we have latest lookahead translation. See comments at 1654 user semantic actions for why this is necessary. */ 1655 yytoken = YYTRANSLATE (yychar); 1656 yydestruct ("Cleanup: discarding lookahead", 1657 yytoken, &yylval); 1658 } 1659 /* Do not reclaim the symbols of the rule whose action triggered 1660 this YYABORT or YYACCEPT. */ 1661 YYPOPSTACK (yylen); 1662 YY_STACK_PRINT (yyss, yyssp); 1663 while (yyssp != yyss) 1664 { 1665 yydestruct ("Cleanup: popping", 1666 yystos[*yyssp], yyvsp); 1667 YYPOPSTACK (1); 1668 } 1669 #ifndef yyoverflow 1670 if (yyss != yyssa) 1671 YYSTACK_FREE (yyss); 1672 #endif 1673 #if YYERROR_VERBOSE 1674 if (yymsg != yymsgbuf) 1675 YYSTACK_FREE (yymsg); 1676 #endif 1677 return yyresult; 1678 } 1679 #line 194 "arparse.y" /* yacc.c:1906 */ 1680 1681 1682 static int 1683 yyerror (const char *x ATTRIBUTE_UNUSED) 1684 { 1685 extern int linenumber; 1686 1687 printf (_("Syntax error in archive script, line %d\n"), linenumber + 1); 1688 return 0; 1689 } 1690