]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - usr.bin/yacc/tests/regress.06.out
MFC: r264832
[FreeBSD/stable/10.git] / usr.bin / yacc / tests / regress.06.out
1 #ifndef lint
2 static const char yysccsid[] = "@(#)yaccpar     1.9 (Berkeley) 02/21/93";
3 #endif
4
5 #define YYBYACC 1
6 #define YYMAJOR 1
7 #define YYMINOR 9
8 #define YYPATCH 20140101
9
10 #define YYEMPTY        (-1)
11 #define yyclearin      (yychar = YYEMPTY)
12 #define yyerrok        (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
14
15 #define YYPREFIX "yy"
16
17 #define YYPURE 0
18
19 #line 2 "error.y"
20 int yylex(void);
21 static void yyerror(const char *);
22 #line 22 "/dev/stdout"
23
24 #ifndef YYSTYPE
25 typedef int YYSTYPE;
26 #endif
27
28 /* compatibility with bison */
29 #ifdef YYPARSE_PARAM
30 /* compatibility with FreeBSD */
31 # ifdef YYPARSE_PARAM_TYPE
32 #  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
33 # else
34 #  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
35 # endif
36 #else
37 # define YYPARSE_DECL() yyparse(void)
38 #endif
39
40 /* Parameters sent to lex. */
41 #ifdef YYLEX_PARAM
42 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
43 # define YYLEX yylex(YYLEX_PARAM)
44 #else
45 # define YYLEX_DECL() yylex(void)
46 # define YYLEX yylex()
47 #endif
48
49 /* Parameters sent to yyerror. */
50 #ifndef YYERROR_DECL
51 #define YYERROR_DECL() yyerror(const char *s)
52 #endif
53 #ifndef YYERROR_CALL
54 #define YYERROR_CALL(msg) yyerror(msg)
55 #endif
56
57 extern int YYPARSE_DECL();
58
59 #define YYERRCODE 256
60 static const short yylhs[] = {                           -1,
61     0,
62 };
63 static const short yylen[] = {                            2,
64     1,
65 };
66 static const short yydefred[] = {                         0,
67     1,    0,
68 };
69 static const short yydgoto[] = {                          2,
70 };
71 static const short yysindex[] = {                      -256,
72     0,    0,
73 };
74 static const short yyrindex[] = {                         0,
75     0,    0,
76 };
77 static const short yygindex[] = {                         0,
78 };
79 #define YYTABLESIZE 0
80 static const short yytable[] = {                          1,
81 };
82 static const short yycheck[] = {                        256,
83 };
84 #define YYFINAL 2
85 #ifndef YYDEBUG
86 #define YYDEBUG 0
87 #endif
88 #define YYMAXTOKEN 0
89 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
90 #if YYDEBUG
91 static const char *yyname[] = {
92
93 "end-of-file","illegal-symbol",
94 };
95 static const char *yyrule[] = {
96 "$accept : S",
97 "S : error",
98
99 };
100 #endif
101
102 int      yydebug;
103 int      yynerrs;
104
105 int      yyerrflag;
106 int      yychar;
107 YYSTYPE  yyval;
108 YYSTYPE  yylval;
109
110 /* define the initial stack-sizes */
111 #ifdef YYSTACKSIZE
112 #undef YYMAXDEPTH
113 #define YYMAXDEPTH  YYSTACKSIZE
114 #else
115 #ifdef YYMAXDEPTH
116 #define YYSTACKSIZE YYMAXDEPTH
117 #else
118 #define YYSTACKSIZE 10000
119 #define YYMAXDEPTH  10000
120 #endif
121 #endif
122
123 #define YYINITSTACKSIZE 200
124
125 typedef struct {
126     unsigned stacksize;
127     short    *s_base;
128     short    *s_mark;
129     short    *s_last;
130     YYSTYPE  *l_base;
131     YYSTYPE  *l_mark;
132 } YYSTACKDATA;
133 /* variables for the parser stack */
134 static YYSTACKDATA yystack;
135 #line 8 "error.y"
136
137 #include <stdio.h>
138
139 int
140 main(void)
141 {
142     printf("yyparse() = %d\n", yyparse());
143     return 0;
144 }
145
146 int
147 yylex(void)
148 {
149     return -1;
150 }
151
152 static void
153 yyerror(const char* s)
154 {
155     printf("%s\n", s);
156 }
157 #line 156 "/dev/stdout"
158
159 #if YYDEBUG
160 #include <stdio.h>              /* needed for printf */
161 #endif
162
163 #include <stdlib.h>     /* needed for malloc, etc */
164 #include <string.h>     /* needed for memset */
165
166 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
167 static int yygrowstack(YYSTACKDATA *data)
168 {
169     int i;
170     unsigned newsize;
171     short *newss;
172     YYSTYPE *newvs;
173
174     if ((newsize = data->stacksize) == 0)
175         newsize = YYINITSTACKSIZE;
176     else if (newsize >= YYMAXDEPTH)
177         return -1;
178     else if ((newsize *= 2) > YYMAXDEPTH)
179         newsize = YYMAXDEPTH;
180
181     i = (int) (data->s_mark - data->s_base);
182     newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
183     if (newss == 0)
184         return -1;
185
186     data->s_base = newss;
187     data->s_mark = newss + i;
188
189     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
190     if (newvs == 0)
191         return -1;
192
193     data->l_base = newvs;
194     data->l_mark = newvs + i;
195
196     data->stacksize = newsize;
197     data->s_last = data->s_base + newsize - 1;
198     return 0;
199 }
200
201 #if YYPURE || defined(YY_NO_LEAKS)
202 static void yyfreestack(YYSTACKDATA *data)
203 {
204     free(data->s_base);
205     free(data->l_base);
206     memset(data, 0, sizeof(*data));
207 }
208 #else
209 #define yyfreestack(data) /* nothing */
210 #endif
211
212 #define YYABORT  goto yyabort
213 #define YYREJECT goto yyabort
214 #define YYACCEPT goto yyaccept
215 #define YYERROR  goto yyerrlab
216
217 int
218 YYPARSE_DECL()
219 {
220     int yym, yyn, yystate;
221 #if YYDEBUG
222     const char *yys;
223
224     if ((yys = getenv("YYDEBUG")) != 0)
225     {
226         yyn = *yys;
227         if (yyn >= '0' && yyn <= '9')
228             yydebug = yyn - '0';
229     }
230 #endif
231
232     yynerrs = 0;
233     yyerrflag = 0;
234     yychar = YYEMPTY;
235     yystate = 0;
236
237 #if YYPURE
238     memset(&yystack, 0, sizeof(yystack));
239 #endif
240
241     if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
242     yystack.s_mark = yystack.s_base;
243     yystack.l_mark = yystack.l_base;
244     yystate = 0;
245     *yystack.s_mark = 0;
246
247 yyloop:
248     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
249     if (yychar < 0)
250     {
251         if ((yychar = YYLEX) < 0) yychar = 0;
252 #if YYDEBUG
253         if (yydebug)
254         {
255             yys = yyname[YYTRANSLATE(yychar)];
256             printf("%sdebug: state %d, reading %d (%s)\n",
257                     YYPREFIX, yystate, yychar, yys);
258         }
259 #endif
260     }
261     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
262             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
263     {
264 #if YYDEBUG
265         if (yydebug)
266             printf("%sdebug: state %d, shifting to state %d\n",
267                     YYPREFIX, yystate, yytable[yyn]);
268 #endif
269         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
270         {
271             goto yyoverflow;
272         }
273         yystate = yytable[yyn];
274         *++yystack.s_mark = yytable[yyn];
275         *++yystack.l_mark = yylval;
276         yychar = YYEMPTY;
277         if (yyerrflag > 0)  --yyerrflag;
278         goto yyloop;
279     }
280     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
281             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
282     {
283         yyn = yytable[yyn];
284         goto yyreduce;
285     }
286     if (yyerrflag) goto yyinrecovery;
287
288     yyerror("syntax error");
289
290     goto yyerrlab;
291
292 yyerrlab:
293     ++yynerrs;
294
295 yyinrecovery:
296     if (yyerrflag < 3)
297     {
298         yyerrflag = 3;
299         for (;;)
300         {
301             if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
302                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
303             {
304 #if YYDEBUG
305                 if (yydebug)
306                     printf("%sdebug: state %d, error recovery shifting\
307  to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
308 #endif
309                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
310                 {
311                     goto yyoverflow;
312                 }
313                 yystate = yytable[yyn];
314                 *++yystack.s_mark = yytable[yyn];
315                 *++yystack.l_mark = yylval;
316                 goto yyloop;
317             }
318             else
319             {
320 #if YYDEBUG
321                 if (yydebug)
322                     printf("%sdebug: error recovery discarding state %d\n",
323                             YYPREFIX, *yystack.s_mark);
324 #endif
325                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
326                 --yystack.s_mark;
327                 --yystack.l_mark;
328             }
329         }
330     }
331     else
332     {
333         if (yychar == 0) goto yyabort;
334 #if YYDEBUG
335         if (yydebug)
336         {
337             yys = yyname[YYTRANSLATE(yychar)];
338             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
339                     YYPREFIX, yystate, yychar, yys);
340         }
341 #endif
342         yychar = YYEMPTY;
343         goto yyloop;
344     }
345
346 yyreduce:
347 #if YYDEBUG
348     if (yydebug)
349         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
350                 YYPREFIX, yystate, yyn, yyrule[yyn]);
351 #endif
352     yym = yylen[yyn];
353     if (yym)
354         yyval = yystack.l_mark[1-yym];
355     else
356         memset(&yyval, 0, sizeof yyval);
357     switch (yyn)
358     {
359     }
360     yystack.s_mark -= yym;
361     yystate = *yystack.s_mark;
362     yystack.l_mark -= yym;
363     yym = yylhs[yyn];
364     if (yystate == 0 && yym == 0)
365     {
366 #if YYDEBUG
367         if (yydebug)
368             printf("%sdebug: after reduction, shifting from state 0 to\
369  state %d\n", YYPREFIX, YYFINAL);
370 #endif
371         yystate = YYFINAL;
372         *++yystack.s_mark = YYFINAL;
373         *++yystack.l_mark = yyval;
374         if (yychar < 0)
375         {
376             if ((yychar = YYLEX) < 0) yychar = 0;
377 #if YYDEBUG
378             if (yydebug)
379             {
380                 yys = yyname[YYTRANSLATE(yychar)];
381                 printf("%sdebug: state %d, reading %d (%s)\n",
382                         YYPREFIX, YYFINAL, yychar, yys);
383             }
384 #endif
385         }
386         if (yychar == 0) goto yyaccept;
387         goto yyloop;
388     }
389     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
390             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
391         yystate = yytable[yyn];
392     else
393         yystate = yydgoto[yym];
394 #if YYDEBUG
395     if (yydebug)
396         printf("%sdebug: after reduction, shifting from state %d \
397 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
398 #endif
399     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
400     {
401         goto yyoverflow;
402     }
403     *++yystack.s_mark = (short) yystate;
404     *++yystack.l_mark = yyval;
405     goto yyloop;
406
407 yyoverflow:
408     yyerror("yacc stack overflow");
409
410 yyabort:
411     yyfreestack(&yystack);
412     return (1);
413
414 yyaccept:
415     yyfreestack(&yystack);
416     return (0);
417 }