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