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