1 /* This file generated automatically using 2 * @Id: skel2c,v 1.4 2016/06/07 00:26:09 tom Exp @ 3 */ 4 5 /* @Id: yaccpar.skel,v 1.7 2016/06/06 23:35:55 Tom.Shields Exp @ */ 6 7 #include "defs.h" 8 9 /* If the skeleton is changed, the banner should be changed so that */ 10 /* the altered version can be easily distinguished from the original. */ 11 /* */ 12 /* The #defines included with the banner are there because they are */ 13 /* useful in subsequent code. The macros #defined in the header or */ 14 /* the body either are not useful outside of semantic actions or */ 15 /* are conditional. */ 16 17 const char *const banner[] = 18 { 19 "/* original parser id follows */", 20 "/* yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\" */", 21 "/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */", 22 "", 23 "#define YYBYACC 1", 24 CONCAT1("#define YYMAJOR ", YYMAJOR), 25 CONCAT1("#define YYMINOR ", YYMINOR), 26 #ifdef YYPATCH 27 CONCAT1("#define YYPATCH ", YYPATCH), 28 #endif 29 "", 30 "#define YYEMPTY (-1)", 31 "#define yyclearin (yychar = YYEMPTY)", 32 "#define yyerrok (yyerrflag = 0)", 33 "#define YYRECOVERING() (yyerrflag != 0)", 34 "#define YYENOMEM (-2)", 35 "#define YYEOF 0", 36 0 37 }; 38 39 const char *const xdecls[] = 40 { 41 "", 42 "extern int YYPARSE_DECL();", 43 0 44 }; 45 46 const char *const tables[] = 47 { 48 "extern YYINT yylhs[];", 49 "extern YYINT yylen[];", 50 "extern YYINT yydefred[];", 51 "extern YYINT yydgoto[];", 52 "extern YYINT yysindex[];", 53 "extern YYINT yyrindex[];", 54 "extern YYINT yygindex[];", 55 "extern YYINT yytable[];", 56 "extern YYINT yycheck[];", 57 "", 58 "#if YYDEBUG || defined(yytname)", 59 "extern char *yyname[];", 60 "#endif", 61 "#if YYDEBUG", 62 "extern char *yyrule[];", 63 "#endif", 64 0 65 }; 66 67 const char *const global_vars[] = 68 { 69 "", 70 "int yydebug;", 71 "int yynerrs;", 72 0 73 }; 74 75 const char *const impure_vars[] = 76 { 77 "", 78 "int yyerrflag;", 79 "int yychar;", 80 "YYSTYPE yyval;", 81 "YYSTYPE yylval;", 82 0 83 }; 84 85 const char *const hdr_defs[] = 86 { 87 "", 88 "/* define the initial stack-sizes */", 89 "#ifdef YYSTACKSIZE", 90 "#undef YYMAXDEPTH", 91 "#define YYMAXDEPTH YYSTACKSIZE", 92 "#else", 93 "#ifdef YYMAXDEPTH", 94 "#define YYSTACKSIZE YYMAXDEPTH", 95 "#else", 96 "#define YYSTACKSIZE 10000", 97 "#define YYMAXDEPTH 10000", 98 "#endif", 99 "#endif", 100 "", 101 "#define YYINITSTACKSIZE 200", 102 "", 103 "typedef struct {", 104 " unsigned stacksize;", 105 " YYINT *s_base;", 106 " YYINT *s_mark;", 107 " YYINT *s_last;", 108 " YYSTYPE *l_base;", 109 " YYSTYPE *l_mark;", 110 "} YYSTACKDATA;", 111 0 112 }; 113 114 const char *const hdr_vars[] = 115 { 116 "/* variables for the parser stack */", 117 "static YYSTACKDATA yystack;", 118 0 119 }; 120 121 const char *const body_vars[] = 122 { 123 " int yyerrflag;", 124 " int yychar;", 125 " YYSTYPE yyval;", 126 " YYSTYPE yylval;", 127 "", 128 " /* variables for the parser stack */", 129 " YYSTACKDATA yystack;", 130 0 131 }; 132 133 const char *const body_1[] = 134 { 135 "", 136 "#if YYDEBUG", 137 "#include <stdio.h> /* needed for printf */", 138 "#endif", 139 "", 140 "#include <stdlib.h> /* needed for malloc, etc */", 141 "#include <string.h> /* needed for memset */", 142 "", 143 "/* allocate initial stack or double stack size, up to YYMAXDEPTH */", 144 "static int yygrowstack(YYSTACKDATA *data)", 145 "{", 146 " int i;", 147 " unsigned newsize;", 148 " YYINT *newss;", 149 " YYSTYPE *newvs;", 150 "", 151 " if ((newsize = data->stacksize) == 0)", 152 " newsize = YYINITSTACKSIZE;", 153 " else if (newsize >= YYMAXDEPTH)", 154 " return YYENOMEM;", 155 " else if ((newsize *= 2) > YYMAXDEPTH)", 156 " newsize = YYMAXDEPTH;", 157 "", 158 " i = (int) (data->s_mark - data->s_base);", 159 " newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));", 160 " if (newss == 0)", 161 " return YYENOMEM;", 162 "", 163 " data->s_base = newss;", 164 " data->s_mark = newss + i;", 165 "", 166 " newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));", 167 " if (newvs == 0)", 168 " return YYENOMEM;", 169 "", 170 " data->l_base = newvs;", 171 " data->l_mark = newvs + i;", 172 "", 173 " data->stacksize = newsize;", 174 " data->s_last = data->s_base + newsize - 1;", 175 " return 0;", 176 "}", 177 "", 178 "#if YYPURE || defined(YY_NO_LEAKS)", 179 "static void yyfreestack(YYSTACKDATA *data)", 180 "{", 181 " free(data->s_base);", 182 " free(data->l_base);", 183 " memset(data, 0, sizeof(*data));", 184 "}", 185 "#else", 186 "#define yyfreestack(data) /* nothing */", 187 "#endif", 188 "", 189 "#define YYABORT goto yyabort", 190 "#define YYREJECT goto yyabort", 191 "#define YYACCEPT goto yyaccept", 192 "#define YYERROR goto yyerrlab", 193 "", 194 "int", 195 "YYPARSE_DECL()", 196 "{", 197 0 198 }; 199 200 const char *const body_2[] = 201 { 202 " int yym, yyn, yystate;", 203 "#if YYDEBUG", 204 " const char *yys;", 205 "", 206 " if ((yys = getenv(\"YYDEBUG\")) != 0)", 207 " {", 208 " yyn = *yys;", 209 " if (yyn >= '0' && yyn <= '9')", 210 " yydebug = yyn - '0';", 211 " }", 212 "#endif", 213 "", 214 0 215 }; 216 217 const char *const body_3[] = 218 { 219 " yym = 0;", 220 " yyn = 0;", 221 " yynerrs = 0;", 222 " yyerrflag = 0;", 223 " yychar = YYEMPTY;", 224 " yystate = 0;", 225 "", 226 "#if YYPURE", 227 " memset(&yystack, 0, sizeof(yystack));", 228 "#endif", 229 "", 230 " if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", 231 " yystack.s_mark = yystack.s_base;", 232 " yystack.l_mark = yystack.l_base;", 233 " yystate = 0;", 234 " *yystack.s_mark = 0;", 235 "", 236 "yyloop:", 237 " if ((yyn = yydefred[yystate]) != 0) goto yyreduce;", 238 " if (yychar < 0)", 239 " {", 240 " yychar = YYLEX;", 241 " if (yychar < 0) yychar = YYEOF;", 242 "#if YYDEBUG", 243 " if (yydebug)", 244 " {", 245 " if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];", 246 " printf(\"%sdebug: state %d, reading %d (%s)\\n\",", 247 " YYPREFIX, yystate, yychar, yys);", 248 " }", 249 "#endif", 250 " }", 251 " if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&", 252 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)", 253 " {", 254 "#if YYDEBUG", 255 " if (yydebug)", 256 " printf(\"%sdebug: state %d, shifting to state %d\\n\",", 257 " YYPREFIX, yystate, yytable[yyn]);", 258 "#endif", 259 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", 260 " yystate = yytable[yyn];", 261 " *++yystack.s_mark = yytable[yyn];", 262 " *++yystack.l_mark = yylval;", 263 " yychar = YYEMPTY;", 264 " if (yyerrflag > 0) --yyerrflag;", 265 " goto yyloop;", 266 " }", 267 " if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&", 268 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)", 269 " {", 270 " yyn = yytable[yyn];", 271 " goto yyreduce;", 272 " }", 273 " if (yyerrflag != 0) goto yyinrecovery;", 274 "", 275 " YYERROR_CALL(\"syntax error\");", 276 "", 277 " goto yyerrlab; /* redundant goto avoids 'unused label' warning */", 278 "yyerrlab:", 279 " ++yynerrs;", 280 "", 281 "yyinrecovery:", 282 " if (yyerrflag < 3)", 283 " {", 284 " yyerrflag = 3;", 285 " for (;;)", 286 " {", 287 " if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&", 288 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)", 289 " {", 290 "#if YYDEBUG", 291 " if (yydebug)", 292 " printf(\"%sdebug: state %d, error recovery shifting\\", 293 " to state %d\\n\", YYPREFIX, *yystack.s_mark, yytable[yyn]);", 294 "#endif", 295 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", 296 " yystate = yytable[yyn];", 297 " *++yystack.s_mark = yytable[yyn];", 298 " *++yystack.l_mark = yylval;", 299 " goto yyloop;", 300 " }", 301 " else", 302 " {", 303 "#if YYDEBUG", 304 " if (yydebug)", 305 " printf(\"%sdebug: error recovery discarding state %d\\n\",", 306 " YYPREFIX, *yystack.s_mark);", 307 "#endif", 308 " if (yystack.s_mark <= yystack.s_base) goto yyabort;", 309 " --yystack.s_mark;", 310 " --yystack.l_mark;", 311 " }", 312 " }", 313 " }", 314 " else", 315 " {", 316 " if (yychar == YYEOF) goto yyabort;", 317 "#if YYDEBUG", 318 " if (yydebug)", 319 " {", 320 " if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];", 321 " printf(\"%sdebug: state %d, error recovery discards token %d (%s)\\n\",", 322 " YYPREFIX, yystate, yychar, yys);", 323 " }", 324 "#endif", 325 " yychar = YYEMPTY;", 326 " goto yyloop;", 327 " }", 328 "", 329 "yyreduce:", 330 "#if YYDEBUG", 331 " if (yydebug)", 332 " printf(\"%sdebug: state %d, reducing by rule %d (%s)\\n\",", 333 " YYPREFIX, yystate, yyn, yyrule[yyn]);", 334 "#endif", 335 " yym = yylen[yyn];", 336 " if (yym > 0)", 337 " yyval = yystack.l_mark[1-yym];", 338 " else", 339 " memset(&yyval, 0, sizeof yyval);", 340 "", 341 " switch (yyn)", 342 " {", 343 0 344 }; 345 346 const char *const trailer[] = 347 { 348 " }", 349 " yystack.s_mark -= yym;", 350 " yystate = *yystack.s_mark;", 351 " yystack.l_mark -= yym;", 352 " yym = yylhs[yyn];", 353 " if (yystate == 0 && yym == 0)", 354 " {", 355 "#if YYDEBUG", 356 " if (yydebug)", 357 " printf(\"%sdebug: after reduction, shifting from state 0 to\\", 358 " state %d\\n\", YYPREFIX, YYFINAL);", 359 "#endif", 360 " yystate = YYFINAL;", 361 " *++yystack.s_mark = YYFINAL;", 362 " *++yystack.l_mark = yyval;", 363 " if (yychar < 0)", 364 " {", 365 " yychar = YYLEX;", 366 " if (yychar < 0) yychar = YYEOF;", 367 "#if YYDEBUG", 368 " if (yydebug)", 369 " {", 370 " if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];", 371 " printf(\"%sdebug: state %d, reading %d (%s)\\n\",", 372 " YYPREFIX, YYFINAL, yychar, yys);", 373 " }", 374 "#endif", 375 " }", 376 " if (yychar == YYEOF) goto yyaccept;", 377 " goto yyloop;", 378 " }", 379 " if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&", 380 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)", 381 " yystate = yytable[yyn];", 382 " else", 383 " yystate = yydgoto[yym];", 384 "#if YYDEBUG", 385 " if (yydebug)", 386 " printf(\"%sdebug: after reduction, shifting from state %d \\", 387 "to state %d\\n\", YYPREFIX, *yystack.s_mark, yystate);", 388 "#endif", 389 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", 390 " *++yystack.s_mark = (YYINT) yystate;", 391 " *++yystack.l_mark = yyval;", 392 " goto yyloop;", 393 "", 394 "yyoverflow:", 395 " YYERROR_CALL(\"yacc stack overflow\");", 396 "", 397 "yyabort:", 398 " yyfreestack(&yystack);", 399 " return (1);", 400 "", 401 "yyaccept:", 402 " yyfreestack(&yystack);", 403 " return (0);", 404 "}", 405 0 406 }; 407 408 void 409 write_section(FILE * fp, const char *const section[]) 410 { 411 int i; 412 const char *s; 413 414 for (i = 0; (s = section[i]) != 0; ++i) 415 { 416 if (fp == code_file) 417 ++outline; 418 fprintf(fp, "%s\n", s); 419 } 420 } 421