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