1 /* $NetBSD: empty.tab.c,v 1.5 2024/09/14 21:29:04 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 19 #ifndef yyparse 20 #define yyparse empty_parse 21 #endif /* yyparse */ 22 23 #ifndef yylex 24 #define yylex empty_lex 25 #endif /* yylex */ 26 27 #ifndef yyerror 28 #define yyerror empty_error 29 #endif /* yyerror */ 30 31 #ifndef yychar 32 #define yychar empty_char 33 #endif /* yychar */ 34 35 #ifndef yyval 36 #define yyval empty_val 37 #endif /* yyval */ 38 39 #ifndef yylval 40 #define yylval empty_lval 41 #endif /* yylval */ 42 43 #ifndef yydebug 44 #define yydebug empty_debug 45 #endif /* yydebug */ 46 47 #ifndef yynerrs 48 #define yynerrs empty_nerrs 49 #endif /* yynerrs */ 50 51 #ifndef yyerrflag 52 #define yyerrflag empty_errflag 53 #endif /* yyerrflag */ 54 55 #ifndef yylhs 56 #define yylhs empty_lhs 57 #endif /* yylhs */ 58 59 #ifndef yylen 60 #define yylen empty_len 61 #endif /* yylen */ 62 63 #ifndef yydefred 64 #define yydefred empty_defred 65 #endif /* yydefred */ 66 67 #ifndef yydgoto 68 #define yydgoto empty_dgoto 69 #endif /* yydgoto */ 70 71 #ifndef yysindex 72 #define yysindex empty_sindex 73 #endif /* yysindex */ 74 75 #ifndef yyrindex 76 #define yyrindex empty_rindex 77 #endif /* yyrindex */ 78 79 #ifndef yygindex 80 #define yygindex empty_gindex 81 #endif /* yygindex */ 82 83 #ifndef yytable 84 #define yytable empty_table 85 #endif /* yytable */ 86 87 #ifndef yycheck 88 #define yycheck empty_check 89 #endif /* yycheck */ 90 91 #ifndef yyname 92 #define yyname empty_name 93 #endif /* yyname */ 94 95 #ifndef yyrule 96 #define yyrule empty_rule 97 #endif /* yyrule */ 98 #define YYPREFIX "empty_" 99 100 #define YYPURE 0 101 102 #line 2 "empty.y" 103 #ifdef YYBISON 104 #define YYLEX_DECL() yylex(void) 105 #define YYERROR_DECL() yyerror(const char *s) 106 static int YYLEX_DECL(); 107 static void YYERROR_DECL(); 108 #endif 109 #line 108 "empty.tab.c" 110 111 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED) 112 /* Default: YYSTYPE is the semantic value type. */ 113 typedef int YYSTYPE; 114 # define YYSTYPE_IS_DECLARED 1 115 #endif 116 117 /* compatibility with bison */ 118 #ifdef YYPARSE_PARAM 119 /* compatibility with FreeBSD */ 120 # ifdef YYPARSE_PARAM_TYPE 121 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 122 # else 123 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 124 # endif 125 #else 126 # define YYPARSE_DECL() yyparse(void) 127 #endif 128 129 /* Parameters sent to lex. */ 130 #ifdef YYLEX_PARAM 131 # define YYLEX_DECL() yylex(void *YYLEX_PARAM) 132 # define YYLEX yylex(YYLEX_PARAM) 133 #else 134 # define YYLEX_DECL() yylex(void) 135 # define YYLEX yylex() 136 #endif 137 138 /* Parameters sent to yyerror. */ 139 #ifndef YYERROR_DECL 140 #define YYERROR_DECL() yyerror(const char *s) 141 #endif 142 #ifndef YYERROR_CALL 143 #define YYERROR_CALL(msg) yyerror(msg) 144 #endif 145 146 extern int YYPARSE_DECL(); 147 148 #define YYERRCODE 256 149 typedef int YYINT; 150 static const YYINT empty_lhs[] = { -1, 151 0, 152 }; 153 static const YYINT empty_len[] = { 2, 154 0, 155 }; 156 static const YYINT empty_defred[] = { 1, 157 0, 158 }; 159 static const YYINT empty_dgoto[] = { 1, 160 }; 161 static const YYINT empty_sindex[] = { 0, 162 0, 163 }; 164 static const YYINT empty_rindex[] = { 0, 165 0, 166 }; 167 static const YYINT empty_gindex[] = { 0, 168 }; 169 #define YYTABLESIZE 0 170 static const YYINT empty_table[] = { 0, 171 }; 172 static const YYINT empty_check[] = { -1, 173 }; 174 #define YYFINAL 1 175 #ifndef YYDEBUG 176 #define YYDEBUG 0 177 #endif 178 #define YYMAXTOKEN 256 179 #define YYUNDFTOKEN 259 180 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) 181 #if YYDEBUG 182 static const char *const empty_name[] = { 183 184 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 185 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 186 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 187 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 188 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 189 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 190 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"illegal-symbol", 191 }; 192 static const char *const empty_rule[] = { 193 "$accept : start", 194 "start :", 195 196 }; 197 #endif 198 199 #if YYDEBUG 200 int yydebug; 201 #endif 202 203 int yyerrflag; 204 int yychar; 205 YYSTYPE yyval; 206 YYSTYPE yylval; 207 int yynerrs; 208 209 /* define the initial stack-sizes */ 210 #ifdef YYSTACKSIZE 211 #undef YYMAXDEPTH 212 #define YYMAXDEPTH YYSTACKSIZE 213 #else 214 #ifdef YYMAXDEPTH 215 #define YYSTACKSIZE YYMAXDEPTH 216 #else 217 #define YYSTACKSIZE 10000 218 #define YYMAXDEPTH 10000 219 #endif 220 #endif 221 222 #define YYINITSTACKSIZE 200 223 224 typedef struct { 225 unsigned stacksize; 226 YYINT *s_base; 227 YYINT *s_mark; 228 YYINT *s_last; 229 YYSTYPE *l_base; 230 YYSTYPE *l_mark; 231 } YYSTACKDATA; 232 /* variables for the parser stack */ 233 static YYSTACKDATA yystack; 234 #line 13 "empty.y" 235 236 #include <stdio.h> 237 238 static int 239 YYLEX_DECL() { 240 return -1; 241 } 242 243 static void 244 YYERROR_DECL() { 245 printf("%s\n",s); 246 } 247 #line 246 "empty.tab.c" 248 249 #if YYDEBUG 250 #include <stdio.h> /* needed for printf */ 251 #endif 252 253 #include <stdlib.h> /* needed for malloc, etc */ 254 #include <string.h> /* needed for memset */ 255 256 /* allocate initial stack or double stack size, up to YYMAXDEPTH */ 257 static int yygrowstack(YYSTACKDATA *data) 258 { 259 int i; 260 unsigned newsize; 261 YYINT *newss; 262 YYSTYPE *newvs; 263 264 if ((newsize = data->stacksize) == 0) 265 newsize = YYINITSTACKSIZE; 266 else if (newsize >= YYMAXDEPTH) 267 return YYENOMEM; 268 else if ((newsize *= 2) > YYMAXDEPTH) 269 newsize = YYMAXDEPTH; 270 271 i = (int) (data->s_mark - data->s_base); 272 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); 273 if (newss == 0) 274 return YYENOMEM; 275 276 data->s_base = newss; 277 data->s_mark = newss + i; 278 279 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 280 if (newvs == 0) 281 return YYENOMEM; 282 283 data->l_base = newvs; 284 data->l_mark = newvs + i; 285 286 data->stacksize = newsize; 287 data->s_last = data->s_base + newsize - 1; 288 return 0; 289 } 290 291 #if YYPURE || defined(YY_NO_LEAKS) 292 static void yyfreestack(YYSTACKDATA *data) 293 { 294 free(data->s_base); 295 free(data->l_base); 296 memset(data, 0, sizeof(*data)); 297 } 298 #else 299 #define yyfreestack(data) /* nothing */ 300 #endif 301 302 #define YYABORT goto yyabort 303 #define YYREJECT goto yyabort 304 #define YYACCEPT goto yyaccept 305 #define YYERROR goto yyerrlab 306 307 int 308 YYPARSE_DECL() 309 { 310 int yym, yyn, yystate; 311 #if YYDEBUG 312 const char *yys; 313 314 if ((yys = getenv("YYDEBUG")) != 0) 315 { 316 yyn = *yys; 317 if (yyn >= '0' && yyn <= '9') 318 yydebug = yyn - '0'; 319 } 320 #endif 321 322 /* yym is set below */ 323 /* yyn is set below */ 324 yynerrs = 0; 325 yyerrflag = 0; 326 yychar = YYEMPTY; 327 yystate = 0; 328 329 #if YYPURE 330 memset(&yystack, 0, sizeof(yystack)); 331 #endif 332 333 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 334 yystack.s_mark = yystack.s_base; 335 yystack.l_mark = yystack.l_base; 336 yystate = 0; 337 *yystack.s_mark = 0; 338 339 yyloop: 340 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 341 if (yychar < 0) 342 { 343 yychar = YYLEX; 344 if (yychar < 0) yychar = YYEOF; 345 #if YYDEBUG 346 if (yydebug) 347 { 348 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 349 printf("%sdebug: state %d, reading %d (%s)\n", 350 YYPREFIX, yystate, yychar, yys); 351 } 352 #endif 353 } 354 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 355 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 356 { 357 #if YYDEBUG 358 if (yydebug) 359 printf("%sdebug: state %d, shifting to state %d\n", 360 YYPREFIX, yystate, yytable[yyn]); 361 #endif 362 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 363 yystate = yytable[yyn]; 364 *++yystack.s_mark = yytable[yyn]; 365 *++yystack.l_mark = yylval; 366 yychar = YYEMPTY; 367 if (yyerrflag > 0) --yyerrflag; 368 goto yyloop; 369 } 370 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 371 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 372 { 373 yyn = yytable[yyn]; 374 goto yyreduce; 375 } 376 if (yyerrflag != 0) goto yyinrecovery; 377 378 YYERROR_CALL("syntax error"); 379 380 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 381 yyerrlab: 382 ++yynerrs; 383 384 yyinrecovery: 385 if (yyerrflag < 3) 386 { 387 yyerrflag = 3; 388 for (;;) 389 { 390 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 391 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 392 { 393 #if YYDEBUG 394 if (yydebug) 395 printf("%sdebug: state %d, error recovery shifting\ 396 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); 397 #endif 398 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 399 yystate = yytable[yyn]; 400 *++yystack.s_mark = yytable[yyn]; 401 *++yystack.l_mark = yylval; 402 goto yyloop; 403 } 404 else 405 { 406 #if YYDEBUG 407 if (yydebug) 408 printf("%sdebug: error recovery discarding state %d\n", 409 YYPREFIX, *yystack.s_mark); 410 #endif 411 if (yystack.s_mark <= yystack.s_base) goto yyabort; 412 --yystack.s_mark; 413 --yystack.l_mark; 414 } 415 } 416 } 417 else 418 { 419 if (yychar == YYEOF) goto yyabort; 420 #if YYDEBUG 421 if (yydebug) 422 { 423 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 424 printf("%sdebug: state %d, error recovery discards token %d (%s)\n", 425 YYPREFIX, yystate, yychar, yys); 426 } 427 #endif 428 yychar = YYEMPTY; 429 goto yyloop; 430 } 431 432 yyreduce: 433 #if YYDEBUG 434 if (yydebug) 435 printf("%sdebug: state %d, reducing by rule %d (%s)\n", 436 YYPREFIX, yystate, yyn, yyrule[yyn]); 437 #endif 438 yym = yylen[yyn]; 439 if (yym > 0) 440 yyval = yystack.l_mark[1-yym]; 441 else 442 memset(&yyval, 0, sizeof yyval); 443 444 switch (yyn) 445 { 446 } 447 yystack.s_mark -= yym; 448 yystate = *yystack.s_mark; 449 yystack.l_mark -= yym; 450 yym = yylhs[yyn]; 451 if (yystate == 0 && yym == 0) 452 { 453 #if YYDEBUG 454 if (yydebug) 455 printf("%sdebug: after reduction, shifting from state 0 to\ 456 state %d\n", YYPREFIX, YYFINAL); 457 #endif 458 yystate = YYFINAL; 459 *++yystack.s_mark = YYFINAL; 460 *++yystack.l_mark = yyval; 461 if (yychar < 0) 462 { 463 yychar = YYLEX; 464 if (yychar < 0) yychar = YYEOF; 465 #if YYDEBUG 466 if (yydebug) 467 { 468 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 469 printf("%sdebug: state %d, reading %d (%s)\n", 470 YYPREFIX, YYFINAL, yychar, yys); 471 } 472 #endif 473 } 474 if (yychar == YYEOF) goto yyaccept; 475 goto yyloop; 476 } 477 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 478 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 479 yystate = yytable[yyn]; 480 else 481 yystate = yydgoto[yym]; 482 #if YYDEBUG 483 if (yydebug) 484 printf("%sdebug: after reduction, shifting from state %d \ 485 to state %d\n", YYPREFIX, *yystack.s_mark, yystate); 486 #endif 487 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 488 *++yystack.s_mark = (YYINT) yystate; 489 *++yystack.l_mark = yyval; 490 goto yyloop; 491 492 yyoverflow: 493 YYERROR_CALL("yacc stack overflow"); 494 495 yyabort: 496 yyfreestack(&yystack); 497 return (1); 498 499 yyaccept: 500 yyfreestack(&yystack); 501 return (0); 502 } 503