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