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.8 2016/12/02 21:44:42 tom 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 init_vars[] = 218 { 219 " memset(&yyval, 0, sizeof(yyval));", 220 " memset(&yylval, 0, sizeof(yylval));", 221 "", 222 0 223 }; 224 225 const char *const body_3[] = 226 { 227 " yym = 0;", 228 " yyn = 0;", 229 " yynerrs = 0;", 230 " yyerrflag = 0;", 231 " yychar = YYEMPTY;", 232 " yystate = 0;", 233 "", 234 "#if YYPURE", 235 " memset(&yystack, 0, sizeof(yystack));", 236 "#endif", 237 "", 238 " if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", 239 " yystack.s_mark = yystack.s_base;", 240 " yystack.l_mark = yystack.l_base;", 241 " yystate = 0;", 242 " *yystack.s_mark = 0;", 243 "", 244 "yyloop:", 245 " if ((yyn = yydefred[yystate]) != 0) goto yyreduce;", 246 " if (yychar < 0)", 247 " {", 248 " yychar = YYLEX;", 249 " if (yychar < 0) yychar = YYEOF;", 250 "#if YYDEBUG", 251 " if (yydebug)", 252 " {", 253 " if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];", 254 " printf(\"%sdebug: state %d, reading %d (%s)\\n\",", 255 " YYPREFIX, yystate, yychar, yys);", 256 " }", 257 "#endif", 258 " }", 259 " if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&", 260 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)", 261 " {", 262 "#if YYDEBUG", 263 " if (yydebug)", 264 " printf(\"%sdebug: state %d, shifting to state %d\\n\",", 265 " YYPREFIX, yystate, yytable[yyn]);", 266 "#endif", 267 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", 268 " yystate = yytable[yyn];", 269 " *++yystack.s_mark = yytable[yyn];", 270 " *++yystack.l_mark = yylval;", 271 " yychar = YYEMPTY;", 272 " if (yyerrflag > 0) --yyerrflag;", 273 " goto yyloop;", 274 " }", 275 " if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&", 276 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)", 277 " {", 278 " yyn = yytable[yyn];", 279 " goto yyreduce;", 280 " }", 281 " if (yyerrflag != 0) goto yyinrecovery;", 282 "", 283 " YYERROR_CALL(\"syntax error\");", 284 "", 285 " goto yyerrlab; /* redundant goto avoids 'unused label' warning */", 286 "yyerrlab:", 287 " ++yynerrs;", 288 "", 289 "yyinrecovery:", 290 " if (yyerrflag < 3)", 291 " {", 292 " yyerrflag = 3;", 293 " for (;;)", 294 " {", 295 " if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&", 296 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)", 297 " {", 298 "#if YYDEBUG", 299 " if (yydebug)", 300 " printf(\"%sdebug: state %d, error recovery shifting\\", 301 " to state %d\\n\", YYPREFIX, *yystack.s_mark, yytable[yyn]);", 302 "#endif", 303 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", 304 " yystate = yytable[yyn];", 305 " *++yystack.s_mark = yytable[yyn];", 306 " *++yystack.l_mark = yylval;", 307 " goto yyloop;", 308 " }", 309 " else", 310 " {", 311 "#if YYDEBUG", 312 " if (yydebug)", 313 " printf(\"%sdebug: error recovery discarding state %d\\n\",", 314 " YYPREFIX, *yystack.s_mark);", 315 "#endif", 316 " if (yystack.s_mark <= yystack.s_base) goto yyabort;", 317 " --yystack.s_mark;", 318 " --yystack.l_mark;", 319 " }", 320 " }", 321 " }", 322 " else", 323 " {", 324 " if (yychar == YYEOF) goto yyabort;", 325 "#if YYDEBUG", 326 " if (yydebug)", 327 " {", 328 " if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];", 329 " printf(\"%sdebug: state %d, error recovery discards token %d (%s)\\n\",", 330 " YYPREFIX, yystate, yychar, yys);", 331 " }", 332 "#endif", 333 " yychar = YYEMPTY;", 334 " goto yyloop;", 335 " }", 336 "", 337 "yyreduce:", 338 "#if YYDEBUG", 339 " if (yydebug)", 340 " printf(\"%sdebug: state %d, reducing by rule %d (%s)\\n\",", 341 " YYPREFIX, yystate, yyn, yyrule[yyn]);", 342 "#endif", 343 " yym = yylen[yyn];", 344 " if (yym > 0)", 345 " yyval = yystack.l_mark[1-yym];", 346 " else", 347 " memset(&yyval, 0, sizeof yyval);", 348 "", 349 " switch (yyn)", 350 " {", 351 0 352 }; 353 354 const char *const trailer[] = 355 { 356 " }", 357 " yystack.s_mark -= yym;", 358 " yystate = *yystack.s_mark;", 359 " yystack.l_mark -= yym;", 360 " yym = yylhs[yyn];", 361 " if (yystate == 0 && yym == 0)", 362 " {", 363 "#if YYDEBUG", 364 " if (yydebug)", 365 " printf(\"%sdebug: after reduction, shifting from state 0 to\\", 366 " state %d\\n\", YYPREFIX, YYFINAL);", 367 "#endif", 368 " yystate = YYFINAL;", 369 " *++yystack.s_mark = YYFINAL;", 370 " *++yystack.l_mark = yyval;", 371 " if (yychar < 0)", 372 " {", 373 " yychar = YYLEX;", 374 " if (yychar < 0) yychar = YYEOF;", 375 "#if YYDEBUG", 376 " if (yydebug)", 377 " {", 378 " if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];", 379 " printf(\"%sdebug: state %d, reading %d (%s)\\n\",", 380 " YYPREFIX, YYFINAL, yychar, yys);", 381 " }", 382 "#endif", 383 " }", 384 " if (yychar == YYEOF) goto yyaccept;", 385 " goto yyloop;", 386 " }", 387 " if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&", 388 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)", 389 " yystate = yytable[yyn];", 390 " else", 391 " yystate = yydgoto[yym];", 392 "#if YYDEBUG", 393 " if (yydebug)", 394 " printf(\"%sdebug: after reduction, shifting from state %d \\", 395 "to state %d\\n\", YYPREFIX, *yystack.s_mark, yystate);", 396 "#endif", 397 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", 398 " *++yystack.s_mark = (YYINT) yystate;", 399 " *++yystack.l_mark = yyval;", 400 " goto yyloop;", 401 "", 402 "yyoverflow:", 403 " YYERROR_CALL(\"yacc stack overflow\");", 404 "", 405 "yyabort:", 406 " yyfreestack(&yystack);", 407 " return (1);", 408 "", 409 "yyaccept:", 410 " yyfreestack(&yystack);", 411 " return (0);", 412 "}", 413 0 414 }; 415 416 void 417 write_section(FILE * fp, const char *const section[]) 418 { 419 int i; 420 const char *s; 421 422 for (i = 0; (s = section[i]) != 0; ++i) 423 { 424 if (fp == code_file) 425 ++outline; 426 fprintf(fp, "%s\n", s); 427 } 428 } 429