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 2 7 #define YYMINOR 0 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 == NULL) 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 == NULL) 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 == NULL) 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")) != NULL) 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 is set below */ 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 #line 1069 "inherit0.tab.c" 1069 break; 1070 case 2: 1071 #line 22 "inherit0.y" 1072 { yyval = yystack.l_mark[0]; } 1073 #line 1074 "inherit0.tab.c" 1074 break; 1075 case 3: 1076 #line 25 "inherit0.y" 1077 { yyval = 1; } 1078 #line 1079 "inherit0.tab.c" 1079 break; 1080 case 4: 1081 #line 26 "inherit0.y" 1082 { yyval = 2; } 1083 #line 1084 "inherit0.tab.c" 1084 break; 1085 case 5: 1086 #line 29 "inherit0.y" 1087 { yyval = 1; } 1088 #line 1089 "inherit0.tab.c" 1089 break; 1090 case 6: 1091 #line 30 "inherit0.y" 1092 { yyval = 2; } 1093 #line 1094 "inherit0.tab.c" 1094 break; 1095 case 7: 1096 #line 34 "inherit0.y" 1097 { mksymbol(yystack.l_mark[-2], yystack.l_mark[-3], yystack.l_mark[0]); } 1098 #line 1099 "inherit0.tab.c" 1099 break; 1100 case 8: 1101 #line 36 "inherit0.y" 1102 { mksymbol(yystack.l_mark[-1], yystack.l_mark[-2], yystack.l_mark[0]); } 1103 #line 1104 "inherit0.tab.c" 1104 break; 1105 case 9: 1106 #line 40 "inherit0.y" 1107 { yyval = 2; } 1108 #line 1109 "inherit0.tab.c" 1109 break; 1110 case 10: 1111 #line 41 "inherit0.y" 1112 { yyval = yystack.l_mark[-2]; } 1113 #line 1114 "inherit0.tab.c" 1114 break; 1115 case 11: 1116 #line 43 "inherit0.y" 1117 { yyval = yystack.l_mark[0]; } 1118 #line 1119 "inherit0.tab.c" 1119 break; 1120 #line 1121 "inherit0.tab.c" 1121 default: 1122 break; 1123 } 1124 yystack.s_mark -= yym; 1125 yystate = *yystack.s_mark; 1126 yystack.l_mark -= yym; 1127 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1128 yystack.p_mark -= yym; 1129 #endif 1130 yym = yylhs[yyn]; 1131 if (yystate == 0 && yym == 0) 1132 { 1133 #if YYDEBUG 1134 if (yydebug) 1135 { 1136 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1137 #ifdef YYSTYPE_TOSTRING 1138 #if YYBTYACC 1139 if (!yytrial) 1140 #endif /* YYBTYACC */ 1141 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); 1142 #endif 1143 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); 1144 } 1145 #endif 1146 yystate = YYFINAL; 1147 *++yystack.s_mark = YYFINAL; 1148 *++yystack.l_mark = yyval; 1149 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1150 *++yystack.p_mark = yyloc; 1151 #endif 1152 if (yychar < 0) 1153 { 1154 #if YYBTYACC 1155 do { 1156 if (yylvp < yylve) 1157 { 1158 /* we're currently re-reading tokens */ 1159 yylval = *yylvp++; 1160 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1161 yylloc = *yylpp++; 1162 #endif 1163 yychar = *yylexp++; 1164 break; 1165 } 1166 if (yyps->save) 1167 { 1168 /* in trial mode; save scanner results for future parse attempts */ 1169 if (yylvp == yylvlim) 1170 { /* Enlarge lexical value queue */ 1171 size_t p = (size_t) (yylvp - yylvals); 1172 size_t s = (size_t) (yylvlim - yylvals); 1173 1174 s += YYLVQUEUEGROWTH; 1175 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) 1176 goto yyenomem; 1177 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) 1178 goto yyenomem; 1179 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1180 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) 1181 goto yyenomem; 1182 #endif 1183 yylvp = yylve = yylvals + p; 1184 yylvlim = yylvals + s; 1185 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1186 yylpp = yylpe = yylpsns + p; 1187 yylplim = yylpsns + s; 1188 #endif 1189 yylexp = yylexemes + p; 1190 } 1191 *yylexp = (YYINT) YYLEX; 1192 *yylvp++ = yylval; 1193 yylve++; 1194 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1195 *yylpp++ = yylloc; 1196 yylpe++; 1197 #endif 1198 yychar = *yylexp++; 1199 break; 1200 } 1201 /* normal operation, no conflict encountered */ 1202 #endif /* YYBTYACC */ 1203 yychar = YYLEX; 1204 #if YYBTYACC 1205 } while (0); 1206 #endif /* YYBTYACC */ 1207 if (yychar < 0) yychar = YYEOF; 1208 #if YYDEBUG 1209 if (yydebug) 1210 { 1211 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 1212 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n", 1213 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); 1214 } 1215 #endif 1216 } 1217 if (yychar == YYEOF) goto yyaccept; 1218 goto yyloop; 1219 } 1220 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 1221 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 1222 yystate = yytable[yyn]; 1223 else 1224 yystate = yydgoto[yym]; 1225 #if YYDEBUG 1226 if (yydebug) 1227 { 1228 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1229 #ifdef YYSTYPE_TOSTRING 1230 #if YYBTYACC 1231 if (!yytrial) 1232 #endif /* YYBTYACC */ 1233 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); 1234 #endif 1235 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); 1236 } 1237 #endif 1238 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1239 *++yystack.s_mark = (YYINT) yystate; 1240 *++yystack.l_mark = yyval; 1241 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1242 *++yystack.p_mark = yyloc; 1243 #endif 1244 goto yyloop; 1245 #if YYBTYACC 1246 1247 /* Reduction declares that this path is valid. Set yypath and do a full parse */ 1248 yyvalid: 1249 if (yypath) YYABORT; 1250 while (yyps->save) 1251 { 1252 YYParseState *save = yyps->save; 1253 yyps->save = save->save; 1254 save->save = yypath; 1255 yypath = save; 1256 } 1257 #if YYDEBUG 1258 if (yydebug) 1259 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", 1260 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); 1261 #endif 1262 if (yyerrctx) 1263 { 1264 yyFreeState(yyerrctx); 1265 yyerrctx = NULL; 1266 } 1267 yylvp = yylvals + yypath->lexeme; 1268 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1269 yylpp = yylpsns + yypath->lexeme; 1270 #endif 1271 yylexp = yylexemes + yypath->lexeme; 1272 yychar = YYEMPTY; 1273 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); 1274 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 1275 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); 1276 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1277 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1278 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); 1279 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1280 #endif 1281 yystate = yypath->state; 1282 goto yyloop; 1283 #endif /* YYBTYACC */ 1284 1285 yyoverflow: 1286 YYERROR_CALL("yacc stack overflow"); 1287 #if YYBTYACC 1288 goto yyabort_nomem; 1289 yyenomem: 1290 YYERROR_CALL("memory exhausted"); 1291 yyabort_nomem: 1292 #endif /* YYBTYACC */ 1293 yyresult = 2; 1294 goto yyreturn; 1295 1296 yyabort: 1297 yyresult = 1; 1298 goto yyreturn; 1299 1300 yyaccept: 1301 #if YYBTYACC 1302 if (yyps->save) goto yyvalid; 1303 #endif /* YYBTYACC */ 1304 yyresult = 0; 1305 1306 yyreturn: 1307 #if defined(YYDESTRUCT_CALL) 1308 if (yychar != YYEOF && yychar != YYEMPTY) 1309 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1310 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); 1311 #else 1312 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); 1313 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1314 1315 { 1316 YYSTYPE *pv; 1317 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1318 YYLTYPE *pp; 1319 1320 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) 1321 YYDESTRUCT_CALL("cleanup: discarding state", 1322 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); 1323 #else 1324 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) 1325 YYDESTRUCT_CALL("cleanup: discarding state", 1326 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); 1327 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1328 } 1329 #endif /* defined(YYDESTRUCT_CALL) */ 1330 1331 #if YYBTYACC 1332 if (yyerrctx) 1333 { 1334 yyFreeState(yyerrctx); 1335 yyerrctx = NULL; 1336 } 1337 while (yyps) 1338 { 1339 YYParseState *save = yyps; 1340 yyps = save->save; 1341 save->save = NULL; 1342 yyFreeState(save); 1343 } 1344 while (yypath) 1345 { 1346 YYParseState *save = yypath; 1347 yypath = save->save; 1348 save->save = NULL; 1349 yyFreeState(save); 1350 } 1351 #endif /* YYBTYACC */ 1352 yyfreestack(&yystack); 1353 return (yyresult); 1354 } 1355