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