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