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