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