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