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