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 yynerrs = 0; 204 yyerrflag = 0; 205 yychar = YYEMPTY; 206 yystate = 0; 207 208 #if YYPURE 209 memset(&yystack, 0, sizeof(yystack)); 210 #endif 211 212 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 213 yystack.s_mark = yystack.s_base; 214 yystack.l_mark = yystack.l_base; 215 yystate = 0; 216 *yystack.s_mark = 0; 217 218 yyloop: 219 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 220 if (yychar < 0) 221 { 222 if ((yychar = YYLEX) < 0) yychar = YYEOF; 223 #if YYDEBUG 224 if (yydebug) 225 { 226 yys = yyname[YYTRANSLATE(yychar)]; 227 printf("%sdebug: state %d, reading %d (%s)\n", 228 YYPREFIX, yystate, yychar, yys); 229 } 230 #endif 231 } 232 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && 233 yyn <= YYTABLESIZE && yycheck[yyn] == yychar) 234 { 235 #if YYDEBUG 236 if (yydebug) 237 printf("%sdebug: state %d, shifting to state %d\n", 238 YYPREFIX, yystate, yytable[yyn]); 239 #endif 240 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) 241 { 242 goto yyoverflow; 243 } 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]) && (yyn += yychar) >= 0 && 252 yyn <= YYTABLESIZE && yycheck[yyn] == yychar) 253 { 254 yyn = yytable[yyn]; 255 goto yyreduce; 256 } 257 if (yyerrflag) goto yyinrecovery; 258 259 YYERROR_CALL("syntax error"); 260 261 goto yyerrlab; 262 263 yyerrlab: 264 ++yynerrs; 265 266 yyinrecovery: 267 if (yyerrflag < 3) 268 { 269 yyerrflag = 3; 270 for (;;) 271 { 272 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && 273 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) 274 { 275 #if YYDEBUG 276 if (yydebug) 277 printf("%sdebug: state %d, error recovery shifting\ 278 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); 279 #endif 280 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) 281 { 282 goto yyoverflow; 283 } 284 yystate = yytable[yyn]; 285 *++yystack.s_mark = yytable[yyn]; 286 *++yystack.l_mark = yylval; 287 goto yyloop; 288 } 289 else 290 { 291 #if YYDEBUG 292 if (yydebug) 293 printf("%sdebug: error recovery discarding state %d\n", 294 YYPREFIX, *yystack.s_mark); 295 #endif 296 if (yystack.s_mark <= yystack.s_base) goto yyabort; 297 --yystack.s_mark; 298 --yystack.l_mark; 299 } 300 } 301 } 302 else 303 { 304 if (yychar == YYEOF) goto yyabort; 305 #if YYDEBUG 306 if (yydebug) 307 { 308 yys = yyname[YYTRANSLATE(yychar)]; 309 printf("%sdebug: state %d, error recovery discards token %d (%s)\n", 310 YYPREFIX, yystate, yychar, yys); 311 } 312 #endif 313 yychar = YYEMPTY; 314 goto yyloop; 315 } 316 317 yyreduce: 318 #if YYDEBUG 319 if (yydebug) 320 printf("%sdebug: state %d, reducing by rule %d (%s)\n", 321 YYPREFIX, yystate, yyn, yyrule[yyn]); 322 #endif 323 yym = yylen[yyn]; 324 if (yym) 325 yyval = yystack.l_mark[1-yym]; 326 else 327 memset(&yyval, 0, sizeof yyval); 328 switch (yyn) 329 { 330 } 331 yystack.s_mark -= yym; 332 yystate = *yystack.s_mark; 333 yystack.l_mark -= yym; 334 yym = yylhs[yyn]; 335 if (yystate == 0 && yym == 0) 336 { 337 #if YYDEBUG 338 if (yydebug) 339 printf("%sdebug: after reduction, shifting from state 0 to\ 340 state %d\n", YYPREFIX, YYFINAL); 341 #endif 342 yystate = YYFINAL; 343 *++yystack.s_mark = YYFINAL; 344 *++yystack.l_mark = yyval; 345 if (yychar < 0) 346 { 347 if ((yychar = YYLEX) < 0) yychar = YYEOF; 348 #if YYDEBUG 349 if (yydebug) 350 { 351 yys = yyname[YYTRANSLATE(yychar)]; 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]) && (yyn += yystate) >= 0 && 361 yyn <= YYTABLESIZE && yycheck[yyn] == 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) 371 { 372 goto yyoverflow; 373 } 374 *++yystack.s_mark = (YYINT) yystate; 375 *++yystack.l_mark = yyval; 376 goto yyloop; 377 378 yyoverflow: 379 YYERROR_CALL("yacc stack overflow"); 380 381 yyabort: 382 yyfreestack(&yystack); 383 return (1); 384 385 yyaccept: 386 yyfreestack(&yystack); 387 return (0); 388 } 389