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