1 /* original parser id follows */ 2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ 3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ 4 5 #define YYBYACC 1 6 #define YYMAJOR 1 7 #define YYMINOR 9 8 #define YYCHECK "yyyymmdd" 9 10 #define YYEMPTY (-1) 11 #define yyclearin (yychar = YYEMPTY) 12 #define yyerrok (yyerrflag = 0) 13 #define YYRECOVERING() (yyerrflag != 0) 14 #define YYENOMEM (-2) 15 #define YYEOF 0 16 #undef YYBTYACC 17 #define YYBTYACC 0 18 #define YYDEBUGSTR YYPREFIX "debug" 19 20 #ifndef yyparse 21 #define yyparse inherit0_parse 22 #endif /* yyparse */ 23 24 #ifndef yylex 25 #define yylex inherit0_lex 26 #endif /* yylex */ 27 28 #ifndef yyerror 29 #define yyerror inherit0_error 30 #endif /* yyerror */ 31 32 #ifndef yychar 33 #define yychar inherit0_char 34 #endif /* yychar */ 35 36 #ifndef yyval 37 #define yyval inherit0_val 38 #endif /* yyval */ 39 40 #ifndef yylval 41 #define yylval inherit0_lval 42 #endif /* yylval */ 43 44 #ifndef yydebug 45 #define yydebug inherit0_debug 46 #endif /* yydebug */ 47 48 #ifndef yynerrs 49 #define yynerrs inherit0_nerrs 50 #endif /* yynerrs */ 51 52 #ifndef yyerrflag 53 #define yyerrflag inherit0_errflag 54 #endif /* yyerrflag */ 55 56 #ifndef yylhs 57 #define yylhs inherit0_lhs 58 #endif /* yylhs */ 59 60 #ifndef yylen 61 #define yylen inherit0_len 62 #endif /* yylen */ 63 64 #ifndef yydefred 65 #define yydefred inherit0_defred 66 #endif /* yydefred */ 67 68 #ifndef yystos 69 #define yystos inherit0_stos 70 #endif /* yystos */ 71 72 #ifndef yydgoto 73 #define yydgoto inherit0_dgoto 74 #endif /* yydgoto */ 75 76 #ifndef yysindex 77 #define yysindex inherit0_sindex 78 #endif /* yysindex */ 79 80 #ifndef yyrindex 81 #define yyrindex inherit0_rindex 82 #endif /* yyrindex */ 83 84 #ifndef yygindex 85 #define yygindex inherit0_gindex 86 #endif /* yygindex */ 87 88 #ifndef yytable 89 #define yytable inherit0_table 90 #endif /* yytable */ 91 92 #ifndef yycheck 93 #define yycheck inherit0_check 94 #endif /* yycheck */ 95 96 #ifndef yyname 97 #define yyname inherit0_name 98 #endif /* yyname */ 99 100 #ifndef yyrule 101 #define yyrule inherit0_rule 102 #endif /* yyrule */ 103 104 #if YYBTYACC 105 106 #ifndef yycindex 107 #define yycindex inherit0_cindex 108 #endif /* yycindex */ 109 110 #ifndef yyctable 111 #define yyctable inherit0_ctable 112 #endif /* yyctable */ 113 114 #endif /* YYBTYACC */ 115 116 #define YYPREFIX "inherit0_" 117 118 #define YYPURE 0 119 120 #line 2 "inherit0.y" 121 extern void mksymbol(int t, int c, int id); 122 123 #ifdef YYBISON 124 #define YYLEX_DECL() yylex(void) 125 #define YYERROR_DECL() yyerror(const char *s) 126 extern int YYLEX_DECL(); 127 extern void YYERROR_DECL(); 128 #endif 129 #line 130 "inherit0.tab.c" 130 131 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED) 132 /* Default: YYSTYPE is the semantic value type. */ 133 typedef int YYSTYPE; 134 # define YYSTYPE_IS_DECLARED 1 135 #endif 136 137 /* compatibility with bison */ 138 #ifdef YYPARSE_PARAM 139 /* compatibility with FreeBSD */ 140 # ifdef YYPARSE_PARAM_TYPE 141 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 142 # else 143 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 144 # endif 145 #else 146 # define YYPARSE_DECL() yyparse(void) 147 #endif 148 149 /* Parameters sent to lex. */ 150 #ifdef YYLEX_PARAM 151 # define YYLEX_DECL() yylex(void *YYLEX_PARAM) 152 # define YYLEX yylex(YYLEX_PARAM) 153 #else 154 # define YYLEX_DECL() yylex(void) 155 # define YYLEX yylex() 156 #endif 157 158 /* Parameters sent to yyerror. */ 159 #ifndef YYERROR_DECL 160 #define YYERROR_DECL() yyerror(const char *s) 161 #endif 162 #ifndef YYERROR_CALL 163 #define YYERROR_CALL(msg) yyerror(msg) 164 #endif 165 166 extern int YYPARSE_DECL(); 167 168 #define GLOBAL 257 169 #define LOCAL 258 170 #define REAL 259 171 #define INTEGER 260 172 #define NAME 261 173 #define YYERRCODE 256 174 typedef short YYINT; 175 static const YYINT inherit0_lhs[] = { -1, 176 0, 0, 1, 1, 2, 2, 3, 3, 5, 6, 177 4, 178 }; 179 static const YYINT inherit0_len[] = { 2, 180 3, 2, 1, 1, 1, 1, 2, 1, 0, 0, 181 3, 182 }; 183 static const YYINT inherit0_defred[] = { 0, 184 3, 4, 5, 6, 0, 0, 9, 0, 2, 10, 185 8, 0, 0, 7, 0, 186 }; 187 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) 188 static const YYINT inherit0_stos[] = { 0, 189 257, 258, 259, 260, 263, 264, 265, 265, 267, 268, 190 261, 266, 269, 261, 266, 191 }; 192 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ 193 static const YYINT inherit0_dgoto[] = { 5, 194 6, 7, 12, 9, 10, 13, 195 }; 196 static const YYINT inherit0_sindex[] = { -257, 197 0, 0, 0, 0, 0, -255, 0, -254, 0, 0, 198 0, -253, -254, 0, -253, 199 }; 200 static const YYINT inherit0_rindex[] = { 0, 201 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 202 0, 6, 0, 0, 9, 203 }; 204 #if YYBTYACC 205 static const YYINT inherit0_cindex[] = { 0, 206 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 207 0, 0, 0, 0, 0, 208 }; 209 #endif 210 static const YYINT inherit0_gindex[] = { 0, 211 0, 4, -2, 0, 0, 0, 212 }; 213 #define YYTABLESIZE 11 214 static const YYINT inherit0_table[] = { 1, 215 2, 3, 4, 3, 4, 1, 11, 14, 11, 8, 216 15, 217 }; 218 static const YYINT inherit0_check[] = { 257, 219 258, 259, 260, 259, 260, 0, 261, 261, 0, 6, 220 13, 221 }; 222 #if YYBTYACC 223 static const YYINT inherit0_ctable[] = { -1, 224 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 225 }; 226 #endif 227 #define YYFINAL 5 228 #ifndef YYDEBUG 229 #define YYDEBUG 0 230 #endif 231 #define YYMAXTOKEN 261 232 #define YYUNDFTOKEN 270 233 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) 234 #if YYDEBUG 235 static const char *const inherit0_name[] = { 236 237 "$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 238 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 239 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 240 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 241 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 242 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 243 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER", 244 "NAME","$accept","declaration","class","type","namelist","locnamelist","$$1", 245 "$$2","illegal-symbol", 246 }; 247 static const char *const inherit0_rule[] = { 248 "$accept : declaration", 249 "declaration : class type namelist", 250 "declaration : type locnamelist", 251 "class : GLOBAL", 252 "class : LOCAL", 253 "type : REAL", 254 "type : INTEGER", 255 "namelist : namelist NAME", 256 "namelist : NAME", 257 "$$1 :", 258 "$$2 :", 259 "locnamelist : $$1 $$2 namelist", 260 261 }; 262 #endif 263 264 int yydebug; 265 int yynerrs; 266 267 int yyerrflag; 268 int yychar; 269 YYSTYPE yyval; 270 YYSTYPE yylval; 271 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 272 YYLTYPE yyloc; /* position returned by actions */ 273 YYLTYPE yylloc; /* position from the lexer */ 274 #endif 275 276 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 277 #ifndef YYLLOC_DEFAULT 278 #define YYLLOC_DEFAULT(loc, rhs, n) \ 279 do \ 280 { \ 281 if (n == 0) \ 282 { \ 283 (loc).first_line = ((rhs)[-1]).last_line; \ 284 (loc).first_column = ((rhs)[-1]).last_column; \ 285 (loc).last_line = ((rhs)[-1]).last_line; \ 286 (loc).last_column = ((rhs)[-1]).last_column; \ 287 } \ 288 else \ 289 { \ 290 (loc).first_line = ((rhs)[ 0 ]).first_line; \ 291 (loc).first_column = ((rhs)[ 0 ]).first_column; \ 292 (loc).last_line = ((rhs)[n-1]).last_line; \ 293 (loc).last_column = ((rhs)[n-1]).last_column; \ 294 } \ 295 } while (0) 296 #endif /* YYLLOC_DEFAULT */ 297 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 298 #if YYBTYACC 299 300 #ifndef YYLVQUEUEGROWTH 301 #define YYLVQUEUEGROWTH 32 302 #endif 303 #endif /* YYBTYACC */ 304 305 /* define the initial stack-sizes */ 306 #ifdef YYSTACKSIZE 307 #undef YYMAXDEPTH 308 #define YYMAXDEPTH YYSTACKSIZE 309 #else 310 #ifdef YYMAXDEPTH 311 #define YYSTACKSIZE YYMAXDEPTH 312 #else 313 #define YYSTACKSIZE 10000 314 #define YYMAXDEPTH 10000 315 #endif 316 #endif 317 318 #ifndef YYINITSTACKSIZE 319 #define YYINITSTACKSIZE 200 320 #endif 321 322 typedef struct { 323 unsigned stacksize; 324 YYINT *s_base; 325 YYINT *s_mark; 326 YYINT *s_last; 327 YYSTYPE *l_base; 328 YYSTYPE *l_mark; 329 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 330 YYLTYPE *p_base; 331 YYLTYPE *p_mark; 332 #endif 333 } YYSTACKDATA; 334 #if YYBTYACC 335 336 struct YYParseState_s 337 { 338 struct YYParseState_s *save; /* Previously saved parser state */ 339 YYSTACKDATA yystack; /* saved parser stack */ 340 int state; /* saved parser state */ 341 int errflag; /* saved error recovery status */ 342 int lexeme; /* saved index of the conflict lexeme in the lexical queue */ 343 YYINT ctry; /* saved index in yyctable[] for this conflict */ 344 }; 345 typedef struct YYParseState_s YYParseState; 346 #endif /* YYBTYACC */ 347 /* variables for the parser stack */ 348 static YYSTACKDATA yystack; 349 #if YYBTYACC 350 351 /* Current parser state */ 352 static YYParseState *yyps = 0; 353 354 /* yypath != NULL: do the full parse, starting at *yypath parser state. */ 355 static YYParseState *yypath = 0; 356 357 /* Base of the lexical value queue */ 358 static YYSTYPE *yylvals = 0; 359 360 /* Current position at lexical value queue */ 361 static YYSTYPE *yylvp = 0; 362 363 /* End position of lexical value queue */ 364 static YYSTYPE *yylve = 0; 365 366 /* The last allocated position at the lexical value queue */ 367 static YYSTYPE *yylvlim = 0; 368 369 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 370 /* Base of the lexical position queue */ 371 static YYLTYPE *yylpsns = 0; 372 373 /* Current position at lexical position queue */ 374 static YYLTYPE *yylpp = 0; 375 376 /* End position of lexical position queue */ 377 static YYLTYPE *yylpe = 0; 378 379 /* The last allocated position at the lexical position queue */ 380 static YYLTYPE *yylplim = 0; 381 #endif 382 383 /* Current position at lexical token queue */ 384 static YYINT *yylexp = 0; 385 386 static YYINT *yylexemes = 0; 387 #endif /* YYBTYACC */ 388 #line 46 "inherit0.y" 389 390 extern int YYLEX_DECL(); 391 extern void YYERROR_DECL(); 392 #line 393 "inherit0.tab.c" 393 394 /* For use in generated program */ 395 #define yydepth (int)(yystack.s_mark - yystack.s_base) 396 #if YYBTYACC 397 #define yytrial (yyps->save) 398 #endif /* YYBTYACC */ 399 400 #if YYDEBUG 401 #include <stdio.h> /* needed for printf */ 402 #endif 403 404 #include <stdlib.h> /* needed for malloc, etc */ 405 #include <string.h> /* needed for memset */ 406 407 /* allocate initial stack or double stack size, up to YYMAXDEPTH */ 408 static int yygrowstack(YYSTACKDATA *data) 409 { 410 int i; 411 unsigned newsize; 412 YYINT *newss; 413 YYSTYPE *newvs; 414 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 415 YYLTYPE *newps; 416 #endif 417 418 if ((newsize = data->stacksize) == 0) 419 newsize = YYINITSTACKSIZE; 420 else if (newsize >= YYMAXDEPTH) 421 return YYENOMEM; 422 else if ((newsize *= 2) > YYMAXDEPTH) 423 newsize = YYMAXDEPTH; 424 425 i = (int) (data->s_mark - data->s_base); 426 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); 427 if (newss == 0) 428 return YYENOMEM; 429 430 data->s_base = newss; 431 data->s_mark = newss + i; 432 433 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 434 if (newvs == 0) 435 return YYENOMEM; 436 437 data->l_base = newvs; 438 data->l_mark = newvs + i; 439 440 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 441 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps)); 442 if (newps == 0) 443 return YYENOMEM; 444 445 data->p_base = newps; 446 data->p_mark = newps + i; 447 #endif 448 449 data->stacksize = newsize; 450 data->s_last = data->s_base + newsize - 1; 451 452 #if YYDEBUG 453 if (yydebug) 454 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize); 455 #endif 456 return 0; 457 } 458 459 #if YYPURE || defined(YY_NO_LEAKS) 460 static void yyfreestack(YYSTACKDATA *data) 461 { 462 free(data->s_base); 463 free(data->l_base); 464 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 465 free(data->p_base); 466 #endif 467 memset(data, 0, sizeof(*data)); 468 } 469 #else 470 #define yyfreestack(data) /* nothing */ 471 #endif /* YYPURE || defined(YY_NO_LEAKS) */ 472 #if YYBTYACC 473 474 static YYParseState * 475 yyNewState(unsigned size) 476 { 477 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState)); 478 if (p == NULL) return NULL; 479 480 p->yystack.stacksize = size; 481 if (size == 0) 482 { 483 p->yystack.s_base = NULL; 484 p->yystack.l_base = NULL; 485 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 486 p->yystack.p_base = NULL; 487 #endif 488 return p; 489 } 490 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT)); 491 if (p->yystack.s_base == NULL) return NULL; 492 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE)); 493 if (p->yystack.l_base == NULL) return NULL; 494 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE)); 495 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 496 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE)); 497 if (p->yystack.p_base == NULL) return NULL; 498 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE)); 499 #endif 500 501 return p; 502 } 503 504 static void 505 yyFreeState(YYParseState *p) 506 { 507 yyfreestack(&p->yystack); 508 free(p); 509 } 510 #endif /* YYBTYACC */ 511 512 #define YYABORT goto yyabort 513 #define YYREJECT goto yyabort 514 #define YYACCEPT goto yyaccept 515 #define YYERROR goto yyerrlab 516 #if YYBTYACC 517 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0) 518 #define YYVALID_NESTED do { if (yyps->save && \ 519 yyps->save->save == 0) goto yyvalid; } while(0) 520 #endif /* YYBTYACC */ 521 522 int 523 YYPARSE_DECL() 524 { 525 int yym, yyn, yystate, yyresult; 526 #if YYBTYACC 527 int yynewerrflag; 528 YYParseState *yyerrctx = NULL; 529 #endif /* YYBTYACC */ 530 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 531 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */ 532 #endif 533 #if YYDEBUG 534 const char *yys; 535 536 if ((yys = getenv("YYDEBUG")) != 0) 537 { 538 yyn = *yys; 539 if (yyn >= '0' && yyn <= '9') 540 yydebug = yyn - '0'; 541 } 542 if (yydebug) 543 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX); 544 #endif 545 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 546 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range)); 547 #endif 548 549 #if YYBTYACC 550 yyps = yyNewState(0); if (yyps == 0) goto yyenomem; 551 yyps->save = 0; 552 #endif /* YYBTYACC */ 553 yym = 0; 554 yyn = 0; 555 yynerrs = 0; 556 yyerrflag = 0; 557 yychar = YYEMPTY; 558 yystate = 0; 559 560 #if YYPURE 561 memset(&yystack, 0, sizeof(yystack)); 562 #endif 563 564 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 565 yystack.s_mark = yystack.s_base; 566 yystack.l_mark = yystack.l_base; 567 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 568 yystack.p_mark = yystack.p_base; 569 #endif 570 yystate = 0; 571 *yystack.s_mark = 0; 572 573 yyloop: 574 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 575 if (yychar < 0) 576 { 577 #if YYBTYACC 578 do { 579 if (yylvp < yylve) 580 { 581 /* we're currently re-reading tokens */ 582 yylval = *yylvp++; 583 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 584 yylloc = *yylpp++; 585 #endif 586 yychar = *yylexp++; 587 break; 588 } 589 if (yyps->save) 590 { 591 /* in trial mode; save scanner results for future parse attempts */ 592 if (yylvp == yylvlim) 593 { /* Enlarge lexical value queue */ 594 size_t p = (size_t) (yylvp - yylvals); 595 size_t s = (size_t) (yylvlim - yylvals); 596 597 s += YYLVQUEUEGROWTH; 598 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; 599 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; 600 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 601 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; 602 #endif 603 yylvp = yylve = yylvals + p; 604 yylvlim = yylvals + s; 605 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 606 yylpp = yylpe = yylpsns + p; 607 yylplim = yylpsns + s; 608 #endif 609 yylexp = yylexemes + p; 610 } 611 *yylexp = (YYINT) YYLEX; 612 *yylvp++ = yylval; 613 yylve++; 614 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 615 *yylpp++ = yylloc; 616 yylpe++; 617 #endif 618 yychar = *yylexp++; 619 break; 620 } 621 /* normal operation, no conflict encountered */ 622 #endif /* YYBTYACC */ 623 yychar = YYLEX; 624 #if YYBTYACC 625 } while (0); 626 #endif /* YYBTYACC */ 627 if (yychar < 0) yychar = YYEOF; 628 #if YYDEBUG 629 if (yydebug) 630 { 631 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 632 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)", 633 YYDEBUGSTR, yydepth, yystate, yychar, yys); 634 #ifdef YYSTYPE_TOSTRING 635 #if YYBTYACC 636 if (!yytrial) 637 #endif /* YYBTYACC */ 638 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval)); 639 #endif 640 fputc('\n', stderr); 641 } 642 #endif 643 } 644 #if YYBTYACC 645 646 /* Do we have a conflict? */ 647 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 && 648 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 649 { 650 YYINT ctry; 651 652 if (yypath) 653 { 654 YYParseState *save; 655 #if YYDEBUG 656 if (yydebug) 657 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n", 658 YYDEBUGSTR, yydepth, yystate); 659 #endif 660 /* Switch to the next conflict context */ 661 save = yypath; 662 yypath = save->save; 663 save->save = NULL; 664 ctry = save->ctry; 665 if (save->state != yystate) YYABORT; 666 yyFreeState(save); 667 668 } 669 else 670 { 671 672 /* Unresolved conflict - start/continue trial parse */ 673 YYParseState *save; 674 #if YYDEBUG 675 if (yydebug) 676 { 677 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate); 678 if (yyps->save) 679 fputs("ALREADY in conflict, continuing trial parse.\n", stderr); 680 else 681 fputs("Starting trial parse.\n", stderr); 682 } 683 #endif 684 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 685 if (save == NULL) goto yyenomem; 686 save->save = yyps->save; 687 save->state = yystate; 688 save->errflag = yyerrflag; 689 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); 690 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 691 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); 692 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 693 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 694 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); 695 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 696 #endif 697 ctry = yytable[yyn]; 698 if (yyctable[ctry] == -1) 699 { 700 #if YYDEBUG 701 if (yydebug && yychar >= YYEOF) 702 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth); 703 #endif 704 ctry++; 705 } 706 save->ctry = ctry; 707 if (yyps->save == NULL) 708 { 709 /* If this is a first conflict in the stack, start saving lexemes */ 710 if (!yylexemes) 711 { 712 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); 713 if (yylexemes == NULL) goto yyenomem; 714 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); 715 if (yylvals == NULL) goto yyenomem; 716 yylvlim = yylvals + YYLVQUEUEGROWTH; 717 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 718 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE)); 719 if (yylpsns == NULL) goto yyenomem; 720 yylplim = yylpsns + YYLVQUEUEGROWTH; 721 #endif 722 } 723 if (yylvp == yylve) 724 { 725 yylvp = yylve = yylvals; 726 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 727 yylpp = yylpe = yylpsns; 728 #endif 729 yylexp = yylexemes; 730 if (yychar >= YYEOF) 731 { 732 *yylve++ = yylval; 733 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 734 *yylpe++ = yylloc; 735 #endif 736 *yylexp = (YYINT) yychar; 737 yychar = YYEMPTY; 738 } 739 } 740 } 741 if (yychar >= YYEOF) 742 { 743 yylvp--; 744 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 745 yylpp--; 746 #endif 747 yylexp--; 748 yychar = YYEMPTY; 749 } 750 save->lexeme = (int) (yylvp - yylvals); 751 yyps->save = save; 752 } 753 if (yytable[yyn] == ctry) 754 { 755 #if YYDEBUG 756 if (yydebug) 757 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 758 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]); 759 #endif 760 if (yychar < 0) 761 { 762 yylvp++; 763 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 764 yylpp++; 765 #endif 766 yylexp++; 767 } 768 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) 769 goto yyoverflow; 770 yystate = yyctable[ctry]; 771 *++yystack.s_mark = (YYINT) yystate; 772 *++yystack.l_mark = yylval; 773 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 774 *++yystack.p_mark = yylloc; 775 #endif 776 yychar = YYEMPTY; 777 if (yyerrflag > 0) --yyerrflag; 778 goto yyloop; 779 } 780 else 781 { 782 yyn = yyctable[ctry]; 783 goto yyreduce; 784 } 785 } /* End of code dealing with conflicts */ 786 #endif /* YYBTYACC */ 787 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 788 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 789 { 790 #if YYDEBUG 791 if (yydebug) 792 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 793 YYDEBUGSTR, yydepth, yystate, yytable[yyn]); 794 #endif 795 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 796 yystate = yytable[yyn]; 797 *++yystack.s_mark = yytable[yyn]; 798 *++yystack.l_mark = yylval; 799 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 800 *++yystack.p_mark = yylloc; 801 #endif 802 yychar = YYEMPTY; 803 if (yyerrflag > 0) --yyerrflag; 804 goto yyloop; 805 } 806 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 807 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 808 { 809 yyn = yytable[yyn]; 810 goto yyreduce; 811 } 812 if (yyerrflag != 0) goto yyinrecovery; 813 #if YYBTYACC 814 815 yynewerrflag = 1; 816 goto yyerrhandler; 817 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 818 819 yyerrlab: 820 /* explicit YYERROR from an action -- pop the rhs of the rule reduced 821 * before looking for error recovery */ 822 yystack.s_mark -= yym; 823 yystate = *yystack.s_mark; 824 yystack.l_mark -= yym; 825 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 826 yystack.p_mark -= yym; 827 #endif 828 829 yynewerrflag = 0; 830 yyerrhandler: 831 while (yyps->save) 832 { 833 int ctry; 834 YYParseState *save = yyps->save; 835 #if YYDEBUG 836 if (yydebug) 837 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n", 838 YYDEBUGSTR, yydepth, yystate, yyps->save->state, 839 (int)(yylvp - yylvals - yyps->save->lexeme)); 840 #endif 841 /* Memorize most forward-looking error state in case it's really an error. */ 842 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals) 843 { 844 /* Free old saved error context state */ 845 if (yyerrctx) yyFreeState(yyerrctx); 846 /* Create and fill out new saved error context state */ 847 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 848 if (yyerrctx == NULL) goto yyenomem; 849 yyerrctx->save = yyps->save; 850 yyerrctx->state = yystate; 851 yyerrctx->errflag = yyerrflag; 852 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); 853 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 854 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); 855 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 856 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 857 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); 858 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 859 #endif 860 yyerrctx->lexeme = (int) (yylvp - yylvals); 861 } 862 yylvp = yylvals + save->lexeme; 863 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 864 yylpp = yylpsns + save->lexeme; 865 #endif 866 yylexp = yylexemes + save->lexeme; 867 yychar = YYEMPTY; 868 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); 869 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 870 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); 871 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 872 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 873 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); 874 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 875 #endif 876 ctry = ++save->ctry; 877 yystate = save->state; 878 /* We tried shift, try reduce now */ 879 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce; 880 yyps->save = save->save; 881 save->save = NULL; 882 yyFreeState(save); 883 884 /* Nothing left on the stack -- error */ 885 if (!yyps->save) 886 { 887 #if YYDEBUG 888 if (yydebug) 889 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n", 890 YYPREFIX, yydepth); 891 #endif 892 /* Restore state as it was in the most forward-advanced error */ 893 yylvp = yylvals + yyerrctx->lexeme; 894 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 895 yylpp = yylpsns + yyerrctx->lexeme; 896 #endif 897 yylexp = yylexemes + yyerrctx->lexeme; 898 yychar = yylexp[-1]; 899 yylval = yylvp[-1]; 900 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 901 yylloc = yylpp[-1]; 902 #endif 903 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); 904 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 905 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); 906 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 907 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 908 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); 909 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 910 #endif 911 yystate = yyerrctx->state; 912 yyFreeState(yyerrctx); 913 yyerrctx = NULL; 914 } 915 yynewerrflag = 1; 916 } 917 if (yynewerrflag == 0) goto yyinrecovery; 918 #endif /* YYBTYACC */ 919 920 YYERROR_CALL("syntax error"); 921 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 922 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */ 923 #endif 924 925 #if !YYBTYACC 926 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 927 yyerrlab: 928 #endif 929 ++yynerrs; 930 931 yyinrecovery: 932 if (yyerrflag < 3) 933 { 934 yyerrflag = 3; 935 for (;;) 936 { 937 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 938 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 939 { 940 #if YYDEBUG 941 if (yydebug) 942 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n", 943 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]); 944 #endif 945 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 946 yystate = yytable[yyn]; 947 *++yystack.s_mark = yytable[yyn]; 948 *++yystack.l_mark = yylval; 949 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 950 /* lookahead position is error end position */ 951 yyerror_loc_range[1] = yylloc; 952 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */ 953 *++yystack.p_mark = yyloc; 954 #endif 955 goto yyloop; 956 } 957 else 958 { 959 #if YYDEBUG 960 if (yydebug) 961 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n", 962 YYDEBUGSTR, yydepth, *yystack.s_mark); 963 #endif 964 if (yystack.s_mark <= yystack.s_base) goto yyabort; 965 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 966 /* the current TOS position is the error start position */ 967 yyerror_loc_range[0] = *yystack.p_mark; 968 #endif 969 #if defined(YYDESTRUCT_CALL) 970 #if YYBTYACC 971 if (!yytrial) 972 #endif /* YYBTYACC */ 973 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 974 YYDESTRUCT_CALL("error: discarding state", 975 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark); 976 #else 977 YYDESTRUCT_CALL("error: discarding state", 978 yystos[*yystack.s_mark], yystack.l_mark); 979 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 980 #endif /* defined(YYDESTRUCT_CALL) */ 981 --yystack.s_mark; 982 --yystack.l_mark; 983 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 984 --yystack.p_mark; 985 #endif 986 } 987 } 988 } 989 else 990 { 991 if (yychar == YYEOF) goto yyabort; 992 #if YYDEBUG 993 if (yydebug) 994 { 995 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 996 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n", 997 YYDEBUGSTR, yydepth, yystate, yychar, yys); 998 } 999 #endif 1000 #if defined(YYDESTRUCT_CALL) 1001 #if YYBTYACC 1002 if (!yytrial) 1003 #endif /* YYBTYACC */ 1004 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1005 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc); 1006 #else 1007 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval); 1008 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1009 #endif /* defined(YYDESTRUCT_CALL) */ 1010 yychar = YYEMPTY; 1011 goto yyloop; 1012 } 1013 1014 yyreduce: 1015 yym = yylen[yyn]; 1016 #if YYDEBUG 1017 if (yydebug) 1018 { 1019 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)", 1020 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]); 1021 #ifdef YYSTYPE_TOSTRING 1022 #if YYBTYACC 1023 if (!yytrial) 1024 #endif /* YYBTYACC */ 1025 if (yym > 0) 1026 { 1027 int i; 1028 fputc('<', stderr); 1029 for (i = yym; i > 0; i--) 1030 { 1031 if (i != yym) fputs(", ", stderr); 1032 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]], 1033 yystack.l_mark[1-i]), stderr); 1034 } 1035 fputc('>', stderr); 1036 } 1037 #endif 1038 fputc('\n', stderr); 1039 } 1040 #endif 1041 if (yym > 0) 1042 yyval = yystack.l_mark[1-yym]; 1043 else 1044 memset(&yyval, 0, sizeof yyval); 1045 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1046 1047 /* Perform position reduction */ 1048 memset(&yyloc, 0, sizeof(yyloc)); 1049 #if YYBTYACC 1050 if (!yytrial) 1051 #endif /* YYBTYACC */ 1052 { 1053 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym); 1054 /* just in case YYERROR is invoked within the action, save 1055 the start of the rhs as the error start position */ 1056 yyerror_loc_range[0] = yystack.p_mark[1-yym]; 1057 } 1058 #endif 1059 1060 switch (yyn) 1061 { 1062 case 1: 1063 #line 20 "inherit0.y" 1064 { yyval = yystack.l_mark[0]; } 1065 break; 1066 case 2: 1067 #line 22 "inherit0.y" 1068 { yyval = yystack.l_mark[0]; } 1069 break; 1070 case 3: 1071 #line 25 "inherit0.y" 1072 { yyval = 1; } 1073 break; 1074 case 4: 1075 #line 26 "inherit0.y" 1076 { yyval = 2; } 1077 break; 1078 case 5: 1079 #line 29 "inherit0.y" 1080 { yyval = 1; } 1081 break; 1082 case 6: 1083 #line 30 "inherit0.y" 1084 { yyval = 2; } 1085 break; 1086 case 7: 1087 #line 34 "inherit0.y" 1088 { mksymbol(yystack.l_mark[-2], yystack.l_mark[-3], yystack.l_mark[0]); } 1089 break; 1090 case 8: 1091 #line 36 "inherit0.y" 1092 { mksymbol(yystack.l_mark[-1], yystack.l_mark[-2], yystack.l_mark[0]); } 1093 break; 1094 case 9: 1095 #line 40 "inherit0.y" 1096 { yyval = 2; } 1097 break; 1098 case 10: 1099 #line 41 "inherit0.y" 1100 { yyval = yystack.l_mark[-2]; } 1101 break; 1102 case 11: 1103 #line 43 "inherit0.y" 1104 { yyval = yystack.l_mark[0]; } 1105 break; 1106 #line 1107 "inherit0.tab.c" 1107 default: 1108 break; 1109 } 1110 yystack.s_mark -= yym; 1111 yystate = *yystack.s_mark; 1112 yystack.l_mark -= yym; 1113 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1114 yystack.p_mark -= yym; 1115 #endif 1116 yym = yylhs[yyn]; 1117 if (yystate == 0 && yym == 0) 1118 { 1119 #if YYDEBUG 1120 if (yydebug) 1121 { 1122 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1123 #ifdef YYSTYPE_TOSTRING 1124 #if YYBTYACC 1125 if (!yytrial) 1126 #endif /* YYBTYACC */ 1127 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); 1128 #endif 1129 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); 1130 } 1131 #endif 1132 yystate = YYFINAL; 1133 *++yystack.s_mark = YYFINAL; 1134 *++yystack.l_mark = yyval; 1135 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1136 *++yystack.p_mark = yyloc; 1137 #endif 1138 if (yychar < 0) 1139 { 1140 #if YYBTYACC 1141 do { 1142 if (yylvp < yylve) 1143 { 1144 /* we're currently re-reading tokens */ 1145 yylval = *yylvp++; 1146 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1147 yylloc = *yylpp++; 1148 #endif 1149 yychar = *yylexp++; 1150 break; 1151 } 1152 if (yyps->save) 1153 { 1154 /* in trial mode; save scanner results for future parse attempts */ 1155 if (yylvp == yylvlim) 1156 { /* Enlarge lexical value queue */ 1157 size_t p = (size_t) (yylvp - yylvals); 1158 size_t s = (size_t) (yylvlim - yylvals); 1159 1160 s += YYLVQUEUEGROWTH; 1161 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) 1162 goto yyenomem; 1163 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) 1164 goto yyenomem; 1165 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1166 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) 1167 goto yyenomem; 1168 #endif 1169 yylvp = yylve = yylvals + p; 1170 yylvlim = yylvals + s; 1171 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1172 yylpp = yylpe = yylpsns + p; 1173 yylplim = yylpsns + s; 1174 #endif 1175 yylexp = yylexemes + p; 1176 } 1177 *yylexp = (YYINT) YYLEX; 1178 *yylvp++ = yylval; 1179 yylve++; 1180 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1181 *yylpp++ = yylloc; 1182 yylpe++; 1183 #endif 1184 yychar = *yylexp++; 1185 break; 1186 } 1187 /* normal operation, no conflict encountered */ 1188 #endif /* YYBTYACC */ 1189 yychar = YYLEX; 1190 #if YYBTYACC 1191 } while (0); 1192 #endif /* YYBTYACC */ 1193 if (yychar < 0) yychar = YYEOF; 1194 #if YYDEBUG 1195 if (yydebug) 1196 { 1197 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 1198 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n", 1199 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); 1200 } 1201 #endif 1202 } 1203 if (yychar == YYEOF) goto yyaccept; 1204 goto yyloop; 1205 } 1206 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 1207 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 1208 yystate = yytable[yyn]; 1209 else 1210 yystate = yydgoto[yym]; 1211 #if YYDEBUG 1212 if (yydebug) 1213 { 1214 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1215 #ifdef YYSTYPE_TOSTRING 1216 #if YYBTYACC 1217 if (!yytrial) 1218 #endif /* YYBTYACC */ 1219 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); 1220 #endif 1221 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); 1222 } 1223 #endif 1224 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1225 *++yystack.s_mark = (YYINT) yystate; 1226 *++yystack.l_mark = yyval; 1227 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1228 *++yystack.p_mark = yyloc; 1229 #endif 1230 goto yyloop; 1231 #if YYBTYACC 1232 1233 /* Reduction declares that this path is valid. Set yypath and do a full parse */ 1234 yyvalid: 1235 if (yypath) YYABORT; 1236 while (yyps->save) 1237 { 1238 YYParseState *save = yyps->save; 1239 yyps->save = save->save; 1240 save->save = yypath; 1241 yypath = save; 1242 } 1243 #if YYDEBUG 1244 if (yydebug) 1245 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", 1246 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); 1247 #endif 1248 if (yyerrctx) 1249 { 1250 yyFreeState(yyerrctx); 1251 yyerrctx = NULL; 1252 } 1253 yylvp = yylvals + yypath->lexeme; 1254 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1255 yylpp = yylpsns + yypath->lexeme; 1256 #endif 1257 yylexp = yylexemes + yypath->lexeme; 1258 yychar = YYEMPTY; 1259 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); 1260 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 1261 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); 1262 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1263 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1264 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); 1265 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1266 #endif 1267 yystate = yypath->state; 1268 goto yyloop; 1269 #endif /* YYBTYACC */ 1270 1271 yyoverflow: 1272 YYERROR_CALL("yacc stack overflow"); 1273 #if YYBTYACC 1274 goto yyabort_nomem; 1275 yyenomem: 1276 YYERROR_CALL("memory exhausted"); 1277 yyabort_nomem: 1278 #endif /* YYBTYACC */ 1279 yyresult = 2; 1280 goto yyreturn; 1281 1282 yyabort: 1283 yyresult = 1; 1284 goto yyreturn; 1285 1286 yyaccept: 1287 #if YYBTYACC 1288 if (yyps->save) goto yyvalid; 1289 #endif /* YYBTYACC */ 1290 yyresult = 0; 1291 1292 yyreturn: 1293 #if defined(YYDESTRUCT_CALL) 1294 if (yychar != YYEOF && yychar != YYEMPTY) 1295 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1296 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); 1297 #else 1298 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); 1299 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1300 1301 { 1302 YYSTYPE *pv; 1303 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1304 YYLTYPE *pp; 1305 1306 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) 1307 YYDESTRUCT_CALL("cleanup: discarding state", 1308 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); 1309 #else 1310 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) 1311 YYDESTRUCT_CALL("cleanup: discarding state", 1312 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); 1313 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1314 } 1315 #endif /* defined(YYDESTRUCT_CALL) */ 1316 1317 #if YYBTYACC 1318 if (yyerrctx) 1319 { 1320 yyFreeState(yyerrctx); 1321 yyerrctx = NULL; 1322 } 1323 while (yyps) 1324 { 1325 YYParseState *save = yyps; 1326 yyps = save->save; 1327 save->save = NULL; 1328 yyFreeState(save); 1329 } 1330 while (yypath) 1331 { 1332 YYParseState *save = yypath; 1333 yypath = save->save; 1334 save->save = NULL; 1335 yyFreeState(save); 1336 } 1337 #endif /* YYBTYACC */ 1338 yyfreestack(&yystack); 1339 return (yyresult); 1340 } 1341