1 /* This file generated automatically using
2 * @Id: skel2c,v 1.4 2016/06/07 00:26:09 tom Exp @
3 */
4
5 /* @Id: btyaccpar.skel,v 1.12 2021/06/19 20:46:31 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 const YYINT yylhs[];",
49 "extern const YYINT yylen[];",
50 "extern const YYINT yydefred[];",
51 "extern const YYINT yystos[];",
52 "extern const YYINT yydgoto[];",
53 "extern const YYINT yysindex[];",
54 "extern const YYINT yyrindex[];",
55 #if defined(YYBTYACC)
56 "#if YYBTYACC",
57 "extern const YYINT yycindex[];",
58 "#endif /* YYBTYACC */",
59 #endif /* defined(YYBTYACC) */
60 "extern const YYINT yygindex[];",
61 "extern const YYINT yytable[];",
62 "extern const YYINT yycheck[];",
63 #if defined(YYBTYACC)
64 "#if YYBTYACC",
65 "extern const YYINT yyctable[];",
66 "#endif /* YYBTYACC */",
67 #endif /* defined(YYBTYACC) */
68 "",
69 "#if YYDEBUG || defined(yytname)",
70 "extern const char *const yyname[];",
71 "#endif",
72 "#if YYDEBUG",
73 "extern const char *const yyrule[];",
74 "#endif",
75 0
76 };
77
78 const char *const global_vars[] =
79 {
80 "",
81 "#if YYDEBUG",
82 "int yydebug;",
83 "#endif",
84 0
85 };
86
87 const char *const impure_vars[] =
88 {
89 "",
90 "int yyerrflag;",
91 "int yychar;",
92 "YYSTYPE yyval;",
93 "YYSTYPE yylval;",
94 "int yynerrs;",
95 "",
96 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
97 "YYLTYPE yyloc; /* position returned by actions */",
98 "YYLTYPE yylloc; /* position from the lexer */",
99 "#endif",
100 0
101 };
102
103 const char *const hdr_defs[] =
104 {
105 "",
106 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
107 "#ifndef YYLLOC_DEFAULT",
108 "#define YYLLOC_DEFAULT(loc, rhs, n) \\",
109 "do \\",
110 "{ \\",
111 " if (n == 0) \\",
112 " { \\",
113 " (loc).first_line = YYRHSLOC(rhs, 0).last_line; \\",
114 " (loc).first_column = YYRHSLOC(rhs, 0).last_column; \\",
115 " (loc).last_line = YYRHSLOC(rhs, 0).last_line; \\",
116 " (loc).last_column = YYRHSLOC(rhs, 0).last_column; \\",
117 " } \\",
118 " else \\",
119 " { \\",
120 " (loc).first_line = YYRHSLOC(rhs, 1).first_line; \\",
121 " (loc).first_column = YYRHSLOC(rhs, 1).first_column; \\",
122 " (loc).last_line = YYRHSLOC(rhs, n).last_line; \\",
123 " (loc).last_column = YYRHSLOC(rhs, n).last_column; \\",
124 " } \\",
125 "} while (0)",
126 "#endif /* YYLLOC_DEFAULT */",
127 "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
128 #if defined(YYBTYACC)
129 "#if YYBTYACC",
130 "",
131 "#ifndef YYLVQUEUEGROWTH",
132 "#define YYLVQUEUEGROWTH 32",
133 "#endif",
134 "#endif /* YYBTYACC */",
135 #endif /* defined(YYBTYACC) */
136 "",
137 "/* define the initial stack-sizes */",
138 "#ifdef YYSTACKSIZE",
139 "#undef YYMAXDEPTH",
140 "#define YYMAXDEPTH YYSTACKSIZE",
141 "#else",
142 "#ifdef YYMAXDEPTH",
143 "#define YYSTACKSIZE YYMAXDEPTH",
144 "#else",
145 "#define YYSTACKSIZE 10000",
146 "#define YYMAXDEPTH 10000",
147 "#endif",
148 "#endif",
149 "",
150 "#ifndef YYINITSTACKSIZE",
151 "#define YYINITSTACKSIZE 200",
152 "#endif",
153 "",
154 "typedef struct {",
155 " unsigned stacksize;",
156 " YYINT *s_base;",
157 " YYINT *s_mark;",
158 " YYINT *s_last;",
159 " YYSTYPE *l_base;",
160 " YYSTYPE *l_mark;",
161 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
162 " YYLTYPE *p_base;",
163 " YYLTYPE *p_mark;",
164 "#endif",
165 "} YYSTACKDATA;",
166 #if defined(YYBTYACC)
167 "#if YYBTYACC",
168 "",
169 "struct YYParseState_s",
170 "{",
171 " struct YYParseState_s *save; /* Previously saved parser state */",
172 " YYSTACKDATA yystack; /* saved parser stack */",
173 " int state; /* saved parser state */",
174 " int errflag; /* saved error recovery status */",
175 " int lexeme; /* saved index of the conflict lexeme in the lexical queue */",
176 " YYINT ctry; /* saved index in yyctable[] for this conflict */",
177 "};",
178 "typedef struct YYParseState_s YYParseState;",
179 "#endif /* YYBTYACC */",
180 #endif /* defined(YYBTYACC) */
181 0
182 };
183
184 const char *const hdr_vars[] =
185 {
186 "/* variables for the parser stack */",
187 "static YYSTACKDATA yystack;",
188 #if defined(YYBTYACC)
189 "#if YYBTYACC",
190 "",
191 "/* Current parser state */",
192 "static YYParseState *yyps = 0;",
193 "",
194 "/* yypath != NULL: do the full parse, starting at *yypath parser state. */",
195 "static YYParseState *yypath = 0;",
196 "",
197 "/* Base of the lexical value queue */",
198 "static YYSTYPE *yylvals = 0;",
199 "",
200 "/* Current position at lexical value queue */",
201 "static YYSTYPE *yylvp = 0;",
202 "",
203 "/* End position of lexical value queue */",
204 "static YYSTYPE *yylve = 0;",
205 "",
206 "/* The last allocated position at the lexical value queue */",
207 "static YYSTYPE *yylvlim = 0;",
208 "",
209 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
210 "/* Base of the lexical position queue */",
211 "static YYLTYPE *yylpsns = 0;",
212 "",
213 "/* Current position at lexical position queue */",
214 "static YYLTYPE *yylpp = 0;",
215 "",
216 "/* End position of lexical position queue */",
217 "static YYLTYPE *yylpe = 0;",
218 "",
219 "/* The last allocated position at the lexical position queue */",
220 "static YYLTYPE *yylplim = 0;",
221 "#endif",
222 "",
223 "/* Current position at lexical token queue */",
224 "static YYINT *yylexp = 0;",
225 "",
226 "static YYINT *yylexemes = 0;",
227 "#endif /* YYBTYACC */",
228 #endif /* defined(YYBTYACC) */
229 0
230 };
231
232 const char *const body_vars[] =
233 {
234 " int yyerrflag;",
235 " int yychar;",
236 " YYSTYPE yyval;",
237 " YYSTYPE yylval;",
238 " int yynerrs;",
239 "",
240 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
241 " YYLTYPE yyloc; /* position returned by actions */",
242 " YYLTYPE yylloc; /* position from the lexer */",
243 "#endif",
244 "",
245 " /* variables for the parser stack */",
246 " YYSTACKDATA yystack;",
247 #if defined(YYBTYACC)
248 "#if YYBTYACC",
249 "",
250 " /* Current parser state */",
251 " static YYParseState *yyps = 0;",
252 "",
253 " /* yypath != NULL: do the full parse, starting at *yypath parser state. */",
254 " static YYParseState *yypath = 0;",
255 "",
256 " /* Base of the lexical value queue */",
257 " static YYSTYPE *yylvals = 0;",
258 "",
259 " /* Current position at lexical value queue */",
260 " static YYSTYPE *yylvp = 0;",
261 "",
262 " /* End position of lexical value queue */",
263 " static YYSTYPE *yylve = 0;",
264 "",
265 " /* The last allocated position at the lexical value queue */",
266 " static YYSTYPE *yylvlim = 0;",
267 "",
268 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
269 " /* Base of the lexical position queue */",
270 " static YYLTYPE *yylpsns = 0;",
271 "",
272 " /* Current position at lexical position queue */",
273 " static YYLTYPE *yylpp = 0;",
274 "",
275 " /* End position of lexical position queue */",
276 " static YYLTYPE *yylpe = 0;",
277 "",
278 " /* The last allocated position at the lexical position queue */",
279 " static YYLTYPE *yylplim = 0;",
280 "#endif",
281 "",
282 " /* Current position at lexical token queue */",
283 " static YYINT *yylexp = 0;",
284 "",
285 " static YYINT *yylexemes = 0;",
286 "#endif /* YYBTYACC */",
287 #endif /* defined(YYBTYACC) */
288 0
289 };
290
291 const char *const body_1[] =
292 {
293 "",
294 "/* For use in generated program */",
295 "#define yydepth (int)(yystack.s_mark - yystack.s_base)",
296 #if defined(YYBTYACC)
297 "#if YYBTYACC",
298 "#define yytrial (yyps->save)",
299 "#endif /* YYBTYACC */",
300 #endif /* defined(YYBTYACC) */
301 "",
302 "#if YYDEBUG",
303 "#include <stdio.h> /* needed for printf */",
304 "#endif",
305 "",
306 "#include <stdlib.h> /* needed for malloc, etc */",
307 "#include <string.h> /* needed for memset */",
308 "",
309 "/* allocate initial stack or double stack size, up to YYMAXDEPTH */",
310 "static int yygrowstack(YYSTACKDATA *data)",
311 "{",
312 " int i;",
313 " unsigned newsize;",
314 " YYINT *newss;",
315 " YYSTYPE *newvs;",
316 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
317 " YYLTYPE *newps;",
318 "#endif",
319 "",
320 " if ((newsize = data->stacksize) == 0)",
321 " newsize = YYINITSTACKSIZE;",
322 " else if (newsize >= YYMAXDEPTH)",
323 " return YYENOMEM;",
324 " else if ((newsize *= 2) > YYMAXDEPTH)",
325 " newsize = YYMAXDEPTH;",
326 "",
327 " i = (int) (data->s_mark - data->s_base);",
328 " newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));",
329 " if (newss == NULL)",
330 " return YYENOMEM;",
331 "",
332 " data->s_base = newss;",
333 " data->s_mark = newss + i;",
334 "",
335 " newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));",
336 " if (newvs == NULL)",
337 " return YYENOMEM;",
338 "",
339 " data->l_base = newvs;",
340 " data->l_mark = newvs + i;",
341 "",
342 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
343 " newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));",
344 " if (newps == NULL)",
345 " return YYENOMEM;",
346 "",
347 " data->p_base = newps;",
348 " data->p_mark = newps + i;",
349 "#endif",
350 "",
351 " data->stacksize = newsize;",
352 " data->s_last = data->s_base + newsize - 1;",
353 "",
354 "#if YYDEBUG",
355 " if (yydebug)",
356 " fprintf(stderr, \"%sdebug: stack size increased to %d\\n\", YYPREFIX, newsize);",
357 "#endif",
358 " return 0;",
359 "}",
360 "",
361 "#if YYPURE || defined(YY_NO_LEAKS)",
362 "static void yyfreestack(YYSTACKDATA *data)",
363 "{",
364 " free(data->s_base);",
365 " free(data->l_base);",
366 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
367 " free(data->p_base);",
368 "#endif",
369 " memset(data, 0, sizeof(*data));",
370 "}",
371 "#else",
372 "#define yyfreestack(data) /* nothing */",
373 "#endif /* YYPURE || defined(YY_NO_LEAKS) */",
374 #if defined(YYBTYACC)
375 "#if YYBTYACC",
376 "",
377 "static YYParseState *",
378 "yyNewState(unsigned size)",
379 "{",
380 " YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));",
381 " if (p == NULL) return NULL;",
382 "",
383 " p->yystack.stacksize = size;",
384 " if (size == 0)",
385 " {",
386 " p->yystack.s_base = NULL;",
387 " p->yystack.l_base = NULL;",
388 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
389 " p->yystack.p_base = NULL;",
390 "#endif",
391 " return p;",
392 " }",
393 " p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));",
394 " if (p->yystack.s_base == NULL) return NULL;",
395 " p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));",
396 " if (p->yystack.l_base == NULL) return NULL;",
397 " memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));",
398 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
399 " p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));",
400 " if (p->yystack.p_base == NULL) return NULL;",
401 " memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));",
402 "#endif",
403 "",
404 " return p;",
405 "}",
406 "",
407 "static void",
408 "yyFreeState(YYParseState *p)",
409 "{",
410 " yyfreestack(&p->yystack);",
411 " free(p);",
412 "}",
413 "#endif /* YYBTYACC */",
414 #endif /* defined(YYBTYACC) */
415 "",
416 "#define YYABORT goto yyabort",
417 "#define YYREJECT goto yyabort",
418 "#define YYACCEPT goto yyaccept",
419 "#define YYERROR goto yyerrlab",
420 #if defined(YYBTYACC)
421 "#if YYBTYACC",
422 "#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)",
423 "#define YYVALID_NESTED do { if (yyps->save && \\",
424 " yyps->save->save == 0) goto yyvalid; } while(0)",
425 "#endif /* YYBTYACC */",
426 #endif /* defined(YYBTYACC) */
427 "",
428 "int",
429 "YYPARSE_DECL()",
430 "{",
431 0
432 };
433
434 const char *const body_2[] =
435 {
436 " int yym, yyn, yystate, yyresult;",
437 #if defined(YYBTYACC)
438 "#if YYBTYACC",
439 " int yynewerrflag;",
440 " YYParseState *yyerrctx = NULL;",
441 "#endif /* YYBTYACC */",
442 #endif /* defined(YYBTYACC) */
443 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
444 " YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */",
445 "#endif",
446 "#if YYDEBUG",
447 " const char *yys;",
448 "",
449 " if ((yys = getenv(\"YYDEBUG\")) != NULL)",
450 " {",
451 " yyn = *yys;",
452 " if (yyn >= '0' && yyn <= '9')",
453 " yydebug = yyn - '0';",
454 " }",
455 " if (yydebug)",
456 " fprintf(stderr, \"%sdebug[<# of symbols on state stack>]\\n\", YYPREFIX);",
457 "#endif",
458 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
459 " memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));",
460 "#endif",
461 "",
462 0
463 };
464
465 const char *const init_vars[] =
466 {
467 " yyerrflag = 0;",
468 " yychar = 0;",
469 " memset(&yyval, 0, sizeof(yyval));",
470 " memset(&yylval, 0, sizeof(yylval));",
471 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
472 " memset(&yyloc, 0, sizeof(yyloc));",
473 " memset(&yylloc, 0, sizeof(yylloc));",
474 "#endif",
475 "",
476 0
477 };
478
479 const char *const body_3[] =
480 {
481 #if defined(YYBTYACC)
482 "#if YYBTYACC",
483 " yyps = yyNewState(0); if (yyps == 0) goto yyenomem;",
484 " yyps->save = 0;",
485 "#endif /* YYBTYACC */",
486 #endif /* defined(YYBTYACC) */
487 " yym = 0;",
488 " /* yyn is set below */",
489 " yynerrs = 0;",
490 " yyerrflag = 0;",
491 " yychar = YYEMPTY;",
492 " yystate = 0;",
493 "",
494 "#if YYPURE",
495 " memset(&yystack, 0, sizeof(yystack));",
496 "#endif",
497 "",
498 " if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;",
499 " yystack.s_mark = yystack.s_base;",
500 " yystack.l_mark = yystack.l_base;",
501 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
502 " yystack.p_mark = yystack.p_base;",
503 "#endif",
504 " yystate = 0;",
505 " *yystack.s_mark = 0;",
506 "",
507 "yyloop:",
508 " if ((yyn = yydefred[yystate]) != 0) goto yyreduce;",
509 " if (yychar < 0)",
510 " {",
511 #if defined(YYBTYACC)
512 "#if YYBTYACC",
513 " do {",
514 " if (yylvp < yylve)",
515 " {",
516 " /* we're currently re-reading tokens */",
517 " yylval = *yylvp++;",
518 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
519 " yylloc = *yylpp++;",
520 "#endif",
521 " yychar = *yylexp++;",
522 " break;",
523 " }",
524 " if (yyps->save)",
525 " {",
526 " /* in trial mode; save scanner results for future parse attempts */",
527 " if (yylvp == yylvlim)",
528 " { /* Enlarge lexical value queue */",
529 " size_t p = (size_t) (yylvp - yylvals);",
530 " size_t s = (size_t) (yylvlim - yylvals);",
531 "",
532 " s += YYLVQUEUEGROWTH;",
533 " if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;",
534 " if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;",
535 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
536 " if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;",
537 "#endif",
538 " yylvp = yylve = yylvals + p;",
539 " yylvlim = yylvals + s;",
540 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
541 " yylpp = yylpe = yylpsns + p;",
542 " yylplim = yylpsns + s;",
543 "#endif",
544 " yylexp = yylexemes + p;",
545 " }",
546 " *yylexp = (YYINT) YYLEX;",
547 " *yylvp++ = yylval;",
548 " yylve++;",
549 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
550 " *yylpp++ = yylloc;",
551 " yylpe++;",
552 "#endif",
553 " yychar = *yylexp++;",
554 " break;",
555 " }",
556 " /* normal operation, no conflict encountered */",
557 "#endif /* YYBTYACC */",
558 #endif /* defined(YYBTYACC) */
559 " yychar = YYLEX;",
560 #if defined(YYBTYACC)
561 "#if YYBTYACC",
562 " } while (0);",
563 "#endif /* YYBTYACC */",
564 #endif /* defined(YYBTYACC) */
565 " if (yychar < 0) yychar = YYEOF;",
566 "#if YYDEBUG",
567 " if (yydebug)",
568 " {",
569 " if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];",
570 " fprintf(stderr, \"%s[%d]: state %d, reading token %d (%s)\",",
571 " YYDEBUGSTR, yydepth, yystate, yychar, yys);",
572 "#ifdef YYSTYPE_TOSTRING",
573 #if defined(YYBTYACC)
574 "#if YYBTYACC",
575 " if (!yytrial)",
576 "#endif /* YYBTYACC */",
577 #endif /* defined(YYBTYACC) */
578 " fprintf(stderr, \" <%s>\", YYSTYPE_TOSTRING(yychar, yylval));",
579 "#endif",
580 " fputc('\\n', stderr);",
581 " }",
582 "#endif",
583 " }",
584 #if defined(YYBTYACC)
585 "#if YYBTYACC",
586 "",
587 " /* Do we have a conflict? */",
588 " if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&",
589 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)",
590 " {",
591 " YYINT ctry;",
592 "",
593 " if (yypath)",
594 " {",
595 " YYParseState *save;",
596 "#if YYDEBUG",
597 " if (yydebug)",
598 " fprintf(stderr, \"%s[%d]: CONFLICT in state %d: following successful trial parse\\n\",",
599 " YYDEBUGSTR, yydepth, yystate);",
600 "#endif",
601 " /* Switch to the next conflict context */",
602 " save = yypath;",
603 " yypath = save->save;",
604 " save->save = NULL;",
605 " ctry = save->ctry;",
606 " if (save->state != yystate) YYABORT;",
607 " yyFreeState(save);",
608 "",
609 " }",
610 " else",
611 " {",
612 "",
613 " /* Unresolved conflict - start/continue trial parse */",
614 " YYParseState *save;",
615 "#if YYDEBUG",
616 " if (yydebug)",
617 " {",
618 " fprintf(stderr, \"%s[%d]: CONFLICT in state %d. \", YYDEBUGSTR, yydepth, yystate);",
619 " if (yyps->save)",
620 " fputs(\"ALREADY in conflict, continuing trial parse.\\n\", stderr);",
621 " else",
622 " fputs(\"Starting trial parse.\\n\", stderr);",
623 " }",
624 "#endif",
625 " save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));",
626 " if (save == NULL) goto yyenomem;",
627 " save->save = yyps->save;",
628 " save->state = yystate;",
629 " save->errflag = yyerrflag;",
630 " save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);",
631 " memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));",
632 " save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);",
633 " memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
634 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
635 " save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);",
636 " memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
637 "#endif",
638 " ctry = yytable[yyn];",
639 " if (yyctable[ctry] == -1)",
640 " {",
641 "#if YYDEBUG",
642 " if (yydebug && yychar >= YYEOF)",
643 " fprintf(stderr, \"%s[%d]: backtracking 1 token\\n\", YYDEBUGSTR, yydepth);",
644 "#endif",
645 " ctry++;",
646 " }",
647 " save->ctry = ctry;",
648 " if (yyps->save == NULL)",
649 " {",
650 " /* If this is a first conflict in the stack, start saving lexemes */",
651 " if (!yylexemes)",
652 " {",
653 " yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));",
654 " if (yylexemes == NULL) goto yyenomem;",
655 " yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));",
656 " if (yylvals == NULL) goto yyenomem;",
657 " yylvlim = yylvals + YYLVQUEUEGROWTH;",
658 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
659 " yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));",
660 " if (yylpsns == NULL) goto yyenomem;",
661 " yylplim = yylpsns + YYLVQUEUEGROWTH;",
662 "#endif",
663 " }",
664 " if (yylvp == yylve)",
665 " {",
666 " yylvp = yylve = yylvals;",
667 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
668 " yylpp = yylpe = yylpsns;",
669 "#endif",
670 " yylexp = yylexemes;",
671 " if (yychar >= YYEOF)",
672 " {",
673 " *yylve++ = yylval;",
674 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
675 " *yylpe++ = yylloc;",
676 "#endif",
677 " *yylexp = (YYINT) yychar;",
678 " yychar = YYEMPTY;",
679 " }",
680 " }",
681 " }",
682 " if (yychar >= YYEOF)",
683 " {",
684 " yylvp--;",
685 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
686 " yylpp--;",
687 "#endif",
688 " yylexp--;",
689 " yychar = YYEMPTY;",
690 " }",
691 " save->lexeme = (int) (yylvp - yylvals);",
692 " yyps->save = save;",
693 " }",
694 " if (yytable[yyn] == ctry)",
695 " {",
696 "#if YYDEBUG",
697 " if (yydebug)",
698 " fprintf(stderr, \"%s[%d]: state %d, shifting to state %d\\n\",",
699 " YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);",
700 "#endif",
701 " if (yychar < 0)",
702 " {",
703 " yylvp++;",
704 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
705 " yylpp++;",
706 "#endif",
707 " yylexp++;",
708 " }",
709 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)",
710 " goto yyoverflow;",
711 " yystate = yyctable[ctry];",
712 " *++yystack.s_mark = (YYINT) yystate;",
713 " *++yystack.l_mark = yylval;",
714 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
715 " *++yystack.p_mark = yylloc;",
716 "#endif",
717 " yychar = YYEMPTY;",
718 " if (yyerrflag > 0) --yyerrflag;",
719 " goto yyloop;",
720 " }",
721 " else",
722 " {",
723 " yyn = yyctable[ctry];",
724 " goto yyreduce;",
725 " }",
726 " } /* End of code dealing with conflicts */",
727 "#endif /* YYBTYACC */",
728 #endif /* defined(YYBTYACC) */
729 " if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&",
730 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)",
731 " {",
732 "#if YYDEBUG",
733 " if (yydebug)",
734 " fprintf(stderr, \"%s[%d]: state %d, shifting to state %d\\n\",",
735 " YYDEBUGSTR, yydepth, yystate, yytable[yyn]);",
736 "#endif",
737 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;",
738 " yystate = yytable[yyn];",
739 " *++yystack.s_mark = yytable[yyn];",
740 " *++yystack.l_mark = yylval;",
741 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
742 " *++yystack.p_mark = yylloc;",
743 "#endif",
744 " yychar = YYEMPTY;",
745 " if (yyerrflag > 0) --yyerrflag;",
746 " goto yyloop;",
747 " }",
748 " if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&",
749 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)",
750 " {",
751 " yyn = yytable[yyn];",
752 " goto yyreduce;",
753 " }",
754 " if (yyerrflag != 0) goto yyinrecovery;",
755 #if defined(YYBTYACC)
756 "#if YYBTYACC",
757 "",
758 " yynewerrflag = 1;",
759 " goto yyerrhandler;",
760 " goto yyerrlab; /* redundant goto avoids 'unused label' warning */",
761 "",
762 "yyerrlab:",
763 " /* explicit YYERROR from an action -- pop the rhs of the rule reduced",
764 " * before looking for error recovery */",
765 " yystack.s_mark -= yym;",
766 " yystate = *yystack.s_mark;",
767 " yystack.l_mark -= yym;",
768 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
769 " yystack.p_mark -= yym;",
770 "#endif",
771 "",
772 " yynewerrflag = 0;",
773 "yyerrhandler:",
774 " while (yyps->save)",
775 " {",
776 " int ctry;",
777 " YYParseState *save = yyps->save;",
778 "#if YYDEBUG",
779 " if (yydebug)",
780 " fprintf(stderr, \"%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\\n\",",
781 " YYDEBUGSTR, yydepth, yystate, yyps->save->state,",
782 " (int)(yylvp - yylvals - yyps->save->lexeme));",
783 "#endif",
784 " /* Memorize most forward-looking error state in case it's really an error. */",
785 " if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)",
786 " {",
787 " /* Free old saved error context state */",
788 " if (yyerrctx) yyFreeState(yyerrctx);",
789 " /* Create and fill out new saved error context state */",
790 " yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));",
791 " if (yyerrctx == NULL) goto yyenomem;",
792 " yyerrctx->save = yyps->save;",
793 " yyerrctx->state = yystate;",
794 " yyerrctx->errflag = yyerrflag;",
795 " yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);",
796 " memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));",
797 " yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);",
798 " memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
799 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
800 " yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);",
801 " memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
802 "#endif",
803 " yyerrctx->lexeme = (int) (yylvp - yylvals);",
804 " }",
805 " yylvp = yylvals + save->lexeme;",
806 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
807 " yylpp = yylpsns + save->lexeme;",
808 "#endif",
809 " yylexp = yylexemes + save->lexeme;",
810 " yychar = YYEMPTY;",
811 " yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);",
812 " memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));",
813 " yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);",
814 " memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
815 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
816 " yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);",
817 " memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
818 "#endif",
819 " ctry = ++save->ctry;",
820 " yystate = save->state;",
821 " /* We tried shift, try reduce now */",
822 " if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;",
823 " yyps->save = save->save;",
824 " save->save = NULL;",
825 " yyFreeState(save);",
826 "",
827 " /* Nothing left on the stack -- error */",
828 " if (!yyps->save)",
829 " {",
830 "#if YYDEBUG",
831 " if (yydebug)",
832 " fprintf(stderr, \"%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\\n\",",
833 " YYPREFIX, yydepth);",
834 "#endif",
835 " /* Restore state as it was in the most forward-advanced error */",
836 " yylvp = yylvals + yyerrctx->lexeme;",
837 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
838 " yylpp = yylpsns + yyerrctx->lexeme;",
839 "#endif",
840 " yylexp = yylexemes + yyerrctx->lexeme;",
841 " yychar = yylexp[-1];",
842 " yylval = yylvp[-1];",
843 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
844 " yylloc = yylpp[-1];",
845 "#endif",
846 " yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);",
847 " memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));",
848 " yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);",
849 " memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
850 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
851 " yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);",
852 " memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
853 "#endif",
854 " yystate = yyerrctx->state;",
855 " yyFreeState(yyerrctx);",
856 " yyerrctx = NULL;",
857 " }",
858 " yynewerrflag = 1;",
859 " }",
860 " if (yynewerrflag == 0) goto yyinrecovery;",
861 "#endif /* YYBTYACC */",
862 #endif /* defined(YYBTYACC) */
863 "",
864 " YYERROR_CALL(\"syntax error\");",
865 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
866 " yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */",
867 "#endif",
868 "",
869 "#if !YYBTYACC",
870 " goto yyerrlab; /* redundant goto avoids 'unused label' warning */",
871 "yyerrlab:",
872 "#endif",
873 " ++yynerrs;",
874 "",
875 "yyinrecovery:",
876 " if (yyerrflag < 3)",
877 " {",
878 " yyerrflag = 3;",
879 " for (;;)",
880 " {",
881 " if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&",
882 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)",
883 " {",
884 "#if YYDEBUG",
885 " if (yydebug)",
886 " fprintf(stderr, \"%s[%d]: state %d, error recovery shifting to state %d\\n\",",
887 " YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);",
888 "#endif",
889 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;",
890 " yystate = yytable[yyn];",
891 " *++yystack.s_mark = yytable[yyn];",
892 " *++yystack.l_mark = yylval;",
893 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
894 " /* lookahead position is error end position */",
895 " yyerror_loc_range[2] = yylloc;",
896 " YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */",
897 " *++yystack.p_mark = yyloc;",
898 "#endif",
899 " goto yyloop;",
900 " }",
901 " else",
902 " {",
903 "#if YYDEBUG",
904 " if (yydebug)",
905 " fprintf(stderr, \"%s[%d]: error recovery discarding state %d\\n\",",
906 " YYDEBUGSTR, yydepth, *yystack.s_mark);",
907 "#endif",
908 " if (yystack.s_mark <= yystack.s_base) goto yyabort;",
909 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
910 " /* the current TOS position is the error start position */",
911 " yyerror_loc_range[1] = *yystack.p_mark;",
912 "#endif",
913 "#if defined(YYDESTRUCT_CALL)",
914 #if defined(YYBTYACC)
915 "#if YYBTYACC",
916 " if (!yytrial)",
917 "#endif /* YYBTYACC */",
918 #endif /* defined(YYBTYACC) */
919 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
920 " YYDESTRUCT_CALL(\"error: discarding state\",",
921 " yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);",
922 "#else",
923 " YYDESTRUCT_CALL(\"error: discarding state\",",
924 " yystos[*yystack.s_mark], yystack.l_mark);",
925 "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
926 "#endif /* defined(YYDESTRUCT_CALL) */",
927 " --yystack.s_mark;",
928 " --yystack.l_mark;",
929 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
930 " --yystack.p_mark;",
931 "#endif",
932 " }",
933 " }",
934 " }",
935 " else",
936 " {",
937 " if (yychar == YYEOF) goto yyabort;",
938 "#if YYDEBUG",
939 " if (yydebug)",
940 " {",
941 " if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];",
942 " fprintf(stderr, \"%s[%d]: state %d, error recovery discarding token %d (%s)\\n\",",
943 " YYDEBUGSTR, yydepth, yystate, yychar, yys);",
944 " }",
945 "#endif",
946 "#if defined(YYDESTRUCT_CALL)",
947 #if defined(YYBTYACC)
948 "#if YYBTYACC",
949 " if (!yytrial)",
950 "#endif /* YYBTYACC */",
951 #endif /* defined(YYBTYACC) */
952 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
953 " YYDESTRUCT_CALL(\"error: discarding token\", yychar, &yylval, &yylloc);",
954 "#else",
955 " YYDESTRUCT_CALL(\"error: discarding token\", yychar, &yylval);",
956 "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
957 "#endif /* defined(YYDESTRUCT_CALL) */",
958 " yychar = YYEMPTY;",
959 " goto yyloop;",
960 " }",
961 "",
962 "yyreduce:",
963 " yym = yylen[yyn];",
964 "#if YYDEBUG",
965 " if (yydebug)",
966 " {",
967 " fprintf(stderr, \"%s[%d]: state %d, reducing by rule %d (%s)\",",
968 " YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);",
969 "#ifdef YYSTYPE_TOSTRING",
970 #if defined(YYBTYACC)
971 "#if YYBTYACC",
972 " if (!yytrial)",
973 "#endif /* YYBTYACC */",
974 #endif /* defined(YYBTYACC) */
975 " if (yym > 0)",
976 " {",
977 " int i;",
978 " fputc('<', stderr);",
979 " for (i = yym; i > 0; i--)",
980 " {",
981 " if (i != yym) fputs(\", \", stderr);",
982 " fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],",
983 " yystack.l_mark[1-i]), stderr);",
984 " }",
985 " fputc('>', stderr);",
986 " }",
987 "#endif",
988 " fputc('\\n', stderr);",
989 " }",
990 "#endif",
991 " if (yym > 0)",
992 " yyval = yystack.l_mark[1-yym];",
993 " else",
994 " memset(&yyval, 0, sizeof yyval);",
995 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
996 "",
997 " /* Perform position reduction */",
998 " memset(&yyloc, 0, sizeof(yyloc));",
999 #if defined(YYBTYACC)
1000 "#if YYBTYACC",
1001 " if (!yytrial)",
1002 "#endif /* YYBTYACC */",
1003 #endif /* defined(YYBTYACC) */
1004 " {",
1005 " YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);",
1006 " /* just in case YYERROR is invoked within the action, save",
1007 " the start of the rhs as the error start position */",
1008 " yyerror_loc_range[1] = yystack.p_mark[1-yym];",
1009 " }",
1010 "#endif",
1011 "",
1012 " switch (yyn)",
1013 " {",
1014 0
1015 };
1016
1017 const char *const trailer[] =
1018 {
1019 " default:",
1020 " break;",
1021 " }",
1022 " yystack.s_mark -= yym;",
1023 " yystate = *yystack.s_mark;",
1024 " yystack.l_mark -= yym;",
1025 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1026 " yystack.p_mark -= yym;",
1027 "#endif",
1028 " yym = yylhs[yyn];",
1029 " if (yystate == 0 && yym == 0)",
1030 " {",
1031 "#if YYDEBUG",
1032 " if (yydebug)",
1033 " {",
1034 " fprintf(stderr, \"%s[%d]: after reduction, \", YYDEBUGSTR, yydepth);",
1035 "#ifdef YYSTYPE_TOSTRING",
1036 #if defined(YYBTYACC)
1037 "#if YYBTYACC",
1038 " if (!yytrial)",
1039 "#endif /* YYBTYACC */",
1040 #endif /* defined(YYBTYACC) */
1041 " fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));",
1042 "#endif",
1043 " fprintf(stderr, \"shifting from state 0 to final state %d\\n\", YYFINAL);",
1044 " }",
1045 "#endif",
1046 " yystate = YYFINAL;",
1047 " *++yystack.s_mark = YYFINAL;",
1048 " *++yystack.l_mark = yyval;",
1049 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1050 " *++yystack.p_mark = yyloc;",
1051 "#endif",
1052 " if (yychar < 0)",
1053 " {",
1054 #if defined(YYBTYACC)
1055 "#if YYBTYACC",
1056 " do {",
1057 " if (yylvp < yylve)",
1058 " {",
1059 " /* we're currently re-reading tokens */",
1060 " yylval = *yylvp++;",
1061 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1062 " yylloc = *yylpp++;",
1063 "#endif",
1064 " yychar = *yylexp++;",
1065 " break;",
1066 " }",
1067 " if (yyps->save)",
1068 " {",
1069 " /* in trial mode; save scanner results for future parse attempts */",
1070 " if (yylvp == yylvlim)",
1071 " { /* Enlarge lexical value queue */",
1072 " size_t p = (size_t) (yylvp - yylvals);",
1073 " size_t s = (size_t) (yylvlim - yylvals);",
1074 "",
1075 " s += YYLVQUEUEGROWTH;",
1076 " if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)",
1077 " goto yyenomem;",
1078 " if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)",
1079 " goto yyenomem;",
1080 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1081 " if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)",
1082 " goto yyenomem;",
1083 "#endif",
1084 " yylvp = yylve = yylvals + p;",
1085 " yylvlim = yylvals + s;",
1086 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1087 " yylpp = yylpe = yylpsns + p;",
1088 " yylplim = yylpsns + s;",
1089 "#endif",
1090 " yylexp = yylexemes + p;",
1091 " }",
1092 " *yylexp = (YYINT) YYLEX;",
1093 " *yylvp++ = yylval;",
1094 " yylve++;",
1095 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1096 " *yylpp++ = yylloc;",
1097 " yylpe++;",
1098 "#endif",
1099 " yychar = *yylexp++;",
1100 " break;",
1101 " }",
1102 " /* normal operation, no conflict encountered */",
1103 "#endif /* YYBTYACC */",
1104 #endif /* defined(YYBTYACC) */
1105 " yychar = YYLEX;",
1106 #if defined(YYBTYACC)
1107 "#if YYBTYACC",
1108 " } while (0);",
1109 "#endif /* YYBTYACC */",
1110 #endif /* defined(YYBTYACC) */
1111 " if (yychar < 0) yychar = YYEOF;",
1112 "#if YYDEBUG",
1113 " if (yydebug)",
1114 " {",
1115 " if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];",
1116 " fprintf(stderr, \"%s[%d]: state %d, reading token %d (%s)\\n\",",
1117 " YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);",
1118 " }",
1119 "#endif",
1120 " }",
1121 " if (yychar == YYEOF) goto yyaccept;",
1122 " goto yyloop;",
1123 " }",
1124 " if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&",
1125 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)",
1126 " yystate = yytable[yyn];",
1127 " else",
1128 " yystate = yydgoto[yym];",
1129 "#if YYDEBUG",
1130 " if (yydebug)",
1131 " {",
1132 " fprintf(stderr, \"%s[%d]: after reduction, \", YYDEBUGSTR, yydepth);",
1133 "#ifdef YYSTYPE_TOSTRING",
1134 #if defined(YYBTYACC)
1135 "#if YYBTYACC",
1136 " if (!yytrial)",
1137 "#endif /* YYBTYACC */",
1138 #endif /* defined(YYBTYACC) */
1139 " fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[yystate], yyval));",
1140 "#endif",
1141 " fprintf(stderr, \"shifting from state %d to state %d\\n\", *yystack.s_mark, yystate);",
1142 " }",
1143 "#endif",
1144 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;",
1145 " *++yystack.s_mark = (YYINT) yystate;",
1146 " *++yystack.l_mark = yyval;",
1147 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1148 " *++yystack.p_mark = yyloc;",
1149 "#endif",
1150 " goto yyloop;",
1151 #if defined(YYBTYACC)
1152 "#if YYBTYACC",
1153 "",
1154 " /* Reduction declares that this path is valid. Set yypath and do a full parse */",
1155 "yyvalid:",
1156 " if (yypath) YYABORT;",
1157 " while (yyps->save)",
1158 " {",
1159 " YYParseState *save = yyps->save;",
1160 " yyps->save = save->save;",
1161 " save->save = yypath;",
1162 " yypath = save;",
1163 " }",
1164 "#if YYDEBUG",
1165 " if (yydebug)",
1166 " fprintf(stderr, \"%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\\n\",",
1167 " YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));",
1168 "#endif",
1169 " if (yyerrctx)",
1170 " {",
1171 " yyFreeState(yyerrctx);",
1172 " yyerrctx = NULL;",
1173 " }",
1174 " yylvp = yylvals + yypath->lexeme;",
1175 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1176 " yylpp = yylpsns + yypath->lexeme;",
1177 "#endif",
1178 " yylexp = yylexemes + yypath->lexeme;",
1179 " yychar = YYEMPTY;",
1180 " yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);",
1181 " memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));",
1182 " yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);",
1183 " memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
1184 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1185 " yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);",
1186 " memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
1187 "#endif",
1188 " yystate = yypath->state;",
1189 " goto yyloop;",
1190 "#endif /* YYBTYACC */",
1191 #endif /* defined(YYBTYACC) */
1192 "",
1193 "yyoverflow:",
1194 " YYERROR_CALL(\"yacc stack overflow\");",
1195 #if defined(YYBTYACC)
1196 "#if YYBTYACC",
1197 " goto yyabort_nomem;",
1198 "yyenomem:",
1199 " YYERROR_CALL(\"memory exhausted\");",
1200 "yyabort_nomem:",
1201 "#endif /* YYBTYACC */",
1202 #endif /* defined(YYBTYACC) */
1203 " yyresult = 2;",
1204 " goto yyreturn;",
1205 "",
1206 "yyabort:",
1207 " yyresult = 1;",
1208 " goto yyreturn;",
1209 "",
1210 "yyaccept:",
1211 #if defined(YYBTYACC)
1212 "#if YYBTYACC",
1213 " if (yyps->save) goto yyvalid;",
1214 "#endif /* YYBTYACC */",
1215 #endif /* defined(YYBTYACC) */
1216 " yyresult = 0;",
1217 "",
1218 "yyreturn:",
1219 "#if defined(YYDESTRUCT_CALL)",
1220 " if (yychar != YYEOF && yychar != YYEMPTY)",
1221 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1222 " YYDESTRUCT_CALL(\"cleanup: discarding token\", yychar, &yylval, &yylloc);",
1223 "#else",
1224 " YYDESTRUCT_CALL(\"cleanup: discarding token\", yychar, &yylval);",
1225 "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
1226 "",
1227 " {",
1228 " YYSTYPE *pv;",
1229 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1230 " YYLTYPE *pp;",
1231 "",
1232 " for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)",
1233 " YYDESTRUCT_CALL(\"cleanup: discarding state\",",
1234 " yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);",
1235 "#else",
1236 " for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)",
1237 " YYDESTRUCT_CALL(\"cleanup: discarding state\",",
1238 " yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);",
1239 "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
1240 " }",
1241 "#endif /* defined(YYDESTRUCT_CALL) */",
1242 "",
1243 #if defined(YYBTYACC)
1244 "#if YYBTYACC",
1245 " if (yyerrctx)",
1246 " {",
1247 " yyFreeState(yyerrctx);",
1248 " yyerrctx = NULL;",
1249 " }",
1250 " while (yyps)",
1251 " {",
1252 " YYParseState *save = yyps;",
1253 " yyps = save->save;",
1254 " save->save = NULL;",
1255 " yyFreeState(save);",
1256 " }",
1257 " while (yypath)",
1258 " {",
1259 " YYParseState *save = yypath;",
1260 " yypath = save->save;",
1261 " save->save = NULL;",
1262 " yyFreeState(save);",
1263 " }",
1264 "#endif /* YYBTYACC */",
1265 #endif /* defined(YYBTYACC) */
1266 " yyfreestack(&yystack);",
1267 " return (yyresult);",
1268 "}",
1269 0
1270 };
1271
1272 void
write_section(FILE * fp,const char * const section[])1273 write_section(FILE * fp, const char *const section[])
1274 {
1275 int i;
1276 const char *s;
1277
1278 for (i = 0; (s = section[i]) != 0; ++i)
1279 {
1280 if (fp == code_file)
1281 ++outline;
1282 fprintf(fp, "%s\n", s);
1283 }
1284 }
1285