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