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