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