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