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