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