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