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 error_parse 22 #endif /* yyparse */ 23 24 #ifndef yylex 25 #define yylex error_lex 26 #endif /* yylex */ 27 28 #ifndef yyerror 29 #define yyerror error_error 30 #endif /* yyerror */ 31 32 #ifndef yychar 33 #define yychar error_char 34 #endif /* yychar */ 35 36 #ifndef yyval 37 #define yyval error_val 38 #endif /* yyval */ 39 40 #ifndef yylval 41 #define yylval error_lval 42 #endif /* yylval */ 43 44 #ifndef yydebug 45 #define yydebug error_debug 46 #endif /* yydebug */ 47 48 #ifndef yynerrs 49 #define yynerrs error_nerrs 50 #endif /* yynerrs */ 51 52 #ifndef yyerrflag 53 #define yyerrflag error_errflag 54 #endif /* yyerrflag */ 55 56 #ifndef yylhs 57 #define yylhs error_lhs 58 #endif /* yylhs */ 59 60 #ifndef yylen 61 #define yylen error_len 62 #endif /* yylen */ 63 64 #ifndef yydefred 65 #define yydefred error_defred 66 #endif /* yydefred */ 67 68 #ifndef yystos 69 #define yystos error_stos 70 #endif /* yystos */ 71 72 #ifndef yydgoto 73 #define yydgoto error_dgoto 74 #endif /* yydgoto */ 75 76 #ifndef yysindex 77 #define yysindex error_sindex 78 #endif /* yysindex */ 79 80 #ifndef yyrindex 81 #define yyrindex error_rindex 82 #endif /* yyrindex */ 83 84 #ifndef yygindex 85 #define yygindex error_gindex 86 #endif /* yygindex */ 87 88 #ifndef yytable 89 #define yytable error_table 90 #endif /* yytable */ 91 92 #ifndef yycheck 93 #define yycheck error_check 94 #endif /* yycheck */ 95 96 #ifndef yyname 97 #define yyname error_name 98 #endif /* yyname */ 99 100 #ifndef yyrule 101 #define yyrule error_rule 102 #endif /* yyrule */ 103 104 #if YYBTYACC 105 106 #ifndef yycindex 107 #define yycindex error_cindex 108 #endif /* yycindex */ 109 110 #ifndef yyctable 111 #define yyctable error_ctable 112 #endif /* yyctable */ 113 114 #endif /* YYBTYACC */ 115 116 #define YYPREFIX "error_" 117 118 #define YYPURE 0 119 120 #line 2 "error.y" 121 int yylex(void); 122 static void yyerror(const char *); 123 #line 124 "error.tab.c" 124 125 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED) 126 /* Default: YYSTYPE is the semantic value type. */ 127 typedef int YYSTYPE; 128 # define YYSTYPE_IS_DECLARED 1 129 #endif 130 131 /* compatibility with bison */ 132 #ifdef YYPARSE_PARAM 133 /* compatibility with FreeBSD */ 134 # ifdef YYPARSE_PARAM_TYPE 135 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 136 # else 137 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 138 # endif 139 #else 140 # define YYPARSE_DECL() yyparse(void) 141 #endif 142 143 /* Parameters sent to lex. */ 144 #ifdef YYLEX_PARAM 145 # define YYLEX_DECL() yylex(void *YYLEX_PARAM) 146 # define YYLEX yylex(YYLEX_PARAM) 147 #else 148 # define YYLEX_DECL() yylex(void) 149 # define YYLEX yylex() 150 #endif 151 152 /* Parameters sent to yyerror. */ 153 #ifndef YYERROR_DECL 154 #define YYERROR_DECL() yyerror(const char *s) 155 #endif 156 #ifndef YYERROR_CALL 157 #define YYERROR_CALL(msg) yyerror(msg) 158 #endif 159 160 extern int YYPARSE_DECL(); 161 162 #define YYERRCODE 256 163 typedef short YYINT; 164 static const YYINT error_lhs[] = { -1, 165 0, 166 }; 167 static const YYINT error_len[] = { 2, 168 1, 169 }; 170 static const YYINT error_defred[] = { 0, 171 1, 0, 172 }; 173 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) 174 static const YYINT error_stos[] = { 0, 175 256, 258, 176 }; 177 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ 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 YYINT *s_base; 288 YYINT *s_mark; 289 YYINT *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 YYINT *yylexp = 0; 348 349 static YYINT *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 374 "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 YYINT *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 = (YYINT *)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 = (YYINT *) malloc(size * sizeof(YYINT)); 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 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 527 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range)); 528 #endif 529 530 #if YYBTYACC 531 yyps = yyNewState(0); if (yyps == 0) goto yyenomem; 532 yyps->save = 0; 533 #endif /* YYBTYACC */ 534 yym = 0; 535 yyn = 0; 536 yynerrs = 0; 537 yyerrflag = 0; 538 yychar = YYEMPTY; 539 yystate = 0; 540 541 #if YYPURE 542 memset(&yystack, 0, sizeof(yystack)); 543 #endif 544 545 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 546 yystack.s_mark = yystack.s_base; 547 yystack.l_mark = yystack.l_base; 548 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 549 yystack.p_mark = yystack.p_base; 550 #endif 551 yystate = 0; 552 *yystack.s_mark = 0; 553 554 yyloop: 555 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 556 if (yychar < 0) 557 { 558 #if YYBTYACC 559 do { 560 if (yylvp < yylve) 561 { 562 /* we're currently re-reading tokens */ 563 yylval = *yylvp++; 564 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 565 yylloc = *yylpp++; 566 #endif 567 yychar = *yylexp++; 568 break; 569 } 570 if (yyps->save) 571 { 572 /* in trial mode; save scanner results for future parse attempts */ 573 if (yylvp == yylvlim) 574 { /* Enlarge lexical value queue */ 575 size_t p = (size_t) (yylvp - yylvals); 576 size_t s = (size_t) (yylvlim - yylvals); 577 578 s += YYLVQUEUEGROWTH; 579 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; 580 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; 581 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 582 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; 583 #endif 584 yylvp = yylve = yylvals + p; 585 yylvlim = yylvals + s; 586 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 587 yylpp = yylpe = yylpsns + p; 588 yylplim = yylpsns + s; 589 #endif 590 yylexp = yylexemes + p; 591 } 592 *yylexp = (YYINT) YYLEX; 593 *yylvp++ = yylval; 594 yylve++; 595 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 596 *yylpp++ = yylloc; 597 yylpe++; 598 #endif 599 yychar = *yylexp++; 600 break; 601 } 602 /* normal operation, no conflict encountered */ 603 #endif /* YYBTYACC */ 604 yychar = YYLEX; 605 #if YYBTYACC 606 } while (0); 607 #endif /* YYBTYACC */ 608 if (yychar < 0) yychar = YYEOF; 609 #if YYDEBUG 610 if (yydebug) 611 { 612 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 613 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)", 614 YYDEBUGSTR, yydepth, yystate, yychar, yys); 615 #ifdef YYSTYPE_TOSTRING 616 #if YYBTYACC 617 if (!yytrial) 618 #endif /* YYBTYACC */ 619 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval)); 620 #endif 621 fputc('\n', stderr); 622 } 623 #endif 624 } 625 #if YYBTYACC 626 627 /* Do we have a conflict? */ 628 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 && 629 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 630 { 631 YYINT ctry; 632 633 if (yypath) 634 { 635 YYParseState *save; 636 #if YYDEBUG 637 if (yydebug) 638 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n", 639 YYDEBUGSTR, yydepth, yystate); 640 #endif 641 /* Switch to the next conflict context */ 642 save = yypath; 643 yypath = save->save; 644 save->save = NULL; 645 ctry = save->ctry; 646 if (save->state != yystate) YYABORT; 647 yyFreeState(save); 648 649 } 650 else 651 { 652 653 /* Unresolved conflict - start/continue trial parse */ 654 YYParseState *save; 655 #if YYDEBUG 656 if (yydebug) 657 { 658 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate); 659 if (yyps->save) 660 fputs("ALREADY in conflict, continuing trial parse.\n", stderr); 661 else 662 fputs("Starting trial parse.\n", stderr); 663 } 664 #endif 665 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 666 if (save == NULL) goto yyenomem; 667 save->save = yyps->save; 668 save->state = yystate; 669 save->errflag = yyerrflag; 670 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); 671 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 672 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); 673 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 674 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 675 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); 676 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 677 #endif 678 ctry = yytable[yyn]; 679 if (yyctable[ctry] == -1) 680 { 681 #if YYDEBUG 682 if (yydebug && yychar >= YYEOF) 683 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth); 684 #endif 685 ctry++; 686 } 687 save->ctry = ctry; 688 if (yyps->save == NULL) 689 { 690 /* If this is a first conflict in the stack, start saving lexemes */ 691 if (!yylexemes) 692 { 693 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); 694 if (yylexemes == NULL) goto yyenomem; 695 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); 696 if (yylvals == NULL) goto yyenomem; 697 yylvlim = yylvals + YYLVQUEUEGROWTH; 698 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 699 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE)); 700 if (yylpsns == NULL) goto yyenomem; 701 yylplim = yylpsns + YYLVQUEUEGROWTH; 702 #endif 703 } 704 if (yylvp == yylve) 705 { 706 yylvp = yylve = yylvals; 707 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 708 yylpp = yylpe = yylpsns; 709 #endif 710 yylexp = yylexemes; 711 if (yychar >= YYEOF) 712 { 713 *yylve++ = yylval; 714 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 715 *yylpe++ = yylloc; 716 #endif 717 *yylexp = (YYINT) yychar; 718 yychar = YYEMPTY; 719 } 720 } 721 } 722 if (yychar >= YYEOF) 723 { 724 yylvp--; 725 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 726 yylpp--; 727 #endif 728 yylexp--; 729 yychar = YYEMPTY; 730 } 731 save->lexeme = (int) (yylvp - yylvals); 732 yyps->save = save; 733 } 734 if (yytable[yyn] == ctry) 735 { 736 #if YYDEBUG 737 if (yydebug) 738 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 739 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]); 740 #endif 741 if (yychar < 0) 742 { 743 yylvp++; 744 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 745 yylpp++; 746 #endif 747 yylexp++; 748 } 749 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) 750 goto yyoverflow; 751 yystate = yyctable[ctry]; 752 *++yystack.s_mark = (YYINT) yystate; 753 *++yystack.l_mark = yylval; 754 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 755 *++yystack.p_mark = yylloc; 756 #endif 757 yychar = YYEMPTY; 758 if (yyerrflag > 0) --yyerrflag; 759 goto yyloop; 760 } 761 else 762 { 763 yyn = yyctable[ctry]; 764 goto yyreduce; 765 } 766 } /* End of code dealing with conflicts */ 767 #endif /* YYBTYACC */ 768 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 769 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 770 { 771 #if YYDEBUG 772 if (yydebug) 773 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 774 YYDEBUGSTR, yydepth, yystate, yytable[yyn]); 775 #endif 776 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 777 yystate = yytable[yyn]; 778 *++yystack.s_mark = yytable[yyn]; 779 *++yystack.l_mark = yylval; 780 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 781 *++yystack.p_mark = yylloc; 782 #endif 783 yychar = YYEMPTY; 784 if (yyerrflag > 0) --yyerrflag; 785 goto yyloop; 786 } 787 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 788 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 789 { 790 yyn = yytable[yyn]; 791 goto yyreduce; 792 } 793 if (yyerrflag != 0) goto yyinrecovery; 794 #if YYBTYACC 795 796 yynewerrflag = 1; 797 goto yyerrhandler; 798 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 799 800 yyerrlab: 801 /* explicit YYERROR from an action -- pop the rhs of the rule reduced 802 * before looking for error recovery */ 803 yystack.s_mark -= yym; 804 yystate = *yystack.s_mark; 805 yystack.l_mark -= yym; 806 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 807 yystack.p_mark -= yym; 808 #endif 809 810 yynewerrflag = 0; 811 yyerrhandler: 812 while (yyps->save) 813 { 814 int ctry; 815 YYParseState *save = yyps->save; 816 #if YYDEBUG 817 if (yydebug) 818 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n", 819 YYDEBUGSTR, yydepth, yystate, yyps->save->state, 820 (int)(yylvp - yylvals - yyps->save->lexeme)); 821 #endif 822 /* Memorize most forward-looking error state in case it's really an error. */ 823 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals) 824 { 825 /* Free old saved error context state */ 826 if (yyerrctx) yyFreeState(yyerrctx); 827 /* Create and fill out new saved error context state */ 828 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 829 if (yyerrctx == NULL) goto yyenomem; 830 yyerrctx->save = yyps->save; 831 yyerrctx->state = yystate; 832 yyerrctx->errflag = yyerrflag; 833 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); 834 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 835 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); 836 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 837 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 838 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); 839 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 840 #endif 841 yyerrctx->lexeme = (int) (yylvp - yylvals); 842 } 843 yylvp = yylvals + save->lexeme; 844 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 845 yylpp = yylpsns + save->lexeme; 846 #endif 847 yylexp = yylexemes + save->lexeme; 848 yychar = YYEMPTY; 849 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); 850 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 851 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); 852 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 853 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 854 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); 855 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 856 #endif 857 ctry = ++save->ctry; 858 yystate = save->state; 859 /* We tried shift, try reduce now */ 860 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce; 861 yyps->save = save->save; 862 save->save = NULL; 863 yyFreeState(save); 864 865 /* Nothing left on the stack -- error */ 866 if (!yyps->save) 867 { 868 #if YYDEBUG 869 if (yydebug) 870 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n", 871 YYPREFIX, yydepth); 872 #endif 873 /* Restore state as it was in the most forward-advanced error */ 874 yylvp = yylvals + yyerrctx->lexeme; 875 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 876 yylpp = yylpsns + yyerrctx->lexeme; 877 #endif 878 yylexp = yylexemes + yyerrctx->lexeme; 879 yychar = yylexp[-1]; 880 yylval = yylvp[-1]; 881 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 882 yylloc = yylpp[-1]; 883 #endif 884 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); 885 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 886 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); 887 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 888 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 889 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); 890 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 891 #endif 892 yystate = yyerrctx->state; 893 yyFreeState(yyerrctx); 894 yyerrctx = NULL; 895 } 896 yynewerrflag = 1; 897 } 898 if (yynewerrflag == 0) goto yyinrecovery; 899 #endif /* YYBTYACC */ 900 901 YYERROR_CALL("syntax error"); 902 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 903 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */ 904 #endif 905 906 #if !YYBTYACC 907 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 908 yyerrlab: 909 #endif 910 ++yynerrs; 911 912 yyinrecovery: 913 if (yyerrflag < 3) 914 { 915 yyerrflag = 3; 916 for (;;) 917 { 918 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 919 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 920 { 921 #if YYDEBUG 922 if (yydebug) 923 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n", 924 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]); 925 #endif 926 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 927 yystate = yytable[yyn]; 928 *++yystack.s_mark = yytable[yyn]; 929 *++yystack.l_mark = yylval; 930 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 931 /* lookahead position is error end position */ 932 yyerror_loc_range[1] = yylloc; 933 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */ 934 *++yystack.p_mark = yyloc; 935 #endif 936 goto yyloop; 937 } 938 else 939 { 940 #if YYDEBUG 941 if (yydebug) 942 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n", 943 YYDEBUGSTR, yydepth, *yystack.s_mark); 944 #endif 945 if (yystack.s_mark <= yystack.s_base) goto yyabort; 946 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 947 /* the current TOS position is the error start position */ 948 yyerror_loc_range[0] = *yystack.p_mark; 949 #endif 950 #if defined(YYDESTRUCT_CALL) 951 #if YYBTYACC 952 if (!yytrial) 953 #endif /* YYBTYACC */ 954 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 955 YYDESTRUCT_CALL("error: discarding state", 956 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark); 957 #else 958 YYDESTRUCT_CALL("error: discarding state", 959 yystos[*yystack.s_mark], yystack.l_mark); 960 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 961 #endif /* defined(YYDESTRUCT_CALL) */ 962 --yystack.s_mark; 963 --yystack.l_mark; 964 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 965 --yystack.p_mark; 966 #endif 967 } 968 } 969 } 970 else 971 { 972 if (yychar == YYEOF) goto yyabort; 973 #if YYDEBUG 974 if (yydebug) 975 { 976 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 977 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n", 978 YYDEBUGSTR, yydepth, yystate, yychar, yys); 979 } 980 #endif 981 #if defined(YYDESTRUCT_CALL) 982 #if YYBTYACC 983 if (!yytrial) 984 #endif /* YYBTYACC */ 985 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 986 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc); 987 #else 988 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval); 989 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 990 #endif /* defined(YYDESTRUCT_CALL) */ 991 yychar = YYEMPTY; 992 goto yyloop; 993 } 994 995 yyreduce: 996 yym = yylen[yyn]; 997 #if YYDEBUG 998 if (yydebug) 999 { 1000 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)", 1001 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]); 1002 #ifdef YYSTYPE_TOSTRING 1003 #if YYBTYACC 1004 if (!yytrial) 1005 #endif /* YYBTYACC */ 1006 if (yym > 0) 1007 { 1008 int i; 1009 fputc('<', stderr); 1010 for (i = yym; i > 0; i--) 1011 { 1012 if (i != yym) fputs(", ", stderr); 1013 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]], 1014 yystack.l_mark[1-i]), stderr); 1015 } 1016 fputc('>', stderr); 1017 } 1018 #endif 1019 fputc('\n', stderr); 1020 } 1021 #endif 1022 if (yym > 0) 1023 yyval = yystack.l_mark[1-yym]; 1024 else 1025 memset(&yyval, 0, sizeof yyval); 1026 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1027 1028 /* Perform position reduction */ 1029 memset(&yyloc, 0, sizeof(yyloc)); 1030 #if YYBTYACC 1031 if (!yytrial) 1032 #endif /* YYBTYACC */ 1033 { 1034 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym); 1035 /* just in case YYERROR is invoked within the action, save 1036 the start of the rhs as the error start position */ 1037 yyerror_loc_range[0] = yystack.p_mark[1-yym]; 1038 } 1039 #endif 1040 1041 switch (yyn) 1042 { 1043 default: 1044 break; 1045 } 1046 yystack.s_mark -= yym; 1047 yystate = *yystack.s_mark; 1048 yystack.l_mark -= yym; 1049 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1050 yystack.p_mark -= yym; 1051 #endif 1052 yym = yylhs[yyn]; 1053 if (yystate == 0 && yym == 0) 1054 { 1055 #if YYDEBUG 1056 if (yydebug) 1057 { 1058 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1059 #ifdef YYSTYPE_TOSTRING 1060 #if YYBTYACC 1061 if (!yytrial) 1062 #endif /* YYBTYACC */ 1063 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); 1064 #endif 1065 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); 1066 } 1067 #endif 1068 yystate = YYFINAL; 1069 *++yystack.s_mark = YYFINAL; 1070 *++yystack.l_mark = yyval; 1071 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1072 *++yystack.p_mark = yyloc; 1073 #endif 1074 if (yychar < 0) 1075 { 1076 #if YYBTYACC 1077 do { 1078 if (yylvp < yylve) 1079 { 1080 /* we're currently re-reading tokens */ 1081 yylval = *yylvp++; 1082 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1083 yylloc = *yylpp++; 1084 #endif 1085 yychar = *yylexp++; 1086 break; 1087 } 1088 if (yyps->save) 1089 { 1090 /* in trial mode; save scanner results for future parse attempts */ 1091 if (yylvp == yylvlim) 1092 { /* Enlarge lexical value queue */ 1093 size_t p = (size_t) (yylvp - yylvals); 1094 size_t s = (size_t) (yylvlim - yylvals); 1095 1096 s += YYLVQUEUEGROWTH; 1097 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) 1098 goto yyenomem; 1099 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) 1100 goto yyenomem; 1101 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1102 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) 1103 goto yyenomem; 1104 #endif 1105 yylvp = yylve = yylvals + p; 1106 yylvlim = yylvals + s; 1107 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1108 yylpp = yylpe = yylpsns + p; 1109 yylplim = yylpsns + s; 1110 #endif 1111 yylexp = yylexemes + p; 1112 } 1113 *yylexp = (YYINT) YYLEX; 1114 *yylvp++ = yylval; 1115 yylve++; 1116 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1117 *yylpp++ = yylloc; 1118 yylpe++; 1119 #endif 1120 yychar = *yylexp++; 1121 break; 1122 } 1123 /* normal operation, no conflict encountered */ 1124 #endif /* YYBTYACC */ 1125 yychar = YYLEX; 1126 #if YYBTYACC 1127 } while (0); 1128 #endif /* YYBTYACC */ 1129 if (yychar < 0) yychar = YYEOF; 1130 #if YYDEBUG 1131 if (yydebug) 1132 { 1133 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 1134 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n", 1135 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); 1136 } 1137 #endif 1138 } 1139 if (yychar == YYEOF) goto yyaccept; 1140 goto yyloop; 1141 } 1142 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 1143 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 1144 yystate = yytable[yyn]; 1145 else 1146 yystate = yydgoto[yym]; 1147 #if YYDEBUG 1148 if (yydebug) 1149 { 1150 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1151 #ifdef YYSTYPE_TOSTRING 1152 #if YYBTYACC 1153 if (!yytrial) 1154 #endif /* YYBTYACC */ 1155 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); 1156 #endif 1157 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); 1158 } 1159 #endif 1160 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1161 *++yystack.s_mark = (YYINT) yystate; 1162 *++yystack.l_mark = yyval; 1163 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1164 *++yystack.p_mark = yyloc; 1165 #endif 1166 goto yyloop; 1167 #if YYBTYACC 1168 1169 /* Reduction declares that this path is valid. Set yypath and do a full parse */ 1170 yyvalid: 1171 if (yypath) YYABORT; 1172 while (yyps->save) 1173 { 1174 YYParseState *save = yyps->save; 1175 yyps->save = save->save; 1176 save->save = yypath; 1177 yypath = save; 1178 } 1179 #if YYDEBUG 1180 if (yydebug) 1181 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", 1182 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); 1183 #endif 1184 if (yyerrctx) 1185 { 1186 yyFreeState(yyerrctx); 1187 yyerrctx = NULL; 1188 } 1189 yylvp = yylvals + yypath->lexeme; 1190 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1191 yylpp = yylpsns + yypath->lexeme; 1192 #endif 1193 yylexp = yylexemes + yypath->lexeme; 1194 yychar = YYEMPTY; 1195 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); 1196 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 1197 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); 1198 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1199 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1200 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); 1201 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1202 #endif 1203 yystate = yypath->state; 1204 goto yyloop; 1205 #endif /* YYBTYACC */ 1206 1207 yyoverflow: 1208 YYERROR_CALL("yacc stack overflow"); 1209 #if YYBTYACC 1210 goto yyabort_nomem; 1211 yyenomem: 1212 YYERROR_CALL("memory exhausted"); 1213 yyabort_nomem: 1214 #endif /* YYBTYACC */ 1215 yyresult = 2; 1216 goto yyreturn; 1217 1218 yyabort: 1219 yyresult = 1; 1220 goto yyreturn; 1221 1222 yyaccept: 1223 #if YYBTYACC 1224 if (yyps->save) goto yyvalid; 1225 #endif /* YYBTYACC */ 1226 yyresult = 0; 1227 1228 yyreturn: 1229 #if defined(YYDESTRUCT_CALL) 1230 if (yychar != YYEOF && yychar != YYEMPTY) 1231 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1232 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); 1233 #else 1234 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); 1235 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1236 1237 { 1238 YYSTYPE *pv; 1239 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1240 YYLTYPE *pp; 1241 1242 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) 1243 YYDESTRUCT_CALL("cleanup: discarding state", 1244 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); 1245 #else 1246 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) 1247 YYDESTRUCT_CALL("cleanup: discarding state", 1248 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); 1249 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1250 } 1251 #endif /* defined(YYDESTRUCT_CALL) */ 1252 1253 #if YYBTYACC 1254 if (yyerrctx) 1255 { 1256 yyFreeState(yyerrctx); 1257 yyerrctx = NULL; 1258 } 1259 while (yyps) 1260 { 1261 YYParseState *save = yyps; 1262 yyps = save->save; 1263 save->save = NULL; 1264 yyFreeState(save); 1265 } 1266 while (yypath) 1267 { 1268 YYParseState *save = yypath; 1269 yypath = save->save; 1270 save->save = NULL; 1271 yyFreeState(save); 1272 } 1273 #endif /* YYBTYACC */ 1274 yyfreestack(&yystack); 1275 return (yyresult); 1276 } 1277