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