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