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