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