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