xref: /freebsd/contrib/byacc/btyaccpar.c (revision 3416500aef140042c64bc149cb1ec6620483bc44)
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.6 2017/04/30 23:40:34 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     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
454     "    memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));",
455     "#endif",
456     "",
457     0
458 };
459 
460 const char *const init_vars[] =
461 {
462     "    yyerrflag = 0;",
463     "    yychar = 0;",
464     "    memset(&yyval,  0, sizeof(yyval));",
465     "    memset(&yylval, 0, sizeof(yylval));",
466     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
467     "    memset(&yyloc,  0, sizeof(yyloc));",
468     "    memset(&yylloc, 0, sizeof(yylloc));",
469     "#endif",
470     "",
471     0
472 };
473 
474 const char *const body_3[] =
475 {
476 #if defined(YYBTYACC)
477     "#if YYBTYACC",
478     "    yyps = yyNewState(0); if (yyps == 0) goto yyenomem;",
479     "    yyps->save = 0;",
480     "#endif /* YYBTYACC */",
481 #endif			/* defined(YYBTYACC) */
482     "    yym = 0;",
483     "    yyn = 0;",
484     "    yynerrs = 0;",
485     "    yyerrflag = 0;",
486     "    yychar = YYEMPTY;",
487     "    yystate = 0;",
488     "",
489     "#if YYPURE",
490     "    memset(&yystack, 0, sizeof(yystack));",
491     "#endif",
492     "",
493     "    if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;",
494     "    yystack.s_mark = yystack.s_base;",
495     "    yystack.l_mark = yystack.l_base;",
496     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
497     "    yystack.p_mark = yystack.p_base;",
498     "#endif",
499     "    yystate = 0;",
500     "    *yystack.s_mark = 0;",
501     "",
502     "yyloop:",
503     "    if ((yyn = yydefred[yystate]) != 0) goto yyreduce;",
504     "    if (yychar < 0)",
505     "    {",
506 #if defined(YYBTYACC)
507     "#if YYBTYACC",
508     "        do {",
509     "        if (yylvp < yylve)",
510     "        {",
511     "            /* we're currently re-reading tokens */",
512     "            yylval = *yylvp++;",
513     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
514     "            yylloc = *yylpp++;",
515     "#endif",
516     "            yychar = *yylexp++;",
517     "            break;",
518     "        }",
519     "        if (yyps->save)",
520     "        {",
521     "            /* in trial mode; save scanner results for future parse attempts */",
522     "            if (yylvp == yylvlim)",
523     "            {   /* Enlarge lexical value queue */",
524     "                size_t p = (size_t) (yylvp - yylvals);",
525     "                size_t s = (size_t) (yylvlim - yylvals);",
526     "",
527     "                s += YYLVQUEUEGROWTH;",
528     "                if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;",
529     "                if ((yylvals   = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;",
530     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
531     "                if ((yylpsns   = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;",
532     "#endif",
533     "                yylvp   = yylve = yylvals + p;",
534     "                yylvlim = yylvals + s;",
535     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
536     "                yylpp   = yylpe = yylpsns + p;",
537     "                yylplim = yylpsns + s;",
538     "#endif",
539     "                yylexp  = yylexemes + p;",
540     "            }",
541     "            *yylexp = (YYINT) YYLEX;",
542     "            *yylvp++ = yylval;",
543     "            yylve++;",
544     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
545     "            *yylpp++ = yylloc;",
546     "            yylpe++;",
547     "#endif",
548     "            yychar = *yylexp++;",
549     "            break;",
550     "        }",
551     "        /* normal operation, no conflict encountered */",
552     "#endif /* YYBTYACC */",
553 #endif			/* defined(YYBTYACC) */
554     "        yychar = YYLEX;",
555 #if defined(YYBTYACC)
556     "#if YYBTYACC",
557     "        } while (0);",
558     "#endif /* YYBTYACC */",
559 #endif			/* defined(YYBTYACC) */
560     "        if (yychar < 0) yychar = YYEOF;",
561     "#if YYDEBUG",
562     "        if (yydebug)",
563     "        {",
564     "            if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];",
565     "            fprintf(stderr, \"%s[%d]: state %d, reading token %d (%s)\",",
566     "                            YYDEBUGSTR, yydepth, yystate, yychar, yys);",
567     "#ifdef YYSTYPE_TOSTRING",
568 #if defined(YYBTYACC)
569     "#if YYBTYACC",
570     "            if (!yytrial)",
571     "#endif /* YYBTYACC */",
572 #endif			/* defined(YYBTYACC) */
573     "                fprintf(stderr, \" <%s>\", YYSTYPE_TOSTRING(yychar, yylval));",
574     "#endif",
575     "            fputc('\\n', stderr);",
576     "        }",
577     "#endif",
578     "    }",
579 #if defined(YYBTYACC)
580     "#if YYBTYACC",
581     "",
582     "    /* Do we have a conflict? */",
583     "    if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&",
584     "        yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)",
585     "    {",
586     "        YYINT ctry;",
587     "",
588     "        if (yypath)",
589     "        {",
590     "            YYParseState *save;",
591     "#if YYDEBUG",
592     "            if (yydebug)",
593     "                fprintf(stderr, \"%s[%d]: CONFLICT in state %d: following successful trial parse\\n\",",
594     "                                YYDEBUGSTR, yydepth, yystate);",
595     "#endif",
596     "            /* Switch to the next conflict context */",
597     "            save = yypath;",
598     "            yypath = save->save;",
599     "            save->save = NULL;",
600     "            ctry = save->ctry;",
601     "            if (save->state != yystate) YYABORT;",
602     "            yyFreeState(save);",
603     "",
604     "        }",
605     "        else",
606     "        {",
607     "",
608     "            /* Unresolved conflict - start/continue trial parse */",
609     "            YYParseState *save;",
610     "#if YYDEBUG",
611     "            if (yydebug)",
612     "            {",
613     "                fprintf(stderr, \"%s[%d]: CONFLICT in state %d. \", YYDEBUGSTR, yydepth, yystate);",
614     "                if (yyps->save)",
615     "                    fputs(\"ALREADY in conflict, continuing trial parse.\\n\", stderr);",
616     "                else",
617     "                    fputs(\"Starting trial parse.\\n\", stderr);",
618     "            }",
619     "#endif",
620     "            save                  = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));",
621     "            if (save == NULL) goto yyenomem;",
622     "            save->save            = yyps->save;",
623     "            save->state           = yystate;",
624     "            save->errflag         = yyerrflag;",
625     "            save->yystack.s_mark  = save->yystack.s_base + (yystack.s_mark - yystack.s_base);",
626     "            memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));",
627     "            save->yystack.l_mark  = save->yystack.l_base + (yystack.l_mark - yystack.l_base);",
628     "            memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
629     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
630     "            save->yystack.p_mark  = save->yystack.p_base + (yystack.p_mark - yystack.p_base);",
631     "            memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
632     "#endif",
633     "            ctry                  = yytable[yyn];",
634     "            if (yyctable[ctry] == -1)",
635     "            {",
636     "#if YYDEBUG",
637     "                if (yydebug && yychar >= YYEOF)",
638     "                    fprintf(stderr, \"%s[%d]: backtracking 1 token\\n\", YYDEBUGSTR, yydepth);",
639     "#endif",
640     "                ctry++;",
641     "            }",
642     "            save->ctry = ctry;",
643     "            if (yyps->save == NULL)",
644     "            {",
645     "                /* If this is a first conflict in the stack, start saving lexemes */",
646     "                if (!yylexemes)",
647     "                {",
648     "                    yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));",
649     "                    if (yylexemes == NULL) goto yyenomem;",
650     "                    yylvals   = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));",
651     "                    if (yylvals == NULL) goto yyenomem;",
652     "                    yylvlim   = yylvals + YYLVQUEUEGROWTH;",
653     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
654     "                    yylpsns   = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));",
655     "                    if (yylpsns == NULL) goto yyenomem;",
656     "                    yylplim   = yylpsns + YYLVQUEUEGROWTH;",
657     "#endif",
658     "                }",
659     "                if (yylvp == yylve)",
660     "                {",
661     "                    yylvp  = yylve = yylvals;",
662     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
663     "                    yylpp  = yylpe = yylpsns;",
664     "#endif",
665     "                    yylexp = yylexemes;",
666     "                    if (yychar >= YYEOF)",
667     "                    {",
668     "                        *yylve++ = yylval;",
669     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
670     "                        *yylpe++ = yylloc;",
671     "#endif",
672     "                        *yylexp  = (YYINT) yychar;",
673     "                        yychar   = YYEMPTY;",
674     "                    }",
675     "                }",
676     "            }",
677     "            if (yychar >= YYEOF)",
678     "            {",
679     "                yylvp--;",
680     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
681     "                yylpp--;",
682     "#endif",
683     "                yylexp--;",
684     "                yychar = YYEMPTY;",
685     "            }",
686     "            save->lexeme = (int) (yylvp - yylvals);",
687     "            yyps->save   = save;",
688     "        }",
689     "        if (yytable[yyn] == ctry)",
690     "        {",
691     "#if YYDEBUG",
692     "            if (yydebug)",
693     "                fprintf(stderr, \"%s[%d]: state %d, shifting to state %d\\n\",",
694     "                                YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);",
695     "#endif",
696     "            if (yychar < 0)",
697     "            {",
698     "                yylvp++;",
699     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
700     "                yylpp++;",
701     "#endif",
702     "                yylexp++;",
703     "            }",
704     "            if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)",
705     "                goto yyoverflow;",
706     "            yystate = yyctable[ctry];",
707     "            *++yystack.s_mark = (YYINT) yystate;",
708     "            *++yystack.l_mark = yylval;",
709     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
710     "            *++yystack.p_mark = yylloc;",
711     "#endif",
712     "            yychar  = YYEMPTY;",
713     "            if (yyerrflag > 0) --yyerrflag;",
714     "            goto yyloop;",
715     "        }",
716     "        else",
717     "        {",
718     "            yyn = yyctable[ctry];",
719     "            goto yyreduce;",
720     "        }",
721     "    } /* End of code dealing with conflicts */",
722     "#endif /* YYBTYACC */",
723 #endif			/* defined(YYBTYACC) */
724     "    if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&",
725     "            yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)",
726     "    {",
727     "#if YYDEBUG",
728     "        if (yydebug)",
729     "            fprintf(stderr, \"%s[%d]: state %d, shifting to state %d\\n\",",
730     "                            YYDEBUGSTR, yydepth, yystate, yytable[yyn]);",
731     "#endif",
732     "        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;",
733     "        yystate = yytable[yyn];",
734     "        *++yystack.s_mark = yytable[yyn];",
735     "        *++yystack.l_mark = yylval;",
736     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
737     "        *++yystack.p_mark = yylloc;",
738     "#endif",
739     "        yychar = YYEMPTY;",
740     "        if (yyerrflag > 0)  --yyerrflag;",
741     "        goto yyloop;",
742     "    }",
743     "    if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&",
744     "            yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)",
745     "    {",
746     "        yyn = yytable[yyn];",
747     "        goto yyreduce;",
748     "    }",
749     "    if (yyerrflag != 0) goto yyinrecovery;",
750 #if defined(YYBTYACC)
751     "#if YYBTYACC",
752     "",
753     "    yynewerrflag = 1;",
754     "    goto yyerrhandler;",
755     "    goto yyerrlab; /* redundant goto avoids 'unused label' warning */",
756     "",
757     "yyerrlab:",
758     "    /* explicit YYERROR from an action -- pop the rhs of the rule reduced",
759     "     * before looking for error recovery */",
760     "    yystack.s_mark -= yym;",
761     "    yystate = *yystack.s_mark;",
762     "    yystack.l_mark -= yym;",
763     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
764     "    yystack.p_mark -= yym;",
765     "#endif",
766     "",
767     "    yynewerrflag = 0;",
768     "yyerrhandler:",
769     "    while (yyps->save)",
770     "    {",
771     "        int ctry;",
772     "        YYParseState *save = yyps->save;",
773     "#if YYDEBUG",
774     "        if (yydebug)",
775     "            fprintf(stderr, \"%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\\n\",",
776     "                            YYDEBUGSTR, yydepth, yystate, yyps->save->state,",
777     "                    (int)(yylvp - yylvals - yyps->save->lexeme));",
778     "#endif",
779     "        /* Memorize most forward-looking error state in case it's really an error. */",
780     "        if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)",
781     "        {",
782     "            /* Free old saved error context state */",
783     "            if (yyerrctx) yyFreeState(yyerrctx);",
784     "            /* Create and fill out new saved error context state */",
785     "            yyerrctx                 = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));",
786     "            if (yyerrctx == NULL) goto yyenomem;",
787     "            yyerrctx->save           = yyps->save;",
788     "            yyerrctx->state          = yystate;",
789     "            yyerrctx->errflag        = yyerrflag;",
790     "            yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);",
791     "            memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));",
792     "            yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);",
793     "            memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
794     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
795     "            yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);",
796     "            memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
797     "#endif",
798     "            yyerrctx->lexeme         = (int) (yylvp - yylvals);",
799     "        }",
800     "        yylvp          = yylvals   + save->lexeme;",
801     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
802     "        yylpp          = yylpsns   + save->lexeme;",
803     "#endif",
804     "        yylexp         = yylexemes + save->lexeme;",
805     "        yychar         = YYEMPTY;",
806     "        yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);",
807     "        memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));",
808     "        yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);",
809     "        memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
810     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
811     "        yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);",
812     "        memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
813     "#endif",
814     "        ctry           = ++save->ctry;",
815     "        yystate        = save->state;",
816     "        /* We tried shift, try reduce now */",
817     "        if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;",
818     "        yyps->save     = save->save;",
819     "        save->save     = NULL;",
820     "        yyFreeState(save);",
821     "",
822     "        /* Nothing left on the stack -- error */",
823     "        if (!yyps->save)",
824     "        {",
825     "#if YYDEBUG",
826     "            if (yydebug)",
827     "                fprintf(stderr, \"%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\\n\",",
828     "                                YYPREFIX, yydepth);",
829     "#endif",
830     "            /* Restore state as it was in the most forward-advanced error */",
831     "            yylvp          = yylvals   + yyerrctx->lexeme;",
832     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
833     "            yylpp          = yylpsns   + yyerrctx->lexeme;",
834     "#endif",
835     "            yylexp         = yylexemes + yyerrctx->lexeme;",
836     "            yychar         = yylexp[-1];",
837     "            yylval         = yylvp[-1];",
838     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
839     "            yylloc         = yylpp[-1];",
840     "#endif",
841     "            yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);",
842     "            memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));",
843     "            yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);",
844     "            memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
845     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
846     "            yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);",
847     "            memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
848     "#endif",
849     "            yystate        = yyerrctx->state;",
850     "            yyFreeState(yyerrctx);",
851     "            yyerrctx       = NULL;",
852     "        }",
853     "        yynewerrflag = 1;",
854     "    }",
855     "    if (yynewerrflag == 0) goto yyinrecovery;",
856     "#endif /* YYBTYACC */",
857 #endif			/* defined(YYBTYACC) */
858     "",
859     "    YYERROR_CALL(\"syntax error\");",
860     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
861     "    yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */",
862     "#endif",
863     "",
864     "#if !YYBTYACC",
865     "    goto yyerrlab; /* redundant goto avoids 'unused label' warning */",
866     "yyerrlab:",
867     "#endif",
868     "    ++yynerrs;",
869     "",
870     "yyinrecovery:",
871     "    if (yyerrflag < 3)",
872     "    {",
873     "        yyerrflag = 3;",
874     "        for (;;)",
875     "        {",
876     "            if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&",
877     "                    yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)",
878     "            {",
879     "#if YYDEBUG",
880     "                if (yydebug)",
881     "                    fprintf(stderr, \"%s[%d]: state %d, error recovery shifting to state %d\\n\",",
882     "                                    YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);",
883     "#endif",
884     "                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;",
885     "                yystate = yytable[yyn];",
886     "                *++yystack.s_mark = yytable[yyn];",
887     "                *++yystack.l_mark = yylval;",
888     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
889     "                /* lookahead position is error end position */",
890     "                yyerror_loc_range[1] = yylloc;",
891     "                YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */",
892     "                *++yystack.p_mark = yyloc;",
893     "#endif",
894     "                goto yyloop;",
895     "            }",
896     "            else",
897     "            {",
898     "#if YYDEBUG",
899     "                if (yydebug)",
900     "                    fprintf(stderr, \"%s[%d]: error recovery discarding state %d\\n\",",
901     "                                    YYDEBUGSTR, yydepth, *yystack.s_mark);",
902     "#endif",
903     "                if (yystack.s_mark <= yystack.s_base) goto yyabort;",
904     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
905     "                /* the current TOS position is the error start position */",
906     "                yyerror_loc_range[0] = *yystack.p_mark;",
907     "#endif",
908     "#if defined(YYDESTRUCT_CALL)",
909 #if defined(YYBTYACC)
910     "#if YYBTYACC",
911     "                if (!yytrial)",
912     "#endif /* YYBTYACC */",
913 #endif			/* defined(YYBTYACC) */
914     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
915     "                    YYDESTRUCT_CALL(\"error: discarding state\",",
916     "                                    yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);",
917     "#else",
918     "                    YYDESTRUCT_CALL(\"error: discarding state\",",
919     "                                    yystos[*yystack.s_mark], yystack.l_mark);",
920     "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
921     "#endif /* defined(YYDESTRUCT_CALL) */",
922     "                --yystack.s_mark;",
923     "                --yystack.l_mark;",
924     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
925     "                --yystack.p_mark;",
926     "#endif",
927     "            }",
928     "        }",
929     "    }",
930     "    else",
931     "    {",
932     "        if (yychar == YYEOF) goto yyabort;",
933     "#if YYDEBUG",
934     "        if (yydebug)",
935     "        {",
936     "            if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];",
937     "            fprintf(stderr, \"%s[%d]: state %d, error recovery discarding token %d (%s)\\n\",",
938     "                            YYDEBUGSTR, yydepth, yystate, yychar, yys);",
939     "        }",
940     "#endif",
941     "#if defined(YYDESTRUCT_CALL)",
942 #if defined(YYBTYACC)
943     "#if YYBTYACC",
944     "        if (!yytrial)",
945     "#endif /* YYBTYACC */",
946 #endif			/* defined(YYBTYACC) */
947     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
948     "            YYDESTRUCT_CALL(\"error: discarding token\", yychar, &yylval, &yylloc);",
949     "#else",
950     "            YYDESTRUCT_CALL(\"error: discarding token\", yychar, &yylval);",
951     "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
952     "#endif /* defined(YYDESTRUCT_CALL) */",
953     "        yychar = YYEMPTY;",
954     "        goto yyloop;",
955     "    }",
956     "",
957     "yyreduce:",
958     "    yym = yylen[yyn];",
959     "#if YYDEBUG",
960     "    if (yydebug)",
961     "    {",
962     "        fprintf(stderr, \"%s[%d]: state %d, reducing by rule %d (%s)\",",
963     "                        YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);",
964     "#ifdef YYSTYPE_TOSTRING",
965 #if defined(YYBTYACC)
966     "#if YYBTYACC",
967     "        if (!yytrial)",
968     "#endif /* YYBTYACC */",
969 #endif			/* defined(YYBTYACC) */
970     "            if (yym > 0)",
971     "            {",
972     "                int i;",
973     "                fputc('<', stderr);",
974     "                for (i = yym; i > 0; i--)",
975     "                {",
976     "                    if (i != yym) fputs(\", \", stderr);",
977     "                    fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],",
978     "                                           yystack.l_mark[1-i]), stderr);",
979     "                }",
980     "                fputc('>', stderr);",
981     "            }",
982     "#endif",
983     "        fputc('\\n', stderr);",
984     "    }",
985     "#endif",
986     "    if (yym > 0)",
987     "        yyval = yystack.l_mark[1-yym];",
988     "    else",
989     "        memset(&yyval, 0, sizeof yyval);",
990     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
991     "",
992     "    /* Perform position reduction */",
993     "    memset(&yyloc, 0, sizeof(yyloc));",
994 #if defined(YYBTYACC)
995     "#if YYBTYACC",
996     "    if (!yytrial)",
997     "#endif /* YYBTYACC */",
998 #endif			/* defined(YYBTYACC) */
999     "    {",
1000     "        YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);",
1001     "        /* just in case YYERROR is invoked within the action, save",
1002     "           the start of the rhs as the error start position */",
1003     "        yyerror_loc_range[0] = yystack.p_mark[1-yym];",
1004     "    }",
1005     "#endif",
1006     "",
1007     "    switch (yyn)",
1008     "    {",
1009     0
1010 };
1011 
1012 const char *const trailer[] =
1013 {
1014     "    default:",
1015     "        break;",
1016     "    }",
1017     "    yystack.s_mark -= yym;",
1018     "    yystate = *yystack.s_mark;",
1019     "    yystack.l_mark -= yym;",
1020     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1021     "    yystack.p_mark -= yym;",
1022     "#endif",
1023     "    yym = yylhs[yyn];",
1024     "    if (yystate == 0 && yym == 0)",
1025     "    {",
1026     "#if YYDEBUG",
1027     "        if (yydebug)",
1028     "        {",
1029     "            fprintf(stderr, \"%s[%d]: after reduction, \", YYDEBUGSTR, yydepth);",
1030     "#ifdef YYSTYPE_TOSTRING",
1031 #if defined(YYBTYACC)
1032     "#if YYBTYACC",
1033     "            if (!yytrial)",
1034     "#endif /* YYBTYACC */",
1035 #endif			/* defined(YYBTYACC) */
1036     "                fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));",
1037     "#endif",
1038     "            fprintf(stderr, \"shifting from state 0 to final state %d\\n\", YYFINAL);",
1039     "        }",
1040     "#endif",
1041     "        yystate = YYFINAL;",
1042     "        *++yystack.s_mark = YYFINAL;",
1043     "        *++yystack.l_mark = yyval;",
1044     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1045     "        *++yystack.p_mark = yyloc;",
1046     "#endif",
1047     "        if (yychar < 0)",
1048     "        {",
1049 #if defined(YYBTYACC)
1050     "#if YYBTYACC",
1051     "            do {",
1052     "            if (yylvp < yylve)",
1053     "            {",
1054     "                /* we're currently re-reading tokens */",
1055     "                yylval = *yylvp++;",
1056     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1057     "                yylloc = *yylpp++;",
1058     "#endif",
1059     "                yychar = *yylexp++;",
1060     "                break;",
1061     "            }",
1062     "            if (yyps->save)",
1063     "            {",
1064     "                /* in trial mode; save scanner results for future parse attempts */",
1065     "                if (yylvp == yylvlim)",
1066     "                {   /* Enlarge lexical value queue */",
1067     "                    size_t p = (size_t) (yylvp - yylvals);",
1068     "                    size_t s = (size_t) (yylvlim - yylvals);",
1069     "",
1070     "                    s += YYLVQUEUEGROWTH;",
1071     "                    if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)",
1072     "                        goto yyenomem;",
1073     "                    if ((yylvals   = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)",
1074     "                        goto yyenomem;",
1075     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1076     "                    if ((yylpsns   = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)",
1077     "                        goto yyenomem;",
1078     "#endif",
1079     "                    yylvp   = yylve = yylvals + p;",
1080     "                    yylvlim = yylvals + s;",
1081     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1082     "                    yylpp   = yylpe = yylpsns + p;",
1083     "                    yylplim = yylpsns + s;",
1084     "#endif",
1085     "                    yylexp  = yylexemes + p;",
1086     "                }",
1087     "                *yylexp = (YYINT) YYLEX;",
1088     "                *yylvp++ = yylval;",
1089     "                yylve++;",
1090     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1091     "                *yylpp++ = yylloc;",
1092     "                yylpe++;",
1093     "#endif",
1094     "                yychar = *yylexp++;",
1095     "                break;",
1096     "            }",
1097     "            /* normal operation, no conflict encountered */",
1098     "#endif /* YYBTYACC */",
1099 #endif			/* defined(YYBTYACC) */
1100     "            yychar = YYLEX;",
1101 #if defined(YYBTYACC)
1102     "#if YYBTYACC",
1103     "            } while (0);",
1104     "#endif /* YYBTYACC */",
1105 #endif			/* defined(YYBTYACC) */
1106     "            if (yychar < 0) yychar = YYEOF;",
1107     "#if YYDEBUG",
1108     "            if (yydebug)",
1109     "            {",
1110     "                if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];",
1111     "                fprintf(stderr, \"%s[%d]: state %d, reading token %d (%s)\\n\",",
1112     "                                YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);",
1113     "            }",
1114     "#endif",
1115     "        }",
1116     "        if (yychar == YYEOF) goto yyaccept;",
1117     "        goto yyloop;",
1118     "    }",
1119     "    if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&",
1120     "            yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)",
1121     "        yystate = yytable[yyn];",
1122     "    else",
1123     "        yystate = yydgoto[yym];",
1124     "#if YYDEBUG",
1125     "    if (yydebug)",
1126     "    {",
1127     "        fprintf(stderr, \"%s[%d]: after reduction, \", YYDEBUGSTR, yydepth);",
1128     "#ifdef YYSTYPE_TOSTRING",
1129 #if defined(YYBTYACC)
1130     "#if YYBTYACC",
1131     "        if (!yytrial)",
1132     "#endif /* YYBTYACC */",
1133 #endif			/* defined(YYBTYACC) */
1134     "            fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[yystate], yyval));",
1135     "#endif",
1136     "        fprintf(stderr, \"shifting from state %d to state %d\\n\", *yystack.s_mark, yystate);",
1137     "    }",
1138     "#endif",
1139     "    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;",
1140     "    *++yystack.s_mark = (YYINT) yystate;",
1141     "    *++yystack.l_mark = yyval;",
1142     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1143     "    *++yystack.p_mark = yyloc;",
1144     "#endif",
1145     "    goto yyloop;",
1146 #if defined(YYBTYACC)
1147     "#if YYBTYACC",
1148     "",
1149     "    /* Reduction declares that this path is valid. Set yypath and do a full parse */",
1150     "yyvalid:",
1151     "    if (yypath) YYABORT;",
1152     "    while (yyps->save)",
1153     "    {",
1154     "        YYParseState *save = yyps->save;",
1155     "        yyps->save = save->save;",
1156     "        save->save = yypath;",
1157     "        yypath = save;",
1158     "    }",
1159     "#if YYDEBUG",
1160     "    if (yydebug)",
1161     "        fprintf(stderr, \"%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\\n\",",
1162     "                        YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));",
1163     "#endif",
1164     "    if (yyerrctx)",
1165     "    {",
1166     "        yyFreeState(yyerrctx);",
1167     "        yyerrctx = NULL;",
1168     "    }",
1169     "    yylvp          = yylvals + yypath->lexeme;",
1170     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1171     "    yylpp          = yylpsns + yypath->lexeme;",
1172     "#endif",
1173     "    yylexp         = yylexemes + yypath->lexeme;",
1174     "    yychar         = YYEMPTY;",
1175     "    yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);",
1176     "    memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));",
1177     "    yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);",
1178     "    memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
1179     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1180     "    yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);",
1181     "    memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
1182     "#endif",
1183     "    yystate        = yypath->state;",
1184     "    goto yyloop;",
1185     "#endif /* YYBTYACC */",
1186 #endif			/* defined(YYBTYACC) */
1187     "",
1188     "yyoverflow:",
1189     "    YYERROR_CALL(\"yacc stack overflow\");",
1190 #if defined(YYBTYACC)
1191     "#if YYBTYACC",
1192     "    goto yyabort_nomem;",
1193     "yyenomem:",
1194     "    YYERROR_CALL(\"memory exhausted\");",
1195     "yyabort_nomem:",
1196     "#endif /* YYBTYACC */",
1197 #endif			/* defined(YYBTYACC) */
1198     "    yyresult = 2;",
1199     "    goto yyreturn;",
1200     "",
1201     "yyabort:",
1202     "    yyresult = 1;",
1203     "    goto yyreturn;",
1204     "",
1205     "yyaccept:",
1206 #if defined(YYBTYACC)
1207     "#if YYBTYACC",
1208     "    if (yyps->save) goto yyvalid;",
1209     "#endif /* YYBTYACC */",
1210 #endif			/* defined(YYBTYACC) */
1211     "    yyresult = 0;",
1212     "",
1213     "yyreturn:",
1214     "#if defined(YYDESTRUCT_CALL)",
1215     "    if (yychar != YYEOF && yychar != YYEMPTY)",
1216     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1217     "        YYDESTRUCT_CALL(\"cleanup: discarding token\", yychar, &yylval, &yylloc);",
1218     "#else",
1219     "        YYDESTRUCT_CALL(\"cleanup: discarding token\", yychar, &yylval);",
1220     "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
1221     "",
1222     "    {",
1223     "        YYSTYPE *pv;",
1224     "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1225     "        YYLTYPE *pp;",
1226     "",
1227     "        for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)",
1228     "             YYDESTRUCT_CALL(\"cleanup: discarding state\",",
1229     "                             yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);",
1230     "#else",
1231     "        for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)",
1232     "             YYDESTRUCT_CALL(\"cleanup: discarding state\",",
1233     "                             yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);",
1234     "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
1235     "    }",
1236     "#endif /* defined(YYDESTRUCT_CALL) */",
1237     "",
1238 #if defined(YYBTYACC)
1239     "#if YYBTYACC",
1240     "    if (yyerrctx)",
1241     "    {",
1242     "        yyFreeState(yyerrctx);",
1243     "        yyerrctx = NULL;",
1244     "    }",
1245     "    while (yyps)",
1246     "    {",
1247     "        YYParseState *save = yyps;",
1248     "        yyps = save->save;",
1249     "        save->save = NULL;",
1250     "        yyFreeState(save);",
1251     "    }",
1252     "    while (yypath)",
1253     "    {",
1254     "        YYParseState *save = yypath;",
1255     "        yypath = save->save;",
1256     "        save->save = NULL;",
1257     "        yyFreeState(save);",
1258     "    }",
1259     "#endif /* YYBTYACC */",
1260 #endif			/* defined(YYBTYACC) */
1261     "    yyfreestack(&yystack);",
1262     "    return (yyresult);",
1263     "}",
1264     0
1265 };
1266 
1267 void
1268 write_section(FILE * fp, const char *const section[])
1269 {
1270     int i;
1271     const char *s;
1272 
1273     for (i = 0; (s = section[i]) != 0; ++i)
1274     {
1275 	if (fp == code_file)
1276 	    ++outline;
1277 	fprintf(fp, "%s\n", s);
1278     }
1279 }
1280