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