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