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