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