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