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