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