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