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