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 #line 17 "rename_debug.c" 17 #include "rename_debug.i" 18 #include "rename_debug.h" 19 typedef int YYINT; 20 static const YYINT yylhs[] = { -1, 21 0, 22 }; 23 static const YYINT yylen[] = { 2, 24 1, 25 }; 26 static const YYINT yydefred[] = { 0, 27 1, 0, 28 }; 29 static const YYINT yydgoto[] = { 2, 30 }; 31 static const YYINT yysindex[] = { -256, 32 0, 0, 33 }; 34 static const YYINT yyrindex[] = { 0, 35 0, 0, 36 }; 37 static const YYINT yygindex[] = { 0, 38 }; 39 #define YYTABLESIZE 0 40 static const YYINT yytable[] = { 1, 41 }; 42 static const YYINT yycheck[] = { 256, 43 }; 44 #define YYFINAL 2 45 #ifndef YYDEBUG 46 #define YYDEBUG 1 47 #endif 48 #define YYMAXTOKEN 256 49 #define YYUNDFTOKEN 259 50 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) 51 #if YYDEBUG 52 static const char *const yyname[] = { 53 54 "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, 55 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 56 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 57 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 58 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 59 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 60 0,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", 61 }; 62 static const char *const yyrule[] = { 63 "$accept : S", 64 "S : error", 65 66 }; 67 #endif 68 69 int yydebug; 70 int yynerrs; 71 72 int yyerrflag; 73 int yychar; 74 YYSTYPE yyval; 75 YYSTYPE yylval; 76 77 /* define the initial stack-sizes */ 78 #ifdef YYSTACKSIZE 79 #undef YYMAXDEPTH 80 #define YYMAXDEPTH YYSTACKSIZE 81 #else 82 #ifdef YYMAXDEPTH 83 #define YYSTACKSIZE YYMAXDEPTH 84 #else 85 #define YYSTACKSIZE 10000 86 #define YYMAXDEPTH 10000 87 #endif 88 #endif 89 90 #define YYINITSTACKSIZE 200 91 92 typedef struct { 93 unsigned stacksize; 94 YYINT *s_base; 95 YYINT *s_mark; 96 YYINT *s_last; 97 YYSTYPE *l_base; 98 YYSTYPE *l_mark; 99 } YYSTACKDATA; 100 /* variables for the parser stack */ 101 static YYSTACKDATA yystack; 102 #line 12 "code_debug.y" 103 104 #include <stdio.h> 105 106 #ifdef YYBYACC 107 extern int YYLEX_DECL(); 108 #endif 109 110 int 111 main(void) 112 { 113 printf("yyparse() = %d\n", yyparse()); 114 return 0; 115 } 116 117 int 118 yylex(void) 119 { 120 return -1; 121 } 122 123 static void 124 yyerror(const char* s) 125 { 126 printf("%s\n", s); 127 } 128 #line 130 "rename_debug.c" 129 130 #if YYDEBUG 131 #include <stdio.h> /* needed for printf */ 132 #endif 133 134 #include <stdlib.h> /* needed for malloc, etc */ 135 #include <string.h> /* needed for memset */ 136 137 /* allocate initial stack or double stack size, up to YYMAXDEPTH */ 138 static int yygrowstack(YYSTACKDATA *data) 139 { 140 int i; 141 unsigned newsize; 142 YYINT *newss; 143 YYSTYPE *newvs; 144 145 if ((newsize = data->stacksize) == 0) 146 newsize = YYINITSTACKSIZE; 147 else if (newsize >= YYMAXDEPTH) 148 return YYENOMEM; 149 else if ((newsize *= 2) > YYMAXDEPTH) 150 newsize = YYMAXDEPTH; 151 152 i = (int) (data->s_mark - data->s_base); 153 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); 154 if (newss == 0) 155 return YYENOMEM; 156 157 data->s_base = newss; 158 data->s_mark = newss + i; 159 160 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 161 if (newvs == 0) 162 return YYENOMEM; 163 164 data->l_base = newvs; 165 data->l_mark = newvs + i; 166 167 data->stacksize = newsize; 168 data->s_last = data->s_base + newsize - 1; 169 return 0; 170 } 171 172 #if YYPURE || defined(YY_NO_LEAKS) 173 static void yyfreestack(YYSTACKDATA *data) 174 { 175 free(data->s_base); 176 free(data->l_base); 177 memset(data, 0, sizeof(*data)); 178 } 179 #else 180 #define yyfreestack(data) /* nothing */ 181 #endif 182 183 #define YYABORT goto yyabort 184 #define YYREJECT goto yyabort 185 #define YYACCEPT goto yyaccept 186 #define YYERROR goto yyerrlab 187 188 int 189 YYPARSE_DECL() 190 { 191 int yym, yyn, yystate; 192 #if YYDEBUG 193 const char *yys; 194 195 if ((yys = getenv("YYDEBUG")) != 0) 196 { 197 yyn = *yys; 198 if (yyn >= '0' && yyn <= '9') 199 yydebug = yyn - '0'; 200 } 201 #endif 202 203 yym = 0; 204 yyn = 0; 205 yynerrs = 0; 206 yyerrflag = 0; 207 yychar = YYEMPTY; 208 yystate = 0; 209 210 #if YYPURE 211 memset(&yystack, 0, sizeof(yystack)); 212 #endif 213 214 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 215 yystack.s_mark = yystack.s_base; 216 yystack.l_mark = yystack.l_base; 217 yystate = 0; 218 *yystack.s_mark = 0; 219 220 yyloop: 221 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 222 if (yychar < 0) 223 { 224 yychar = YYLEX; 225 if (yychar < 0) yychar = YYEOF; 226 #if YYDEBUG 227 if (yydebug) 228 { 229 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 230 printf("%sdebug: state %d, reading %d (%s)\n", 231 YYPREFIX, yystate, yychar, yys); 232 } 233 #endif 234 } 235 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 236 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 237 { 238 #if YYDEBUG 239 if (yydebug) 240 printf("%sdebug: state %d, shifting to state %d\n", 241 YYPREFIX, yystate, yytable[yyn]); 242 #endif 243 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 244 yystate = yytable[yyn]; 245 *++yystack.s_mark = yytable[yyn]; 246 *++yystack.l_mark = yylval; 247 yychar = YYEMPTY; 248 if (yyerrflag > 0) --yyerrflag; 249 goto yyloop; 250 } 251 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 252 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 253 { 254 yyn = yytable[yyn]; 255 goto yyreduce; 256 } 257 if (yyerrflag != 0) goto yyinrecovery; 258 259 YYERROR_CALL("syntax error"); 260 261 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 262 yyerrlab: 263 ++yynerrs; 264 265 yyinrecovery: 266 if (yyerrflag < 3) 267 { 268 yyerrflag = 3; 269 for (;;) 270 { 271 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 272 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 273 { 274 #if YYDEBUG 275 if (yydebug) 276 printf("%sdebug: state %d, error recovery shifting\ 277 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); 278 #endif 279 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 280 yystate = yytable[yyn]; 281 *++yystack.s_mark = yytable[yyn]; 282 *++yystack.l_mark = yylval; 283 goto yyloop; 284 } 285 else 286 { 287 #if YYDEBUG 288 if (yydebug) 289 printf("%sdebug: error recovery discarding state %d\n", 290 YYPREFIX, *yystack.s_mark); 291 #endif 292 if (yystack.s_mark <= yystack.s_base) goto yyabort; 293 --yystack.s_mark; 294 --yystack.l_mark; 295 } 296 } 297 } 298 else 299 { 300 if (yychar == YYEOF) goto yyabort; 301 #if YYDEBUG 302 if (yydebug) 303 { 304 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 305 printf("%sdebug: state %d, error recovery discards token %d (%s)\n", 306 YYPREFIX, yystate, yychar, yys); 307 } 308 #endif 309 yychar = YYEMPTY; 310 goto yyloop; 311 } 312 313 yyreduce: 314 #if YYDEBUG 315 if (yydebug) 316 printf("%sdebug: state %d, reducing by rule %d (%s)\n", 317 YYPREFIX, yystate, yyn, yyrule[yyn]); 318 #endif 319 yym = yylen[yyn]; 320 if (yym > 0) 321 yyval = yystack.l_mark[1-yym]; 322 else 323 memset(&yyval, 0, sizeof yyval); 324 325 switch (yyn) 326 { 327 } 328 yystack.s_mark -= yym; 329 yystate = *yystack.s_mark; 330 yystack.l_mark -= yym; 331 yym = yylhs[yyn]; 332 if (yystate == 0 && yym == 0) 333 { 334 #if YYDEBUG 335 if (yydebug) 336 printf("%sdebug: after reduction, shifting from state 0 to\ 337 state %d\n", YYPREFIX, YYFINAL); 338 #endif 339 yystate = YYFINAL; 340 *++yystack.s_mark = YYFINAL; 341 *++yystack.l_mark = yyval; 342 if (yychar < 0) 343 { 344 yychar = YYLEX; 345 if (yychar < 0) yychar = YYEOF; 346 #if YYDEBUG 347 if (yydebug) 348 { 349 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 350 printf("%sdebug: state %d, reading %d (%s)\n", 351 YYPREFIX, YYFINAL, yychar, yys); 352 } 353 #endif 354 } 355 if (yychar == YYEOF) goto yyaccept; 356 goto yyloop; 357 } 358 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 359 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 360 yystate = yytable[yyn]; 361 else 362 yystate = yydgoto[yym]; 363 #if YYDEBUG 364 if (yydebug) 365 printf("%sdebug: after reduction, shifting from state %d \ 366 to state %d\n", YYPREFIX, *yystack.s_mark, yystate); 367 #endif 368 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 369 *++yystack.s_mark = (YYINT) yystate; 370 *++yystack.l_mark = yyval; 371 goto yyloop; 372 373 yyoverflow: 374 YYERROR_CALL("yacc stack overflow"); 375 376 yyabort: 377 yyfreestack(&yystack); 378 return (1); 379 380 yyaccept: 381 yyfreestack(&yystack); 382 return (0); 383 } 384