dhclient: Log a warning instead of bailing upon "illegal" options
[dragonfly.git] / contrib / byacc / yaccpar.c
blob717d735defc474596c89e2589f5820a04e5ad8d6
1 /* This file generated automatically using
2 * @Id: skel2c,v 1.3 2014/04/06 19:48:04 tom Exp @
3 */
5 /* @Id: yaccpar.skel,v 1.5 2014/04/07 21:51:00 tom Exp @ */
7 #include "defs.h"
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. */
17 const char *const banner[] =
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",
39 const char *const xdecls[] =
41 "",
42 "extern int YYPARSE_DECL();",
46 const char *const tables[] =
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",
59 "extern char *yyname[];",
60 "extern char *yyrule[];",
61 "#endif",
65 const char *const global_vars[] =
67 "",
68 "int yydebug;",
69 "int yynerrs;",
73 const char *const impure_vars[] =
75 "",
76 "int yyerrflag;",
77 "int yychar;",
78 "YYSTYPE yyval;",
79 "YYSTYPE yylval;",
83 const char *const hdr_defs[] =
85 "",
86 "/* define the initial stack-sizes */",
87 "#ifdef YYSTACKSIZE",
88 "#undef YYMAXDEPTH",
89 "#define YYMAXDEPTH YYSTACKSIZE",
90 "#else",
91 "#ifdef YYMAXDEPTH",
92 "#define YYSTACKSIZE YYMAXDEPTH",
93 "#else",
94 "#define YYSTACKSIZE 10000",
95 "#define YYMAXDEPTH 10000",
96 "#endif",
97 "#endif",
98 "",
99 "#define YYINITSTACKSIZE 200",
101 "typedef struct {",
102 " unsigned stacksize;",
103 " YYINT *s_base;",
104 " YYINT *s_mark;",
105 " YYINT *s_last;",
106 " YYSTYPE *l_base;",
107 " YYSTYPE *l_mark;",
108 "} YYSTACKDATA;",
112 const char *const hdr_vars[] =
114 "/* variables for the parser stack */",
115 "static YYSTACKDATA yystack;",
119 const char *const body_vars[] =
121 " int yyerrflag;",
122 " int yychar;",
123 " YYSTYPE yyval;",
124 " YYSTYPE yylval;",
126 " /* variables for the parser stack */",
127 " YYSTACKDATA yystack;",
131 const char *const body_1[] =
134 "#if YYDEBUG",
135 "#include <stdio.h> /* needed for printf */",
136 "#endif",
138 "#include <stdlib.h> /* needed for malloc, etc */",
139 "#include <string.h> /* needed for memset */",
141 "/* allocate initial stack or double stack size, up to YYMAXDEPTH */",
142 "static int yygrowstack(YYSTACKDATA *data)",
143 "{",
144 " int i;",
145 " unsigned newsize;",
146 " YYINT *newss;",
147 " YYSTYPE *newvs;",
149 " if ((newsize = data->stacksize) == 0)",
150 " newsize = YYINITSTACKSIZE;",
151 " else if (newsize >= YYMAXDEPTH)",
152 " return YYENOMEM;",
153 " else if ((newsize *= 2) > YYMAXDEPTH)",
154 " newsize = YYMAXDEPTH;",
156 " i = (int) (data->s_mark - data->s_base);",
157 " newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));",
158 " if (newss == 0)",
159 " return YYENOMEM;",
161 " data->s_base = newss;",
162 " data->s_mark = newss + i;",
164 " newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));",
165 " if (newvs == 0)",
166 " return YYENOMEM;",
168 " data->l_base = newvs;",
169 " data->l_mark = newvs + i;",
171 " data->stacksize = newsize;",
172 " data->s_last = data->s_base + newsize - 1;",
173 " return 0;",
174 "}",
176 "#if YYPURE || defined(YY_NO_LEAKS)",
177 "static void yyfreestack(YYSTACKDATA *data)",
178 "{",
179 " free(data->s_base);",
180 " free(data->l_base);",
181 " memset(data, 0, sizeof(*data));",
182 "}",
183 "#else",
184 "#define yyfreestack(data) /* nothing */",
185 "#endif",
187 "#define YYABORT goto yyabort",
188 "#define YYREJECT goto yyabort",
189 "#define YYACCEPT goto yyaccept",
190 "#define YYERROR goto yyerrlab",
192 "int",
193 "YYPARSE_DECL()",
194 "{",
198 const char *const body_2[] =
200 " int yym, yyn, yystate;",
201 "#if YYDEBUG",
202 " const char *yys;",
204 " if ((yys = getenv(\"YYDEBUG\")) != 0)",
205 " {",
206 " yyn = *yys;",
207 " if (yyn >= '0' && yyn <= '9')",
208 " yydebug = yyn - '0';",
209 " }",
210 "#endif",
212 " yynerrs = 0;",
213 " yyerrflag = 0;",
214 " yychar = YYEMPTY;",
215 " yystate = 0;",
217 "#if YYPURE",
218 " memset(&yystack, 0, sizeof(yystack));",
219 "#endif",
221 " if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;",
222 " yystack.s_mark = yystack.s_base;",
223 " yystack.l_mark = yystack.l_base;",
224 " yystate = 0;",
225 " *yystack.s_mark = 0;",
227 "yyloop:",
228 " if ((yyn = yydefred[yystate]) != 0) goto yyreduce;",
229 " if (yychar < 0)",
230 " {",
231 " if ((yychar = YYLEX) < 0) yychar = YYEOF;",
232 "#if YYDEBUG",
233 " if (yydebug)",
234 " {",
235 " yys = yyname[YYTRANSLATE(yychar)];",
236 " printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
237 " YYPREFIX, yystate, yychar, yys);",
238 " }",
239 "#endif",
240 " }",
241 " if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&",
242 " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)",
243 " {",
244 "#if YYDEBUG",
245 " if (yydebug)",
246 " printf(\"%sdebug: state %d, shifting to state %d\\n\",",
247 " YYPREFIX, yystate, yytable[yyn]);",
248 "#endif",
249 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)",
250 " {",
251 " goto yyoverflow;",
252 " }",
253 " yystate = yytable[yyn];",
254 " *++yystack.s_mark = yytable[yyn];",
255 " *++yystack.l_mark = yylval;",
256 " yychar = YYEMPTY;",
257 " if (yyerrflag > 0) --yyerrflag;",
258 " goto yyloop;",
259 " }",
260 " if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&",
261 " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)",
262 " {",
263 " yyn = yytable[yyn];",
264 " goto yyreduce;",
265 " }",
266 " if (yyerrflag) goto yyinrecovery;",
268 " YYERROR_CALL(\"syntax error\");",
270 " goto yyerrlab;",
272 "yyerrlab:",
273 " ++yynerrs;",
275 "yyinrecovery:",
276 " if (yyerrflag < 3)",
277 " {",
278 " yyerrflag = 3;",
279 " for (;;)",
280 " {",
281 " if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&",
282 " yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)",
283 " {",
284 "#if YYDEBUG",
285 " if (yydebug)",
286 " printf(\"%sdebug: state %d, error recovery shifting\\",
287 " to state %d\\n\", YYPREFIX, *yystack.s_mark, yytable[yyn]);",
288 "#endif",
289 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)",
290 " {",
291 " goto yyoverflow;",
292 " }",
293 " yystate = yytable[yyn];",
294 " *++yystack.s_mark = yytable[yyn];",
295 " *++yystack.l_mark = yylval;",
296 " goto yyloop;",
297 " }",
298 " else",
299 " {",
300 "#if YYDEBUG",
301 " if (yydebug)",
302 " printf(\"%sdebug: error recovery discarding state %d\\n\",",
303 " YYPREFIX, *yystack.s_mark);",
304 "#endif",
305 " if (yystack.s_mark <= yystack.s_base) goto yyabort;",
306 " --yystack.s_mark;",
307 " --yystack.l_mark;",
308 " }",
309 " }",
310 " }",
311 " else",
312 " {",
313 " if (yychar == YYEOF) goto yyabort;",
314 "#if YYDEBUG",
315 " if (yydebug)",
316 " {",
317 " yys = yyname[YYTRANSLATE(yychar)];",
318 " printf(\"%sdebug: state %d, error recovery discards token %d (%s)\\n\",",
319 " YYPREFIX, yystate, yychar, yys);",
320 " }",
321 "#endif",
322 " yychar = YYEMPTY;",
323 " goto yyloop;",
324 " }",
326 "yyreduce:",
327 "#if YYDEBUG",
328 " if (yydebug)",
329 " printf(\"%sdebug: state %d, reducing by rule %d (%s)\\n\",",
330 " YYPREFIX, yystate, yyn, yyrule[yyn]);",
331 "#endif",
332 " yym = yylen[yyn];",
333 " if (yym)",
334 " yyval = yystack.l_mark[1-yym];",
335 " else",
336 " memset(&yyval, 0, sizeof yyval);",
337 " switch (yyn)",
338 " {",
342 const char *const trailer[] =
344 " }",
345 " yystack.s_mark -= yym;",
346 " yystate = *yystack.s_mark;",
347 " yystack.l_mark -= yym;",
348 " yym = yylhs[yyn];",
349 " if (yystate == 0 && yym == 0)",
350 " {",
351 "#if YYDEBUG",
352 " if (yydebug)",
353 " printf(\"%sdebug: after reduction, shifting from state 0 to\\",
354 " state %d\\n\", YYPREFIX, YYFINAL);",
355 "#endif",
356 " yystate = YYFINAL;",
357 " *++yystack.s_mark = YYFINAL;",
358 " *++yystack.l_mark = yyval;",
359 " if (yychar < 0)",
360 " {",
361 " if ((yychar = YYLEX) < 0) yychar = YYEOF;",
362 "#if YYDEBUG",
363 " if (yydebug)",
364 " {",
365 " yys = yyname[YYTRANSLATE(yychar)];",
366 " printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
367 " YYPREFIX, YYFINAL, yychar, yys);",
368 " }",
369 "#endif",
370 " }",
371 " if (yychar == YYEOF) goto yyaccept;",
372 " goto yyloop;",
373 " }",
374 " if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&",
375 " yyn <= YYTABLESIZE && yycheck[yyn] == yystate)",
376 " yystate = yytable[yyn];",
377 " else",
378 " yystate = yydgoto[yym];",
379 "#if YYDEBUG",
380 " if (yydebug)",
381 " printf(\"%sdebug: after reduction, shifting from state %d \\",
382 "to state %d\\n\", YYPREFIX, *yystack.s_mark, yystate);",
383 "#endif",
384 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)",
385 " {",
386 " goto yyoverflow;",
387 " }",
388 " *++yystack.s_mark = (YYINT) yystate;",
389 " *++yystack.l_mark = yyval;",
390 " goto yyloop;",
392 "yyoverflow:",
393 " YYERROR_CALL(\"yacc stack overflow\");",
395 "yyabort:",
396 " yyfreestack(&yystack);",
397 " return (1);",
399 "yyaccept:",
400 " yyfreestack(&yystack);",
401 " return (0);",
402 "}",
406 void
407 write_section(FILE * fp, const char *const section[])
409 int i;
410 const char *s;
412 for (i = 0; (s = section[i]) != 0; ++i)
414 if (fp == code_file)
415 ++outline;
416 fprintf(fp, "%s\n", s);