y.tab.c (43208B)
1 /* A Bison parser, made by GNU Bison 3.8.2. */ 2 3 /* Bison implementation for Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, 6 Inc. 7 8 This program is free software: you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation, either version 3 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 20 21 /* As a special exception, you may create a larger work that contains 22 part or all of the Bison parser skeleton and distribute that work 23 under terms of your choice, so long as that work isn't itself a 24 parser generator using the skeleton or a modified version thereof 25 as a parser skeleton. Alternatively, if you modify or redistribute 26 the parser skeleton itself, you may (at your option) remove this 27 special exception, which will cause the skeleton and the resulting 28 Bison output files to be licensed under the GNU General Public 29 License without this special exception. 30 31 This special exception was added by the Free Software Foundation in 32 version 2.2 of Bison. */ 33 34 /* C LALR(1) parser skeleton written by Richard Stallman, by 35 simplifying the original so-called "semantic" parser. */ 36 37 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, 38 especially those whose name start with YY_ or yy_. They are 39 private implementation details that can be changed or removed. */ 40 41 /* All symbols defined below should begin with yy or YY, to avoid 42 infringing on user name space. This should be done even for local 43 variables, as they might otherwise be expanded by user macros. 44 There are some unavoidable exceptions within include files to 45 define necessary library symbols; they are noted "INFRINGES ON 46 USER NAME SPACE" below. */ 47 48 /* Identify Bison output, and Bison version. */ 49 #define YYBISON 30802 50 51 /* Bison version string. */ 52 #define YYBISON_VERSION "3.8.2" 53 54 /* Skeleton name. */ 55 #define YYSKELETON_NAME "yacc.c" 56 57 /* Pure parsers. */ 58 #define YYPURE 0 59 60 /* Push parsers. */ 61 #define YYPUSH 0 62 63 /* Pull parsers. */ 64 #define YYPULL 1 65 66 67 68 69 /* First part of user prologue. */ 70 #line 1 "parse.y" 71 72 enum triggerType { 73 AND, 74 OR, 75 XOR, 76 NOT, 77 NESTED, 78 FN, 79 } 80 81 typedef struct prev { 82 int start, end; 83 char *prev; 84 } prev; 85 86 typedef struct trigger { 87 int op; 88 union { 89 struct trigger triggers[2]; 90 char *name; 91 }; 92 } trigger; 93 94 typedef struct line { 95 char *name; 96 prev *prev; 97 trigger *trig; 98 char *code; 99 } line; 100 101 line * 102 new_line(char *n, prev *p, trigger *t, code *c) { 103 line *l = malloc(sizeof(line)); 104 l->name = n; 105 l->prev = p; 106 l->trig = t; 107 l->code = c; 108 return l; 109 } 110 111 trigger * 112 new_trigger(int op, trigger trigs[2], char *name) { 113 trigger *t = malloc(sizeof(line)); 114 t->op = op; 115 if (!name) 116 memcpy(t->triggers, trigs, sizeof(trigger) * 2); 117 else 118 t->name = name; 119 return t; 120 } 121 122 prev * 123 new_prev(int min, int max, char *name) { 124 prev *p = malloc(sizeof(prev)); 125 p->min = min; 126 p->max = max; 127 p->name = name; 128 return p; 129 } 130 131 132 #line 133 "y.tab.c" 133 134 # ifndef YY_CAST 135 # ifdef __cplusplus 136 # define YY_CAST(Type, Val) static_cast<Type> (Val) 137 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) 138 # else 139 # define YY_CAST(Type, Val) ((Type) (Val)) 140 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) 141 # endif 142 # endif 143 # ifndef YY_NULLPTR 144 # if defined __cplusplus 145 # if 201103L <= __cplusplus 146 # define YY_NULLPTR nullptr 147 # else 148 # define YY_NULLPTR 0 149 # endif 150 # else 151 # define YY_NULLPTR ((void*)0) 152 # endif 153 # endif 154 155 156 /* Debug traces. */ 157 #ifndef YYDEBUG 158 # define YYDEBUG 0 159 #endif 160 #if YYDEBUG 161 extern int yydebug; 162 #endif 163 164 /* Token kinds. */ 165 #ifndef YYTOKENTYPE 166 # define YYTOKENTYPE 167 enum yytokentype 168 { 169 YYEMPTY = -2, 170 YYEOF = 0, /* "end of file" */ 171 YYerror = 256, /* error */ 172 YYUNDEF = 257, /* "invalid token" */ 173 NAME = 258, /* NAME */ 174 NUM = 259, /* NUM */ 175 CODE = 260 /* CODE */ 176 }; 177 typedef enum yytokentype yytoken_kind_t; 178 #endif 179 /* Token kinds. */ 180 #define YYEMPTY -2 181 #define YYEOF 0 182 #define YYerror 256 183 #define YYUNDEF 257 184 #define NAME 258 185 #define NUM 259 186 #define CODE 260 187 188 /* Value type. */ 189 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 190 union YYSTYPE 191 { 192 #line 63 "parse.y" 193 194 trigger *trig; 195 char *name; 196 char *code; 197 long num; 198 199 #line 200 "y.tab.c" 200 201 }; 202 typedef union YYSTYPE YYSTYPE; 203 # define YYSTYPE_IS_TRIVIAL 1 204 # define YYSTYPE_IS_DECLARED 1 205 #endif 206 207 208 extern YYSTYPE yylval; 209 210 211 int yyparse (void); 212 213 214 215 /* Symbol kind. */ 216 enum yysymbol_kind_t 217 { 218 YYSYMBOL_YYEMPTY = -2, 219 YYSYMBOL_YYEOF = 0, /* "end of file" */ 220 YYSYMBOL_YYerror = 1, /* error */ 221 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ 222 YYSYMBOL_NAME = 3, /* NAME */ 223 YYSYMBOL_NUM = 4, /* NUM */ 224 YYSYMBOL_CODE = 5, /* CODE */ 225 YYSYMBOL_6_ = 6, /* ':' */ 226 YYSYMBOL_7_ = 7, /* '!' */ 227 YYSYMBOL_8_ = 8, /* '(' */ 228 YYSYMBOL_9_ = 9, /* ')' */ 229 YYSYMBOL_10_ = 10, /* '&' */ 230 YYSYMBOL_11_ = 11, /* '|' */ 231 YYSYMBOL_12_ = 12, /* '^' */ 232 YYSYMBOL_13_ = 13, /* '{' */ 233 YYSYMBOL_14_ = 14, /* '}' */ 234 YYSYMBOL_YYACCEPT = 15, /* $accept */ 235 YYSYMBOL_line = 16, /* line */ 236 YYSYMBOL_prev = 17, /* prev */ 237 YYSYMBOL_trigger = 18, /* trigger */ 238 YYSYMBOL_action = 19 /* action */ 239 }; 240 typedef enum yysymbol_kind_t yysymbol_kind_t; 241 242 243 244 245 #ifdef short 246 # undef short 247 #endif 248 249 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure 250 <limits.h> and (if available) <stdint.h> are included 251 so that the code can choose integer types of a good width. */ 252 253 #ifndef __PTRDIFF_MAX__ 254 # include <limits.h> /* INFRINGES ON USER NAME SPACE */ 255 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ 256 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */ 257 # define YY_STDINT_H 258 # endif 259 #endif 260 261 /* Narrow types that promote to a signed type and that can represent a 262 signed or unsigned integer of at least N bits. In tables they can 263 save space and decrease cache pressure. Promoting to a signed type 264 helps avoid bugs in integer arithmetic. */ 265 266 #ifdef __INT_LEAST8_MAX__ 267 typedef __INT_LEAST8_TYPE__ yytype_int8; 268 #elif defined YY_STDINT_H 269 typedef int_least8_t yytype_int8; 270 #else 271 typedef signed char yytype_int8; 272 #endif 273 274 #ifdef __INT_LEAST16_MAX__ 275 typedef __INT_LEAST16_TYPE__ yytype_int16; 276 #elif defined YY_STDINT_H 277 typedef int_least16_t yytype_int16; 278 #else 279 typedef short yytype_int16; 280 #endif 281 282 /* Work around bug in HP-UX 11.23, which defines these macros 283 incorrectly for preprocessor constants. This workaround can likely 284 be removed in 2023, as HPE has promised support for HP-UX 11.23 285 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of 286 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */ 287 #ifdef __hpux 288 # undef UINT_LEAST8_MAX 289 # undef UINT_LEAST16_MAX 290 # define UINT_LEAST8_MAX 255 291 # define UINT_LEAST16_MAX 65535 292 #endif 293 294 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ 295 typedef __UINT_LEAST8_TYPE__ yytype_uint8; 296 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ 297 && UINT_LEAST8_MAX <= INT_MAX) 298 typedef uint_least8_t yytype_uint8; 299 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX 300 typedef unsigned char yytype_uint8; 301 #else 302 typedef short yytype_uint8; 303 #endif 304 305 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ 306 typedef __UINT_LEAST16_TYPE__ yytype_uint16; 307 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ 308 && UINT_LEAST16_MAX <= INT_MAX) 309 typedef uint_least16_t yytype_uint16; 310 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX 311 typedef unsigned short yytype_uint16; 312 #else 313 typedef int yytype_uint16; 314 #endif 315 316 #ifndef YYPTRDIFF_T 317 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ 318 # define YYPTRDIFF_T __PTRDIFF_TYPE__ 319 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ 320 # elif defined PTRDIFF_MAX 321 # ifndef ptrdiff_t 322 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 323 # endif 324 # define YYPTRDIFF_T ptrdiff_t 325 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX 326 # else 327 # define YYPTRDIFF_T long 328 # define YYPTRDIFF_MAXIMUM LONG_MAX 329 # endif 330 #endif 331 332 #ifndef YYSIZE_T 333 # ifdef __SIZE_TYPE__ 334 # define YYSIZE_T __SIZE_TYPE__ 335 # elif defined size_t 336 # define YYSIZE_T size_t 337 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ 338 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 339 # define YYSIZE_T size_t 340 # else 341 # define YYSIZE_T unsigned 342 # endif 343 #endif 344 345 #define YYSIZE_MAXIMUM \ 346 YY_CAST (YYPTRDIFF_T, \ 347 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ 348 ? YYPTRDIFF_MAXIMUM \ 349 : YY_CAST (YYSIZE_T, -1))) 350 351 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) 352 353 354 /* Stored state numbers (used for stacks). */ 355 typedef yytype_int8 yy_state_t; 356 357 /* State numbers in computations. */ 358 typedef int yy_state_fast_t; 359 360 #ifndef YY_ 361 # if defined YYENABLE_NLS && YYENABLE_NLS 362 # if ENABLE_NLS 363 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 364 # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 365 # endif 366 # endif 367 # ifndef YY_ 368 # define YY_(Msgid) Msgid 369 # endif 370 #endif 371 372 373 #ifndef YY_ATTRIBUTE_PURE 374 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) 375 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) 376 # else 377 # define YY_ATTRIBUTE_PURE 378 # endif 379 #endif 380 381 #ifndef YY_ATTRIBUTE_UNUSED 382 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) 383 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 384 # else 385 # define YY_ATTRIBUTE_UNUSED 386 # endif 387 #endif 388 389 /* Suppress unused-variable warnings by "using" E. */ 390 #if ! defined lint || defined __GNUC__ 391 # define YY_USE(E) ((void) (E)) 392 #else 393 # define YY_USE(E) /* empty */ 394 #endif 395 396 /* Suppress an incorrect diagnostic about yylval being uninitialized. */ 397 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ 398 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407 399 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 400 _Pragma ("GCC diagnostic push") \ 401 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") 402 # else 403 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 404 _Pragma ("GCC diagnostic push") \ 405 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ 406 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 407 # endif 408 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 409 _Pragma ("GCC diagnostic pop") 410 #else 411 # define YY_INITIAL_VALUE(Value) Value 412 #endif 413 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 414 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 415 # define YY_IGNORE_MAYBE_UNINITIALIZED_END 416 #endif 417 #ifndef YY_INITIAL_VALUE 418 # define YY_INITIAL_VALUE(Value) /* Nothing. */ 419 #endif 420 421 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ 422 # define YY_IGNORE_USELESS_CAST_BEGIN \ 423 _Pragma ("GCC diagnostic push") \ 424 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") 425 # define YY_IGNORE_USELESS_CAST_END \ 426 _Pragma ("GCC diagnostic pop") 427 #endif 428 #ifndef YY_IGNORE_USELESS_CAST_BEGIN 429 # define YY_IGNORE_USELESS_CAST_BEGIN 430 # define YY_IGNORE_USELESS_CAST_END 431 #endif 432 433 434 #define YY_ASSERT(E) ((void) (0 && (E))) 435 436 #if !defined yyoverflow 437 438 /* The parser invokes alloca or malloc; define the necessary symbols. */ 439 440 # ifdef YYSTACK_USE_ALLOCA 441 # if YYSTACK_USE_ALLOCA 442 # ifdef __GNUC__ 443 # define YYSTACK_ALLOC __builtin_alloca 444 # elif defined __BUILTIN_VA_ARG_INCR 445 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 446 # elif defined _AIX 447 # define YYSTACK_ALLOC __alloca 448 # elif defined _MSC_VER 449 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 450 # define alloca _alloca 451 # else 452 # define YYSTACK_ALLOC alloca 453 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 454 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 455 /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 456 # ifndef EXIT_SUCCESS 457 # define EXIT_SUCCESS 0 458 # endif 459 # endif 460 # endif 461 # endif 462 # endif 463 464 # ifdef YYSTACK_ALLOC 465 /* Pacify GCC's 'empty if-body' warning. */ 466 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 467 # ifndef YYSTACK_ALLOC_MAXIMUM 468 /* The OS might guarantee only one guard page at the bottom of the stack, 469 and a page size can be as small as 4096 bytes. So we cannot safely 470 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 471 to allow for a few compiler-allocated temporary stack slots. */ 472 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 473 # endif 474 # else 475 # define YYSTACK_ALLOC YYMALLOC 476 # define YYSTACK_FREE YYFREE 477 # ifndef YYSTACK_ALLOC_MAXIMUM 478 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 479 # endif 480 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 481 && ! ((defined YYMALLOC || defined malloc) \ 482 && (defined YYFREE || defined free))) 483 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 484 # ifndef EXIT_SUCCESS 485 # define EXIT_SUCCESS 0 486 # endif 487 # endif 488 # ifndef YYMALLOC 489 # define YYMALLOC malloc 490 # if ! defined malloc && ! defined EXIT_SUCCESS 491 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 492 # endif 493 # endif 494 # ifndef YYFREE 495 # define YYFREE free 496 # if ! defined free && ! defined EXIT_SUCCESS 497 void free (void *); /* INFRINGES ON USER NAME SPACE */ 498 # endif 499 # endif 500 # endif 501 #endif /* !defined yyoverflow */ 502 503 #if (! defined yyoverflow \ 504 && (! defined __cplusplus \ 505 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 506 507 /* A type that is properly aligned for any stack member. */ 508 union yyalloc 509 { 510 yy_state_t yyss_alloc; 511 YYSTYPE yyvs_alloc; 512 }; 513 514 /* The size of the maximum gap between one aligned stack and the next. */ 515 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) 516 517 /* The size of an array large to enough to hold all stacks, each with 518 N elements. */ 519 # define YYSTACK_BYTES(N) \ 520 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ 521 + YYSTACK_GAP_MAXIMUM) 522 523 # define YYCOPY_NEEDED 1 524 525 /* Relocate STACK from its old location to the new one. The 526 local variables YYSIZE and YYSTACKSIZE give the old and new number of 527 elements in the stack, and YYPTR gives the new location of the 528 stack. Advance YYPTR to a properly aligned location for the next 529 stack. */ 530 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 531 do \ 532 { \ 533 YYPTRDIFF_T yynewbytes; \ 534 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 535 Stack = &yyptr->Stack_alloc; \ 536 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ 537 yyptr += yynewbytes / YYSIZEOF (*yyptr); \ 538 } \ 539 while (0) 540 541 #endif 542 543 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 544 /* Copy COUNT objects from SRC to DST. The source and destination do 545 not overlap. */ 546 # ifndef YYCOPY 547 # if defined __GNUC__ && 1 < __GNUC__ 548 # define YYCOPY(Dst, Src, Count) \ 549 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) 550 # else 551 # define YYCOPY(Dst, Src, Count) \ 552 do \ 553 { \ 554 YYPTRDIFF_T yyi; \ 555 for (yyi = 0; yyi < (Count); yyi++) \ 556 (Dst)[yyi] = (Src)[yyi]; \ 557 } \ 558 while (0) 559 # endif 560 # endif 561 #endif /* !YYCOPY_NEEDED */ 562 563 /* YYFINAL -- State number of the termination state. */ 564 #define YYFINAL 4 565 /* YYLAST -- Last index in YYTABLE. */ 566 #define YYLAST 31 567 568 /* YYNTOKENS -- Number of terminals. */ 569 #define YYNTOKENS 15 570 /* YYNNTS -- Number of nonterminals. */ 571 #define YYNNTS 5 572 /* YYNRULES -- Number of rules. */ 573 #define YYNRULES 13 574 /* YYNSTATES -- Number of states. */ 575 #define YYNSTATES 30 576 577 /* YYMAXUTOK -- Last valid token kind. */ 578 #define YYMAXUTOK 260 579 580 581 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM 582 as returned by yylex, with out-of-bounds checking. */ 583 #define YYTRANSLATE(YYX) \ 584 (0 <= (YYX) && (YYX) <= YYMAXUTOK \ 585 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ 586 : YYSYMBOL_YYUNDEF) 587 588 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 589 as returned by yylex. */ 590 static const yytype_int8 yytranslate[] = 591 { 592 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 595 2, 2, 2, 7, 2, 2, 2, 2, 10, 2, 596 8, 9, 2, 2, 2, 2, 2, 2, 2, 2, 597 2, 2, 2, 2, 2, 2, 2, 2, 6, 2, 598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 601 2, 2, 2, 2, 12, 2, 2, 2, 2, 2, 602 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 603 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 604 2, 2, 2, 13, 11, 14, 2, 2, 2, 2, 605 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 606 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 607 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 608 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 609 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 610 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 611 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 613 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 617 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 618 5 619 }; 620 621 #if YYDEBUG 622 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 623 static const yytype_int8 yyrline[] = 624 { 625 0, 77, 77, 80, 81, 82, 83, 86, 87, 88, 626 89, 90, 91, 94 627 }; 628 #endif 629 630 /** Accessing symbol of state STATE. */ 631 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) 632 633 #if YYDEBUG || 0 634 /* The user-facing name of the symbol whose (internal) number is 635 YYSYMBOL. No bounds checking. */ 636 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; 637 638 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 639 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 640 static const char *const yytname[] = 641 { 642 "\"end of file\"", "error", "\"invalid token\"", "NAME", "NUM", "CODE", 643 "':'", "'!'", "'('", "')'", "'&'", "'|'", "'^'", "'{'", "'}'", "$accept", 644 "line", "prev", "trigger", "action", YY_NULLPTR 645 }; 646 647 static const char * 648 yysymbol_name (yysymbol_kind_t yysymbol) 649 { 650 return yytname[yysymbol]; 651 } 652 #endif 653 654 #define YYPACT_NINF (-14) 655 656 #define yypact_value_is_default(Yyn) \ 657 ((Yyn) == YYPACT_NINF) 658 659 #define YYTABLE_NINF (-1) 660 661 #define yytable_value_is_error(Yyn) \ 662 0 663 664 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 665 STATE-NUM. */ 666 static const yytype_int8 yypact[] = 667 { 668 15, 7, 23, 11, -14, 20, 22, 21, -14, 24, 669 9, -14, -14, 9, 9, -1, -8, 10, 13, 9, 670 9, 9, -14, 25, -14, -8, -8, -8, 17, -14 671 }; 672 673 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. 674 Performed when YYTABLE does not specify something else to do. Zero 675 means the default is an error. */ 676 static const yytype_int8 yydefact[] = 677 { 678 0, 0, 0, 0, 1, 3, 0, 0, 5, 4, 679 0, 6, 7, 0, 0, 0, 8, 0, 0, 0, 680 0, 0, 9, 0, 2, 10, 11, 12, 0, 13 681 }; 682 683 /* YYPGOTO[NTERM-NUM]. */ 684 static const yytype_int8 yypgoto[] = 685 { 686 -14, -14, -14, -13, -14 687 }; 688 689 /* YYDEFGOTO[NTERM-NUM]. */ 690 static const yytype_int8 yydefgoto[] = 691 { 692 0, 2, 7, 15, 24 693 }; 694 695 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If 696 positive, shift that token. If negative, reduce the rule whose 697 number is the opposite. If YYTABLE_NINF, syntax error. */ 698 static const yytype_int8 yytable[] = 699 { 700 16, 17, 19, 20, 21, 18, 25, 26, 27, 19, 701 20, 21, 12, 3, 5, 6, 13, 14, 1, 22, 702 19, 20, 21, 4, 8, 9, 23, 10, 11, 0, 703 28, 29 704 }; 705 706 static const yytype_int8 yycheck[] = 707 { 708 13, 14, 10, 11, 12, 6, 19, 20, 21, 10, 709 11, 12, 3, 6, 3, 4, 7, 8, 3, 9, 710 10, 11, 12, 0, 4, 3, 13, 6, 4, -1, 711 5, 14 712 }; 713 714 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of 715 state STATE-NUM. */ 716 static const yytype_int8 yystos[] = 717 { 718 0, 3, 16, 6, 0, 3, 4, 17, 4, 3, 719 6, 4, 3, 7, 8, 18, 18, 18, 6, 10, 720 11, 12, 9, 13, 19, 18, 18, 18, 5, 14 721 }; 722 723 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ 724 static const yytype_int8 yyr1[] = 725 { 726 0, 15, 16, 17, 17, 17, 17, 18, 18, 18, 727 18, 18, 18, 19 728 }; 729 730 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ 731 static const yytype_int8 yyr2[] = 732 { 733 0, 2, 7, 1, 2, 2, 3, 1, 2, 3, 734 3, 3, 3, 3 735 }; 736 737 738 enum { YYENOMEM = -2 }; 739 740 #define yyerrok (yyerrstatus = 0) 741 #define yyclearin (yychar = YYEMPTY) 742 743 #define YYACCEPT goto yyacceptlab 744 #define YYABORT goto yyabortlab 745 #define YYERROR goto yyerrorlab 746 #define YYNOMEM goto yyexhaustedlab 747 748 749 #define YYRECOVERING() (!!yyerrstatus) 750 751 #define YYBACKUP(Token, Value) \ 752 do \ 753 if (yychar == YYEMPTY) \ 754 { \ 755 yychar = (Token); \ 756 yylval = (Value); \ 757 YYPOPSTACK (yylen); \ 758 yystate = *yyssp; \ 759 goto yybackup; \ 760 } \ 761 else \ 762 { \ 763 yyerror (YY_("syntax error: cannot back up")); \ 764 YYERROR; \ 765 } \ 766 while (0) 767 768 /* Backward compatibility with an undocumented macro. 769 Use YYerror or YYUNDEF. */ 770 #define YYERRCODE YYUNDEF 771 772 773 /* Enable debugging if requested. */ 774 #if YYDEBUG 775 776 # ifndef YYFPRINTF 777 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 778 # define YYFPRINTF fprintf 779 # endif 780 781 # define YYDPRINTF(Args) \ 782 do { \ 783 if (yydebug) \ 784 YYFPRINTF Args; \ 785 } while (0) 786 787 788 789 790 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ 791 do { \ 792 if (yydebug) \ 793 { \ 794 YYFPRINTF (stderr, "%s ", Title); \ 795 yy_symbol_print (stderr, \ 796 Kind, Value); \ 797 YYFPRINTF (stderr, "\n"); \ 798 } \ 799 } while (0) 800 801 802 /*-----------------------------------. 803 | Print this symbol's value on YYO. | 804 `-----------------------------------*/ 805 806 static void 807 yy_symbol_value_print (FILE *yyo, 808 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) 809 { 810 FILE *yyoutput = yyo; 811 YY_USE (yyoutput); 812 if (!yyvaluep) 813 return; 814 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 815 YY_USE (yykind); 816 YY_IGNORE_MAYBE_UNINITIALIZED_END 817 } 818 819 820 /*---------------------------. 821 | Print this symbol on YYO. | 822 `---------------------------*/ 823 824 static void 825 yy_symbol_print (FILE *yyo, 826 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) 827 { 828 YYFPRINTF (yyo, "%s %s (", 829 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); 830 831 yy_symbol_value_print (yyo, yykind, yyvaluep); 832 YYFPRINTF (yyo, ")"); 833 } 834 835 /*------------------------------------------------------------------. 836 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 837 | TOP (included). | 838 `------------------------------------------------------------------*/ 839 840 static void 841 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) 842 { 843 YYFPRINTF (stderr, "Stack now"); 844 for (; yybottom <= yytop; yybottom++) 845 { 846 int yybot = *yybottom; 847 YYFPRINTF (stderr, " %d", yybot); 848 } 849 YYFPRINTF (stderr, "\n"); 850 } 851 852 # define YY_STACK_PRINT(Bottom, Top) \ 853 do { \ 854 if (yydebug) \ 855 yy_stack_print ((Bottom), (Top)); \ 856 } while (0) 857 858 859 /*------------------------------------------------. 860 | Report that the YYRULE is going to be reduced. | 861 `------------------------------------------------*/ 862 863 static void 864 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, 865 int yyrule) 866 { 867 int yylno = yyrline[yyrule]; 868 int yynrhs = yyr2[yyrule]; 869 int yyi; 870 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", 871 yyrule - 1, yylno); 872 /* The symbols being reduced. */ 873 for (yyi = 0; yyi < yynrhs; yyi++) 874 { 875 YYFPRINTF (stderr, " $%d = ", yyi + 1); 876 yy_symbol_print (stderr, 877 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), 878 &yyvsp[(yyi + 1) - (yynrhs)]); 879 YYFPRINTF (stderr, "\n"); 880 } 881 } 882 883 # define YY_REDUCE_PRINT(Rule) \ 884 do { \ 885 if (yydebug) \ 886 yy_reduce_print (yyssp, yyvsp, Rule); \ 887 } while (0) 888 889 /* Nonzero means print parse trace. It is left uninitialized so that 890 multiple parsers can coexist. */ 891 int yydebug; 892 #else /* !YYDEBUG */ 893 # define YYDPRINTF(Args) ((void) 0) 894 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) 895 # define YY_STACK_PRINT(Bottom, Top) 896 # define YY_REDUCE_PRINT(Rule) 897 #endif /* !YYDEBUG */ 898 899 900 /* YYINITDEPTH -- initial size of the parser's stacks. */ 901 #ifndef YYINITDEPTH 902 # define YYINITDEPTH 200 903 #endif 904 905 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 906 if the built-in stack extension method is used). 907 908 Do not make this value too large; the results are undefined if 909 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 910 evaluated with infinite-precision integer arithmetic. */ 911 912 #ifndef YYMAXDEPTH 913 # define YYMAXDEPTH 10000 914 #endif 915 916 917 918 919 920 921 /*-----------------------------------------------. 922 | Release the memory associated to this symbol. | 923 `-----------------------------------------------*/ 924 925 static void 926 yydestruct (const char *yymsg, 927 yysymbol_kind_t yykind, YYSTYPE *yyvaluep) 928 { 929 YY_USE (yyvaluep); 930 if (!yymsg) 931 yymsg = "Deleting"; 932 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); 933 934 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 935 YY_USE (yykind); 936 YY_IGNORE_MAYBE_UNINITIALIZED_END 937 } 938 939 940 /* Lookahead token kind. */ 941 int yychar; 942 943 /* The semantic value of the lookahead symbol. */ 944 YYSTYPE yylval; 945 /* Number of syntax errors so far. */ 946 int yynerrs; 947 948 949 950 951 /*----------. 952 | yyparse. | 953 `----------*/ 954 955 int 956 yyparse (void) 957 { 958 yy_state_fast_t yystate = 0; 959 /* Number of tokens to shift before error messages enabled. */ 960 int yyerrstatus = 0; 961 962 /* Refer to the stacks through separate pointers, to allow yyoverflow 963 to reallocate them elsewhere. */ 964 965 /* Their size. */ 966 YYPTRDIFF_T yystacksize = YYINITDEPTH; 967 968 /* The state stack: array, bottom, top. */ 969 yy_state_t yyssa[YYINITDEPTH]; 970 yy_state_t *yyss = yyssa; 971 yy_state_t *yyssp = yyss; 972 973 /* The semantic value stack: array, bottom, top. */ 974 YYSTYPE yyvsa[YYINITDEPTH]; 975 YYSTYPE *yyvs = yyvsa; 976 YYSTYPE *yyvsp = yyvs; 977 978 int yyn; 979 /* The return value of yyparse. */ 980 int yyresult; 981 /* Lookahead symbol kind. */ 982 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; 983 /* The variables used to return semantic value and location from the 984 action routines. */ 985 YYSTYPE yyval; 986 987 988 989 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 990 991 /* The number of symbols on the RHS of the reduced rule. 992 Keep to zero when no symbol should be popped. */ 993 int yylen = 0; 994 995 YYDPRINTF ((stderr, "Starting parse\n")); 996 997 yychar = YYEMPTY; /* Cause a token to be read. */ 998 999 goto yysetstate; 1000 1001 1002 /*------------------------------------------------------------. 1003 | yynewstate -- push a new state, which is found in yystate. | 1004 `------------------------------------------------------------*/ 1005 yynewstate: 1006 /* In all cases, when you get here, the value and location stacks 1007 have just been pushed. So pushing a state here evens the stacks. */ 1008 yyssp++; 1009 1010 1011 /*--------------------------------------------------------------------. 1012 | yysetstate -- set current state (the top of the stack) to yystate. | 1013 `--------------------------------------------------------------------*/ 1014 yysetstate: 1015 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1016 YY_ASSERT (0 <= yystate && yystate < YYNSTATES); 1017 YY_IGNORE_USELESS_CAST_BEGIN 1018 *yyssp = YY_CAST (yy_state_t, yystate); 1019 YY_IGNORE_USELESS_CAST_END 1020 YY_STACK_PRINT (yyss, yyssp); 1021 1022 if (yyss + yystacksize - 1 <= yyssp) 1023 #if !defined yyoverflow && !defined YYSTACK_RELOCATE 1024 YYNOMEM; 1025 #else 1026 { 1027 /* Get the current used size of the three stacks, in elements. */ 1028 YYPTRDIFF_T yysize = yyssp - yyss + 1; 1029 1030 # if defined yyoverflow 1031 { 1032 /* Give user a chance to reallocate the stack. Use copies of 1033 these so that the &'s don't force the real ones into 1034 memory. */ 1035 yy_state_t *yyss1 = yyss; 1036 YYSTYPE *yyvs1 = yyvs; 1037 1038 /* Each stack pointer address is followed by the size of the 1039 data in use in that stack, in bytes. This used to be a 1040 conditional around just the two extra args, but that might 1041 be undefined if yyoverflow is a macro. */ 1042 yyoverflow (YY_("memory exhausted"), 1043 &yyss1, yysize * YYSIZEOF (*yyssp), 1044 &yyvs1, yysize * YYSIZEOF (*yyvsp), 1045 &yystacksize); 1046 yyss = yyss1; 1047 yyvs = yyvs1; 1048 } 1049 # else /* defined YYSTACK_RELOCATE */ 1050 /* Extend the stack our own way. */ 1051 if (YYMAXDEPTH <= yystacksize) 1052 YYNOMEM; 1053 yystacksize *= 2; 1054 if (YYMAXDEPTH < yystacksize) 1055 yystacksize = YYMAXDEPTH; 1056 1057 { 1058 yy_state_t *yyss1 = yyss; 1059 union yyalloc *yyptr = 1060 YY_CAST (union yyalloc *, 1061 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); 1062 if (! yyptr) 1063 YYNOMEM; 1064 YYSTACK_RELOCATE (yyss_alloc, yyss); 1065 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1066 # undef YYSTACK_RELOCATE 1067 if (yyss1 != yyssa) 1068 YYSTACK_FREE (yyss1); 1069 } 1070 # endif 1071 1072 yyssp = yyss + yysize - 1; 1073 yyvsp = yyvs + yysize - 1; 1074 1075 YY_IGNORE_USELESS_CAST_BEGIN 1076 YYDPRINTF ((stderr, "Stack size increased to %ld\n", 1077 YY_CAST (long, yystacksize))); 1078 YY_IGNORE_USELESS_CAST_END 1079 1080 if (yyss + yystacksize - 1 <= yyssp) 1081 YYABORT; 1082 } 1083 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ 1084 1085 1086 if (yystate == YYFINAL) 1087 YYACCEPT; 1088 1089 goto yybackup; 1090 1091 1092 /*-----------. 1093 | yybackup. | 1094 `-----------*/ 1095 yybackup: 1096 /* Do appropriate processing given the current state. Read a 1097 lookahead token if we need one and don't already have one. */ 1098 1099 /* First try to decide what to do without reference to lookahead token. */ 1100 yyn = yypact[yystate]; 1101 if (yypact_value_is_default (yyn)) 1102 goto yydefault; 1103 1104 /* Not known => get a lookahead token if don't already have one. */ 1105 1106 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ 1107 if (yychar == YYEMPTY) 1108 { 1109 YYDPRINTF ((stderr, "Reading a token\n")); 1110 yychar = yylex (); 1111 } 1112 1113 if (yychar <= YYEOF) 1114 { 1115 yychar = YYEOF; 1116 yytoken = YYSYMBOL_YYEOF; 1117 YYDPRINTF ((stderr, "Now at end of input.\n")); 1118 } 1119 else if (yychar == YYerror) 1120 { 1121 /* The scanner already issued an error message, process directly 1122 to error recovery. But do not keep the error token as 1123 lookahead, it is too special and may lead us to an endless 1124 loop in error recovery. */ 1125 yychar = YYUNDEF; 1126 yytoken = YYSYMBOL_YYerror; 1127 goto yyerrlab1; 1128 } 1129 else 1130 { 1131 yytoken = YYTRANSLATE (yychar); 1132 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1133 } 1134 1135 /* If the proper action on seeing token YYTOKEN is to reduce or to 1136 detect an error, take that action. */ 1137 yyn += yytoken; 1138 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1139 goto yydefault; 1140 yyn = yytable[yyn]; 1141 if (yyn <= 0) 1142 { 1143 if (yytable_value_is_error (yyn)) 1144 goto yyerrlab; 1145 yyn = -yyn; 1146 goto yyreduce; 1147 } 1148 1149 /* Count tokens shifted since error; after three, turn off error 1150 status. */ 1151 if (yyerrstatus) 1152 yyerrstatus--; 1153 1154 /* Shift the lookahead token. */ 1155 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1156 yystate = yyn; 1157 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1158 *++yyvsp = yylval; 1159 YY_IGNORE_MAYBE_UNINITIALIZED_END 1160 1161 /* Discard the shifted token. */ 1162 yychar = YYEMPTY; 1163 goto yynewstate; 1164 1165 1166 /*-----------------------------------------------------------. 1167 | yydefault -- do the default action for the current state. | 1168 `-----------------------------------------------------------*/ 1169 yydefault: 1170 yyn = yydefact[yystate]; 1171 if (yyn == 0) 1172 goto yyerrlab; 1173 goto yyreduce; 1174 1175 1176 /*-----------------------------. 1177 | yyreduce -- do a reduction. | 1178 `-----------------------------*/ 1179 yyreduce: 1180 /* yyn is the number of a rule to reduce with. */ 1181 yylen = yyr2[yyn]; 1182 1183 /* If YYLEN is nonzero, implement the default value of the action: 1184 '$$ = $1'. 1185 1186 Otherwise, the following line sets YYVAL to garbage. 1187 This behavior is undocumented and Bison 1188 users should not rely upon it. Assigning to YYVAL 1189 unconditionally makes the parser a bit smaller, and it avoids a 1190 GCC warning that YYVAL may be used uninitialized. */ 1191 yyval = yyvsp[1-yylen]; 1192 1193 1194 YY_REDUCE_PRINT (yyn); 1195 switch (yyn) 1196 { 1197 case 2: /* line: NAME ':' prev ':' trigger ':' action */ 1198 #line 77 "parse.y" 1199 {} 1200 #line 1201 "y.tab.c" 1201 break; 1202 1203 case 3: /* prev: NAME */ 1204 #line 80 "parse.y" 1205 {} 1206 #line 1207 "y.tab.c" 1207 break; 1208 1209 case 4: /* prev: NUM NAME */ 1210 #line 81 "parse.y" 1211 {} 1212 #line 1213 "y.tab.c" 1213 break; 1214 1215 case 5: /* prev: NAME NUM */ 1216 #line 82 "parse.y" 1217 {} 1218 #line 1219 "y.tab.c" 1219 break; 1220 1221 case 6: /* prev: NUM NAME NUM */ 1222 #line 83 "parse.y" 1223 {} 1224 #line 1225 "y.tab.c" 1225 break; 1226 1227 1228 #line 1229 "y.tab.c" 1229 1230 default: break; 1231 } 1232 /* User semantic actions sometimes alter yychar, and that requires 1233 that yytoken be updated with the new translation. We take the 1234 approach of translating immediately before every use of yytoken. 1235 One alternative is translating here after every semantic action, 1236 but that translation would be missed if the semantic action invokes 1237 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 1238 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 1239 incorrect destructor might then be invoked immediately. In the 1240 case of YYERROR or YYBACKUP, subsequent parser actions might lead 1241 to an incorrect destructor call or verbose syntax error message 1242 before the lookahead is translated. */ 1243 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); 1244 1245 YYPOPSTACK (yylen); 1246 yylen = 0; 1247 1248 *++yyvsp = yyval; 1249 1250 /* Now 'shift' the result of the reduction. Determine what state 1251 that goes to, based on the state we popped back to and the rule 1252 number reduced by. */ 1253 { 1254 const int yylhs = yyr1[yyn] - YYNTOKENS; 1255 const int yyi = yypgoto[yylhs] + *yyssp; 1256 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp 1257 ? yytable[yyi] 1258 : yydefgoto[yylhs]); 1259 } 1260 1261 goto yynewstate; 1262 1263 1264 /*--------------------------------------. 1265 | yyerrlab -- here on detecting error. | 1266 `--------------------------------------*/ 1267 yyerrlab: 1268 /* Make sure we have latest lookahead translation. See comments at 1269 user semantic actions for why this is necessary. */ 1270 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); 1271 /* If not already recovering from an error, report this error. */ 1272 if (!yyerrstatus) 1273 { 1274 ++yynerrs; 1275 yyerror (YY_("syntax error")); 1276 } 1277 1278 if (yyerrstatus == 3) 1279 { 1280 /* If just tried and failed to reuse lookahead token after an 1281 error, discard it. */ 1282 1283 if (yychar <= YYEOF) 1284 { 1285 /* Return failure if at end of input. */ 1286 if (yychar == YYEOF) 1287 YYABORT; 1288 } 1289 else 1290 { 1291 yydestruct ("Error: discarding", 1292 yytoken, &yylval); 1293 yychar = YYEMPTY; 1294 } 1295 } 1296 1297 /* Else will try to reuse lookahead token after shifting the error 1298 token. */ 1299 goto yyerrlab1; 1300 1301 1302 /*---------------------------------------------------. 1303 | yyerrorlab -- error raised explicitly by YYERROR. | 1304 `---------------------------------------------------*/ 1305 yyerrorlab: 1306 /* Pacify compilers when the user code never invokes YYERROR and the 1307 label yyerrorlab therefore never appears in user code. */ 1308 if (0) 1309 YYERROR; 1310 ++yynerrs; 1311 1312 /* Do not reclaim the symbols of the rule whose action triggered 1313 this YYERROR. */ 1314 YYPOPSTACK (yylen); 1315 yylen = 0; 1316 YY_STACK_PRINT (yyss, yyssp); 1317 yystate = *yyssp; 1318 goto yyerrlab1; 1319 1320 1321 /*-------------------------------------------------------------. 1322 | yyerrlab1 -- common code for both syntax error and YYERROR. | 1323 `-------------------------------------------------------------*/ 1324 yyerrlab1: 1325 yyerrstatus = 3; /* Each real token shifted decrements this. */ 1326 1327 /* Pop stack until we find a state that shifts the error token. */ 1328 for (;;) 1329 { 1330 yyn = yypact[yystate]; 1331 if (!yypact_value_is_default (yyn)) 1332 { 1333 yyn += YYSYMBOL_YYerror; 1334 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) 1335 { 1336 yyn = yytable[yyn]; 1337 if (0 < yyn) 1338 break; 1339 } 1340 } 1341 1342 /* Pop the current state because it cannot handle the error token. */ 1343 if (yyssp == yyss) 1344 YYABORT; 1345 1346 1347 yydestruct ("Error: popping", 1348 YY_ACCESSING_SYMBOL (yystate), yyvsp); 1349 YYPOPSTACK (1); 1350 yystate = *yyssp; 1351 YY_STACK_PRINT (yyss, yyssp); 1352 } 1353 1354 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1355 *++yyvsp = yylval; 1356 YY_IGNORE_MAYBE_UNINITIALIZED_END 1357 1358 1359 /* Shift the error token. */ 1360 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); 1361 1362 yystate = yyn; 1363 goto yynewstate; 1364 1365 1366 /*-------------------------------------. 1367 | yyacceptlab -- YYACCEPT comes here. | 1368 `-------------------------------------*/ 1369 yyacceptlab: 1370 yyresult = 0; 1371 goto yyreturnlab; 1372 1373 1374 /*-----------------------------------. 1375 | yyabortlab -- YYABORT comes here. | 1376 `-----------------------------------*/ 1377 yyabortlab: 1378 yyresult = 1; 1379 goto yyreturnlab; 1380 1381 1382 /*-----------------------------------------------------------. 1383 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | 1384 `-----------------------------------------------------------*/ 1385 yyexhaustedlab: 1386 yyerror (YY_("memory exhausted")); 1387 yyresult = 2; 1388 goto yyreturnlab; 1389 1390 1391 /*----------------------------------------------------------. 1392 | yyreturnlab -- parsing is finished, clean up and return. | 1393 `----------------------------------------------------------*/ 1394 yyreturnlab: 1395 if (yychar != YYEMPTY) 1396 { 1397 /* Make sure we have latest lookahead translation. See comments at 1398 user semantic actions for why this is necessary. */ 1399 yytoken = YYTRANSLATE (yychar); 1400 yydestruct ("Cleanup: discarding lookahead", 1401 yytoken, &yylval); 1402 } 1403 /* Do not reclaim the symbols of the rule whose action triggered 1404 this YYABORT or YYACCEPT. */ 1405 YYPOPSTACK (yylen); 1406 YY_STACK_PRINT (yyss, yyssp); 1407 while (yyssp != yyss) 1408 { 1409 yydestruct ("Cleanup: popping", 1410 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); 1411 YYPOPSTACK (1); 1412 } 1413 #ifndef yyoverflow 1414 if (yyss != yyssa) 1415 YYSTACK_FREE (yyss); 1416 #endif 1417 1418 return yyresult; 1419 } 1420 1421 #line 96 "parse.y" 1422 1423 1424 int 1425 main() { 1426 yyparse(); 1427 }