xref: /netbsd-src/external/bsd/byacc/dist/test/yacc/err_syntax12.tab.c (revision d90047b5d07facf36e6c01dcc0bded8997ce9cc2)
1 /*	$NetBSD: err_syntax12.tab.c,v 1.3 2018/12/23 15:38:54 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 #if YYDEBUG
202 int      yydebug;
203 #endif
204 
205 int      yyerrflag;
206 int      yychar;
207 YYSTYPE  yyval;
208 YYSTYPE  yylval;
209 int      yynerrs;
210 
211 /* define the initial stack-sizes */
212 #ifdef YYSTACKSIZE
213 #undef YYMAXDEPTH
214 #define YYMAXDEPTH  YYSTACKSIZE
215 #else
216 #ifdef YYMAXDEPTH
217 #define YYSTACKSIZE YYMAXDEPTH
218 #else
219 #define YYSTACKSIZE 10000
220 #define YYMAXDEPTH  10000
221 #endif
222 #endif
223 
224 #define YYINITSTACKSIZE 200
225 
226 typedef struct {
227     unsigned stacksize;
228     YYINT    *s_base;
229     YYINT    *s_mark;
230     YYINT    *s_last;
231     YYSTYPE  *l_base;
232     YYSTYPE  *l_mark;
233 } YYSTACKDATA;
234 /* variables for the parser stack */
235 static YYSTACKDATA yystack;
236 #line 12 "err_syntax12.y"
237 
238 #include <stdio.h>
239 
240 int
241 main(void)
242 {
243     printf("yyparse() = %d\n", yyparse());
244     return 0;
245 }
246 
247 int
248 yylex(void)
249 {
250     return -1;
251 }
252 
253 static void
254 yyerror(const char* s)
255 {
256     printf("%s\n", s);
257 }
258 #line 257 "err_syntax12.tab.c"
259 
260 #if YYDEBUG
261 #include <stdio.h>	/* needed for printf */
262 #endif
263 
264 #include <stdlib.h>	/* needed for malloc, etc */
265 #include <string.h>	/* needed for memset */
266 
267 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
268 static int yygrowstack(YYSTACKDATA *data)
269 {
270     int i;
271     unsigned newsize;
272     YYINT *newss;
273     YYSTYPE *newvs;
274 
275     if ((newsize = data->stacksize) == 0)
276         newsize = YYINITSTACKSIZE;
277     else if (newsize >= YYMAXDEPTH)
278         return YYENOMEM;
279     else if ((newsize *= 2) > YYMAXDEPTH)
280         newsize = YYMAXDEPTH;
281 
282     i = (int) (data->s_mark - data->s_base);
283     newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
284     if (newss == 0)
285         return YYENOMEM;
286 
287     data->s_base = newss;
288     data->s_mark = newss + i;
289 
290     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
291     if (newvs == 0)
292         return YYENOMEM;
293 
294     data->l_base = newvs;
295     data->l_mark = newvs + i;
296 
297     data->stacksize = newsize;
298     data->s_last = data->s_base + newsize - 1;
299     return 0;
300 }
301 
302 #if YYPURE || defined(YY_NO_LEAKS)
303 static void yyfreestack(YYSTACKDATA *data)
304 {
305     free(data->s_base);
306     free(data->l_base);
307     memset(data, 0, sizeof(*data));
308 }
309 #else
310 #define yyfreestack(data) /* nothing */
311 #endif
312 
313 #define YYABORT  goto yyabort
314 #define YYREJECT goto yyabort
315 #define YYACCEPT goto yyaccept
316 #define YYERROR  goto yyerrlab
317 
318 int
319 YYPARSE_DECL()
320 {
321     int yym, yyn, yystate;
322 #if YYDEBUG
323     const char *yys;
324 
325     if ((yys = getenv("YYDEBUG")) != 0)
326     {
327         yyn = *yys;
328         if (yyn >= '0' && yyn <= '9')
329             yydebug = yyn - '0';
330     }
331 #endif
332 
333     yym = 0;
334     yyn = 0;
335     yynerrs = 0;
336     yyerrflag = 0;
337     yychar = YYEMPTY;
338     yystate = 0;
339 
340 #if YYPURE
341     memset(&yystack, 0, sizeof(yystack));
342 #endif
343 
344     if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
345     yystack.s_mark = yystack.s_base;
346     yystack.l_mark = yystack.l_base;
347     yystate = 0;
348     *yystack.s_mark = 0;
349 
350 yyloop:
351     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
352     if (yychar < 0)
353     {
354         yychar = YYLEX;
355         if (yychar < 0) yychar = YYEOF;
356 #if YYDEBUG
357         if (yydebug)
358         {
359             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
360             printf("%sdebug: state %d, reading %d (%s)\n",
361                     YYPREFIX, yystate, yychar, yys);
362         }
363 #endif
364     }
365     if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
366             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
367     {
368 #if YYDEBUG
369         if (yydebug)
370             printf("%sdebug: state %d, shifting to state %d\n",
371                     YYPREFIX, yystate, yytable[yyn]);
372 #endif
373         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
374         yystate = yytable[yyn];
375         *++yystack.s_mark = yytable[yyn];
376         *++yystack.l_mark = yylval;
377         yychar = YYEMPTY;
378         if (yyerrflag > 0)  --yyerrflag;
379         goto yyloop;
380     }
381     if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
382             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
383     {
384         yyn = yytable[yyn];
385         goto yyreduce;
386     }
387     if (yyerrflag != 0) goto yyinrecovery;
388 
389     YYERROR_CALL("syntax error");
390 
391     goto yyerrlab; /* redundant goto avoids 'unused label' warning */
392 yyerrlab:
393     ++yynerrs;
394 
395 yyinrecovery:
396     if (yyerrflag < 3)
397     {
398         yyerrflag = 3;
399         for (;;)
400         {
401             if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
402                     yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
403             {
404 #if YYDEBUG
405                 if (yydebug)
406                     printf("%sdebug: state %d, error recovery shifting\
407  to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
408 #endif
409                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
410                 yystate = yytable[yyn];
411                 *++yystack.s_mark = yytable[yyn];
412                 *++yystack.l_mark = yylval;
413                 goto yyloop;
414             }
415             else
416             {
417 #if YYDEBUG
418                 if (yydebug)
419                     printf("%sdebug: error recovery discarding state %d\n",
420                             YYPREFIX, *yystack.s_mark);
421 #endif
422                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
423                 --yystack.s_mark;
424                 --yystack.l_mark;
425             }
426         }
427     }
428     else
429     {
430         if (yychar == YYEOF) goto yyabort;
431 #if YYDEBUG
432         if (yydebug)
433         {
434             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
435             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
436                     YYPREFIX, yystate, yychar, yys);
437         }
438 #endif
439         yychar = YYEMPTY;
440         goto yyloop;
441     }
442 
443 yyreduce:
444 #if YYDEBUG
445     if (yydebug)
446         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
447                 YYPREFIX, yystate, yyn, yyrule[yyn]);
448 #endif
449     yym = yylen[yyn];
450     if (yym > 0)
451         yyval = yystack.l_mark[1-yym];
452     else
453         memset(&yyval, 0, sizeof yyval);
454 
455     switch (yyn)
456     {
457     }
458     yystack.s_mark -= yym;
459     yystate = *yystack.s_mark;
460     yystack.l_mark -= yym;
461     yym = yylhs[yyn];
462     if (yystate == 0 && yym == 0)
463     {
464 #if YYDEBUG
465         if (yydebug)
466             printf("%sdebug: after reduction, shifting from state 0 to\
467  state %d\n", YYPREFIX, YYFINAL);
468 #endif
469         yystate = YYFINAL;
470         *++yystack.s_mark = YYFINAL;
471         *++yystack.l_mark = yyval;
472         if (yychar < 0)
473         {
474             yychar = YYLEX;
475             if (yychar < 0) yychar = YYEOF;
476 #if YYDEBUG
477             if (yydebug)
478             {
479                 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
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]) != 0) && (yyn += yystate) >= 0 &&
489             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) 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) goto yyoverflow;
499     *++yystack.s_mark = (YYINT) yystate;
500     *++yystack.l_mark = yyval;
501     goto yyloop;
502 
503 yyoverflow:
504     YYERROR_CALL("yacc stack overflow");
505 
506 yyabort:
507     yyfreestack(&yystack);
508     return (1);
509 
510 yyaccept:
511     yyfreestack(&yystack);
512     return (0);
513 }
514