1 /* original parser id follows */ 2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ 3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ 4 5 #define YYBYACC 1 6 #define YYMAJOR 1 7 #define YYMINOR 9 8 #define YYCHECK "yyyymmdd" 9 10 #define YYEMPTY (-1) 11 #define yyclearin (yychar = YYEMPTY) 12 #define yyerrok (yyerrflag = 0) 13 #define YYRECOVERING() (yyerrflag != 0) 14 #define YYENOMEM (-2) 15 #define YYEOF 0 16 #undef YYBTYACC 17 #define YYBTYACC 0 18 #define YYDEBUGSTR YYPREFIX "debug" 19 20 #ifndef yyparse 21 #define yyparse err_inherit4_parse 22 #endif /* yyparse */ 23 24 #ifndef yylex 25 #define yylex err_inherit4_lex 26 #endif /* yylex */ 27 28 #ifndef yyerror 29 #define yyerror err_inherit4_error 30 #endif /* yyerror */ 31 32 #ifndef yychar 33 #define yychar err_inherit4_char 34 #endif /* yychar */ 35 36 #ifndef yyval 37 #define yyval err_inherit4_val 38 #endif /* yyval */ 39 40 #ifndef yylval 41 #define yylval err_inherit4_lval 42 #endif /* yylval */ 43 44 #ifndef yydebug 45 #define yydebug err_inherit4_debug 46 #endif /* yydebug */ 47 48 #ifndef yynerrs 49 #define yynerrs err_inherit4_nerrs 50 #endif /* yynerrs */ 51 52 #ifndef yyerrflag 53 #define yyerrflag err_inherit4_errflag 54 #endif /* yyerrflag */ 55 56 #ifndef yylhs 57 #define yylhs err_inherit4_lhs 58 #endif /* yylhs */ 59 60 #ifndef yylen 61 #define yylen err_inherit4_len 62 #endif /* yylen */ 63 64 #ifndef yydefred 65 #define yydefred err_inherit4_defred 66 #endif /* yydefred */ 67 68 #ifndef yystos 69 #define yystos err_inherit4_stos 70 #endif /* yystos */ 71 72 #ifndef yydgoto 73 #define yydgoto err_inherit4_dgoto 74 #endif /* yydgoto */ 75 76 #ifndef yysindex 77 #define yysindex err_inherit4_sindex 78 #endif /* yysindex */ 79 80 #ifndef yyrindex 81 #define yyrindex err_inherit4_rindex 82 #endif /* yyrindex */ 83 84 #ifndef yygindex 85 #define yygindex err_inherit4_gindex 86 #endif /* yygindex */ 87 88 #ifndef yytable 89 #define yytable err_inherit4_table 90 #endif /* yytable */ 91 92 #ifndef yycheck 93 #define yycheck err_inherit4_check 94 #endif /* yycheck */ 95 96 #ifndef yyname 97 #define yyname err_inherit4_name 98 #endif /* yyname */ 99 100 #ifndef yyrule 101 #define yyrule err_inherit4_rule 102 #endif /* yyrule */ 103 104 #ifndef yyloc 105 #define yyloc err_inherit4_loc 106 #endif /* yyloc */ 107 108 #ifndef yylloc 109 #define yylloc err_inherit4_lloc 110 #endif /* yylloc */ 111 112 #if YYBTYACC 113 114 #ifndef yycindex 115 #define yycindex err_inherit4_cindex 116 #endif /* yycindex */ 117 118 #ifndef yyctable 119 #define yyctable err_inherit4_ctable 120 #endif /* yyctable */ 121 122 #endif /* YYBTYACC */ 123 124 #define YYPREFIX "err_inherit4_" 125 126 #define YYPURE 0 127 128 #line 3 "err_inherit4.y" 129 #include <stdlib.h> 130 131 typedef enum {cGLOBAL, cLOCAL} class; 132 typedef enum {tREAL, tINTEGER} type; 133 typedef char * name; 134 135 struct symbol { class c; type t; name id; }; 136 typedef struct symbol symbol; 137 138 struct namelist { symbol *s; struct namelist *next; }; 139 typedef struct namelist namelist; 140 141 extern symbol *mksymbol(type t, class c, name id); 142 143 #ifdef YYBISON 144 #define YYLEX_DECL() yylex(void) 145 #define YYERROR_DECL() yyerror(const char *s) 146 #endif 147 #ifdef YYSTYPE 148 #undef YYSTYPE_IS_DECLARED 149 #define YYSTYPE_IS_DECLARED 1 150 #endif 151 #ifndef YYSTYPE_IS_DECLARED 152 #define YYSTYPE_IS_DECLARED 1 153 #line 41 "err_inherit4.y" 154 typedef 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. */ 166 typedef struct YYLTYPE 167 { 168 int first_line; 169 int first_column; 170 int last_line; 171 int last_column; 172 unsigned source; 173 } YYLTYPE; 174 #define YYLTYPE_IS_DECLARED 1 175 #endif 176 #define YYRHSLOC(rhs, k) ((rhs)[k]) 177 178 /* compatibility with bison */ 179 #ifdef YYPARSE_PARAM 180 /* compatibility with FreeBSD */ 181 # ifdef YYPARSE_PARAM_TYPE 182 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 183 # else 184 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 185 # endif 186 #else 187 # define YYPARSE_DECL() yyparse(void) 188 #endif 189 190 /* Parameters sent to lex. */ 191 #ifdef YYLEX_PARAM 192 # define YYLEX_DECL() yylex(void *YYLEX_PARAM) 193 # define YYLEX yylex(YYLEX_PARAM) 194 #else 195 # define YYLEX_DECL() yylex(void) 196 # define YYLEX yylex() 197 #endif 198 199 /* Parameters sent to yyerror. */ 200 #ifndef YYERROR_DECL 201 #define YYERROR_DECL() yyerror(YYLTYPE *loc, const char *s) 202 #endif 203 #ifndef YYERROR_CALL 204 #define YYERROR_CALL(msg) yyerror(&yylloc, msg) 205 #endif 206 207 #ifndef YYDESTRUCT_DECL 208 #define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, YYLTYPE *loc) 209 #endif 210 #ifndef YYDESTRUCT_CALL 211 #define YYDESTRUCT_CALL(msg, psymb, val, loc) yydestruct(msg, psymb, val, loc) 212 #endif 213 214 extern int YYPARSE_DECL(); 215 216 #define GLOBAL 257 217 #define LOCAL 258 218 #define REAL 259 219 #define INTEGER 260 220 #define NAME 261 221 #define YYERRCODE 256 222 typedef short YYINT; 223 static const YYINT err_inherit4_lhs[] = { -1, 224 5, 6, 0, 0, 3, 3, 4, 4, 1, 1, 225 2, 226 }; 227 static const YYINT err_inherit4_len[] = { 2, 228 0, 0, 5, 2, 1, 1, 1, 1, 2, 1, 229 1, 230 }; 231 static const YYINT err_inherit4_defred[] = { 0, 232 5, 6, 7, 8, 0, 0, 0, 1, 10, 0, 233 4, 2, 9, 0, 0, 234 }; 235 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) 236 static const YYINT err_inherit4_stos[] = { 0, 237 257, 258, 259, 260, 263, 266, 267, 267, 261, 264, 238 265, 268, 261, 269, 264, 239 }; 240 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ 241 static const YYINT err_inherit4_dgoto[] = { 5, 242 10, 11, 6, 7, 12, 14, 243 }; 244 static const YYINT err_inherit4_sindex[] = { -257, 245 0, 0, 0, 0, 0, -255, -254, 0, 0, -253, 246 0, 0, 0, -254, -253, 247 }; 248 static const YYINT err_inherit4_rindex[] = { 0, 249 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 250 0, 0, 0, 0, 9, 251 }; 252 #if YYBTYACC 253 static const YYINT err_inherit4_cindex[] = { 0, 254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255 0, 0, 0, 0, 0, 256 }; 257 #endif 258 static const YYINT err_inherit4_gindex[] = { 0, 259 -4, 0, 0, 5, 0, 0, 260 }; 261 #define YYTABLESIZE 11 262 static const YYINT err_inherit4_table[] = { 1, 263 2, 3, 4, 3, 4, 11, 9, 13, 3, 15, 264 8, 265 }; 266 static const YYINT err_inherit4_check[] = { 257, 267 258, 259, 260, 259, 260, 0, 261, 261, 0, 14, 268 6, 269 }; 270 #if YYBTYACC 271 static const YYINT err_inherit4_ctable[] = { -1, 272 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 273 }; 274 #endif 275 #define YYFINAL 5 276 #ifndef YYDEBUG 277 #define YYDEBUG 0 278 #endif 279 #define YYMAXTOKEN 261 280 #define YYUNDFTOKEN 270 281 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) 282 #if YYDEBUG 283 static const char *const err_inherit4_name[] = { 284 285 "$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 286 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 287 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 288 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 289 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 290 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 291 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER", 292 "NAME","$accept","declaration","namelist","locnamelist","class","type","$$1", 293 "$$2","illegal-symbol", 294 }; 295 static const char *const err_inherit4_rule[] = { 296 "$accept : declaration", 297 "$$1 :", 298 "$$2 :", 299 "declaration : class type $$1 $$2 namelist", 300 "declaration : type locnamelist", 301 "class : GLOBAL", 302 "class : LOCAL", 303 "type : REAL", 304 "type : INTEGER", 305 "namelist : namelist NAME", 306 "namelist : NAME", 307 "locnamelist : namelist", 308 309 }; 310 #endif 311 312 int yydebug; 313 int yynerrs; 314 315 int yyerrflag; 316 int yychar; 317 YYSTYPE yyval; 318 YYSTYPE yylval; 319 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 320 YYLTYPE yyloc; /* position returned by actions */ 321 YYLTYPE yylloc; /* position from the lexer */ 322 #endif 323 324 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 325 #ifndef YYLLOC_DEFAULT 326 #define YYLLOC_DEFAULT(loc, rhs, n) \ 327 do \ 328 { \ 329 if (n == 0) \ 330 { \ 331 (loc).first_line = ((rhs)[-1]).last_line; \ 332 (loc).first_column = ((rhs)[-1]).last_column; \ 333 (loc).last_line = ((rhs)[-1]).last_line; \ 334 (loc).last_column = ((rhs)[-1]).last_column; \ 335 } \ 336 else \ 337 { \ 338 (loc).first_line = ((rhs)[ 0 ]).first_line; \ 339 (loc).first_column = ((rhs)[ 0 ]).first_column; \ 340 (loc).last_line = ((rhs)[n-1]).last_line; \ 341 (loc).last_column = ((rhs)[n-1]).last_column; \ 342 } \ 343 } while (0) 344 #endif /* YYLLOC_DEFAULT */ 345 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 346 #if YYBTYACC 347 348 #ifndef YYLVQUEUEGROWTH 349 #define YYLVQUEUEGROWTH 32 350 #endif 351 #endif /* YYBTYACC */ 352 353 /* define the initial stack-sizes */ 354 #ifdef YYSTACKSIZE 355 #undef YYMAXDEPTH 356 #define YYMAXDEPTH YYSTACKSIZE 357 #else 358 #ifdef YYMAXDEPTH 359 #define YYSTACKSIZE YYMAXDEPTH 360 #else 361 #define YYSTACKSIZE 10000 362 #define YYMAXDEPTH 10000 363 #endif 364 #endif 365 366 #ifndef YYINITSTACKSIZE 367 #define YYINITSTACKSIZE 200 368 #endif 369 370 typedef struct { 371 unsigned stacksize; 372 YYINT *s_base; 373 YYINT *s_mark; 374 YYINT *s_last; 375 YYSTYPE *l_base; 376 YYSTYPE *l_mark; 377 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 378 YYLTYPE *p_base; 379 YYLTYPE *p_mark; 380 #endif 381 } YYSTACKDATA; 382 #if YYBTYACC 383 384 struct YYParseState_s 385 { 386 struct YYParseState_s *save; /* Previously saved parser state */ 387 YYSTACKDATA yystack; /* saved parser stack */ 388 int state; /* saved parser state */ 389 int errflag; /* saved error recovery status */ 390 int lexeme; /* saved index of the conflict lexeme in the lexical queue */ 391 YYINT ctry; /* saved index in yyctable[] for this conflict */ 392 }; 393 typedef struct YYParseState_s YYParseState; 394 #endif /* YYBTYACC */ 395 /* variables for the parser stack */ 396 static YYSTACKDATA yystack; 397 #if YYBTYACC 398 399 /* Current parser state */ 400 static YYParseState *yyps = 0; 401 402 /* yypath != NULL: do the full parse, starting at *yypath parser state. */ 403 static YYParseState *yypath = 0; 404 405 /* Base of the lexical value queue */ 406 static YYSTYPE *yylvals = 0; 407 408 /* Current position at lexical value queue */ 409 static YYSTYPE *yylvp = 0; 410 411 /* End position of lexical value queue */ 412 static YYSTYPE *yylve = 0; 413 414 /* The last allocated position at the lexical value queue */ 415 static YYSTYPE *yylvlim = 0; 416 417 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 418 /* Base of the lexical position queue */ 419 static YYLTYPE *yylpsns = 0; 420 421 /* Current position at lexical position queue */ 422 static YYLTYPE *yylpp = 0; 423 424 /* End position of lexical position queue */ 425 static YYLTYPE *yylpe = 0; 426 427 /* The last allocated position at the lexical position queue */ 428 static YYLTYPE *yylplim = 0; 429 #endif 430 431 /* Current position at lexical token queue */ 432 static YYINT *yylexp = 0; 433 434 static YYINT *yylexemes = 0; 435 #endif /* YYBTYACC */ 436 #line 80 "err_inherit4.y" 437 438 extern int YYLEX_DECL(); 439 extern void YYERROR_DECL(); 440 #line 441 "err_inherit4.tab.c" 441 442 /* Release memory associated with symbol. */ 443 #if ! defined YYDESTRUCT_IS_DECLARED 444 static void 445 YYDESTRUCT_DECL() 446 { 447 switch (psymb) 448 { 449 case 263: 450 #line 28 "err_inherit4.y" 451 { } 452 break; 453 #line 454 "err_inherit4.tab.c" 454 case 264: 455 #line 28 "err_inherit4.y" 456 { } 457 break; 458 #line 459 "err_inherit4.tab.c" 459 case 265: 460 #line 28 "err_inherit4.y" 461 { } 462 break; 463 #line 464 "err_inherit4.tab.c" 464 } 465 } 466 #define YYDESTRUCT_IS_DECLARED 1 467 #endif 468 469 /* For use in generated program */ 470 #define yydepth (int)(yystack.s_mark - yystack.s_base) 471 #if YYBTYACC 472 #define yytrial (yyps->save) 473 #endif /* YYBTYACC */ 474 475 #if YYDEBUG 476 #include <stdio.h> /* needed for printf */ 477 #endif 478 479 #include <stdlib.h> /* needed for malloc, etc */ 480 #include <string.h> /* needed for memset */ 481 482 /* allocate initial stack or double stack size, up to YYMAXDEPTH */ 483 static int yygrowstack(YYSTACKDATA *data) 484 { 485 int i; 486 unsigned newsize; 487 YYINT *newss; 488 YYSTYPE *newvs; 489 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 490 YYLTYPE *newps; 491 #endif 492 493 if ((newsize = data->stacksize) == 0) 494 newsize = YYINITSTACKSIZE; 495 else if (newsize >= YYMAXDEPTH) 496 return YYENOMEM; 497 else if ((newsize *= 2) > YYMAXDEPTH) 498 newsize = YYMAXDEPTH; 499 500 i = (int) (data->s_mark - data->s_base); 501 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); 502 if (newss == 0) 503 return YYENOMEM; 504 505 data->s_base = newss; 506 data->s_mark = newss + i; 507 508 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 509 if (newvs == 0) 510 return YYENOMEM; 511 512 data->l_base = newvs; 513 data->l_mark = newvs + i; 514 515 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 516 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps)); 517 if (newps == 0) 518 return YYENOMEM; 519 520 data->p_base = newps; 521 data->p_mark = newps + i; 522 #endif 523 524 data->stacksize = newsize; 525 data->s_last = data->s_base + newsize - 1; 526 527 #if YYDEBUG 528 if (yydebug) 529 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize); 530 #endif 531 return 0; 532 } 533 534 #if YYPURE || defined(YY_NO_LEAKS) 535 static void yyfreestack(YYSTACKDATA *data) 536 { 537 free(data->s_base); 538 free(data->l_base); 539 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 540 free(data->p_base); 541 #endif 542 memset(data, 0, sizeof(*data)); 543 } 544 #else 545 #define yyfreestack(data) /* nothing */ 546 #endif /* YYPURE || defined(YY_NO_LEAKS) */ 547 #if YYBTYACC 548 549 static YYParseState * 550 yyNewState(unsigned size) 551 { 552 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState)); 553 if (p == NULL) return NULL; 554 555 p->yystack.stacksize = size; 556 if (size == 0) 557 { 558 p->yystack.s_base = NULL; 559 p->yystack.l_base = NULL; 560 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 561 p->yystack.p_base = NULL; 562 #endif 563 return p; 564 } 565 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT)); 566 if (p->yystack.s_base == NULL) return NULL; 567 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE)); 568 if (p->yystack.l_base == NULL) return NULL; 569 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE)); 570 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 571 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE)); 572 if (p->yystack.p_base == NULL) return NULL; 573 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE)); 574 #endif 575 576 return p; 577 } 578 579 static void 580 yyFreeState(YYParseState *p) 581 { 582 yyfreestack(&p->yystack); 583 free(p); 584 } 585 #endif /* YYBTYACC */ 586 587 #define YYABORT goto yyabort 588 #define YYREJECT goto yyabort 589 #define YYACCEPT goto yyaccept 590 #define YYERROR goto yyerrlab 591 #if YYBTYACC 592 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0) 593 #define YYVALID_NESTED do { if (yyps->save && \ 594 yyps->save->save == 0) goto yyvalid; } while(0) 595 #endif /* YYBTYACC */ 596 597 int 598 YYPARSE_DECL() 599 { 600 int yym, yyn, yystate, yyresult; 601 #if YYBTYACC 602 int yynewerrflag; 603 YYParseState *yyerrctx = NULL; 604 #endif /* YYBTYACC */ 605 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 606 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */ 607 #endif 608 #if YYDEBUG 609 const char *yys; 610 611 if ((yys = getenv("YYDEBUG")) != 0) 612 { 613 yyn = *yys; 614 if (yyn >= '0' && yyn <= '9') 615 yydebug = yyn - '0'; 616 } 617 if (yydebug) 618 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX); 619 #endif 620 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 621 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range)); 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 648 yyloop: 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 894 yyerrlab: 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; 905 yyerrhandler: 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 */ 1002 yyerrlab: 1003 #endif 1004 ++yynerrs; 1005 1006 yyinrecovery: 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 1089 yyreduce: 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 { 1137 case 1: 1138 #line 52 "err_inherit4.y" 1139 yyval.cval = yystack.l_mark[-1].cval; 1140 break; 1141 case 2: 1142 #line 52 "err_inherit4.y" 1143 yyval.tval = yystack.l_mark[-1].tval; 1144 break; 1145 case 3: 1146 #line 53 "err_inherit4.y" 1147 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[0]; } 1148 break; 1149 case 4: 1150 #line 55 "err_inherit4.y" 1151 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[-3]; } 1152 break; 1153 case 5: 1154 #line 58 "err_inherit4.y" 1155 { yyval.cval = cGLOBAL; } 1156 break; 1157 case 6: 1158 #line 59 "err_inherit4.y" 1159 { yyval.cval = cLOCAL; } 1160 break; 1161 case 7: 1162 #line 62 "err_inherit4.y" 1163 { yyval.tval = tREAL; } 1164 break; 1165 case 8: 1166 #line 63 "err_inherit4.y" 1167 { yyval.tval = tINTEGER; } 1168 break; 1169 case 9: 1170 #line 67 "err_inherit4.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 } 1174 break; 1175 case 10: 1176 #line 71 "err_inherit4.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 } 1180 break; 1181 case 11: 1182 #line 77 "err_inherit4.y" 1183 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[1]; } 1184 break; 1185 #line 1186 "err_inherit4.tab.c" 1186 default: 1187 break; 1188 } 1189 yystack.s_mark -= yym; 1190 yystate = *yystack.s_mark; 1191 yystack.l_mark -= yym; 1192 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1193 yystack.p_mark -= yym; 1194 #endif 1195 yym = yylhs[yyn]; 1196 if (yystate == 0 && yym == 0) 1197 { 1198 #if YYDEBUG 1199 if (yydebug) 1200 { 1201 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1202 #ifdef YYSTYPE_TOSTRING 1203 #if YYBTYACC 1204 if (!yytrial) 1205 #endif /* YYBTYACC */ 1206 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); 1207 #endif 1208 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); 1209 } 1210 #endif 1211 yystate = YYFINAL; 1212 *++yystack.s_mark = YYFINAL; 1213 *++yystack.l_mark = yyval; 1214 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1215 *++yystack.p_mark = yyloc; 1216 #endif 1217 if (yychar < 0) 1218 { 1219 #if YYBTYACC 1220 do { 1221 if (yylvp < yylve) 1222 { 1223 /* we're currently re-reading tokens */ 1224 yylval = *yylvp++; 1225 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1226 yylloc = *yylpp++; 1227 #endif 1228 yychar = *yylexp++; 1229 break; 1230 } 1231 if (yyps->save) 1232 { 1233 /* in trial mode; save scanner results for future parse attempts */ 1234 if (yylvp == yylvlim) 1235 { /* Enlarge lexical value queue */ 1236 size_t p = (size_t) (yylvp - yylvals); 1237 size_t s = (size_t) (yylvlim - yylvals); 1238 1239 s += YYLVQUEUEGROWTH; 1240 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) 1241 goto yyenomem; 1242 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) 1243 goto yyenomem; 1244 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1245 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) 1246 goto yyenomem; 1247 #endif 1248 yylvp = yylve = yylvals + p; 1249 yylvlim = yylvals + s; 1250 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1251 yylpp = yylpe = yylpsns + p; 1252 yylplim = yylpsns + s; 1253 #endif 1254 yylexp = yylexemes + p; 1255 } 1256 *yylexp = (YYINT) YYLEX; 1257 *yylvp++ = yylval; 1258 yylve++; 1259 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1260 *yylpp++ = yylloc; 1261 yylpe++; 1262 #endif 1263 yychar = *yylexp++; 1264 break; 1265 } 1266 /* normal operation, no conflict encountered */ 1267 #endif /* YYBTYACC */ 1268 yychar = YYLEX; 1269 #if YYBTYACC 1270 } while (0); 1271 #endif /* YYBTYACC */ 1272 if (yychar < 0) yychar = YYEOF; 1273 #if YYDEBUG 1274 if (yydebug) 1275 { 1276 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 1277 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n", 1278 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); 1279 } 1280 #endif 1281 } 1282 if (yychar == YYEOF) goto yyaccept; 1283 goto yyloop; 1284 } 1285 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 1286 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 1287 yystate = yytable[yyn]; 1288 else 1289 yystate = yydgoto[yym]; 1290 #if YYDEBUG 1291 if (yydebug) 1292 { 1293 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1294 #ifdef YYSTYPE_TOSTRING 1295 #if YYBTYACC 1296 if (!yytrial) 1297 #endif /* YYBTYACC */ 1298 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); 1299 #endif 1300 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); 1301 } 1302 #endif 1303 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1304 *++yystack.s_mark = (YYINT) yystate; 1305 *++yystack.l_mark = yyval; 1306 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1307 *++yystack.p_mark = yyloc; 1308 #endif 1309 goto yyloop; 1310 #if YYBTYACC 1311 1312 /* Reduction declares that this path is valid. Set yypath and do a full parse */ 1313 yyvalid: 1314 if (yypath) YYABORT; 1315 while (yyps->save) 1316 { 1317 YYParseState *save = yyps->save; 1318 yyps->save = save->save; 1319 save->save = yypath; 1320 yypath = save; 1321 } 1322 #if YYDEBUG 1323 if (yydebug) 1324 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", 1325 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); 1326 #endif 1327 if (yyerrctx) 1328 { 1329 yyFreeState(yyerrctx); 1330 yyerrctx = NULL; 1331 } 1332 yylvp = yylvals + yypath->lexeme; 1333 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1334 yylpp = yylpsns + yypath->lexeme; 1335 #endif 1336 yylexp = yylexemes + yypath->lexeme; 1337 yychar = YYEMPTY; 1338 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); 1339 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 1340 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); 1341 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1342 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1343 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); 1344 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1345 #endif 1346 yystate = yypath->state; 1347 goto yyloop; 1348 #endif /* YYBTYACC */ 1349 1350 yyoverflow: 1351 YYERROR_CALL("yacc stack overflow"); 1352 #if YYBTYACC 1353 goto yyabort_nomem; 1354 yyenomem: 1355 YYERROR_CALL("memory exhausted"); 1356 yyabort_nomem: 1357 #endif /* YYBTYACC */ 1358 yyresult = 2; 1359 goto yyreturn; 1360 1361 yyabort: 1362 yyresult = 1; 1363 goto yyreturn; 1364 1365 yyaccept: 1366 #if YYBTYACC 1367 if (yyps->save) goto yyvalid; 1368 #endif /* YYBTYACC */ 1369 yyresult = 0; 1370 1371 yyreturn: 1372 #if defined(YYDESTRUCT_CALL) 1373 if (yychar != YYEOF && yychar != YYEMPTY) 1374 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1375 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); 1376 #else 1377 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); 1378 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1379 1380 { 1381 YYSTYPE *pv; 1382 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1383 YYLTYPE *pp; 1384 1385 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) 1386 YYDESTRUCT_CALL("cleanup: discarding state", 1387 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); 1388 #else 1389 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) 1390 YYDESTRUCT_CALL("cleanup: discarding state", 1391 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); 1392 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1393 } 1394 #endif /* defined(YYDESTRUCT_CALL) */ 1395 1396 #if YYBTYACC 1397 if (yyerrctx) 1398 { 1399 yyFreeState(yyerrctx); 1400 yyerrctx = NULL; 1401 } 1402 while (yyps) 1403 { 1404 YYParseState *save = yyps; 1405 yyps = save->save; 1406 save->save = NULL; 1407 yyFreeState(save); 1408 } 1409 while (yypath) 1410 { 1411 YYParseState *save = yypath; 1412 yypath = save->save; 1413 save->save = NULL; 1414 yyFreeState(save); 1415 } 1416 #endif /* YYBTYACC */ 1417 yyfreestack(&yystack); 1418 return (yyresult); 1419 } 1420