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