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