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 546 #if YYBTYACC 547 yyps = yyNewState(0); if (yyps == 0) goto yyenomem; 548 yyps->save = 0; 549 #endif /* YYBTYACC */ 550 yym = 0; 551 yyn = 0; 552 yynerrs = 0; 553 yyerrflag = 0; 554 yychar = YYEMPTY; 555 yystate = 0; 556 557 #if YYPURE 558 memset(&yystack, 0, sizeof(yystack)); 559 #endif 560 561 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 562 yystack.s_mark = yystack.s_base; 563 yystack.l_mark = yystack.l_base; 564 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 565 yystack.p_mark = yystack.p_base; 566 #endif 567 yystate = 0; 568 *yystack.s_mark = 0; 569 570 yyloop: 571 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 572 if (yychar < 0) 573 { 574 #if YYBTYACC 575 do { 576 if (yylvp < yylve) 577 { 578 /* we're currently re-reading tokens */ 579 yylval = *yylvp++; 580 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 581 yylloc = *yylpp++; 582 #endif 583 yychar = *yylexp++; 584 break; 585 } 586 if (yyps->save) 587 { 588 /* in trial mode; save scanner results for future parse attempts */ 589 if (yylvp == yylvlim) 590 { /* Enlarge lexical value queue */ 591 size_t p = (size_t) (yylvp - yylvals); 592 size_t s = (size_t) (yylvlim - yylvals); 593 594 s += YYLVQUEUEGROWTH; 595 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; 596 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; 597 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 598 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; 599 #endif 600 yylvp = yylve = yylvals + p; 601 yylvlim = yylvals + s; 602 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 603 yylpp = yylpe = yylpsns + p; 604 yylplim = yylpsns + s; 605 #endif 606 yylexp = yylexemes + p; 607 } 608 *yylexp = (YYINT) YYLEX; 609 *yylvp++ = yylval; 610 yylve++; 611 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 612 *yylpp++ = yylloc; 613 yylpe++; 614 #endif 615 yychar = *yylexp++; 616 break; 617 } 618 /* normal operation, no conflict encountered */ 619 #endif /* YYBTYACC */ 620 yychar = YYLEX; 621 #if YYBTYACC 622 } while (0); 623 #endif /* YYBTYACC */ 624 if (yychar < 0) yychar = YYEOF; 625 #if YYDEBUG 626 if (yydebug) 627 { 628 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 629 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)", 630 YYDEBUGSTR, yydepth, yystate, yychar, yys); 631 #ifdef YYSTYPE_TOSTRING 632 #if YYBTYACC 633 if (!yytrial) 634 #endif /* YYBTYACC */ 635 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval)); 636 #endif 637 fputc('\n', stderr); 638 } 639 #endif 640 } 641 #if YYBTYACC 642 643 /* Do we have a conflict? */ 644 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 && 645 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 646 { 647 YYINT ctry; 648 649 if (yypath) 650 { 651 YYParseState *save; 652 #if YYDEBUG 653 if (yydebug) 654 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n", 655 YYDEBUGSTR, yydepth, yystate); 656 #endif 657 /* Switch to the next conflict context */ 658 save = yypath; 659 yypath = save->save; 660 save->save = NULL; 661 ctry = save->ctry; 662 if (save->state != yystate) YYABORT; 663 yyFreeState(save); 664 665 } 666 else 667 { 668 669 /* Unresolved conflict - start/continue trial parse */ 670 YYParseState *save; 671 #if YYDEBUG 672 if (yydebug) 673 { 674 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate); 675 if (yyps->save) 676 fputs("ALREADY in conflict, continuing trial parse.\n", stderr); 677 else 678 fputs("Starting trial parse.\n", stderr); 679 } 680 #endif 681 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 682 if (save == NULL) goto yyenomem; 683 save->save = yyps->save; 684 save->state = yystate; 685 save->errflag = yyerrflag; 686 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); 687 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 688 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); 689 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 690 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 691 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); 692 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 693 #endif 694 ctry = yytable[yyn]; 695 if (yyctable[ctry] == -1) 696 { 697 #if YYDEBUG 698 if (yydebug && yychar >= YYEOF) 699 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth); 700 #endif 701 ctry++; 702 } 703 save->ctry = ctry; 704 if (yyps->save == NULL) 705 { 706 /* If this is a first conflict in the stack, start saving lexemes */ 707 if (!yylexemes) 708 { 709 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); 710 if (yylexemes == NULL) goto yyenomem; 711 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); 712 if (yylvals == NULL) goto yyenomem; 713 yylvlim = yylvals + YYLVQUEUEGROWTH; 714 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 715 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE)); 716 if (yylpsns == NULL) goto yyenomem; 717 yylplim = yylpsns + YYLVQUEUEGROWTH; 718 #endif 719 } 720 if (yylvp == yylve) 721 { 722 yylvp = yylve = yylvals; 723 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 724 yylpp = yylpe = yylpsns; 725 #endif 726 yylexp = yylexemes; 727 if (yychar >= YYEOF) 728 { 729 *yylve++ = yylval; 730 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 731 *yylpe++ = yylloc; 732 #endif 733 *yylexp = (YYINT) yychar; 734 yychar = YYEMPTY; 735 } 736 } 737 } 738 if (yychar >= YYEOF) 739 { 740 yylvp--; 741 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 742 yylpp--; 743 #endif 744 yylexp--; 745 yychar = YYEMPTY; 746 } 747 save->lexeme = (int) (yylvp - yylvals); 748 yyps->save = save; 749 } 750 if (yytable[yyn] == ctry) 751 { 752 #if YYDEBUG 753 if (yydebug) 754 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 755 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]); 756 #endif 757 if (yychar < 0) 758 { 759 yylvp++; 760 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 761 yylpp++; 762 #endif 763 yylexp++; 764 } 765 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) 766 goto yyoverflow; 767 yystate = yyctable[ctry]; 768 *++yystack.s_mark = (YYINT) yystate; 769 *++yystack.l_mark = yylval; 770 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 771 *++yystack.p_mark = yylloc; 772 #endif 773 yychar = YYEMPTY; 774 if (yyerrflag > 0) --yyerrflag; 775 goto yyloop; 776 } 777 else 778 { 779 yyn = yyctable[ctry]; 780 goto yyreduce; 781 } 782 } /* End of code dealing with conflicts */ 783 #endif /* YYBTYACC */ 784 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 785 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 786 { 787 #if YYDEBUG 788 if (yydebug) 789 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 790 YYDEBUGSTR, yydepth, yystate, yytable[yyn]); 791 #endif 792 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 793 yystate = yytable[yyn]; 794 *++yystack.s_mark = yytable[yyn]; 795 *++yystack.l_mark = yylval; 796 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 797 *++yystack.p_mark = yylloc; 798 #endif 799 yychar = YYEMPTY; 800 if (yyerrflag > 0) --yyerrflag; 801 goto yyloop; 802 } 803 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 804 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 805 { 806 yyn = yytable[yyn]; 807 goto yyreduce; 808 } 809 if (yyerrflag != 0) goto yyinrecovery; 810 #if YYBTYACC 811 812 yynewerrflag = 1; 813 goto yyerrhandler; 814 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 815 816 yyerrlab: 817 /* explicit YYERROR from an action -- pop the rhs of the rule reduced 818 * before looking for error recovery */ 819 yystack.s_mark -= yym; 820 yystate = *yystack.s_mark; 821 yystack.l_mark -= yym; 822 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 823 yystack.p_mark -= yym; 824 #endif 825 826 yynewerrflag = 0; 827 yyerrhandler: 828 while (yyps->save) 829 { 830 int ctry; 831 YYParseState *save = yyps->save; 832 #if YYDEBUG 833 if (yydebug) 834 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n", 835 YYDEBUGSTR, yydepth, yystate, yyps->save->state, 836 (int)(yylvp - yylvals - yyps->save->lexeme)); 837 #endif 838 /* Memorize most forward-looking error state in case it's really an error. */ 839 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals) 840 { 841 /* Free old saved error context state */ 842 if (yyerrctx) yyFreeState(yyerrctx); 843 /* Create and fill out new saved error context state */ 844 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 845 if (yyerrctx == NULL) goto yyenomem; 846 yyerrctx->save = yyps->save; 847 yyerrctx->state = yystate; 848 yyerrctx->errflag = yyerrflag; 849 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); 850 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 851 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); 852 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 853 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 854 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); 855 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 856 #endif 857 yyerrctx->lexeme = (int) (yylvp - yylvals); 858 } 859 yylvp = yylvals + save->lexeme; 860 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 861 yylpp = yylpsns + save->lexeme; 862 #endif 863 yylexp = yylexemes + save->lexeme; 864 yychar = YYEMPTY; 865 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); 866 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 867 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); 868 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 869 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 870 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); 871 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 872 #endif 873 ctry = ++save->ctry; 874 yystate = save->state; 875 /* We tried shift, try reduce now */ 876 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce; 877 yyps->save = save->save; 878 save->save = NULL; 879 yyFreeState(save); 880 881 /* Nothing left on the stack -- error */ 882 if (!yyps->save) 883 { 884 #if YYDEBUG 885 if (yydebug) 886 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n", 887 YYPREFIX, yydepth); 888 #endif 889 /* Restore state as it was in the most forward-advanced error */ 890 yylvp = yylvals + yyerrctx->lexeme; 891 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 892 yylpp = yylpsns + yyerrctx->lexeme; 893 #endif 894 yylexp = yylexemes + yyerrctx->lexeme; 895 yychar = yylexp[-1]; 896 yylval = yylvp[-1]; 897 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 898 yylloc = yylpp[-1]; 899 #endif 900 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); 901 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 902 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); 903 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 904 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 905 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); 906 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 907 #endif 908 yystate = yyerrctx->state; 909 yyFreeState(yyerrctx); 910 yyerrctx = NULL; 911 } 912 yynewerrflag = 1; 913 } 914 if (yynewerrflag == 0) goto yyinrecovery; 915 #endif /* YYBTYACC */ 916 917 YYERROR_CALL("syntax error"); 918 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 919 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */ 920 #endif 921 922 #if !YYBTYACC 923 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 924 yyerrlab: 925 #endif 926 ++yynerrs; 927 928 yyinrecovery: 929 if (yyerrflag < 3) 930 { 931 yyerrflag = 3; 932 for (;;) 933 { 934 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 935 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 936 { 937 #if YYDEBUG 938 if (yydebug) 939 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n", 940 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]); 941 #endif 942 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 943 yystate = yytable[yyn]; 944 *++yystack.s_mark = yytable[yyn]; 945 *++yystack.l_mark = yylval; 946 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 947 /* lookahead position is error end position */ 948 yyerror_loc_range[1] = yylloc; 949 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */ 950 *++yystack.p_mark = yyloc; 951 #endif 952 goto yyloop; 953 } 954 else 955 { 956 #if YYDEBUG 957 if (yydebug) 958 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n", 959 YYDEBUGSTR, yydepth, *yystack.s_mark); 960 #endif 961 if (yystack.s_mark <= yystack.s_base) goto yyabort; 962 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 963 /* the current TOS position is the error start position */ 964 yyerror_loc_range[0] = *yystack.p_mark; 965 #endif 966 #if defined(YYDESTRUCT_CALL) 967 #if YYBTYACC 968 if (!yytrial) 969 #endif /* YYBTYACC */ 970 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 971 YYDESTRUCT_CALL("error: discarding state", 972 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark); 973 #else 974 YYDESTRUCT_CALL("error: discarding state", 975 yystos[*yystack.s_mark], yystack.l_mark); 976 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 977 #endif /* defined(YYDESTRUCT_CALL) */ 978 --yystack.s_mark; 979 --yystack.l_mark; 980 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 981 --yystack.p_mark; 982 #endif 983 } 984 } 985 } 986 else 987 { 988 if (yychar == YYEOF) goto yyabort; 989 #if YYDEBUG 990 if (yydebug) 991 { 992 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 993 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n", 994 YYDEBUGSTR, yydepth, yystate, yychar, yys); 995 } 996 #endif 997 #if defined(YYDESTRUCT_CALL) 998 #if YYBTYACC 999 if (!yytrial) 1000 #endif /* YYBTYACC */ 1001 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1002 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc); 1003 #else 1004 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval); 1005 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1006 #endif /* defined(YYDESTRUCT_CALL) */ 1007 yychar = YYEMPTY; 1008 goto yyloop; 1009 } 1010 1011 yyreduce: 1012 yym = yylen[yyn]; 1013 #if YYDEBUG 1014 if (yydebug) 1015 { 1016 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)", 1017 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]); 1018 #ifdef YYSTYPE_TOSTRING 1019 #if YYBTYACC 1020 if (!yytrial) 1021 #endif /* YYBTYACC */ 1022 if (yym > 0) 1023 { 1024 int i; 1025 fputc('<', stderr); 1026 for (i = yym; i > 0; i--) 1027 { 1028 if (i != yym) fputs(", ", stderr); 1029 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]], 1030 yystack.l_mark[1-i]), stderr); 1031 } 1032 fputc('>', stderr); 1033 } 1034 #endif 1035 fputc('\n', stderr); 1036 } 1037 #endif 1038 if (yym > 0) 1039 yyval = yystack.l_mark[1-yym]; 1040 else 1041 memset(&yyval, 0, sizeof yyval); 1042 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1043 1044 /* Perform position reduction */ 1045 memset(&yyloc, 0, sizeof(yyloc)); 1046 #if YYBTYACC 1047 if (!yytrial) 1048 #endif /* YYBTYACC */ 1049 { 1050 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym); 1051 /* just in case YYERROR is invoked within the action, save 1052 the start of the rhs as the error start position */ 1053 yyerror_loc_range[0] = yystack.p_mark[1-yym]; 1054 } 1055 #endif 1056 1057 switch (yyn) 1058 { 1059 case 1: 1060 #line 20 "inherit0.y" 1061 { yyval = yystack.l_mark[0]; } 1062 break; 1063 case 2: 1064 #line 22 "inherit0.y" 1065 { yyval = yystack.l_mark[0]; } 1066 break; 1067 case 3: 1068 #line 25 "inherit0.y" 1069 { yyval = 1; } 1070 break; 1071 case 4: 1072 #line 26 "inherit0.y" 1073 { yyval = 2; } 1074 break; 1075 case 5: 1076 #line 29 "inherit0.y" 1077 { yyval = 1; } 1078 break; 1079 case 6: 1080 #line 30 "inherit0.y" 1081 { yyval = 2; } 1082 break; 1083 case 7: 1084 #line 34 "inherit0.y" 1085 { mksymbol(yystack.l_mark[-2], yystack.l_mark[-3], yystack.l_mark[0]); } 1086 break; 1087 case 8: 1088 #line 36 "inherit0.y" 1089 { mksymbol(yystack.l_mark[-1], yystack.l_mark[-2], yystack.l_mark[0]); } 1090 break; 1091 case 9: 1092 #line 40 "inherit0.y" 1093 { yyval = 2; } 1094 break; 1095 case 10: 1096 #line 41 "inherit0.y" 1097 { yyval = yystack.l_mark[-2]; } 1098 break; 1099 case 11: 1100 #line 43 "inherit0.y" 1101 { yyval = yystack.l_mark[0]; } 1102 break; 1103 #line 1104 "inherit0.tab.c" 1104 default: 1105 break; 1106 } 1107 yystack.s_mark -= yym; 1108 yystate = *yystack.s_mark; 1109 yystack.l_mark -= yym; 1110 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1111 yystack.p_mark -= yym; 1112 #endif 1113 yym = yylhs[yyn]; 1114 if (yystate == 0 && yym == 0) 1115 { 1116 #if YYDEBUG 1117 if (yydebug) 1118 { 1119 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1120 #ifdef YYSTYPE_TOSTRING 1121 #if YYBTYACC 1122 if (!yytrial) 1123 #endif /* YYBTYACC */ 1124 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); 1125 #endif 1126 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); 1127 } 1128 #endif 1129 yystate = YYFINAL; 1130 *++yystack.s_mark = YYFINAL; 1131 *++yystack.l_mark = yyval; 1132 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1133 *++yystack.p_mark = yyloc; 1134 #endif 1135 if (yychar < 0) 1136 { 1137 #if YYBTYACC 1138 do { 1139 if (yylvp < yylve) 1140 { 1141 /* we're currently re-reading tokens */ 1142 yylval = *yylvp++; 1143 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1144 yylloc = *yylpp++; 1145 #endif 1146 yychar = *yylexp++; 1147 break; 1148 } 1149 if (yyps->save) 1150 { 1151 /* in trial mode; save scanner results for future parse attempts */ 1152 if (yylvp == yylvlim) 1153 { /* Enlarge lexical value queue */ 1154 size_t p = (size_t) (yylvp - yylvals); 1155 size_t s = (size_t) (yylvlim - yylvals); 1156 1157 s += YYLVQUEUEGROWTH; 1158 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) 1159 goto yyenomem; 1160 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) 1161 goto yyenomem; 1162 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1163 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) 1164 goto yyenomem; 1165 #endif 1166 yylvp = yylve = yylvals + p; 1167 yylvlim = yylvals + s; 1168 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1169 yylpp = yylpe = yylpsns + p; 1170 yylplim = yylpsns + s; 1171 #endif 1172 yylexp = yylexemes + p; 1173 } 1174 *yylexp = (YYINT) YYLEX; 1175 *yylvp++ = yylval; 1176 yylve++; 1177 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1178 *yylpp++ = yylloc; 1179 yylpe++; 1180 #endif 1181 yychar = *yylexp++; 1182 break; 1183 } 1184 /* normal operation, no conflict encountered */ 1185 #endif /* YYBTYACC */ 1186 yychar = YYLEX; 1187 #if YYBTYACC 1188 } while (0); 1189 #endif /* YYBTYACC */ 1190 if (yychar < 0) yychar = YYEOF; 1191 #if YYDEBUG 1192 if (yydebug) 1193 { 1194 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 1195 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n", 1196 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); 1197 } 1198 #endif 1199 } 1200 if (yychar == YYEOF) goto yyaccept; 1201 goto yyloop; 1202 } 1203 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 1204 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 1205 yystate = yytable[yyn]; 1206 else 1207 yystate = yydgoto[yym]; 1208 #if YYDEBUG 1209 if (yydebug) 1210 { 1211 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1212 #ifdef YYSTYPE_TOSTRING 1213 #if YYBTYACC 1214 if (!yytrial) 1215 #endif /* YYBTYACC */ 1216 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); 1217 #endif 1218 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); 1219 } 1220 #endif 1221 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1222 *++yystack.s_mark = (YYINT) yystate; 1223 *++yystack.l_mark = yyval; 1224 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1225 *++yystack.p_mark = yyloc; 1226 #endif 1227 goto yyloop; 1228 #if YYBTYACC 1229 1230 /* Reduction declares that this path is valid. Set yypath and do a full parse */ 1231 yyvalid: 1232 if (yypath) YYABORT; 1233 while (yyps->save) 1234 { 1235 YYParseState *save = yyps->save; 1236 yyps->save = save->save; 1237 save->save = yypath; 1238 yypath = save; 1239 } 1240 #if YYDEBUG 1241 if (yydebug) 1242 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", 1243 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); 1244 #endif 1245 if (yyerrctx) 1246 { 1247 yyFreeState(yyerrctx); 1248 yyerrctx = NULL; 1249 } 1250 yylvp = yylvals + yypath->lexeme; 1251 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1252 yylpp = yylpsns + yypath->lexeme; 1253 #endif 1254 yylexp = yylexemes + yypath->lexeme; 1255 yychar = YYEMPTY; 1256 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); 1257 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 1258 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); 1259 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1260 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1261 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); 1262 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1263 #endif 1264 yystate = yypath->state; 1265 goto yyloop; 1266 #endif /* YYBTYACC */ 1267 1268 yyoverflow: 1269 YYERROR_CALL("yacc stack overflow"); 1270 #if YYBTYACC 1271 goto yyabort_nomem; 1272 yyenomem: 1273 YYERROR_CALL("memory exhausted"); 1274 yyabort_nomem: 1275 #endif /* YYBTYACC */ 1276 yyresult = 2; 1277 goto yyreturn; 1278 1279 yyabort: 1280 yyresult = 1; 1281 goto yyreturn; 1282 1283 yyaccept: 1284 #if YYBTYACC 1285 if (yyps->save) goto yyvalid; 1286 #endif /* YYBTYACC */ 1287 yyresult = 0; 1288 1289 yyreturn: 1290 #if defined(YYDESTRUCT_CALL) 1291 if (yychar != YYEOF && yychar != YYEMPTY) 1292 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1293 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); 1294 #else 1295 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); 1296 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1297 1298 { 1299 YYSTYPE *pv; 1300 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1301 YYLTYPE *pp; 1302 1303 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) 1304 YYDESTRUCT_CALL("cleanup: discarding state", 1305 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); 1306 #else 1307 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) 1308 YYDESTRUCT_CALL("cleanup: discarding state", 1309 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); 1310 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1311 } 1312 #endif /* defined(YYDESTRUCT_CALL) */ 1313 1314 #if YYBTYACC 1315 if (yyerrctx) 1316 { 1317 yyFreeState(yyerrctx); 1318 yyerrctx = NULL; 1319 } 1320 while (yyps) 1321 { 1322 YYParseState *save = yyps; 1323 yyps = save->save; 1324 save->save = NULL; 1325 yyFreeState(save); 1326 } 1327 while (yypath) 1328 { 1329 YYParseState *save = yypath; 1330 yypath = save->save; 1331 save->save = NULL; 1332 yyFreeState(save); 1333 } 1334 #endif /* YYBTYACC */ 1335 yyfreestack(&yystack); 1336 return (yyresult); 1337 } 1338