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 err_inherit4_parse 22 #endif /* yyparse */ 23 24 #ifndef yylex 25 #define yylex err_inherit4_lex 26 #endif /* yylex */ 27 28 #ifndef yyerror 29 #define yyerror err_inherit4_error 30 #endif /* yyerror */ 31 32 #ifndef yychar 33 #define yychar err_inherit4_char 34 #endif /* yychar */ 35 36 #ifndef yyval 37 #define yyval err_inherit4_val 38 #endif /* yyval */ 39 40 #ifndef yylval 41 #define yylval err_inherit4_lval 42 #endif /* yylval */ 43 44 #ifndef yydebug 45 #define yydebug err_inherit4_debug 46 #endif /* yydebug */ 47 48 #ifndef yynerrs 49 #define yynerrs err_inherit4_nerrs 50 #endif /* yynerrs */ 51 52 #ifndef yyerrflag 53 #define yyerrflag err_inherit4_errflag 54 #endif /* yyerrflag */ 55 56 #ifndef yylhs 57 #define yylhs err_inherit4_lhs 58 #endif /* yylhs */ 59 60 #ifndef yylen 61 #define yylen err_inherit4_len 62 #endif /* yylen */ 63 64 #ifndef yydefred 65 #define yydefred err_inherit4_defred 66 #endif /* yydefred */ 67 68 #ifndef yystos 69 #define yystos err_inherit4_stos 70 #endif /* yystos */ 71 72 #ifndef yydgoto 73 #define yydgoto err_inherit4_dgoto 74 #endif /* yydgoto */ 75 76 #ifndef yysindex 77 #define yysindex err_inherit4_sindex 78 #endif /* yysindex */ 79 80 #ifndef yyrindex 81 #define yyrindex err_inherit4_rindex 82 #endif /* yyrindex */ 83 84 #ifndef yygindex 85 #define yygindex err_inherit4_gindex 86 #endif /* yygindex */ 87 88 #ifndef yytable 89 #define yytable err_inherit4_table 90 #endif /* yytable */ 91 92 #ifndef yycheck 93 #define yycheck err_inherit4_check 94 #endif /* yycheck */ 95 96 #ifndef yyname 97 #define yyname err_inherit4_name 98 #endif /* yyname */ 99 100 #ifndef yyrule 101 #define yyrule err_inherit4_rule 102 #endif /* yyrule */ 103 104 #ifndef yyloc 105 #define yyloc err_inherit4_loc 106 #endif /* yyloc */ 107 108 #ifndef yylloc 109 #define yylloc err_inherit4_lloc 110 #endif /* yylloc */ 111 112 #if YYBTYACC 113 114 #ifndef yycindex 115 #define yycindex err_inherit4_cindex 116 #endif /* yycindex */ 117 118 #ifndef yyctable 119 #define yyctable err_inherit4_ctable 120 #endif /* yyctable */ 121 122 #endif /* YYBTYACC */ 123 124 #define YYPREFIX "err_inherit4_" 125 126 #define YYPURE 0 127 128 #line 3 "err_inherit4.y" 129 #include <stdlib.h> 130 131 typedef enum {cGLOBAL, cLOCAL} class; 132 typedef enum {tREAL, tINTEGER} type; 133 typedef char * name; 134 135 struct symbol { class c; type t; name id; }; 136 typedef struct symbol symbol; 137 138 struct namelist { symbol *s; struct namelist *next; }; 139 typedef struct namelist namelist; 140 141 extern symbol *mksymbol(type t, class c, name id); 142 143 #ifdef YYBISON 144 #define YYLEX_DECL() yylex(void) 145 #define YYERROR_DECL() yyerror(const char *s) 146 #endif 147 #ifdef YYSTYPE 148 #undef YYSTYPE_IS_DECLARED 149 #define YYSTYPE_IS_DECLARED 1 150 #endif 151 #ifndef YYSTYPE_IS_DECLARED 152 #define YYSTYPE_IS_DECLARED 1 153 #line 41 "err_inherit4.y" 154 typedef union 155 { 156 class cval; 157 type tval; 158 namelist * nlist; 159 name id; 160 } YYSTYPE; 161 #endif /* !YYSTYPE_IS_DECLARED */ 162 #line 163 "err_inherit4.tab.c" 163 164 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED 165 /* Default: YYLTYPE is the text position type. */ 166 typedef struct YYLTYPE 167 { 168 int first_line; 169 int first_column; 170 int last_line; 171 int last_column; 172 unsigned source; 173 } YYLTYPE; 174 #define YYLTYPE_IS_DECLARED 1 175 #endif 176 #define YYRHSLOC(rhs, k) ((rhs)[k]) 177 178 /* compatibility with bison */ 179 #ifdef YYPARSE_PARAM 180 /* compatibility with FreeBSD */ 181 # ifdef YYPARSE_PARAM_TYPE 182 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 183 # else 184 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 185 # endif 186 #else 187 # define YYPARSE_DECL() yyparse(void) 188 #endif 189 190 /* Parameters sent to lex. */ 191 #ifdef YYLEX_PARAM 192 # define YYLEX_DECL() yylex(void *YYLEX_PARAM) 193 # define YYLEX yylex(YYLEX_PARAM) 194 #else 195 # define YYLEX_DECL() yylex(void) 196 # define YYLEX yylex() 197 #endif 198 199 /* Parameters sent to yyerror. */ 200 #ifndef YYERROR_DECL 201 #define YYERROR_DECL() yyerror(YYLTYPE *loc, const char *s) 202 #endif 203 #ifndef YYERROR_CALL 204 #define YYERROR_CALL(msg) yyerror(&yylloc, msg) 205 #endif 206 207 #ifndef YYDESTRUCT_DECL 208 #define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, YYLTYPE *loc) 209 #endif 210 #ifndef YYDESTRUCT_CALL 211 #define YYDESTRUCT_CALL(msg, psymb, val, loc) yydestruct(msg, psymb, val, loc) 212 #endif 213 214 extern int YYPARSE_DECL(); 215 216 #define GLOBAL 257 217 #define LOCAL 258 218 #define REAL 259 219 #define INTEGER 260 220 #define NAME 261 221 #define YYERRCODE 256 222 typedef int YYINT; 223 static const YYINT err_inherit4_lhs[] = { -1, 224 5, 6, 0, 0, 3, 3, 4, 4, 1, 1, 225 2, 226 }; 227 static const YYINT err_inherit4_len[] = { 2, 228 0, 0, 5, 2, 1, 1, 1, 1, 2, 1, 229 1, 230 }; 231 static const YYINT err_inherit4_defred[] = { 0, 232 5, 6, 7, 8, 0, 0, 0, 1, 10, 0, 233 4, 2, 9, 0, 0, 234 }; 235 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) 236 static const YYINT err_inherit4_stos[] = { 0, 237 257, 258, 259, 260, 263, 266, 267, 267, 261, 264, 238 265, 268, 261, 269, 264, 239 }; 240 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ 241 static const YYINT err_inherit4_dgoto[] = { 5, 242 10, 11, 6, 7, 12, 14, 243 }; 244 static const YYINT err_inherit4_sindex[] = { -257, 245 0, 0, 0, 0, 0, -255, -254, 0, 0, -253, 246 0, 0, 0, -254, -253, 247 }; 248 static const YYINT err_inherit4_rindex[] = { 0, 249 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 250 0, 0, 0, 0, 9, 251 }; 252 #if YYBTYACC 253 static const YYINT err_inherit4_cindex[] = { 0, 254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255 0, 0, 0, 0, 0, 256 }; 257 #endif 258 static const YYINT err_inherit4_gindex[] = { 0, 259 -4, 0, 0, 5, 0, 0, 260 }; 261 #define YYTABLESIZE 11 262 static const YYINT err_inherit4_table[] = { 1, 263 2, 3, 4, 3, 4, 11, 9, 13, 3, 15, 264 8, 265 }; 266 static const YYINT err_inherit4_check[] = { 257, 267 258, 259, 260, 259, 260, 0, 261, 261, 0, 14, 268 6, 269 }; 270 #if YYBTYACC 271 static const YYINT err_inherit4_ctable[] = { -1, 272 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 273 }; 274 #endif 275 #define YYFINAL 5 276 #ifndef YYDEBUG 277 #define YYDEBUG 0 278 #endif 279 #define YYMAXTOKEN 261 280 #define YYUNDFTOKEN 270 281 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) 282 #if YYDEBUG 283 static const char *const err_inherit4_name[] = { 284 285 "$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, 286 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 287 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 288 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 289 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 290 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 291 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER", 292 "NAME","$accept","declaration","namelist","locnamelist","class","type","$$1", 293 "$$2","illegal-symbol", 294 }; 295 static const char *const err_inherit4_rule[] = { 296 "$accept : declaration", 297 "$$1 :", 298 "$$2 :", 299 "declaration : class type $$1 $$2 namelist", 300 "declaration : type locnamelist", 301 "class : GLOBAL", 302 "class : LOCAL", 303 "type : REAL", 304 "type : INTEGER", 305 "namelist : namelist NAME", 306 "namelist : NAME", 307 "locnamelist : namelist", 308 309 }; 310 #endif 311 312 #if YYDEBUG 313 int yydebug; 314 #endif 315 316 int yyerrflag; 317 int yychar; 318 YYSTYPE yyval; 319 YYSTYPE yylval; 320 int yynerrs; 321 322 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 323 YYLTYPE yyloc; /* position returned by actions */ 324 YYLTYPE yylloc; /* position from the lexer */ 325 #endif 326 327 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 328 #ifndef YYLLOC_DEFAULT 329 #define YYLLOC_DEFAULT(loc, rhs, n) \ 330 do \ 331 { \ 332 if (n == 0) \ 333 { \ 334 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \ 335 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \ 336 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \ 337 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \ 338 } \ 339 else \ 340 { \ 341 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \ 342 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \ 343 (loc).last_line = YYRHSLOC(rhs, n).last_line; \ 344 (loc).last_column = YYRHSLOC(rhs, n).last_column; \ 345 } \ 346 } while (0) 347 #endif /* YYLLOC_DEFAULT */ 348 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 349 #if YYBTYACC 350 351 #ifndef YYLVQUEUEGROWTH 352 #define YYLVQUEUEGROWTH 32 353 #endif 354 #endif /* YYBTYACC */ 355 356 /* define the initial stack-sizes */ 357 #ifdef YYSTACKSIZE 358 #undef YYMAXDEPTH 359 #define YYMAXDEPTH YYSTACKSIZE 360 #else 361 #ifdef YYMAXDEPTH 362 #define YYSTACKSIZE YYMAXDEPTH 363 #else 364 #define YYSTACKSIZE 10000 365 #define YYMAXDEPTH 10000 366 #endif 367 #endif 368 369 #ifndef YYINITSTACKSIZE 370 #define YYINITSTACKSIZE 200 371 #endif 372 373 typedef struct { 374 unsigned stacksize; 375 YYINT *s_base; 376 YYINT *s_mark; 377 YYINT *s_last; 378 YYSTYPE *l_base; 379 YYSTYPE *l_mark; 380 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 381 YYLTYPE *p_base; 382 YYLTYPE *p_mark; 383 #endif 384 } YYSTACKDATA; 385 #if YYBTYACC 386 387 struct YYParseState_s 388 { 389 struct YYParseState_s *save; /* Previously saved parser state */ 390 YYSTACKDATA yystack; /* saved parser stack */ 391 int state; /* saved parser state */ 392 int errflag; /* saved error recovery status */ 393 int lexeme; /* saved index of the conflict lexeme in the lexical queue */ 394 YYINT ctry; /* saved index in yyctable[] for this conflict */ 395 }; 396 typedef struct YYParseState_s YYParseState; 397 #endif /* YYBTYACC */ 398 /* variables for the parser stack */ 399 static YYSTACKDATA yystack; 400 #if YYBTYACC 401 402 /* Current parser state */ 403 static YYParseState *yyps = 0; 404 405 /* yypath != NULL: do the full parse, starting at *yypath parser state. */ 406 static YYParseState *yypath = 0; 407 408 /* Base of the lexical value queue */ 409 static YYSTYPE *yylvals = 0; 410 411 /* Current position at lexical value queue */ 412 static YYSTYPE *yylvp = 0; 413 414 /* End position of lexical value queue */ 415 static YYSTYPE *yylve = 0; 416 417 /* The last allocated position at the lexical value queue */ 418 static YYSTYPE *yylvlim = 0; 419 420 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 421 /* Base of the lexical position queue */ 422 static YYLTYPE *yylpsns = 0; 423 424 /* Current position at lexical position queue */ 425 static YYLTYPE *yylpp = 0; 426 427 /* End position of lexical position queue */ 428 static YYLTYPE *yylpe = 0; 429 430 /* The last allocated position at the lexical position queue */ 431 static YYLTYPE *yylplim = 0; 432 #endif 433 434 /* Current position at lexical token queue */ 435 static YYINT *yylexp = 0; 436 437 static YYINT *yylexemes = 0; 438 #endif /* YYBTYACC */ 439 #line 80 "err_inherit4.y" 440 441 extern int YYLEX_DECL(); 442 extern void YYERROR_DECL(); 443 #line 444 "err_inherit4.tab.c" 444 445 /* Release memory associated with symbol. */ 446 #if ! defined YYDESTRUCT_IS_DECLARED 447 static void 448 YYDESTRUCT_DECL() 449 { 450 switch (psymb) 451 { 452 case 263: 453 #line 28 "err_inherit4.y" 454 { } 455 #line 456 "err_inherit4.tab.c" 456 break; 457 case 264: 458 #line 28 "err_inherit4.y" 459 { } 460 #line 461 "err_inherit4.tab.c" 461 break; 462 case 265: 463 #line 28 "err_inherit4.y" 464 { } 465 #line 466 "err_inherit4.tab.c" 466 break; 467 } 468 } 469 #define YYDESTRUCT_IS_DECLARED 1 470 #endif 471 472 /* For use in generated program */ 473 #define yydepth (int)(yystack.s_mark - yystack.s_base) 474 #if YYBTYACC 475 #define yytrial (yyps->save) 476 #endif /* YYBTYACC */ 477 478 #if YYDEBUG 479 #include <stdio.h> /* needed for printf */ 480 #endif 481 482 #include <stdlib.h> /* needed for malloc, etc */ 483 #include <string.h> /* needed for memset */ 484 485 /* allocate initial stack or double stack size, up to YYMAXDEPTH */ 486 static int yygrowstack(YYSTACKDATA *data) 487 { 488 int i; 489 unsigned newsize; 490 YYINT *newss; 491 YYSTYPE *newvs; 492 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 493 YYLTYPE *newps; 494 #endif 495 496 if ((newsize = data->stacksize) == 0) 497 newsize = YYINITSTACKSIZE; 498 else if (newsize >= YYMAXDEPTH) 499 return YYENOMEM; 500 else if ((newsize *= 2) > YYMAXDEPTH) 501 newsize = YYMAXDEPTH; 502 503 i = (int) (data->s_mark - data->s_base); 504 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); 505 if (newss == NULL) 506 return YYENOMEM; 507 508 data->s_base = newss; 509 data->s_mark = newss + i; 510 511 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 512 if (newvs == NULL) 513 return YYENOMEM; 514 515 data->l_base = newvs; 516 data->l_mark = newvs + i; 517 518 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 519 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps)); 520 if (newps == NULL) 521 return YYENOMEM; 522 523 data->p_base = newps; 524 data->p_mark = newps + i; 525 #endif 526 527 data->stacksize = newsize; 528 data->s_last = data->s_base + newsize - 1; 529 530 #if YYDEBUG 531 if (yydebug) 532 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize); 533 #endif 534 return 0; 535 } 536 537 #if YYPURE || defined(YY_NO_LEAKS) 538 static void yyfreestack(YYSTACKDATA *data) 539 { 540 free(data->s_base); 541 free(data->l_base); 542 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 543 free(data->p_base); 544 #endif 545 memset(data, 0, sizeof(*data)); 546 } 547 #else 548 #define yyfreestack(data) /* nothing */ 549 #endif /* YYPURE || defined(YY_NO_LEAKS) */ 550 #if YYBTYACC 551 552 static YYParseState * 553 yyNewState(unsigned size) 554 { 555 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState)); 556 if (p == NULL) return NULL; 557 558 p->yystack.stacksize = size; 559 if (size == 0) 560 { 561 p->yystack.s_base = NULL; 562 p->yystack.l_base = NULL; 563 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 564 p->yystack.p_base = NULL; 565 #endif 566 return p; 567 } 568 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT)); 569 if (p->yystack.s_base == NULL) return NULL; 570 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE)); 571 if (p->yystack.l_base == NULL) return NULL; 572 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE)); 573 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 574 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE)); 575 if (p->yystack.p_base == NULL) return NULL; 576 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE)); 577 #endif 578 579 return p; 580 } 581 582 static void 583 yyFreeState(YYParseState *p) 584 { 585 yyfreestack(&p->yystack); 586 free(p); 587 } 588 #endif /* YYBTYACC */ 589 590 #define YYABORT goto yyabort 591 #define YYREJECT goto yyabort 592 #define YYACCEPT goto yyaccept 593 #define YYERROR goto yyerrlab 594 #if YYBTYACC 595 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0) 596 #define YYVALID_NESTED do { if (yyps->save && \ 597 yyps->save->save == 0) goto yyvalid; } while(0) 598 #endif /* YYBTYACC */ 599 600 int 601 YYPARSE_DECL() 602 { 603 int yym, yyn, yystate, yyresult; 604 #if YYBTYACC 605 int yynewerrflag; 606 YYParseState *yyerrctx = NULL; 607 #endif /* YYBTYACC */ 608 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 609 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */ 610 #endif 611 #if YYDEBUG 612 const char *yys; 613 614 if ((yys = getenv("YYDEBUG")) != NULL) 615 { 616 yyn = *yys; 617 if (yyn >= '0' && yyn <= '9') 618 yydebug = yyn - '0'; 619 } 620 if (yydebug) 621 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX); 622 #endif 623 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 624 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range)); 625 #endif 626 627 #if YYBTYACC 628 yyps = yyNewState(0); if (yyps == 0) goto yyenomem; 629 yyps->save = 0; 630 #endif /* YYBTYACC */ 631 yym = 0; 632 /* yyn is set below */ 633 yynerrs = 0; 634 yyerrflag = 0; 635 yychar = YYEMPTY; 636 yystate = 0; 637 638 #if YYPURE 639 memset(&yystack, 0, sizeof(yystack)); 640 #endif 641 642 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 643 yystack.s_mark = yystack.s_base; 644 yystack.l_mark = yystack.l_base; 645 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 646 yystack.p_mark = yystack.p_base; 647 #endif 648 yystate = 0; 649 *yystack.s_mark = 0; 650 651 yyloop: 652 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 653 if (yychar < 0) 654 { 655 #if YYBTYACC 656 do { 657 if (yylvp < yylve) 658 { 659 /* we're currently re-reading tokens */ 660 yylval = *yylvp++; 661 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 662 yylloc = *yylpp++; 663 #endif 664 yychar = *yylexp++; 665 break; 666 } 667 if (yyps->save) 668 { 669 /* in trial mode; save scanner results for future parse attempts */ 670 if (yylvp == yylvlim) 671 { /* Enlarge lexical value queue */ 672 size_t p = (size_t) (yylvp - yylvals); 673 size_t s = (size_t) (yylvlim - yylvals); 674 675 s += YYLVQUEUEGROWTH; 676 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; 677 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; 678 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 679 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; 680 #endif 681 yylvp = yylve = yylvals + p; 682 yylvlim = yylvals + s; 683 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 684 yylpp = yylpe = yylpsns + p; 685 yylplim = yylpsns + s; 686 #endif 687 yylexp = yylexemes + p; 688 } 689 *yylexp = (YYINT) YYLEX; 690 *yylvp++ = yylval; 691 yylve++; 692 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 693 *yylpp++ = yylloc; 694 yylpe++; 695 #endif 696 yychar = *yylexp++; 697 break; 698 } 699 /* normal operation, no conflict encountered */ 700 #endif /* YYBTYACC */ 701 yychar = YYLEX; 702 #if YYBTYACC 703 } while (0); 704 #endif /* YYBTYACC */ 705 if (yychar < 0) yychar = YYEOF; 706 #if YYDEBUG 707 if (yydebug) 708 { 709 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 710 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)", 711 YYDEBUGSTR, yydepth, yystate, yychar, yys); 712 #ifdef YYSTYPE_TOSTRING 713 #if YYBTYACC 714 if (!yytrial) 715 #endif /* YYBTYACC */ 716 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval)); 717 #endif 718 fputc('\n', stderr); 719 } 720 #endif 721 } 722 #if YYBTYACC 723 724 /* Do we have a conflict? */ 725 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 && 726 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 727 { 728 YYINT ctry; 729 730 if (yypath) 731 { 732 YYParseState *save; 733 #if YYDEBUG 734 if (yydebug) 735 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n", 736 YYDEBUGSTR, yydepth, yystate); 737 #endif 738 /* Switch to the next conflict context */ 739 save = yypath; 740 yypath = save->save; 741 save->save = NULL; 742 ctry = save->ctry; 743 if (save->state != yystate) YYABORT; 744 yyFreeState(save); 745 746 } 747 else 748 { 749 750 /* Unresolved conflict - start/continue trial parse */ 751 YYParseState *save; 752 #if YYDEBUG 753 if (yydebug) 754 { 755 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate); 756 if (yyps->save) 757 fputs("ALREADY in conflict, continuing trial parse.\n", stderr); 758 else 759 fputs("Starting trial parse.\n", stderr); 760 } 761 #endif 762 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 763 if (save == NULL) goto yyenomem; 764 save->save = yyps->save; 765 save->state = yystate; 766 save->errflag = yyerrflag; 767 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); 768 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 769 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); 770 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 771 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 772 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); 773 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 774 #endif 775 ctry = yytable[yyn]; 776 if (yyctable[ctry] == -1) 777 { 778 #if YYDEBUG 779 if (yydebug && yychar >= YYEOF) 780 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth); 781 #endif 782 ctry++; 783 } 784 save->ctry = ctry; 785 if (yyps->save == NULL) 786 { 787 /* If this is a first conflict in the stack, start saving lexemes */ 788 if (!yylexemes) 789 { 790 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); 791 if (yylexemes == NULL) goto yyenomem; 792 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); 793 if (yylvals == NULL) goto yyenomem; 794 yylvlim = yylvals + YYLVQUEUEGROWTH; 795 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 796 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE)); 797 if (yylpsns == NULL) goto yyenomem; 798 yylplim = yylpsns + YYLVQUEUEGROWTH; 799 #endif 800 } 801 if (yylvp == yylve) 802 { 803 yylvp = yylve = yylvals; 804 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 805 yylpp = yylpe = yylpsns; 806 #endif 807 yylexp = yylexemes; 808 if (yychar >= YYEOF) 809 { 810 *yylve++ = yylval; 811 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 812 *yylpe++ = yylloc; 813 #endif 814 *yylexp = (YYINT) yychar; 815 yychar = YYEMPTY; 816 } 817 } 818 } 819 if (yychar >= YYEOF) 820 { 821 yylvp--; 822 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 823 yylpp--; 824 #endif 825 yylexp--; 826 yychar = YYEMPTY; 827 } 828 save->lexeme = (int) (yylvp - yylvals); 829 yyps->save = save; 830 } 831 if (yytable[yyn] == ctry) 832 { 833 #if YYDEBUG 834 if (yydebug) 835 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 836 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]); 837 #endif 838 if (yychar < 0) 839 { 840 yylvp++; 841 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 842 yylpp++; 843 #endif 844 yylexp++; 845 } 846 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) 847 goto yyoverflow; 848 yystate = yyctable[ctry]; 849 *++yystack.s_mark = (YYINT) yystate; 850 *++yystack.l_mark = yylval; 851 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 852 *++yystack.p_mark = yylloc; 853 #endif 854 yychar = YYEMPTY; 855 if (yyerrflag > 0) --yyerrflag; 856 goto yyloop; 857 } 858 else 859 { 860 yyn = yyctable[ctry]; 861 goto yyreduce; 862 } 863 } /* End of code dealing with conflicts */ 864 #endif /* YYBTYACC */ 865 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 866 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 867 { 868 #if YYDEBUG 869 if (yydebug) 870 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 871 YYDEBUGSTR, yydepth, yystate, yytable[yyn]); 872 #endif 873 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 874 yystate = yytable[yyn]; 875 *++yystack.s_mark = yytable[yyn]; 876 *++yystack.l_mark = yylval; 877 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 878 *++yystack.p_mark = yylloc; 879 #endif 880 yychar = YYEMPTY; 881 if (yyerrflag > 0) --yyerrflag; 882 goto yyloop; 883 } 884 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 885 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 886 { 887 yyn = yytable[yyn]; 888 goto yyreduce; 889 } 890 if (yyerrflag != 0) goto yyinrecovery; 891 #if YYBTYACC 892 893 yynewerrflag = 1; 894 goto yyerrhandler; 895 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 896 897 yyerrlab: 898 /* explicit YYERROR from an action -- pop the rhs of the rule reduced 899 * before looking for error recovery */ 900 yystack.s_mark -= yym; 901 yystate = *yystack.s_mark; 902 yystack.l_mark -= yym; 903 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 904 yystack.p_mark -= yym; 905 #endif 906 907 yynewerrflag = 0; 908 yyerrhandler: 909 while (yyps->save) 910 { 911 int ctry; 912 YYParseState *save = yyps->save; 913 #if YYDEBUG 914 if (yydebug) 915 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n", 916 YYDEBUGSTR, yydepth, yystate, yyps->save->state, 917 (int)(yylvp - yylvals - yyps->save->lexeme)); 918 #endif 919 /* Memorize most forward-looking error state in case it's really an error. */ 920 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals) 921 { 922 /* Free old saved error context state */ 923 if (yyerrctx) yyFreeState(yyerrctx); 924 /* Create and fill out new saved error context state */ 925 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 926 if (yyerrctx == NULL) goto yyenomem; 927 yyerrctx->save = yyps->save; 928 yyerrctx->state = yystate; 929 yyerrctx->errflag = yyerrflag; 930 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); 931 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 932 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); 933 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 934 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 935 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); 936 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 937 #endif 938 yyerrctx->lexeme = (int) (yylvp - yylvals); 939 } 940 yylvp = yylvals + save->lexeme; 941 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 942 yylpp = yylpsns + save->lexeme; 943 #endif 944 yylexp = yylexemes + save->lexeme; 945 yychar = YYEMPTY; 946 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); 947 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 948 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); 949 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 950 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 951 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); 952 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 953 #endif 954 ctry = ++save->ctry; 955 yystate = save->state; 956 /* We tried shift, try reduce now */ 957 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce; 958 yyps->save = save->save; 959 save->save = NULL; 960 yyFreeState(save); 961 962 /* Nothing left on the stack -- error */ 963 if (!yyps->save) 964 { 965 #if YYDEBUG 966 if (yydebug) 967 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n", 968 YYPREFIX, yydepth); 969 #endif 970 /* Restore state as it was in the most forward-advanced error */ 971 yylvp = yylvals + yyerrctx->lexeme; 972 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 973 yylpp = yylpsns + yyerrctx->lexeme; 974 #endif 975 yylexp = yylexemes + yyerrctx->lexeme; 976 yychar = yylexp[-1]; 977 yylval = yylvp[-1]; 978 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 979 yylloc = yylpp[-1]; 980 #endif 981 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); 982 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 983 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); 984 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 985 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 986 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); 987 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 988 #endif 989 yystate = yyerrctx->state; 990 yyFreeState(yyerrctx); 991 yyerrctx = NULL; 992 } 993 yynewerrflag = 1; 994 } 995 if (yynewerrflag == 0) goto yyinrecovery; 996 #endif /* YYBTYACC */ 997 998 YYERROR_CALL("syntax error"); 999 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1000 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */ 1001 #endif 1002 1003 #if !YYBTYACC 1004 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 1005 yyerrlab: 1006 #endif 1007 ++yynerrs; 1008 1009 yyinrecovery: 1010 if (yyerrflag < 3) 1011 { 1012 yyerrflag = 3; 1013 for (;;) 1014 { 1015 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 1016 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 1017 { 1018 #if YYDEBUG 1019 if (yydebug) 1020 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n", 1021 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]); 1022 #endif 1023 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1024 yystate = yytable[yyn]; 1025 *++yystack.s_mark = yytable[yyn]; 1026 *++yystack.l_mark = yylval; 1027 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1028 /* lookahead position is error end position */ 1029 yyerror_loc_range[2] = yylloc; 1030 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */ 1031 *++yystack.p_mark = yyloc; 1032 #endif 1033 goto yyloop; 1034 } 1035 else 1036 { 1037 #if YYDEBUG 1038 if (yydebug) 1039 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n", 1040 YYDEBUGSTR, yydepth, *yystack.s_mark); 1041 #endif 1042 if (yystack.s_mark <= yystack.s_base) goto yyabort; 1043 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1044 /* the current TOS position is the error start position */ 1045 yyerror_loc_range[1] = *yystack.p_mark; 1046 #endif 1047 #if defined(YYDESTRUCT_CALL) 1048 #if YYBTYACC 1049 if (!yytrial) 1050 #endif /* YYBTYACC */ 1051 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1052 YYDESTRUCT_CALL("error: discarding state", 1053 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark); 1054 #else 1055 YYDESTRUCT_CALL("error: discarding state", 1056 yystos[*yystack.s_mark], yystack.l_mark); 1057 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1058 #endif /* defined(YYDESTRUCT_CALL) */ 1059 --yystack.s_mark; 1060 --yystack.l_mark; 1061 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1062 --yystack.p_mark; 1063 #endif 1064 } 1065 } 1066 } 1067 else 1068 { 1069 if (yychar == YYEOF) goto yyabort; 1070 #if YYDEBUG 1071 if (yydebug) 1072 { 1073 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 1074 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n", 1075 YYDEBUGSTR, yydepth, yystate, yychar, yys); 1076 } 1077 #endif 1078 #if defined(YYDESTRUCT_CALL) 1079 #if YYBTYACC 1080 if (!yytrial) 1081 #endif /* YYBTYACC */ 1082 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1083 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc); 1084 #else 1085 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval); 1086 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1087 #endif /* defined(YYDESTRUCT_CALL) */ 1088 yychar = YYEMPTY; 1089 goto yyloop; 1090 } 1091 1092 yyreduce: 1093 yym = yylen[yyn]; 1094 #if YYDEBUG 1095 if (yydebug) 1096 { 1097 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)", 1098 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]); 1099 #ifdef YYSTYPE_TOSTRING 1100 #if YYBTYACC 1101 if (!yytrial) 1102 #endif /* YYBTYACC */ 1103 if (yym > 0) 1104 { 1105 int i; 1106 fputc('<', stderr); 1107 for (i = yym; i > 0; i--) 1108 { 1109 if (i != yym) fputs(", ", stderr); 1110 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]], 1111 yystack.l_mark[1-i]), stderr); 1112 } 1113 fputc('>', stderr); 1114 } 1115 #endif 1116 fputc('\n', stderr); 1117 } 1118 #endif 1119 if (yym > 0) 1120 yyval = yystack.l_mark[1-yym]; 1121 else 1122 memset(&yyval, 0, sizeof yyval); 1123 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1124 1125 /* Perform position reduction */ 1126 memset(&yyloc, 0, sizeof(yyloc)); 1127 #if YYBTYACC 1128 if (!yytrial) 1129 #endif /* YYBTYACC */ 1130 { 1131 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym); 1132 /* just in case YYERROR is invoked within the action, save 1133 the start of the rhs as the error start position */ 1134 yyerror_loc_range[1] = yystack.p_mark[1-yym]; 1135 } 1136 #endif 1137 1138 switch (yyn) 1139 { 1140 case 1: 1141 #line 52 "err_inherit4.y" 1142 yyval.cval = yystack.l_mark[-1].cval; 1143 #line 1144 "err_inherit4.tab.c" 1144 break; 1145 case 2: 1146 #line 52 "err_inherit4.y" 1147 yyval.tval = yystack.l_mark[-1].tval; 1148 #line 1149 "err_inherit4.tab.c" 1149 break; 1150 case 3: 1151 #line 53 "err_inherit4.y" 1152 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[0]; } 1153 #line 1154 "err_inherit4.tab.c" 1154 break; 1155 case 4: 1156 #line 55 "err_inherit4.y" 1157 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[-3]; } 1158 #line 1159 "err_inherit4.tab.c" 1159 break; 1160 case 5: 1161 #line 58 "err_inherit4.y" 1162 { yyval.cval = cGLOBAL; } 1163 #line 1164 "err_inherit4.tab.c" 1164 break; 1165 case 6: 1166 #line 59 "err_inherit4.y" 1167 { yyval.cval = cLOCAL; } 1168 #line 1169 "err_inherit4.tab.c" 1169 break; 1170 case 7: 1171 #line 62 "err_inherit4.y" 1172 { yyval.tval = tREAL; } 1173 #line 1174 "err_inherit4.tab.c" 1174 break; 1175 case 8: 1176 #line 63 "err_inherit4.y" 1177 { yyval.tval = tINTEGER; } 1178 #line 1179 "err_inherit4.tab.c" 1179 break; 1180 case 9: 1181 #line 67 "err_inherit4.y" 1182 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-3].cval, yystack.l_mark[0].id); 1183 yyval.nlist->next = yystack.l_mark[-1].nlist; 1184 } 1185 #line 1186 "err_inherit4.tab.c" 1186 break; 1187 case 10: 1188 #line 71 "err_inherit4.y" 1189 { yyval.nlist->s = mksymbol(yystack.l_mark[-1].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id); 1190 yyval.nlist->next = NULL; 1191 } 1192 #line 1193 "err_inherit4.tab.c" 1193 break; 1194 case 11: 1195 #line 77 "err_inherit4.y" 1196 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[1]; } 1197 #line 1198 "err_inherit4.tab.c" 1198 break; 1199 #line 1200 "err_inherit4.tab.c" 1200 default: 1201 break; 1202 } 1203 yystack.s_mark -= yym; 1204 yystate = *yystack.s_mark; 1205 yystack.l_mark -= yym; 1206 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1207 yystack.p_mark -= yym; 1208 #endif 1209 yym = yylhs[yyn]; 1210 if (yystate == 0 && yym == 0) 1211 { 1212 #if YYDEBUG 1213 if (yydebug) 1214 { 1215 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1216 #ifdef YYSTYPE_TOSTRING 1217 #if YYBTYACC 1218 if (!yytrial) 1219 #endif /* YYBTYACC */ 1220 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); 1221 #endif 1222 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); 1223 } 1224 #endif 1225 yystate = YYFINAL; 1226 *++yystack.s_mark = YYFINAL; 1227 *++yystack.l_mark = yyval; 1228 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1229 *++yystack.p_mark = yyloc; 1230 #endif 1231 if (yychar < 0) 1232 { 1233 #if YYBTYACC 1234 do { 1235 if (yylvp < yylve) 1236 { 1237 /* we're currently re-reading tokens */ 1238 yylval = *yylvp++; 1239 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1240 yylloc = *yylpp++; 1241 #endif 1242 yychar = *yylexp++; 1243 break; 1244 } 1245 if (yyps->save) 1246 { 1247 /* in trial mode; save scanner results for future parse attempts */ 1248 if (yylvp == yylvlim) 1249 { /* Enlarge lexical value queue */ 1250 size_t p = (size_t) (yylvp - yylvals); 1251 size_t s = (size_t) (yylvlim - yylvals); 1252 1253 s += YYLVQUEUEGROWTH; 1254 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) 1255 goto yyenomem; 1256 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) 1257 goto yyenomem; 1258 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1259 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) 1260 goto yyenomem; 1261 #endif 1262 yylvp = yylve = yylvals + p; 1263 yylvlim = yylvals + s; 1264 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1265 yylpp = yylpe = yylpsns + p; 1266 yylplim = yylpsns + s; 1267 #endif 1268 yylexp = yylexemes + p; 1269 } 1270 *yylexp = (YYINT) YYLEX; 1271 *yylvp++ = yylval; 1272 yylve++; 1273 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1274 *yylpp++ = yylloc; 1275 yylpe++; 1276 #endif 1277 yychar = *yylexp++; 1278 break; 1279 } 1280 /* normal operation, no conflict encountered */ 1281 #endif /* YYBTYACC */ 1282 yychar = YYLEX; 1283 #if YYBTYACC 1284 } while (0); 1285 #endif /* YYBTYACC */ 1286 if (yychar < 0) yychar = YYEOF; 1287 #if YYDEBUG 1288 if (yydebug) 1289 { 1290 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 1291 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n", 1292 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); 1293 } 1294 #endif 1295 } 1296 if (yychar == YYEOF) goto yyaccept; 1297 goto yyloop; 1298 } 1299 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 1300 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 1301 yystate = yytable[yyn]; 1302 else 1303 yystate = yydgoto[yym]; 1304 #if YYDEBUG 1305 if (yydebug) 1306 { 1307 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1308 #ifdef YYSTYPE_TOSTRING 1309 #if YYBTYACC 1310 if (!yytrial) 1311 #endif /* YYBTYACC */ 1312 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); 1313 #endif 1314 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); 1315 } 1316 #endif 1317 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1318 *++yystack.s_mark = (YYINT) yystate; 1319 *++yystack.l_mark = yyval; 1320 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1321 *++yystack.p_mark = yyloc; 1322 #endif 1323 goto yyloop; 1324 #if YYBTYACC 1325 1326 /* Reduction declares that this path is valid. Set yypath and do a full parse */ 1327 yyvalid: 1328 if (yypath) YYABORT; 1329 while (yyps->save) 1330 { 1331 YYParseState *save = yyps->save; 1332 yyps->save = save->save; 1333 save->save = yypath; 1334 yypath = save; 1335 } 1336 #if YYDEBUG 1337 if (yydebug) 1338 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", 1339 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); 1340 #endif 1341 if (yyerrctx) 1342 { 1343 yyFreeState(yyerrctx); 1344 yyerrctx = NULL; 1345 } 1346 yylvp = yylvals + yypath->lexeme; 1347 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1348 yylpp = yylpsns + yypath->lexeme; 1349 #endif 1350 yylexp = yylexemes + yypath->lexeme; 1351 yychar = YYEMPTY; 1352 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); 1353 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 1354 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); 1355 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1356 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1357 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); 1358 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1359 #endif 1360 yystate = yypath->state; 1361 goto yyloop; 1362 #endif /* YYBTYACC */ 1363 1364 yyoverflow: 1365 YYERROR_CALL("yacc stack overflow"); 1366 #if YYBTYACC 1367 goto yyabort_nomem; 1368 yyenomem: 1369 YYERROR_CALL("memory exhausted"); 1370 yyabort_nomem: 1371 #endif /* YYBTYACC */ 1372 yyresult = 2; 1373 goto yyreturn; 1374 1375 yyabort: 1376 yyresult = 1; 1377 goto yyreturn; 1378 1379 yyaccept: 1380 #if YYBTYACC 1381 if (yyps->save) goto yyvalid; 1382 #endif /* YYBTYACC */ 1383 yyresult = 0; 1384 1385 yyreturn: 1386 #if defined(YYDESTRUCT_CALL) 1387 if (yychar != YYEOF && yychar != YYEMPTY) 1388 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1389 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); 1390 #else 1391 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); 1392 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1393 1394 { 1395 YYSTYPE *pv; 1396 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1397 YYLTYPE *pp; 1398 1399 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) 1400 YYDESTRUCT_CALL("cleanup: discarding state", 1401 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); 1402 #else 1403 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) 1404 YYDESTRUCT_CALL("cleanup: discarding state", 1405 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); 1406 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1407 } 1408 #endif /* defined(YYDESTRUCT_CALL) */ 1409 1410 #if YYBTYACC 1411 if (yyerrctx) 1412 { 1413 yyFreeState(yyerrctx); 1414 yyerrctx = NULL; 1415 } 1416 while (yyps) 1417 { 1418 YYParseState *save = yyps; 1419 yyps = save->save; 1420 save->save = NULL; 1421 yyFreeState(save); 1422 } 1423 while (yypath) 1424 { 1425 YYParseState *save = yypath; 1426 yypath = save->save; 1427 save->save = NULL; 1428 yyFreeState(save); 1429 } 1430 #endif /* YYBTYACC */ 1431 yyfreestack(&yystack); 1432 return (yyresult); 1433 } 1434