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