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