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