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