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