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