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