1 /* A Bison parser, made by GNU Bison 2.2a. */ 2 3 /* Skeleton implementation for Bison's Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 6 Free Software Foundation, Inc. 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 2, or (at your option) 11 any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 Boston, MA 02110-1301, USA. */ 22 23 /* As a special exception, you may create a larger work that contains 24 part or all of the Bison parser skeleton and distribute that work 25 under terms of your choice, so long as that work isn't itself a 26 parser generator using the skeleton or a modified version thereof 27 as a parser skeleton. Alternatively, if you modify or redistribute 28 the parser skeleton itself, you may (at your option) remove this 29 special exception, which will cause the skeleton and the resulting 30 Bison output files to be licensed under the GNU General Public 31 License without this special exception. 32 33 This special exception was added by the Free Software Foundation in 34 version 2.2 of Bison. */ 35 36 /* C LALR(1) parser skeleton written by Richard Stallman, by 37 simplifying the original so-called "semantic" parser. */ 38 39 /* All symbols defined below should begin with yy or YY, to avoid 40 infringing on user name space. This should be done even for local 41 variables, as they might otherwise be expanded by user macros. 42 There are some unavoidable exceptions within include files to 43 define necessary library symbols; they are noted "INFRINGES ON 44 USER NAME SPACE" below. */ 45 46 /* Identify Bison output. */ 47 #define YYBISON 1 48 49 /* Bison version. */ 50 #define YYBISON_VERSION "2.2a" 51 52 /* Skeleton name. */ 53 #define YYSKELETON_NAME "yacc.c" 54 55 /* Pure parsers. */ 56 #define YYPURE 1 57 58 /* Using locations. */ 59 #define YYLSP_NEEDED 1 60 61 /* Substitute the variable and function names. */ 62 #define yyparse gram_parse 63 #define yylex gram_lex 64 #define yyerror gram_error 65 #define yylval gram_lval 66 #define yychar gram_char 67 #define yydebug gram_debug 68 #define yynerrs gram_nerrs 69 #define yylloc gram_lloc 70 71 /* Tokens. */ 72 #ifndef YYTOKENTYPE 73 # define YYTOKENTYPE 74 /* Put the tokens into the symbol table, so that GDB and other debuggers 75 know about them. */ 76 enum yytokentype { 77 GRAM_EOF = 0, 78 STRING = 258, 79 INT = 259, 80 PERCENT_TOKEN = 260, 81 PERCENT_NTERM = 261, 82 PERCENT_TYPE = 262, 83 PERCENT_DESTRUCTOR = 263, 84 PERCENT_PRINTER = 264, 85 PERCENT_UNION = 265, 86 PERCENT_LEFT = 266, 87 PERCENT_RIGHT = 267, 88 PERCENT_NONASSOC = 268, 89 PERCENT_PREC = 269, 90 PERCENT_DPREC = 270, 91 PERCENT_MERGE = 271, 92 PERCENT_DEBUG = 272, 93 PERCENT_DEFAULT_PREC = 273, 94 PERCENT_DEFINE = 274, 95 PERCENT_DEFINES = 275, 96 PERCENT_ERROR_VERBOSE = 276, 97 PERCENT_EXPECT = 277, 98 PERCENT_EXPECT_RR = 278, 99 PERCENT_FILE_PREFIX = 279, 100 PERCENT_GLR_PARSER = 280, 101 PERCENT_INITIAL_ACTION = 281, 102 PERCENT_LEX_PARAM = 282, 103 PERCENT_LOCATIONS = 283, 104 PERCENT_NAME_PREFIX = 284, 105 PERCENT_NO_DEFAULT_PREC = 285, 106 PERCENT_NO_LINES = 286, 107 PERCENT_NONDETERMINISTIC_PARSER = 287, 108 PERCENT_OUTPUT = 288, 109 PERCENT_PARSE_PARAM = 289, 110 PERCENT_PURE_PARSER = 290, 111 PERCENT_REQUIRE = 291, 112 PERCENT_SKELETON = 292, 113 PERCENT_START = 293, 114 PERCENT_TOKEN_TABLE = 294, 115 PERCENT_VERBOSE = 295, 116 PERCENT_YACC = 296, 117 TYPE = 297, 118 EQUAL = 298, 119 SEMICOLON = 299, 120 PIPE = 300, 121 ID = 301, 122 ID_COLON = 302, 123 PERCENT_PERCENT = 303, 124 PROLOGUE = 304, 125 EPILOGUE = 305, 126 BRACED_CODE = 306 127 }; 128 #endif 129 /* Tokens. */ 130 #define GRAM_EOF 0 131 #define STRING 258 132 #define INT 259 133 #define PERCENT_TOKEN 260 134 #define PERCENT_NTERM 261 135 #define PERCENT_TYPE 262 136 #define PERCENT_DESTRUCTOR 263 137 #define PERCENT_PRINTER 264 138 #define PERCENT_UNION 265 139 #define PERCENT_LEFT 266 140 #define PERCENT_RIGHT 267 141 #define PERCENT_NONASSOC 268 142 #define PERCENT_PREC 269 143 #define PERCENT_DPREC 270 144 #define PERCENT_MERGE 271 145 #define PERCENT_DEBUG 272 146 #define PERCENT_DEFAULT_PREC 273 147 #define PERCENT_DEFINE 274 148 #define PERCENT_DEFINES 275 149 #define PERCENT_ERROR_VERBOSE 276 150 #define PERCENT_EXPECT 277 151 #define PERCENT_EXPECT_RR 278 152 #define PERCENT_FILE_PREFIX 279 153 #define PERCENT_GLR_PARSER 280 154 #define PERCENT_INITIAL_ACTION 281 155 #define PERCENT_LEX_PARAM 282 156 #define PERCENT_LOCATIONS 283 157 #define PERCENT_NAME_PREFIX 284 158 #define PERCENT_NO_DEFAULT_PREC 285 159 #define PERCENT_NO_LINES 286 160 #define PERCENT_NONDETERMINISTIC_PARSER 287 161 #define PERCENT_OUTPUT 288 162 #define PERCENT_PARSE_PARAM 289 163 #define PERCENT_PURE_PARSER 290 164 #define PERCENT_REQUIRE 291 165 #define PERCENT_SKELETON 292 166 #define PERCENT_START 293 167 #define PERCENT_TOKEN_TABLE 294 168 #define PERCENT_VERBOSE 295 169 #define PERCENT_YACC 296 170 #define TYPE 297 171 #define EQUAL 298 172 #define SEMICOLON 299 173 #define PIPE 300 174 #define ID 301 175 #define ID_COLON 302 176 #define PERCENT_PERCENT 303 177 #define PROLOGUE 304 178 #define EPILOGUE 305 179 #define BRACED_CODE 306 180 181 182 183 184 /* Copy the first part of user declarations. */ 185 #line 1 "parse-gram.y" 186 /* Bison Grammar Parser -*- C -*- 187 188 Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 189 190 This file is part of Bison, the GNU Compiler Compiler. 191 192 This program is free software; you can redistribute it and/or modify 193 it under the terms of the GNU General Public License as published by 194 the Free Software Foundation; either version 2 of the License, or 195 (at your option) any later version. 196 197 This program is distributed in the hope that it will be useful, 198 but WITHOUT ANY WARRANTY; without even the implied warranty of 199 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 200 GNU General Public License for more details. 201 202 You should have received a copy of the GNU General Public License 203 along with this program; if not, write to the Free Software 204 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 205 02110-1301 USA 206 */ 207 208 #include <config.h> 209 #include "system.h" 210 211 #include "complain.h" 212 #include "conflicts.h" 213 #include "files.h" 214 #include "getargs.h" 215 #include "gram.h" 216 #include "muscle_tab.h" 217 #include "quotearg.h" 218 #include "reader.h" 219 #include "symlist.h" 220 #include "strverscmp.h" 221 222 #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N) 223 static YYLTYPE lloc_default (YYLTYPE const *, int); 224 225 #define YY_LOCATION_PRINT(File, Loc) \ 226 location_print (File, Loc) 227 228 static void version_check (location const *loc, char const *version); 229 230 /* Request detailed syntax error messages, and pass them to GRAM_ERROR. 231 FIXME: depends on the undocumented availability of YYLLOC. */ 232 #undef yyerror 233 #define yyerror(Msg) \ 234 gram_error (&yylloc, Msg) 235 static void gram_error (location const *, char const *); 236 237 static void add_param (char const *, char *, location); 238 239 static symbol_class current_class = unknown_sym; 240 static uniqstr current_type = 0; 241 static symbol *current_lhs; 242 static location current_lhs_location; 243 static int current_prec = 0; 244 245 #ifdef UINT_FAST8_MAX 246 # define YYTYPE_UINT8 uint_fast8_t 247 #endif 248 #ifdef INT_FAST8_MAX 249 # define YYTYPE_INT8 int_fast8_t 250 #endif 251 #ifdef UINT_FAST16_MAX 252 # define YYTYPE_UINT16 uint_fast16_t 253 #endif 254 #ifdef INT_FAST16_MAX 255 # define YYTYPE_INT16 int_fast16_t 256 #endif 257 258 259 /* Enabling traces. */ 260 #ifndef YYDEBUG 261 # define YYDEBUG 1 262 #endif 263 264 /* Enabling verbose error messages. */ 265 #ifdef YYERROR_VERBOSE 266 # undef YYERROR_VERBOSE 267 # define YYERROR_VERBOSE 1 268 #else 269 # define YYERROR_VERBOSE 1 270 #endif 271 272 /* Enabling the token table. */ 273 #ifndef YYTOKEN_TABLE 274 # define YYTOKEN_TABLE 0 275 #endif 276 277 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 278 typedef union YYSTYPE 279 #line 94 "parse-gram.y" 280 { 281 symbol *symbol; 282 symbol_list *list; 283 int integer; 284 char *chars; 285 assoc assoc; 286 uniqstr uniqstr; 287 } 288 /* Line 193 of yacc.c. */ 289 #line 290 "parse-gram.c" 290 YYSTYPE; 291 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 292 # define YYSTYPE_IS_DECLARED 1 293 # define YYSTYPE_IS_TRIVIAL 1 294 #endif 295 296 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED 297 typedef struct YYLTYPE 298 { 299 int first_line; 300 int first_column; 301 int last_line; 302 int last_column; 303 } YYLTYPE; 304 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ 305 # define YYLTYPE_IS_DECLARED 1 306 # define YYLTYPE_IS_TRIVIAL 1 307 #endif 308 309 310 /* Copy the second part of user declarations. */ 311 312 313 /* Line 216 of yacc.c. */ 314 #line 315 "parse-gram.c" 315 316 #ifdef short 317 # undef short 318 #endif 319 320 #ifdef YYTYPE_UINT8 321 typedef YYTYPE_UINT8 yytype_uint8; 322 #else 323 typedef unsigned char yytype_uint8; 324 #endif 325 326 #ifdef YYTYPE_INT8 327 typedef YYTYPE_INT8 yytype_int8; 328 #elif (defined __STDC__ || defined __C99__FUNC__ \ 329 || defined __cplusplus || defined _MSC_VER) 330 typedef signed char yytype_int8; 331 #else 332 typedef short int yytype_int8; 333 #endif 334 335 #ifdef YYTYPE_UINT16 336 typedef YYTYPE_UINT16 yytype_uint16; 337 #else 338 typedef unsigned short int yytype_uint16; 339 #endif 340 341 #ifdef YYTYPE_INT16 342 typedef YYTYPE_INT16 yytype_int16; 343 #else 344 typedef short int yytype_int16; 345 #endif 346 347 #ifndef YYSIZE_T 348 # ifdef __SIZE_TYPE__ 349 # define YYSIZE_T __SIZE_TYPE__ 350 # elif defined size_t 351 # define YYSIZE_T size_t 352 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 353 || defined __cplusplus || defined _MSC_VER) 354 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 355 # define YYSIZE_T size_t 356 # else 357 # define YYSIZE_T unsigned int 358 # endif 359 #endif 360 361 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 362 363 #ifndef YY_ 364 # if YYENABLE_NLS 365 # if ENABLE_NLS 366 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 367 # define YY_(msgid) dgettext ("bison-runtime", msgid) 368 # endif 369 # endif 370 # ifndef YY_ 371 # define YY_(msgid) msgid 372 # endif 373 #endif 374 375 /* Suppress unused-variable warnings by "using" E. */ 376 #if ! defined lint || defined __GNUC__ 377 # define YYUSE(e) ((void) (e)) 378 #else 379 # define YYUSE(e) /* empty */ 380 #endif 381 382 /* Identity function, used to suppress warnings about constant conditions. */ 383 #ifndef lint 384 # define YYID(n) (n) 385 #else 386 #if (defined __STDC__ || defined __C99__FUNC__ \ 387 || defined __cplusplus || defined _MSC_VER) 388 static int 389 YYID (int i) 390 #else 391 static int 392 YYID (i) 393 int i; 394 #endif 395 { 396 return i; 397 } 398 #endif 399 400 #if ! defined yyoverflow || YYERROR_VERBOSE 401 402 /* The parser invokes alloca or malloc; define the necessary symbols. */ 403 404 # ifdef YYSTACK_USE_ALLOCA 405 # if YYSTACK_USE_ALLOCA 406 # ifdef __GNUC__ 407 # define YYSTACK_ALLOC __builtin_alloca 408 # elif defined __BUILTIN_VA_ARG_INCR 409 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 410 # elif defined _AIX 411 # define YYSTACK_ALLOC __alloca 412 # elif defined _MSC_VER 413 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 414 # define alloca _alloca 415 # else 416 # define YYSTACK_ALLOC alloca 417 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 418 || defined __cplusplus || defined _MSC_VER) 419 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 420 # ifndef _STDLIB_H 421 # define _STDLIB_H 1 422 # endif 423 # endif 424 # endif 425 # endif 426 # endif 427 428 # ifdef YYSTACK_ALLOC 429 /* Pacify GCC's `empty if-body' warning. */ 430 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 431 # ifndef YYSTACK_ALLOC_MAXIMUM 432 /* The OS might guarantee only one guard page at the bottom of the stack, 433 and a page size can be as small as 4096 bytes. So we cannot safely 434 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 435 to allow for a few compiler-allocated temporary stack slots. */ 436 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 437 # endif 438 # else 439 # define YYSTACK_ALLOC YYMALLOC 440 # define YYSTACK_FREE YYFREE 441 # ifndef YYSTACK_ALLOC_MAXIMUM 442 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 443 # endif 444 # if (defined __cplusplus && ! defined _STDLIB_H \ 445 && ! ((defined YYMALLOC || defined malloc) \ 446 && (defined YYFREE || defined free))) 447 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 448 # ifndef _STDLIB_H 449 # define _STDLIB_H 1 450 # endif 451 # endif 452 # ifndef YYMALLOC 453 # define YYMALLOC malloc 454 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 455 || defined __cplusplus || defined _MSC_VER) 456 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 457 # endif 458 # endif 459 # ifndef YYFREE 460 # define YYFREE free 461 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 462 || defined __cplusplus || defined _MSC_VER) 463 void free (void *); /* INFRINGES ON USER NAME SPACE */ 464 # endif 465 # endif 466 # endif 467 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 468 469 470 #if (! defined yyoverflow \ 471 && (! defined __cplusplus \ 472 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ 473 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 474 475 /* A type that is properly aligned for any stack member. */ 476 union yyalloc 477 { 478 yytype_int16 yyss; 479 YYSTYPE yyvs; 480 YYLTYPE yyls; 481 }; 482 483 /* The size of the maximum gap between one aligned stack and the next. */ 484 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 485 486 /* The size of an array large to enough to hold all stacks, each with 487 N elements. */ 488 # define YYSTACK_BYTES(N) \ 489 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ 490 + 2 * YYSTACK_GAP_MAXIMUM) 491 492 /* Copy COUNT objects from FROM to TO. The source and destination do 493 not overlap. */ 494 # ifndef YYCOPY 495 # if defined __GNUC__ && 1 < __GNUC__ 496 # define YYCOPY(To, From, Count) \ 497 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 498 # else 499 # define YYCOPY(To, From, Count) \ 500 do \ 501 { \ 502 YYSIZE_T yyi; \ 503 for (yyi = 0; yyi < (Count); yyi++) \ 504 (To)[yyi] = (From)[yyi]; \ 505 } \ 506 while (YYID (0)) 507 # endif 508 # endif 509 510 /* Relocate STACK from its old location to the new one. The 511 local variables YYSIZE and YYSTACKSIZE give the old and new number of 512 elements in the stack, and YYPTR gives the new location of the 513 stack. Advance YYPTR to a properly aligned location for the next 514 stack. */ 515 # define YYSTACK_RELOCATE(Stack) \ 516 do \ 517 { \ 518 YYSIZE_T yynewbytes; \ 519 YYCOPY (&yyptr->Stack, Stack, yysize); \ 520 Stack = &yyptr->Stack; \ 521 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 522 yyptr += yynewbytes / sizeof (*yyptr); \ 523 } \ 524 while (YYID (0)) 525 526 #endif 527 528 /* YYFINAL -- State number of the termination state. */ 529 #define YYFINAL 3 530 /* YYLAST -- Last index in YYTABLE. */ 531 #define YYLAST 161 532 533 /* YYNTOKENS -- Number of terminals. */ 534 #define YYNTOKENS 52 535 /* YYNNTS -- Number of nonterminals. */ 536 #define YYNNTS 26 537 /* YYNRULES -- Number of rules. */ 538 #define YYNRULES 82 539 /* YYNRULES -- Number of states. */ 540 #define YYNSTATES 111 541 542 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 543 #define YYUNDEFTOK 2 544 #define YYMAXUTOK 306 545 546 #define YYTRANSLATE(YYX) \ 547 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 548 549 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 550 static const yytype_uint8 yytranslate[] = 551 { 552 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 577 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 578 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 579 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 580 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 581 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 582 45, 46, 47, 48, 49, 50, 51 583 }; 584 585 #if YYDEBUG 586 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 587 YYRHS. */ 588 static const yytype_uint8 yyprhs[] = 589 { 590 0, 0, 3, 8, 9, 12, 14, 16, 18, 21, 591 25, 27, 29, 32, 35, 39, 41, 43, 45, 47, 592 51, 53, 55, 59, 61, 63, 66, 69, 71, 73, 593 75, 77, 79, 81, 84, 86, 89, 92, 94, 96, 594 97, 101, 102, 106, 110, 114, 116, 118, 120, 121, 595 123, 125, 128, 130, 132, 135, 138, 142, 144, 147, 596 149, 152, 154, 157, 160, 161, 165, 167, 171, 174, 597 175, 178, 181, 185, 189, 193, 195, 197, 198, 201, 598 203, 205, 206 599 }; 600 601 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 602 static const yytype_int8 yyrhs[] = 603 { 604 53, 0, -1, 54, 48, 66, 77, -1, -1, 54, 605 55, -1, 56, -1, 49, -1, 17, -1, 19, 76, 606 -1, 19, 76, 76, -1, 20, -1, 21, -1, 22, 607 4, -1, 23, 4, -1, 24, 43, 76, -1, 25, 608 -1, 26, -1, 27, -1, 28, -1, 29, 43, 76, 609 -1, 31, -1, 32, -1, 33, 43, 76, -1, 34, 610 -1, 35, -1, 36, 76, -1, 37, 76, -1, 39, 611 -1, 40, -1, 41, -1, 44, -1, 60, -1, 57, 612 -1, 38, 72, -1, 10, -1, 8, 63, -1, 9, 613 63, -1, 18, -1, 30, -1, -1, 6, 58, 65, 614 -1, -1, 5, 59, 65, -1, 7, 42, 63, -1, 615 61, 62, 63, -1, 11, -1, 12, -1, 13, -1, 616 -1, 42, -1, 72, -1, 63, 72, -1, 42, -1, 617 46, -1, 46, 4, -1, 46, 75, -1, 46, 4, 618 75, -1, 64, -1, 65, 64, -1, 67, -1, 66, 619 67, -1, 68, -1, 56, 44, -1, 1, 44, -1, 620 -1, 47, 69, 70, -1, 71, -1, 70, 45, 71, 621 -1, 70, 44, -1, -1, 71, 72, -1, 71, 73, 622 -1, 71, 14, 72, -1, 71, 15, 4, -1, 71, 623 16, 42, -1, 46, -1, 75, -1, -1, 74, 51, 624 -1, 3, -1, 3, -1, -1, 48, 50, -1 625 }; 626 627 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 628 static const yytype_uint16 yyrline[] = 629 { 630 0, 202, 202, 210, 212, 216, 217, 218, 219, 224, 631 225, 226, 227, 228, 229, 230, 235, 239, 240, 241, 632 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 633 252, 256, 257, 258, 262, 278, 285, 292, 296, 303, 634 303, 308, 308, 313, 323, 338, 339, 340, 344, 345, 635 351, 352, 357, 361, 366, 372, 378, 389, 390, 399, 636 400, 406, 407, 408, 415, 415, 419, 420, 421, 426, 637 427, 429, 430, 432, 434, 439, 440, 456, 456, 462, 638 471, 476, 478 639 }; 640 #endif 641 642 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 643 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 644 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 645 static const char *const yytname[] = 646 { 647 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"", 648 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor {...}\"", 649 "\"%printer {...}\"", "\"%union {...}\"", "\"%left\"", "\"%right\"", 650 "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%debug\"", 651 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"", 652 "\"%expect\"", "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"", 653 "\"%initial-action {...}\"", "\"%lex-param {...}\"", "\"%locations\"", 654 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"", 655 "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param {...}\"", 656 "\"%pure-parser\"", "\"%require\"", "\"%skeleton\"", "\"%start\"", 657 "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"", 658 "\";\"", "\"|\"", "\"identifier\"", "\"identifier:\"", "\"%%\"", 659 "\"%{...%}\"", "\"epilogue\"", "\"{...}\"", "$accept", "input", 660 "declarations", "declaration", "grammar_declaration", 661 "symbol_declaration", "@1", "@2", "precedence_declaration", 662 "precedence_declarator", "type.opt", "symbols.1", "symbol_def", 663 "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules", 664 "@3", "rhses.1", "rhs", "symbol", "action", "@4", "string_as_id", 665 "string_content", "epilogue.opt", 0 666 }; 667 #endif 668 669 # ifdef YYPRINT 670 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 671 token YYLEX-NUM. */ 672 static const yytype_uint16 yytoknum[] = 673 { 674 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 675 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 676 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 677 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 678 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 679 305, 306 680 }; 681 # endif 682 683 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 684 static const yytype_uint8 yyr1[] = 685 { 686 0, 52, 53, 54, 54, 55, 55, 55, 55, 55, 687 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 688 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 689 55, 56, 56, 56, 56, 56, 56, 56, 56, 58, 690 57, 59, 57, 57, 60, 61, 61, 61, 62, 62, 691 63, 63, 64, 64, 64, 64, 64, 65, 65, 66, 692 66, 67, 67, 67, 69, 68, 70, 70, 70, 71, 693 71, 71, 71, 71, 71, 72, 72, 74, 73, 75, 694 76, 77, 77 695 }; 696 697 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 698 static const yytype_uint8 yyr2[] = 699 { 700 0, 2, 4, 0, 2, 1, 1, 1, 2, 3, 701 1, 1, 2, 2, 3, 1, 1, 1, 1, 3, 702 1, 1, 3, 1, 1, 2, 2, 1, 1, 1, 703 1, 1, 1, 2, 1, 2, 2, 1, 1, 0, 704 3, 0, 3, 3, 3, 1, 1, 1, 0, 1, 705 1, 2, 1, 1, 2, 2, 3, 1, 2, 1, 706 2, 1, 2, 2, 0, 3, 1, 3, 2, 0, 707 2, 2, 3, 3, 3, 1, 1, 0, 2, 1, 708 1, 0, 2 709 }; 710 711 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 712 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 713 means the default is an error. */ 714 static const yytype_uint8 yydefact[] = 715 { 716 3, 0, 0, 1, 41, 39, 0, 0, 0, 34, 717 45, 46, 47, 7, 37, 0, 10, 11, 0, 0, 718 0, 15, 16, 17, 18, 0, 38, 20, 21, 0, 719 23, 24, 0, 0, 0, 27, 28, 29, 30, 0, 720 6, 4, 5, 32, 31, 48, 0, 0, 0, 79, 721 75, 35, 50, 76, 36, 80, 8, 12, 13, 0, 722 0, 0, 25, 26, 33, 0, 64, 0, 0, 59, 723 61, 49, 0, 52, 53, 57, 42, 40, 43, 51, 724 9, 14, 19, 22, 63, 69, 62, 0, 60, 2, 725 44, 54, 55, 58, 65, 66, 82, 56, 68, 69, 726 0, 0, 0, 70, 71, 0, 67, 72, 73, 74, 727 78 728 }; 729 730 /* YYDEFGOTO[NTERM-NUM]. */ 731 static const yytype_int8 yydefgoto[] = 732 { 733 -1, 1, 2, 41, 67, 43, 47, 46, 44, 45, 734 72, 51, 75, 76, 68, 69, 70, 85, 94, 95, 735 52, 104, 105, 53, 56, 89 736 }; 737 738 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 739 STATE-NUM. */ 740 #define YYPACT_NINF -69 741 static const yytype_int8 yypact[] = 742 { 743 -69, 5, 112, -69, -69, -69, -35, 0, 0, -69, 744 -69, -69, -69, -69, -69, 13, -69, -69, 20, 31, 745 -18, -69, -69, -69, -69, -6, -69, -69, -69, -5, 746 -69, -69, 13, 13, 0, -69, -69, -69, -69, 69, 747 -69, -69, -69, -69, -69, -2, -38, -38, 0, -69, 748 -69, 0, -69, -69, 0, -69, 13, -69, -69, 13, 749 13, 13, -69, -69, -69, -8, -69, 3, 21, -69, 750 -69, -69, 0, -69, 6, -69, -38, -38, 0, -69, 751 -69, -69, -69, -69, -69, -69, -69, 2, -69, -69, 752 0, 39, -69, -69, -33, -1, -69, -69, -69, -69, 753 0, 44, 1, -69, -69, 4, -1, -69, -69, -69, 754 -69 755 }; 756 757 /* YYPGOTO[NTERM-NUM]. */ 758 static const yytype_int8 yypgoto[] = 759 { 760 -69, -69, -69, -69, 47, -69, -69, -69, -69, -69, 761 -69, -7, -58, 7, -69, -15, -69, -69, -69, -42, 762 -34, -69, -69, -68, 30, -69 763 }; 764 765 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 766 positive, shift that token. If negative, reduce the rule which 767 number is the opposite. If zero, do what YYDEFACT says. 768 If YYTABLE_NINF, syntax error. */ 769 #define YYTABLE_NINF -82 770 static const yytype_int8 yytable[] = 771 { 772 64, 54, 49, 49, 73, 3, 92, 48, 74, 49, 773 91, 98, 99, 100, 101, 102, 55, 79, 93, 93, 774 79, -81, 65, 97, 57, 59, 4, 5, 6, 7, 775 8, 9, 10, 11, 12, 58, 84, 60, 61, 14, 776 71, 78, 49, 109, 79, 50, 50, 86, 108, 42, 777 -77, 26, 96, 88, 77, 110, 79, 106, 0, 34, 778 0, 103, 62, 63, 0, 90, 107, 0, 66, 87, 779 65, 0, 103, 0, 4, 5, 6, 7, 8, 9, 780 10, 11, 12, 0, 0, 0, 80, 14, 0, 81, 781 82, 83, 0, 0, 0, 0, 0, 0, 0, 26, 782 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 783 0, 0, 0, 0, 0, 0, 66, 4, 5, 6, 784 7, 8, 9, 10, 11, 12, 0, 0, 0, 13, 785 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 786 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 787 34, 35, 36, 37, 0, 0, 38, 0, 0, 0, 788 39, 40 789 }; 790 791 static const yytype_int8 yycheck[] = 792 { 793 34, 8, 3, 3, 42, 0, 74, 42, 46, 3, 794 4, 44, 45, 14, 15, 16, 3, 51, 76, 77, 795 54, 0, 1, 91, 4, 43, 5, 6, 7, 8, 796 9, 10, 11, 12, 13, 4, 44, 43, 43, 18, 797 42, 48, 3, 42, 78, 46, 46, 44, 4, 2, 798 51, 30, 50, 68, 47, 51, 90, 99, -1, 38, 799 -1, 95, 32, 33, -1, 72, 100, -1, 47, 48, 800 1, -1, 106, -1, 5, 6, 7, 8, 9, 10, 801 11, 12, 13, -1, -1, -1, 56, 18, -1, 59, 802 60, 61, -1, -1, -1, -1, -1, -1, -1, 30, 803 -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, 804 -1, -1, -1, -1, -1, -1, 47, 5, 6, 7, 805 8, 9, 10, 11, 12, 13, -1, -1, -1, 17, 806 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 807 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 808 38, 39, 40, 41, -1, -1, 44, -1, -1, -1, 809 48, 49 810 }; 811 812 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 813 symbol of state STATE-NUM. */ 814 static const yytype_uint8 yystos[] = 815 { 816 0, 53, 54, 0, 5, 6, 7, 8, 9, 10, 817 11, 12, 13, 17, 18, 19, 20, 21, 22, 23, 818 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 819 34, 35, 36, 37, 38, 39, 40, 41, 44, 48, 820 49, 55, 56, 57, 60, 61, 59, 58, 42, 3, 821 46, 63, 72, 75, 63, 3, 76, 4, 4, 43, 822 43, 43, 76, 76, 72, 1, 47, 56, 66, 67, 823 68, 42, 62, 42, 46, 64, 65, 65, 63, 72, 824 76, 76, 76, 76, 44, 69, 44, 48, 67, 77, 825 63, 4, 75, 64, 70, 71, 50, 75, 44, 45, 826 14, 15, 16, 72, 73, 74, 71, 72, 4, 42, 827 51 828 }; 829 830 #define yyerrok (yyerrstatus = 0) 831 #define yyclearin (yychar = YYEMPTY) 832 #define YYEMPTY (-2) 833 #define YYEOF 0 834 835 #define YYACCEPT goto yyacceptlab 836 #define YYABORT goto yyabortlab 837 #define YYERROR goto yyerrorlab 838 839 840 /* Like YYERROR except do call yyerror. This remains here temporarily 841 to ease the transition to the new meaning of YYERROR, for GCC. 842 Once GCC version 2 has supplanted version 1, this can go. */ 843 844 #define YYFAIL goto yyerrlab 845 846 #define YYRECOVERING() (!!yyerrstatus) 847 848 #define YYBACKUP(Token, Value) \ 849 do \ 850 if (yychar == YYEMPTY && yylen == 1) \ 851 { \ 852 yychar = (Token); \ 853 yylval = (Value); \ 854 yytoken = YYTRANSLATE (yychar); \ 855 YYPOPSTACK (1); \ 856 goto yybackup; \ 857 } \ 858 else \ 859 { \ 860 yyerror (YY_("syntax error: cannot back up")); \ 861 YYERROR; \ 862 } \ 863 while (YYID (0)) 864 865 866 #define YYTERROR 1 867 #define YYERRCODE 256 868 869 870 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 871 If N is 0, then set CURRENT to the empty location which ends 872 the previous symbol: RHS[0] (always defined). */ 873 874 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 875 #ifndef YYLLOC_DEFAULT 876 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 877 do \ 878 if (YYID (N)) \ 879 { \ 880 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 881 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 882 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 883 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 884 } \ 885 else \ 886 { \ 887 (Current).first_line = (Current).last_line = \ 888 YYRHSLOC (Rhs, 0).last_line; \ 889 (Current).first_column = (Current).last_column = \ 890 YYRHSLOC (Rhs, 0).last_column; \ 891 } \ 892 while (YYID (0)) 893 #endif 894 895 896 /* YY_LOCATION_PRINT -- Print the location on the stream. 897 This macro was not mandated originally: define only if we know 898 we won't break user code: when these are the locations we know. */ 899 900 #ifndef YY_LOCATION_PRINT 901 # if YYLTYPE_IS_TRIVIAL 902 # define YY_LOCATION_PRINT(File, Loc) \ 903 fprintf (File, "%d.%d-%d.%d", \ 904 (Loc).first_line, (Loc).first_column, \ 905 (Loc).last_line, (Loc).last_column) 906 # else 907 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 908 # endif 909 #endif 910 911 912 /* YYLEX -- calling `yylex' with the right arguments. */ 913 914 #ifdef YYLEX_PARAM 915 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) 916 #else 917 # define YYLEX yylex (&yylval, &yylloc) 918 #endif 919 920 /* Enable debugging if requested. */ 921 #if YYDEBUG 922 923 # ifndef YYFPRINTF 924 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 925 # define YYFPRINTF fprintf 926 # endif 927 928 # define YYDPRINTF(Args) \ 929 do { \ 930 if (yydebug) \ 931 YYFPRINTF Args; \ 932 } while (YYID (0)) 933 934 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 935 do { \ 936 if (yydebug) \ 937 { \ 938 YYFPRINTF (stderr, "%s ", Title); \ 939 yy_symbol_print (stderr, \ 940 Type, Value, Location); \ 941 YYFPRINTF (stderr, "\n"); \ 942 } \ 943 } while (YYID (0)) 944 945 946 /*--------------------------------. 947 | Print this symbol on YYOUTPUT. | 948 `--------------------------------*/ 949 950 /*ARGSUSED*/ 951 #if (defined __STDC__ || defined __C99__FUNC__ \ 952 || defined __cplusplus || defined _MSC_VER) 953 static void 954 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) 955 #else 956 static void 957 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) 958 FILE *yyoutput; 959 int yytype; 960 YYSTYPE const * const yyvaluep; 961 YYLTYPE const * const yylocationp; 962 #endif 963 { 964 if (!yyvaluep) 965 return; 966 YYUSE (yylocationp); 967 # ifdef YYPRINT 968 if (yytype < YYNTOKENS) 969 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 970 # else 971 YYUSE (yyoutput); 972 # endif 973 switch (yytype) 974 { 975 case 3: /* "\"string\"" */ 976 #line 179 "parse-gram.y" 977 { fprintf (stderr, "\"%s\"", (yyvaluep->chars)); }; 978 #line 979 "parse-gram.c" 979 break; 980 case 4: /* "\"integer\"" */ 981 #line 192 "parse-gram.y" 982 { fprintf (stderr, "%d", (yyvaluep->integer)); }; 983 #line 984 "parse-gram.c" 984 break; 985 case 8: /* "\"%destructor {...}\"" */ 986 #line 181 "parse-gram.y" 987 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; 988 #line 989 "parse-gram.c" 989 break; 990 case 9: /* "\"%printer {...}\"" */ 991 #line 181 "parse-gram.y" 992 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; 993 #line 994 "parse-gram.c" 994 break; 995 case 10: /* "\"%union {...}\"" */ 996 #line 181 "parse-gram.y" 997 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; 998 #line 999 "parse-gram.c" 999 break; 1000 case 26: /* "\"%initial-action {...}\"" */ 1001 #line 181 "parse-gram.y" 1002 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; 1003 #line 1004 "parse-gram.c" 1004 break; 1005 case 27: /* "\"%lex-param {...}\"" */ 1006 #line 181 "parse-gram.y" 1007 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; 1008 #line 1009 "parse-gram.c" 1009 break; 1010 case 34: /* "\"%parse-param {...}\"" */ 1011 #line 181 "parse-gram.y" 1012 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; 1013 #line 1014 "parse-gram.c" 1014 break; 1015 case 42: /* "\"type\"" */ 1016 #line 190 "parse-gram.y" 1017 { fprintf (stderr, "<%s>", (yyvaluep->uniqstr)); }; 1018 #line 1019 "parse-gram.c" 1019 break; 1020 case 46: /* "\"identifier\"" */ 1021 #line 194 "parse-gram.y" 1022 { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; 1023 #line 1024 "parse-gram.c" 1024 break; 1025 case 47: /* "\"identifier:\"" */ 1026 #line 196 "parse-gram.y" 1027 { fprintf (stderr, "%s:", (yyvaluep->symbol)->tag); }; 1028 #line 1029 "parse-gram.c" 1029 break; 1030 case 49: /* "\"%{...%}\"" */ 1031 #line 181 "parse-gram.y" 1032 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; 1033 #line 1034 "parse-gram.c" 1034 break; 1035 case 50: /* "\"epilogue\"" */ 1036 #line 181 "parse-gram.y" 1037 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; 1038 #line 1039 "parse-gram.c" 1039 break; 1040 case 72: /* "symbol" */ 1041 #line 194 "parse-gram.y" 1042 { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; 1043 #line 1044 "parse-gram.c" 1044 break; 1045 case 75: /* "string_as_id" */ 1046 #line 194 "parse-gram.y" 1047 { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; 1048 #line 1049 "parse-gram.c" 1049 break; 1050 case 76: /* "string_content" */ 1051 #line 179 "parse-gram.y" 1052 { fprintf (stderr, "\"%s\"", (yyvaluep->chars)); }; 1053 #line 1054 "parse-gram.c" 1054 break; 1055 default: 1056 break; 1057 } 1058 } 1059 1060 1061 /*--------------------------------. 1062 | Print this symbol on YYOUTPUT. | 1063 `--------------------------------*/ 1064 1065 #if (defined __STDC__ || defined __C99__FUNC__ \ 1066 || defined __cplusplus || defined _MSC_VER) 1067 static void 1068 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) 1069 #else 1070 static void 1071 yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) 1072 FILE *yyoutput; 1073 int yytype; 1074 YYSTYPE const * const yyvaluep; 1075 YYLTYPE const * const yylocationp; 1076 #endif 1077 { 1078 if (yytype < YYNTOKENS) 1079 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 1080 else 1081 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 1082 1083 YY_LOCATION_PRINT (yyoutput, *yylocationp); 1084 YYFPRINTF (yyoutput, ": "); 1085 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); 1086 YYFPRINTF (yyoutput, ")"); 1087 } 1088 1089 /*------------------------------------------------------------------. 1090 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 1091 | TOP (included). | 1092 `------------------------------------------------------------------*/ 1093 1094 #if (defined __STDC__ || defined __C99__FUNC__ \ 1095 || defined __cplusplus || defined _MSC_VER) 1096 static void 1097 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) 1098 #else 1099 static void 1100 yy_stack_print (bottom, top) 1101 yytype_int16 *bottom; 1102 yytype_int16 *top; 1103 #endif 1104 { 1105 YYFPRINTF (stderr, "Stack now"); 1106 for (; bottom <= top; ++bottom) 1107 YYFPRINTF (stderr, " %d", *bottom); 1108 YYFPRINTF (stderr, "\n"); 1109 } 1110 1111 # define YY_STACK_PRINT(Bottom, Top) \ 1112 do { \ 1113 if (yydebug) \ 1114 yy_stack_print ((Bottom), (Top)); \ 1115 } while (YYID (0)) 1116 1117 1118 /*------------------------------------------------. 1119 | Report that the YYRULE is going to be reduced. | 1120 `------------------------------------------------*/ 1121 1122 #if (defined __STDC__ || defined __C99__FUNC__ \ 1123 || defined __cplusplus || defined _MSC_VER) 1124 static void 1125 yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) 1126 #else 1127 static void 1128 yy_reduce_print (yyvsp, yylsp, yyrule) 1129 YYSTYPE *yyvsp; 1130 YYLTYPE *yylsp; 1131 int yyrule; 1132 #endif 1133 { 1134 int yynrhs = yyr2[yyrule]; 1135 int yyi; 1136 unsigned long int yylno = yyrline[yyrule]; 1137 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 1138 yyrule - 1, yylno); 1139 /* The symbols being reduced. */ 1140 for (yyi = 0; yyi < yynrhs; yyi++) 1141 { 1142 fprintf (stderr, " $%d = ", yyi + 1); 1143 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 1144 &(yyvsp[(yyi + 1) - (yynrhs)]) 1145 , &(yylsp[(yyi + 1) - (yynrhs)]) ); 1146 fprintf (stderr, "\n"); 1147 } 1148 } 1149 1150 # define YY_REDUCE_PRINT(Rule) \ 1151 do { \ 1152 if (yydebug) \ 1153 yy_reduce_print (yyvsp, yylsp, Rule); \ 1154 } while (YYID (0)) 1155 1156 /* Nonzero means print parse trace. It is left uninitialized so that 1157 multiple parsers can coexist. */ 1158 int yydebug; 1159 #else /* !YYDEBUG */ 1160 # define YYDPRINTF(Args) 1161 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 1162 # define YY_STACK_PRINT(Bottom, Top) 1163 # define YY_REDUCE_PRINT(Rule) 1164 #endif /* !YYDEBUG */ 1165 1166 1167 /* YYINITDEPTH -- initial size of the parser's stacks. */ 1168 #ifndef YYINITDEPTH 1169 # define YYINITDEPTH 200 1170 #endif 1171 1172 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 1173 if the built-in stack extension method is used). 1174 1175 Do not make this value too large; the results are undefined if 1176 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 1177 evaluated with infinite-precision integer arithmetic. */ 1178 1179 #ifndef YYMAXDEPTH 1180 # define YYMAXDEPTH 10000 1181 #endif 1182 1183 1184 1186 #if YYERROR_VERBOSE 1187 1188 # ifndef yystrlen 1189 # if defined __GLIBC__ && defined _STRING_H 1190 # define yystrlen strlen 1191 # else 1192 /* Return the length of YYSTR. */ 1193 #if (defined __STDC__ || defined __C99__FUNC__ \ 1194 || defined __cplusplus || defined _MSC_VER) 1195 static YYSIZE_T 1196 yystrlen (const char *yystr) 1197 #else 1198 static YYSIZE_T 1199 yystrlen (yystr) 1200 const char *yystr; 1201 #endif 1202 { 1203 YYSIZE_T yylen; 1204 for (yylen = 0; yystr[yylen]; yylen++) 1205 continue; 1206 return yylen; 1207 } 1208 # endif 1209 # endif 1210 1211 # ifndef yystpcpy 1212 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 1213 # define yystpcpy stpcpy 1214 # else 1215 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1216 YYDEST. */ 1217 #if (defined __STDC__ || defined __C99__FUNC__ \ 1218 || defined __cplusplus || defined _MSC_VER) 1219 static char * 1220 yystpcpy (char *yydest, const char *yysrc) 1221 #else 1222 static char * 1223 yystpcpy (yydest, yysrc) 1224 char *yydest; 1225 const char *yysrc; 1226 #endif 1227 { 1228 char *yyd = yydest; 1229 const char *yys = yysrc; 1230 1231 while ((*yyd++ = *yys++) != '\0') 1232 continue; 1233 1234 return yyd - 1; 1235 } 1236 # endif 1237 # endif 1238 1239 # ifndef yytnamerr 1240 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 1241 quotes and backslashes, so that it's suitable for yyerror. The 1242 heuristic is that double-quoting is unnecessary unless the string 1243 contains an apostrophe, a comma, or backslash (other than 1244 backslash-backslash). YYSTR is taken from yytname. If YYRES is 1245 null, do not copy; instead, return the length of what the result 1246 would have been. */ 1247 static YYSIZE_T 1248 yytnamerr (char *yyres, const char *yystr) 1249 { 1250 if (*yystr == '"') 1251 { 1252 YYSIZE_T yyn = 0; 1253 char const *yyp = yystr; 1254 1255 for (;;) 1256 switch (*++yyp) 1257 { 1258 case '\'': 1259 case ',': 1260 goto do_not_strip_quotes; 1261 1262 case '\\': 1263 if (*++yyp != '\\') 1264 goto do_not_strip_quotes; 1265 /* Fall through. */ 1266 default: 1267 if (yyres) 1268 yyres[yyn] = *yyp; 1269 yyn++; 1270 break; 1271 1272 case '"': 1273 if (yyres) 1274 yyres[yyn] = '\0'; 1275 return yyn; 1276 } 1277 do_not_strip_quotes: ; 1278 } 1279 1280 if (! yyres) 1281 return yystrlen (yystr); 1282 1283 return yystpcpy (yyres, yystr) - yyres; 1284 } 1285 # endif 1286 1287 /* Copy into YYRESULT an error message about the unexpected token 1288 YYCHAR while in state YYSTATE. Return the number of bytes copied, 1289 including the terminating null byte. If YYRESULT is null, do not 1290 copy anything; just return the number of bytes that would be 1291 copied. As a special case, return 0 if an ordinary "syntax error" 1292 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 1293 size calculation. */ 1294 static YYSIZE_T 1295 yysyntax_error (char *yyresult, int yystate, int yychar) 1296 { 1297 int yyn = yypact[yystate]; 1298 1299 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 1300 return 0; 1301 else 1302 { 1303 int yytype = YYTRANSLATE (yychar); 1304 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 1305 YYSIZE_T yysize = yysize0; 1306 YYSIZE_T yysize1; 1307 int yysize_overflow = 0; 1308 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1309 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1310 int yyx; 1311 1312 # if 0 1313 /* This is so xgettext sees the translatable formats that are 1314 constructed on the fly. */ 1315 YY_("syntax error, unexpected %s"); 1316 YY_("syntax error, unexpected %s, expecting %s"); 1317 YY_("syntax error, unexpected %s, expecting %s or %s"); 1318 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 1319 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 1320 # endif 1321 char *yyfmt; 1322 char const *yyf; 1323 static char const yyunexpected[] = "syntax error, unexpected %s"; 1324 static char const yyexpecting[] = ", expecting %s"; 1325 static char const yyor[] = " or %s"; 1326 char yyformat[sizeof yyunexpected 1327 + sizeof yyexpecting - 1 1328 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 1329 * (sizeof yyor - 1))]; 1330 char const *yyprefix = yyexpecting; 1331 1332 /* Start YYX at -YYN if negative to avoid negative indexes in 1333 YYCHECK. */ 1334 int yyxbegin = yyn < 0 ? -yyn : 0; 1335 1336 /* Stay within bounds of both yycheck and yytname. */ 1337 int yychecklim = YYLAST - yyn + 1; 1338 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1339 int yycount = 1; 1340 1341 yyarg[0] = yytname[yytype]; 1342 yyfmt = yystpcpy (yyformat, yyunexpected); 1343 1344 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1345 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 1346 { 1347 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1348 { 1349 yycount = 1; 1350 yysize = yysize0; 1351 yyformat[sizeof yyunexpected - 1] = '\0'; 1352 break; 1353 } 1354 yyarg[yycount++] = yytname[yyx]; 1355 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 1356 yysize_overflow |= (yysize1 < yysize); 1357 yysize = yysize1; 1358 yyfmt = yystpcpy (yyfmt, yyprefix); 1359 yyprefix = yyor; 1360 } 1361 1362 yyf = YY_(yyformat); 1363 yysize1 = yysize + yystrlen (yyf); 1364 yysize_overflow |= (yysize1 < yysize); 1365 yysize = yysize1; 1366 1367 if (yysize_overflow) 1368 return YYSIZE_MAXIMUM; 1369 1370 if (yyresult) 1371 { 1372 /* Avoid sprintf, as that infringes on the user's name space. 1373 Don't have undefined behavior even if the translation 1374 produced a string with the wrong number of "%s"s. */ 1375 char *yyp = yyresult; 1376 int yyi = 0; 1377 while ((*yyp = *yyf) != '\0') 1378 { 1379 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 1380 { 1381 yyp += yytnamerr (yyp, yyarg[yyi++]); 1382 yyf += 2; 1383 } 1384 else 1385 { 1386 yyp++; 1387 yyf++; 1388 } 1389 } 1390 } 1391 return yysize; 1392 } 1393 } 1394 #endif /* YYERROR_VERBOSE */ 1395 1396 1398 /*-----------------------------------------------. 1399 | Release the memory associated to this symbol. | 1400 `-----------------------------------------------*/ 1401 1402 /*ARGSUSED*/ 1403 #if (defined __STDC__ || defined __C99__FUNC__ \ 1404 || defined __cplusplus || defined _MSC_VER) 1405 static void 1406 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) 1407 #else 1408 static void 1409 yydestruct (yymsg, yytype, yyvaluep, yylocationp) 1410 const char *yymsg; 1411 int yytype; 1412 YYSTYPE *yyvaluep; 1413 YYLTYPE *yylocationp; 1414 #endif 1415 { 1416 YYUSE (yyvaluep); 1417 YYUSE (yylocationp); 1418 1419 if (!yymsg) 1420 yymsg = "Deleting"; 1421 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1422 1423 switch (yytype) 1424 { 1425 1426 default: 1427 break; 1428 } 1429 } 1430 1431 1433 /* Prevent warnings from -Wmissing-prototypes. */ 1434 1435 #ifdef YYPARSE_PARAM 1436 #if defined __STDC__ || defined __cplusplus 1437 int yyparse (void *YYPARSE_PARAM); 1438 #else 1439 int yyparse (); 1440 #endif 1441 #else /* ! YYPARSE_PARAM */ 1442 #if defined __STDC__ || defined __cplusplus 1443 int yyparse (void); 1444 #else 1445 int yyparse (); 1446 #endif 1447 #endif /* ! YYPARSE_PARAM */ 1448 1449 1450 1451 1452 1453 1454 /*----------. 1455 | yyparse. | 1456 `----------*/ 1457 1458 #ifdef YYPARSE_PARAM 1459 #if (defined __STDC__ || defined __C99__FUNC__ \ 1460 || defined __cplusplus || defined _MSC_VER) 1461 int 1462 yyparse (void *YYPARSE_PARAM) 1463 #else 1464 int 1465 yyparse (YYPARSE_PARAM) 1466 void *YYPARSE_PARAM; 1467 #endif 1468 #else /* ! YYPARSE_PARAM */ 1469 #if (defined __STDC__ || defined __C99__FUNC__ \ 1470 || defined __cplusplus || defined _MSC_VER) 1471 int 1472 yyparse (void) 1473 #else 1474 int 1475 yyparse () 1476 1477 #endif 1478 #endif 1479 { 1480 /* The look-ahead symbol. */ 1481 int yychar; 1482 1483 /* The semantic value of the look-ahead symbol. */ 1484 YYSTYPE yylval; 1485 1486 /* Number of syntax errors so far. */ 1487 int yynerrs; 1488 /* Location data for the look-ahead symbol. */ 1489 YYLTYPE yylloc; 1490 1491 int yystate; 1492 int yyn; 1493 int yyresult; 1494 /* Number of tokens to shift before error messages enabled. */ 1495 int yyerrstatus; 1496 /* Look-ahead token as an internal (translated) token number. */ 1497 int yytoken = 0; 1498 #if YYERROR_VERBOSE 1499 /* Buffer for error messages, and its allocated size. */ 1500 char yymsgbuf[128]; 1501 char *yymsg = yymsgbuf; 1502 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1503 #endif 1504 1505 /* Three stacks and their tools: 1506 `yyss': related to states, 1507 `yyvs': related to semantic values, 1508 `yyls': related to locations. 1509 1510 Refer to the stacks thru separate pointers, to allow yyoverflow 1511 to reallocate them elsewhere. */ 1512 1513 /* The state stack. */ 1514 yytype_int16 yyssa[YYINITDEPTH]; 1515 yytype_int16 *yyss = yyssa; 1516 yytype_int16 *yyssp; 1517 1518 /* The semantic value stack. */ 1519 YYSTYPE yyvsa[YYINITDEPTH]; 1520 YYSTYPE *yyvs = yyvsa; 1521 YYSTYPE *yyvsp; 1522 1523 /* The location stack. */ 1524 YYLTYPE yylsa[YYINITDEPTH]; 1525 YYLTYPE *yyls = yylsa; 1526 YYLTYPE *yylsp; 1527 /* The locations where the error started and ended. */ 1528 YYLTYPE yyerror_range[2]; 1529 1530 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) 1531 1532 YYSIZE_T yystacksize = YYINITDEPTH; 1533 1534 /* The variables used to return semantic value and location from the 1535 action routines. */ 1536 YYSTYPE yyval; 1537 YYLTYPE yyloc; 1538 1539 /* The number of symbols on the RHS of the reduced rule. 1540 Keep to zero when no symbol should be popped. */ 1541 int yylen = 0; 1542 1543 YYDPRINTF ((stderr, "Starting parse\n")); 1544 1545 yystate = 0; 1546 yyerrstatus = 0; 1547 yynerrs = 0; 1548 yychar = YYEMPTY; /* Cause a token to be read. */ 1549 1550 /* Initialize stack pointers. 1551 Waste one element of value and location stack 1552 so that they stay on the same level as the state stack. 1553 The wasted elements are never initialized. */ 1554 1555 yyssp = yyss; 1556 yyvsp = yyvs; 1557 yylsp = yyls; 1558 #if YYLTYPE_IS_TRIVIAL 1559 /* Initialize the default location before parsing starts. */ 1560 yylloc.first_line = yylloc.last_line = 1; 1561 yylloc.first_column = yylloc.last_column = 0; 1562 #endif 1563 1564 1565 /* User initialization code. */ 1566 #line 84 "parse-gram.y" 1567 { 1568 /* Bison's grammar can initial empty locations, hence a default 1569 location is needed. */ 1570 yylloc.start.file = yylloc.end.file = current_file; 1571 yylloc.start.line = yylloc.end.line = 1; 1572 yylloc.start.column = yylloc.end.column = 0; 1573 } 1574 /* Line 1078 of yacc.c. */ 1575 #line 1573 "parse-gram.c" 1576 yylsp[0] = yylloc; 1577 goto yysetstate; 1578 1579 /*------------------------------------------------------------. 1580 | yynewstate -- Push a new state, which is found in yystate. | 1581 `------------------------------------------------------------*/ 1582 yynewstate: 1583 /* In all cases, when you get here, the value and location stacks 1584 have just been pushed. So pushing a state here evens the stacks. */ 1585 yyssp++; 1586 1587 yysetstate: 1588 *yyssp = yystate; 1589 1590 if (yyss + yystacksize - 1 <= yyssp) 1591 { 1592 /* Get the current used size of the three stacks, in elements. */ 1593 YYSIZE_T yysize = yyssp - yyss + 1; 1594 1595 #ifdef yyoverflow 1596 { 1597 /* Give user a chance to reallocate the stack. Use copies of 1598 these so that the &'s don't force the real ones into 1599 memory. */ 1600 YYSTYPE *yyvs1 = yyvs; 1601 yytype_int16 *yyss1 = yyss; 1602 YYLTYPE *yyls1 = yyls; 1603 1604 /* Each stack pointer address is followed by the size of the 1605 data in use in that stack, in bytes. This used to be a 1606 conditional around just the two extra args, but that might 1607 be undefined if yyoverflow is a macro. */ 1608 yyoverflow (YY_("memory exhausted"), 1609 &yyss1, yysize * sizeof (*yyssp), 1610 &yyvs1, yysize * sizeof (*yyvsp), 1611 &yyls1, yysize * sizeof (*yylsp), 1612 &yystacksize); 1613 yyls = yyls1; 1614 yyss = yyss1; 1615 yyvs = yyvs1; 1616 } 1617 #else /* no yyoverflow */ 1618 # ifndef YYSTACK_RELOCATE 1619 goto yyexhaustedlab; 1620 # else 1621 /* Extend the stack our own way. */ 1622 if (YYMAXDEPTH <= yystacksize) 1623 goto yyexhaustedlab; 1624 yystacksize *= 2; 1625 if (YYMAXDEPTH < yystacksize) 1626 yystacksize = YYMAXDEPTH; 1627 1628 { 1629 yytype_int16 *yyss1 = yyss; 1630 union yyalloc *yyptr = 1631 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1632 if (! yyptr) 1633 goto yyexhaustedlab; 1634 YYSTACK_RELOCATE (yyss); 1635 YYSTACK_RELOCATE (yyvs); 1636 YYSTACK_RELOCATE (yyls); 1637 # undef YYSTACK_RELOCATE 1638 if (yyss1 != yyssa) 1639 YYSTACK_FREE (yyss1); 1640 } 1641 # endif 1642 #endif /* no yyoverflow */ 1643 1644 yyssp = yyss + yysize - 1; 1645 yyvsp = yyvs + yysize - 1; 1646 yylsp = yyls + yysize - 1; 1647 1648 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1649 (unsigned long int) yystacksize)); 1650 1651 if (yyss + yystacksize - 1 <= yyssp) 1652 YYABORT; 1653 } 1654 1655 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1656 1657 goto yybackup; 1658 1659 /*-----------. 1660 | yybackup. | 1661 `-----------*/ 1662 yybackup: 1663 1664 /* Do appropriate processing given the current state. Read a 1665 look-ahead token if we need one and don't already have one. */ 1666 1667 /* First try to decide what to do without reference to look-ahead token. */ 1668 yyn = yypact[yystate]; 1669 if (yyn == YYPACT_NINF) 1670 goto yydefault; 1671 1672 /* Not known => get a look-ahead token if don't already have one. */ 1673 1674 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ 1675 if (yychar == YYEMPTY) 1676 { 1677 YYDPRINTF ((stderr, "Reading a token: ")); 1678 yychar = YYLEX; 1679 } 1680 1681 if (yychar <= YYEOF) 1682 { 1683 yychar = yytoken = YYEOF; 1684 YYDPRINTF ((stderr, "Now at end of input.\n")); 1685 } 1686 else 1687 { 1688 yytoken = YYTRANSLATE (yychar); 1689 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1690 } 1691 1692 /* If the proper action on seeing token YYTOKEN is to reduce or to 1693 detect an error, take that action. */ 1694 yyn += yytoken; 1695 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1696 goto yydefault; 1697 yyn = yytable[yyn]; 1698 if (yyn <= 0) 1699 { 1700 if (yyn == 0 || yyn == YYTABLE_NINF) 1701 goto yyerrlab; 1702 yyn = -yyn; 1703 goto yyreduce; 1704 } 1705 1706 if (yyn == YYFINAL) 1707 YYACCEPT; 1708 1709 /* Count tokens shifted since error; after three, turn off error 1710 status. */ 1711 if (yyerrstatus) 1712 yyerrstatus--; 1713 1714 /* Shift the look-ahead token. */ 1715 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1716 1717 /* Discard the shifted token unless it is eof. */ 1718 if (yychar != YYEOF) 1719 yychar = YYEMPTY; 1720 1721 yystate = yyn; 1722 *++yyvsp = yylval; 1723 *++yylsp = yylloc; 1724 goto yynewstate; 1725 1726 1727 /*-----------------------------------------------------------. 1728 | yydefault -- do the default action for the current state. | 1729 `-----------------------------------------------------------*/ 1730 yydefault: 1731 yyn = yydefact[yystate]; 1732 if (yyn == 0) 1733 goto yyerrlab; 1734 goto yyreduce; 1735 1736 1737 /*-----------------------------. 1738 | yyreduce -- Do a reduction. | 1739 `-----------------------------*/ 1740 yyreduce: 1741 /* yyn is the number of a rule to reduce with. */ 1742 yylen = yyr2[yyn]; 1743 1744 /* If YYLEN is nonzero, implement the default value of the action: 1745 `$$ = $1'. 1746 1747 Otherwise, the following line sets YYVAL to garbage. 1748 This behavior is undocumented and Bison 1749 users should not rely upon it. Assigning to YYVAL 1750 unconditionally makes the parser a bit smaller, and it avoids a 1751 GCC warning that YYVAL may be used uninitialized. */ 1752 yyval = yyvsp[1-yylen]; 1753 1754 /* Default location. */ 1755 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); 1756 YY_REDUCE_PRINT (yyn); 1757 switch (yyn) 1758 { 1759 case 6: 1760 #line 217 "parse-gram.y" 1761 { prologue_augment ((yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); } 1762 break; 1763 1764 case 7: 1765 #line 218 "parse-gram.y" 1766 { debug_flag = true; } 1767 break; 1768 1769 case 8: 1770 #line 220 "parse-gram.y" 1771 { 1772 static char one[] = "1"; 1773 muscle_insert ((yyvsp[(2) - (2)].chars), one); 1774 } 1775 break; 1776 1777 case 9: 1778 #line 224 "parse-gram.y" 1779 { muscle_insert ((yyvsp[(2) - (3)].chars), (yyvsp[(3) - (3)].chars)); } 1780 break; 1781 1782 case 10: 1783 #line 225 "parse-gram.y" 1784 { defines_flag = true; } 1785 break; 1786 1787 case 11: 1788 #line 226 "parse-gram.y" 1789 { error_verbose = true; } 1790 break; 1791 1792 case 12: 1793 #line 227 "parse-gram.y" 1794 { expected_sr_conflicts = (yyvsp[(2) - (2)].integer); } 1795 break; 1796 1797 case 13: 1798 #line 228 "parse-gram.y" 1799 { expected_rr_conflicts = (yyvsp[(2) - (2)].integer); } 1800 break; 1801 1802 case 14: 1803 #line 229 "parse-gram.y" 1804 { spec_file_prefix = (yyvsp[(3) - (3)].chars); } 1805 break; 1806 1807 case 15: 1808 #line 231 "parse-gram.y" 1809 { 1810 nondeterministic_parser = true; 1811 glr_parser = true; 1812 } 1813 break; 1814 1815 case 16: 1816 #line 236 "parse-gram.y" 1817 { 1818 muscle_code_grow ("initial_action", (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); 1819 } 1820 break; 1821 1822 case 17: 1823 #line 239 "parse-gram.y" 1824 { add_param ("lex_param", (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); } 1825 break; 1826 1827 case 18: 1828 #line 240 "parse-gram.y" 1829 { locations_flag = true; } 1830 break; 1831 1832 case 19: 1833 #line 241 "parse-gram.y" 1834 { spec_name_prefix = (yyvsp[(3) - (3)].chars); } 1835 break; 1836 1837 case 20: 1838 #line 242 "parse-gram.y" 1839 { no_lines_flag = true; } 1840 break; 1841 1842 case 21: 1843 #line 243 "parse-gram.y" 1844 { nondeterministic_parser = true; } 1845 break; 1846 1847 case 22: 1848 #line 244 "parse-gram.y" 1849 { spec_outfile = (yyvsp[(3) - (3)].chars); } 1850 break; 1851 1852 case 23: 1853 #line 245 "parse-gram.y" 1854 { add_param ("parse_param", (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); } 1855 break; 1856 1857 case 24: 1858 #line 246 "parse-gram.y" 1859 { pure_parser = true; } 1860 break; 1861 1862 case 25: 1863 #line 247 "parse-gram.y" 1864 { version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); } 1865 break; 1866 1867 case 26: 1868 #line 248 "parse-gram.y" 1869 { skeleton = (yyvsp[(2) - (2)].chars); } 1870 break; 1871 1872 case 27: 1873 #line 249 "parse-gram.y" 1874 { token_table_flag = true; } 1875 break; 1876 1877 case 28: 1878 #line 250 "parse-gram.y" 1879 { report_flag = report_states; } 1880 break; 1881 1882 case 29: 1883 #line 251 "parse-gram.y" 1884 { yacc_flag = true; } 1885 break; 1886 1887 case 33: 1888 #line 259 "parse-gram.y" 1889 { 1890 grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); 1891 } 1892 break; 1893 1894 case 34: 1895 #line 263 "parse-gram.y" 1896 { 1897 char const *body = (yyvsp[(1) - (1)].chars); 1898 1899 if (typed) 1900 { 1901 /* Concatenate the union bodies, turning the first one's 1902 trailing '}' into '\n', and omitting the second one's '{'. */ 1903 char *code = muscle_find ("stype"); 1904 code[strlen (code) - 1] = '\n'; 1905 body++; 1906 } 1907 1908 typed = true; 1909 muscle_code_grow ("stype", body, (yylsp[(1) - (1)])); 1910 } 1911 break; 1912 1913 case 35: 1914 #line 279 "parse-gram.y" 1915 { 1916 symbol_list *list; 1917 for (list = (yyvsp[(2) - (2)].list); list; list = list->next) 1918 symbol_destructor_set (list->sym, (yyvsp[(1) - (2)].chars), (yylsp[(1) - (2)])); 1919 symbol_list_free ((yyvsp[(2) - (2)].list)); 1920 } 1921 break; 1922 1923 case 36: 1924 #line 286 "parse-gram.y" 1925 { 1926 symbol_list *list; 1927 for (list = (yyvsp[(2) - (2)].list); list; list = list->next) 1928 symbol_printer_set (list->sym, (yyvsp[(1) - (2)].chars), (yylsp[(1) - (2)])); 1929 symbol_list_free ((yyvsp[(2) - (2)].list)); 1930 } 1931 break; 1932 1933 case 37: 1934 #line 293 "parse-gram.y" 1935 { 1936 default_prec = true; 1937 } 1938 break; 1939 1940 case 38: 1941 #line 297 "parse-gram.y" 1942 { 1943 default_prec = false; 1944 } 1945 break; 1946 1947 case 39: 1948 #line 303 "parse-gram.y" 1949 { current_class = nterm_sym; } 1950 break; 1951 1952 case 40: 1953 #line 304 "parse-gram.y" 1954 { 1955 current_class = unknown_sym; 1956 current_type = NULL; 1957 } 1958 break; 1959 1960 case 41: 1961 #line 308 "parse-gram.y" 1962 { current_class = token_sym; } 1963 break; 1964 1965 case 42: 1966 #line 309 "parse-gram.y" 1967 { 1968 current_class = unknown_sym; 1969 current_type = NULL; 1970 } 1971 break; 1972 1973 case 43: 1974 #line 314 "parse-gram.y" 1975 { 1976 symbol_list *list; 1977 for (list = (yyvsp[(3) - (3)].list); list; list = list->next) 1978 symbol_type_set (list->sym, (yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)])); 1979 symbol_list_free ((yyvsp[(3) - (3)].list)); 1980 } 1981 break; 1982 1983 case 44: 1984 #line 324 "parse-gram.y" 1985 { 1986 symbol_list *list; 1987 ++current_prec; 1988 for (list = (yyvsp[(3) - (3)].list); list; list = list->next) 1989 { 1990 symbol_type_set (list->sym, current_type, (yylsp[(2) - (3)])); 1991 symbol_precedence_set (list->sym, current_prec, (yyvsp[(1) - (3)].assoc), (yylsp[(1) - (3)])); 1992 } 1993 symbol_list_free ((yyvsp[(3) - (3)].list)); 1994 current_type = NULL; 1995 } 1996 break; 1997 1998 case 45: 1999 #line 338 "parse-gram.y" 2000 { (yyval.assoc) = left_assoc; } 2001 break; 2002 2003 case 46: 2004 #line 339 "parse-gram.y" 2005 { (yyval.assoc) = right_assoc; } 2006 break; 2007 2008 case 47: 2009 #line 340 "parse-gram.y" 2010 { (yyval.assoc) = non_assoc; } 2011 break; 2012 2013 case 48: 2014 #line 344 "parse-gram.y" 2015 { current_type = NULL; } 2016 break; 2017 2018 case 49: 2019 #line 345 "parse-gram.y" 2020 { current_type = (yyvsp[(1) - (1)].uniqstr); } 2021 break; 2022 2023 case 50: 2024 #line 351 "parse-gram.y" 2025 { (yyval.list) = symbol_list_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } 2026 break; 2027 2028 case 51: 2029 #line 352 "parse-gram.y" 2030 { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); } 2031 break; 2032 2033 case 52: 2034 #line 358 "parse-gram.y" 2035 { 2036 current_type = (yyvsp[(1) - (1)].uniqstr); 2037 } 2038 break; 2039 2040 case 53: 2041 #line 362 "parse-gram.y" 2042 { 2043 symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true); 2044 symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)])); 2045 } 2046 break; 2047 2048 case 54: 2049 #line 367 "parse-gram.y" 2050 { 2051 symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true); 2052 symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)])); 2053 symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)])); 2054 } 2055 break; 2056 2057 case 55: 2058 #line 373 "parse-gram.y" 2059 { 2060 symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true); 2061 symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)])); 2062 symbol_make_alias ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].symbol), (yyloc)); 2063 } 2064 break; 2065 2066 case 56: 2067 #line 379 "parse-gram.y" 2068 { 2069 symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true); 2070 symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)])); 2071 symbol_user_token_number_set ((yyvsp[(1) - (3)].symbol), (yyvsp[(2) - (3)].integer), (yylsp[(2) - (3)])); 2072 symbol_make_alias ((yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol), (yyloc)); 2073 } 2074 break; 2075 2076 case 63: 2077 #line 409 "parse-gram.y" 2078 { 2079 yyerrok; 2080 } 2081 break; 2082 2083 case 64: 2084 #line 415 "parse-gram.y" 2085 { current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); } 2086 break; 2087 2088 case 66: 2089 #line 419 "parse-gram.y" 2090 { grammar_current_rule_end ((yylsp[(1) - (1)])); } 2091 break; 2092 2093 case 67: 2094 #line 420 "parse-gram.y" 2095 { grammar_current_rule_end ((yylsp[(3) - (3)])); } 2096 break; 2097 2098 case 69: 2099 #line 426 "parse-gram.y" 2100 { grammar_current_rule_begin (current_lhs, current_lhs_location); } 2101 break; 2102 2103 case 70: 2104 #line 428 "parse-gram.y" 2105 { grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); } 2106 break; 2107 2108 case 72: 2109 #line 431 "parse-gram.y" 2110 { grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); } 2111 break; 2112 2113 case 73: 2114 #line 433 "parse-gram.y" 2115 { grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); } 2116 break; 2117 2118 case 74: 2119 #line 435 "parse-gram.y" 2120 { grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); } 2121 break; 2122 2123 case 75: 2124 #line 439 "parse-gram.y" 2125 { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); } 2126 break; 2127 2128 case 76: 2129 #line 440 "parse-gram.y" 2130 { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); } 2131 break; 2132 2133 case 77: 2134 #line 456 "parse-gram.y" 2135 { grammar_current_rule_action_append (last_string, last_braced_code_loc); } 2136 break; 2137 2138 case 79: 2139 #line 463 "parse-gram.y" 2140 { 2141 (yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)])); 2142 symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false); 2143 } 2144 break; 2145 2146 case 80: 2147 #line 472 "parse-gram.y" 2148 { (yyval.chars) = (yyvsp[(1) - (1)].chars); } 2149 break; 2150 2151 case 82: 2152 #line 479 "parse-gram.y" 2153 { 2154 muscle_code_grow ("epilogue", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); 2155 scanner_last_string_free (); 2156 } 2157 break; 2158 2159 2160 /* Line 1267 of yacc.c. */ 2161 #line 2159 "parse-gram.c" 2162 default: break; 2163 } 2164 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 2165 2166 YYPOPSTACK (yylen); 2167 yylen = 0; 2168 YY_STACK_PRINT (yyss, yyssp); 2169 2170 *++yyvsp = yyval; 2171 *++yylsp = yyloc; 2172 2173 /* Now `shift' the result of the reduction. Determine what state 2174 that goes to, based on the state we popped back to and the rule 2175 number reduced by. */ 2176 2177 yyn = yyr1[yyn]; 2178 2179 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 2180 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 2181 yystate = yytable[yystate]; 2182 else 2183 yystate = yydefgoto[yyn - YYNTOKENS]; 2184 2185 goto yynewstate; 2186 2187 2188 /*------------------------------------. 2189 | yyerrlab -- here on detecting error | 2190 `------------------------------------*/ 2191 yyerrlab: 2192 /* If not already recovering from an error, report this error. */ 2193 if (!yyerrstatus) 2194 { 2195 ++yynerrs; 2196 #if ! YYERROR_VERBOSE 2197 yyerror (YY_("syntax error")); 2198 #else 2199 { 2200 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 2201 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 2202 { 2203 YYSIZE_T yyalloc = 2 * yysize; 2204 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 2205 yyalloc = YYSTACK_ALLOC_MAXIMUM; 2206 if (yymsg != yymsgbuf) 2207 YYSTACK_FREE (yymsg); 2208 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 2209 if (yymsg) 2210 yymsg_alloc = yyalloc; 2211 else 2212 { 2213 yymsg = yymsgbuf; 2214 yymsg_alloc = sizeof yymsgbuf; 2215 } 2216 } 2217 2218 if (0 < yysize && yysize <= yymsg_alloc) 2219 { 2220 (void) yysyntax_error (yymsg, yystate, yychar); 2221 yyerror (yymsg); 2222 } 2223 else 2224 { 2225 yyerror (YY_("syntax error")); 2226 if (yysize != 0) 2227 goto yyexhaustedlab; 2228 } 2229 } 2230 #endif 2231 } 2232 2233 yyerror_range[0] = yylloc; 2234 2235 if (yyerrstatus == 3) 2236 { 2237 /* If just tried and failed to reuse look-ahead token after an 2238 error, discard it. */ 2239 2240 if (yychar <= YYEOF) 2241 { 2242 /* Return failure if at end of input. */ 2243 if (yychar == YYEOF) 2244 YYABORT; 2245 } 2246 else 2247 { 2248 yydestruct ("Error: discarding", 2249 yytoken, &yylval, &yylloc); 2250 yychar = YYEMPTY; 2251 } 2252 } 2253 2254 /* Else will try to reuse look-ahead token after shifting the error 2255 token. */ 2256 goto yyerrlab1; 2257 2258 2259 /*---------------------------------------------------. 2260 | yyerrorlab -- error raised explicitly by YYERROR. | 2261 `---------------------------------------------------*/ 2262 yyerrorlab: 2263 2264 /* Pacify compilers like GCC when the user code never invokes 2265 YYERROR and the label yyerrorlab therefore never appears in user 2266 code. */ 2267 if (/*CONSTCOND*/ 0) 2268 goto yyerrorlab; 2269 2270 yyerror_range[0] = yylsp[1-yylen]; 2271 /* Do not reclaim the symbols of the rule which action triggered 2272 this YYERROR. */ 2273 YYPOPSTACK (yylen); 2274 yylen = 0; 2275 YY_STACK_PRINT (yyss, yyssp); 2276 yystate = *yyssp; 2277 goto yyerrlab1; 2278 2279 2280 /*-------------------------------------------------------------. 2281 | yyerrlab1 -- common code for both syntax error and YYERROR. | 2282 `-------------------------------------------------------------*/ 2283 yyerrlab1: 2284 yyerrstatus = 3; /* Each real token shifted decrements this. */ 2285 2286 for (;;) 2287 { 2288 yyn = yypact[yystate]; 2289 if (yyn != YYPACT_NINF) 2290 { 2291 yyn += YYTERROR; 2292 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2293 { 2294 yyn = yytable[yyn]; 2295 if (0 < yyn) 2296 break; 2297 } 2298 } 2299 2300 /* Pop the current state because it cannot handle the error token. */ 2301 if (yyssp == yyss) 2302 YYABORT; 2303 2304 yyerror_range[0] = *yylsp; 2305 yydestruct ("Error: popping", 2306 yystos[yystate], yyvsp, yylsp); 2307 YYPOPSTACK (1); 2308 yystate = *yyssp; 2309 YY_STACK_PRINT (yyss, yyssp); 2310 } 2311 2312 if (yyn == YYFINAL) 2313 YYACCEPT; 2314 2315 *++yyvsp = yylval; 2316 2317 yyerror_range[1] = yylloc; 2318 /* Using YYLLOC is tempting, but would change the location of 2319 the look-ahead. YYLOC is available though. */ 2320 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); 2321 *++yylsp = yyloc; 2322 2323 /* Shift the error token. */ 2324 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 2325 2326 yystate = yyn; 2327 goto yynewstate; 2328 2329 2330 /*-------------------------------------. 2331 | yyacceptlab -- YYACCEPT comes here. | 2332 `-------------------------------------*/ 2333 yyacceptlab: 2334 yyresult = 0; 2335 goto yyreturn; 2336 2337 /*-----------------------------------. 2338 | yyabortlab -- YYABORT comes here. | 2339 `-----------------------------------*/ 2340 yyabortlab: 2341 yyresult = 1; 2342 goto yyreturn; 2343 2344 #ifndef yyoverflow 2345 /*-------------------------------------------------. 2346 | yyexhaustedlab -- memory exhaustion comes here. | 2347 `-------------------------------------------------*/ 2348 yyexhaustedlab: 2349 yyerror (YY_("memory exhausted")); 2350 yyresult = 2; 2351 /* Fall through. */ 2352 #endif 2353 2354 yyreturn: 2355 if (yychar != YYEOF && yychar != YYEMPTY) 2356 yydestruct ("Cleanup: discarding lookahead", 2357 yytoken, &yylval, &yylloc); 2358 /* Do not reclaim the symbols of the rule which action triggered 2359 this YYABORT or YYACCEPT. */ 2360 YYPOPSTACK (yylen); 2361 YY_STACK_PRINT (yyss, yyssp); 2362 while (yyssp != yyss) 2363 { 2364 yydestruct ("Cleanup: popping", 2365 yystos[*yyssp], yyvsp, yylsp); 2366 YYPOPSTACK (1); 2367 } 2368 #ifndef yyoverflow 2369 if (yyss != yyssa) 2370 YYSTACK_FREE (yyss); 2371 #endif 2372 #if YYERROR_VERBOSE 2373 if (yymsg != yymsgbuf) 2374 YYSTACK_FREE (yymsg); 2375 #endif 2376 /* Make sure YYID is used. */ 2377 return YYID (yyresult); 2378 } 2379 2380 2381 #line 485 "parse-gram.y" 2382 2383 2384 2385 /* Return the location of the left-hand side of a rule whose 2386 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in 2387 the right-hand side, and return an empty location equal to the end 2388 boundary of RHS[0] if the right-hand side is empty. */ 2389 2390 static YYLTYPE 2391 lloc_default (YYLTYPE const *rhs, int n) 2392 { 2393 int i; 2394 YYLTYPE loc; 2395 2396 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;". 2397 The bug is fixed in 7.4.2m, but play it safe for now. */ 2398 loc.start = rhs[n].end; 2399 loc.end = rhs[n].end; 2400 2401 /* Ignore empty nonterminals the start of the the right-hand side. 2402 Do not bother to ignore them at the end of the right-hand side, 2403 since empty nonterminals have the same end as their predecessors. */ 2404 for (i = 1; i <= n; i++) 2405 if (! equal_boundaries (rhs[i].start, rhs[i].end)) 2406 { 2407 loc.start = rhs[i].start; 2408 break; 2409 } 2410 2411 return loc; 2412 } 2413 2414 2415 /* Add a lex-param or a parse-param (depending on TYPE) with 2416 declaration DECL and location LOC. */ 2417 2418 static void 2419 add_param (char const *type, char *decl, location loc) 2420 { 2421 static char const alphanum[26 + 26 + 1 + 10] = 2422 "abcdefghijklmnopqrstuvwxyz" 2423 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 2424 "_" 2425 "0123456789"; 2426 char const *name_start = NULL; 2427 char *p; 2428 2429 /* Stop on last actual character. */ 2430 for (p = decl; p[1]; p++) 2431 if ((p == decl 2432 || ! memchr (alphanum, p[-1], sizeof alphanum)) 2433 && memchr (alphanum, p[0], sizeof alphanum - 10)) 2434 name_start = p; 2435 2436 /* Strip the surrounding '{' and '}', and any blanks just inside 2437 the braces. */ 2438 while (*--p == ' ' || *p == '\t') 2439 continue; 2440 p[1] = '\0'; 2441 while (*++decl == ' ' || *decl == '\t') 2442 continue; 2443 2444 if (! name_start) 2445 complain_at (loc, _("missing identifier in parameter declaration")); 2446 else 2447 { 2448 char *name; 2449 size_t name_len; 2450 2451 for (name_len = 1; 2452 memchr (alphanum, name_start[name_len], sizeof alphanum); 2453 name_len++) 2454 continue; 2455 2456 name = xmalloc (name_len + 1); 2457 memcpy (name, name_start, name_len); 2458 name[name_len] = '\0'; 2459 muscle_pair_list_grow (type, decl, name); 2460 free (name); 2461 } 2462 2463 scanner_last_string_free (); 2464 } 2465 2466 static void 2467 version_check (location const *loc, char const *version) 2468 { 2469 if (strverscmp (version, PACKAGE_VERSION) > 0) 2470 { 2471 complain_at (*loc, "require bison %s, but have %s", 2472 version, PACKAGE_VERSION); 2473 exit (63); 2474 } 2475 } 2476 2477 static void 2478 gram_error (location const *loc, char const *msg) 2479 { 2480 complain_at (*loc, "%s", msg); 2481 } 2482 2483 char const * 2484 token_name (int type) 2485 { 2486 return yytname[YYTRANSLATE (type)]; 2487 } 2488 2489