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