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