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