1/* original parser id follows */
2/* yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93" */
3/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
4
5#define YYBYACC 1
6#define YYMAJOR 1
7#define YYMINOR 9
8#define YYCHECK "yyyymmdd"
9
10#define YYEMPTY        (-1)
11#define yyclearin      (yychar = YYEMPTY)
12#define yyerrok        (yyerrflag = 0)
13#define YYRECOVERING() (yyerrflag != 0)
14#define YYENOMEM       (-2)
15#define YYEOF          0
16
17#ifndef yyparse
18#define yyparse    err_syntax20_parse
19#endif /* yyparse */
20
21#ifndef yylex
22#define yylex      err_syntax20_lex
23#endif /* yylex */
24
25#ifndef yyerror
26#define yyerror    err_syntax20_error
27#endif /* yyerror */
28
29#ifndef yychar
30#define yychar     err_syntax20_char
31#endif /* yychar */
32
33#ifndef yyval
34#define yyval      err_syntax20_val
35#endif /* yyval */
36
37#ifndef yylval
38#define yylval     err_syntax20_lval
39#endif /* yylval */
40
41#ifndef yydebug
42#define yydebug    err_syntax20_debug
43#endif /* yydebug */
44
45#ifndef yynerrs
46#define yynerrs    err_syntax20_nerrs
47#endif /* yynerrs */
48
49#ifndef yyerrflag
50#define yyerrflag  err_syntax20_errflag
51#endif /* yyerrflag */
52
53#ifndef yylhs
54#define yylhs      err_syntax20_lhs
55#endif /* yylhs */
56
57#ifndef yylen
58#define yylen      err_syntax20_len
59#endif /* yylen */
60
61#ifndef yydefred
62#define yydefred   err_syntax20_defred
63#endif /* yydefred */
64
65#ifndef yydgoto
66#define yydgoto    err_syntax20_dgoto
67#endif /* yydgoto */
68
69#ifndef yysindex
70#define yysindex   err_syntax20_sindex
71#endif /* yysindex */
72
73#ifndef yyrindex
74#define yyrindex   err_syntax20_rindex
75#endif /* yyrindex */
76
77#ifndef yygindex
78#define yygindex   err_syntax20_gindex
79#endif /* yygindex */
80
81#ifndef yytable
82#define yytable    err_syntax20_table
83#endif /* yytable */
84
85#ifndef yycheck
86#define yycheck    err_syntax20_check
87#endif /* yycheck */
88
89#ifndef yyname
90#define yyname     err_syntax20_name
91#endif /* yyname */
92
93#ifndef yyrule
94#define yyrule     err_syntax20_rule
95#endif /* yyrule */
96#define YYPREFIX "err_syntax20_"
97
98#define YYPURE 0
99
100#line 2 "err_syntax20.y"
101int yylex(void);
102static void yyerror(const char *);
103#line 104 "err_syntax20.tab.c"
104
105/* compatibility with bison */
106#ifdef YYPARSE_PARAM
107/* compatibility with FreeBSD */
108# ifdef YYPARSE_PARAM_TYPE
109#  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
110# else
111#  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
112# endif
113#else
114# define YYPARSE_DECL() yyparse(void)
115#endif
116
117/* Parameters sent to lex. */
118#ifdef YYLEX_PARAM
119# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
120# define YYLEX yylex(YYLEX_PARAM)
121#else
122# define YYLEX_DECL() yylex(void)
123# define YYLEX yylex()
124#endif
125
126/* Parameters sent to yyerror. */
127#ifndef YYERROR_DECL
128#define YYERROR_DECL() yyerror(const char *s)
129#endif
130#ifndef YYERROR_CALL
131#define YYERROR_CALL(msg) yyerror(msg)
132#endif
133
134extern int YYPARSE_DECL();
135
136#define recur 257
137#define YYERRCODE 256
138typedef int YYINT;
139static const YYINT err_syntax20_lhs[] = {                -1,
140    0,
141};
142static const YYINT err_syntax20_len[] = {                 2,
143    3,
144};
145static const YYINT err_syntax20_defred[] = {              0,
146    0,    0,    0,    1,
147};
148static const YYINT err_syntax20_dgoto[] = {               2,
149};
150static const YYINT err_syntax20_sindex[] = {            -40,
151 -256,    0,  -39,    0,
152};
153static const YYINT err_syntax20_rindex[] = {              0,
154    0,    0,    0,    0,
155};
156static const YYINT err_syntax20_gindex[] = {              0,
157};
158#define YYTABLESIZE 2
159static const YYINT err_syntax20_table[] = {               1,
160    3,    4,
161};
162static const YYINT err_syntax20_check[] = {              40,
163  257,   41,
164};
165#define YYFINAL 2
166#ifndef YYDEBUG
167#define YYDEBUG 0
168#endif
169#define YYMAXTOKEN 257
170#define YYUNDFTOKEN 260
171#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
172#if YYDEBUG
173static const char *const err_syntax20_name[] = {
174
175"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1760,0,0,0,0,0,"'('","')'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1770,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1780,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1790,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1810,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"recur",0,0,
182"illegal-symbol",
183};
184static const char *const err_syntax20_rule[] = {
185"$accept : expr",
186"expr : '(' recur ')'",
187
188};
189#endif
190
191int      yydebug;
192int      yynerrs;
193
194int      yyerrflag;
195int      yychar;
196YYSTYPE  yyval;
197YYSTYPE  yylval;
198
199/* define the initial stack-sizes */
200#ifdef YYSTACKSIZE
201#undef YYMAXDEPTH
202#define YYMAXDEPTH  YYSTACKSIZE
203#else
204#ifdef YYMAXDEPTH
205#define YYSTACKSIZE YYMAXDEPTH
206#else
207#define YYSTACKSIZE 10000
208#define YYMAXDEPTH  10000
209#endif
210#endif
211
212#define YYINITSTACKSIZE 200
213
214typedef struct {
215    unsigned stacksize;
216    YYINT    *s_base;
217    YYINT    *s_mark;
218    YYINT    *s_last;
219    YYSTYPE  *l_base;
220    YYSTYPE  *l_mark;
221} YYSTACKDATA;
222/* variables for the parser stack */
223static YYSTACKDATA yystack;
224#line 16 "err_syntax20.y"
225
226#include <stdio.h>
227
228int
229main(void)
230{
231    printf("yyparse() = %d\n", yyparse());
232    return 0;
233}
234
235int
236yylex(void)
237{
238    return -1;
239}
240
241static void
242yyerror(const char* s)
243{
244    printf("%s\n", s);
245}
246#line 247 "err_syntax20.tab.c"
247
248#if YYDEBUG
249#include <stdio.h>	/* needed for printf */
250#endif
251
252#include <stdlib.h>	/* needed for malloc, etc */
253#include <string.h>	/* needed for memset */
254
255/* allocate initial stack or double stack size, up to YYMAXDEPTH */
256static int yygrowstack(YYSTACKDATA *data)
257{
258    int i;
259    unsigned newsize;
260    YYINT *newss;
261    YYSTYPE *newvs;
262
263    if ((newsize = data->stacksize) == 0)
264        newsize = YYINITSTACKSIZE;
265    else if (newsize >= YYMAXDEPTH)
266        return YYENOMEM;
267    else if ((newsize *= 2) > YYMAXDEPTH)
268        newsize = YYMAXDEPTH;
269
270    i = (int) (data->s_mark - data->s_base);
271    newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
272    if (newss == 0)
273        return YYENOMEM;
274
275    data->s_base = newss;
276    data->s_mark = newss + i;
277
278    newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
279    if (newvs == 0)
280        return YYENOMEM;
281
282    data->l_base = newvs;
283    data->l_mark = newvs + i;
284
285    data->stacksize = newsize;
286    data->s_last = data->s_base + newsize - 1;
287    return 0;
288}
289
290#if YYPURE || defined(YY_NO_LEAKS)
291static void yyfreestack(YYSTACKDATA *data)
292{
293    free(data->s_base);
294    free(data->l_base);
295    memset(data, 0, sizeof(*data));
296}
297#else
298#define yyfreestack(data) /* nothing */
299#endif
300
301#define YYABORT  goto yyabort
302#define YYREJECT goto yyabort
303#define YYACCEPT goto yyaccept
304#define YYERROR  goto yyerrlab
305
306int
307YYPARSE_DECL()
308{
309    int yym, yyn, yystate;
310#if YYDEBUG
311    const char *yys;
312
313    if ((yys = getenv("YYDEBUG")) != 0)
314    {
315        yyn = *yys;
316        if (yyn >= '0' && yyn <= '9')
317            yydebug = yyn - '0';
318    }
319#endif
320
321    yym = 0;
322    yyn = 0;
323    yynerrs = 0;
324    yyerrflag = 0;
325    yychar = YYEMPTY;
326    yystate = 0;
327
328#if YYPURE
329    memset(&yystack, 0, sizeof(yystack));
330#endif
331
332    if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
333    yystack.s_mark = yystack.s_base;
334    yystack.l_mark = yystack.l_base;
335    yystate = 0;
336    *yystack.s_mark = 0;
337
338yyloop:
339    if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
340    if (yychar < 0)
341    {
342        yychar = YYLEX;
343        if (yychar < 0) yychar = YYEOF;
344#if YYDEBUG
345        if (yydebug)
346        {
347            if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
348            printf("%sdebug: state %d, reading %d (%s)\n",
349                    YYPREFIX, yystate, yychar, yys);
350        }
351#endif
352    }
353    if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
354            yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
355    {
356#if YYDEBUG
357        if (yydebug)
358            printf("%sdebug: state %d, shifting to state %d\n",
359                    YYPREFIX, yystate, yytable[yyn]);
360#endif
361        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
362        yystate = yytable[yyn];
363        *++yystack.s_mark = yytable[yyn];
364        *++yystack.l_mark = yylval;
365        yychar = YYEMPTY;
366        if (yyerrflag > 0)  --yyerrflag;
367        goto yyloop;
368    }
369    if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
370            yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
371    {
372        yyn = yytable[yyn];
373        goto yyreduce;
374    }
375    if (yyerrflag != 0) goto yyinrecovery;
376
377    YYERROR_CALL("syntax error");
378
379    goto yyerrlab; /* redundant goto avoids 'unused label' warning */
380yyerrlab:
381    ++yynerrs;
382
383yyinrecovery:
384    if (yyerrflag < 3)
385    {
386        yyerrflag = 3;
387        for (;;)
388        {
389            if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
390                    yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
391            {
392#if YYDEBUG
393                if (yydebug)
394                    printf("%sdebug: state %d, error recovery shifting\
395 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
396#endif
397                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
398                yystate = yytable[yyn];
399                *++yystack.s_mark = yytable[yyn];
400                *++yystack.l_mark = yylval;
401                goto yyloop;
402            }
403            else
404            {
405#if YYDEBUG
406                if (yydebug)
407                    printf("%sdebug: error recovery discarding state %d\n",
408                            YYPREFIX, *yystack.s_mark);
409#endif
410                if (yystack.s_mark <= yystack.s_base) goto yyabort;
411                --yystack.s_mark;
412                --yystack.l_mark;
413            }
414        }
415    }
416    else
417    {
418        if (yychar == YYEOF) goto yyabort;
419#if YYDEBUG
420        if (yydebug)
421        {
422            if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
423            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
424                    YYPREFIX, yystate, yychar, yys);
425        }
426#endif
427        yychar = YYEMPTY;
428        goto yyloop;
429    }
430
431yyreduce:
432#if YYDEBUG
433    if (yydebug)
434        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
435                YYPREFIX, yystate, yyn, yyrule[yyn]);
436#endif
437    yym = yylen[yyn];
438    if (yym > 0)
439        yyval = yystack.l_mark[1-yym];
440    else
441        memset(&yyval, 0, sizeof yyval);
442
443    switch (yyn)
444    {
445case 1:
446#line 12 "err_syntax20.y"
447	{ yystack.l_mark[-1].rechk = 3; }
448break;
449#line 450 "err_syntax20.tab.c"
450    }
451    yystack.s_mark -= yym;
452    yystate = *yystack.s_mark;
453    yystack.l_mark -= yym;
454    yym = yylhs[yyn];
455    if (yystate == 0 && yym == 0)
456    {
457#if YYDEBUG
458        if (yydebug)
459            printf("%sdebug: after reduction, shifting from state 0 to\
460 state %d\n", YYPREFIX, YYFINAL);
461#endif
462        yystate = YYFINAL;
463        *++yystack.s_mark = YYFINAL;
464        *++yystack.l_mark = yyval;
465        if (yychar < 0)
466        {
467            yychar = YYLEX;
468            if (yychar < 0) yychar = YYEOF;
469#if YYDEBUG
470            if (yydebug)
471            {
472                if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
473                printf("%sdebug: state %d, reading %d (%s)\n",
474                        YYPREFIX, YYFINAL, yychar, yys);
475            }
476#endif
477        }
478        if (yychar == YYEOF) goto yyaccept;
479        goto yyloop;
480    }
481    if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
482            yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
483        yystate = yytable[yyn];
484    else
485        yystate = yydgoto[yym];
486#if YYDEBUG
487    if (yydebug)
488        printf("%sdebug: after reduction, shifting from state %d \
489to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
490#endif
491    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
492    *++yystack.s_mark = (YYINT) yystate;
493    *++yystack.l_mark = yyval;
494    goto yyloop;
495
496yyoverflow:
497    YYERROR_CALL("yacc stack overflow");
498
499yyabort:
500    yyfreestack(&yystack);
501    return (1);
502
503yyaccept:
504    yyfreestack(&yystack);
505    return (0);
506}
507