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