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