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