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