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