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