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