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