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