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