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