updated with Tizen:Base source codes
[external/byacc.git] / test / error.tab.c
1 #ifndef lint
2 static const char yysccsid[] = "@(#)yaccpar     1.9 (Berkeley) 02/21/93";
3 #endif
4
5 #include <stdlib.h>
6 #include <string.h>
7
8 #define YYBYACC 1
9 #define YYMAJOR 1
10 #define YYMINOR 9
11
12 #define YYEMPTY        (-1)
13 #define yyclearin      (yychar = YYEMPTY)
14 #define yyerrok        (yyerrflag = 0)
15 #define YYRECOVERING() (yyerrflag != 0)
16
17 /* compatibility with bison */
18 #ifdef YYPARSE_PARAM
19 /* compatibility with FreeBSD */
20 #ifdef YYPARSE_PARAM_TYPE
21 #define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
22 #else
23 #define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
24 #endif
25 #else
26 #define YYPARSE_DECL() yyparse(void)
27 #endif /* YYPARSE_PARAM */
28
29 extern int YYPARSE_DECL();
30
31 static int yygrowstack(void);
32 #define yyparse    error_parse
33 #define yylex      error_lex
34 #define yyerror    error_error
35 #define yychar     error_char
36 #define yyval      error_val
37 #define yylval     error_lval
38 #define yydebug    error_debug
39 #define yynerrs    error_nerrs
40 #define yyerrflag  error_errflag
41 #define yyss       error_ss
42 #define yyssp      error_ssp
43 #define yyvs       error_vs
44 #define yyvsp      error_vsp
45 #define yylhs      error_lhs
46 #define yylen      error_len
47 #define yydefred   error_defred
48 #define yydgoto    error_dgoto
49 #define yysindex   error_sindex
50 #define yyrindex   error_rindex
51 #define yygindex   error_gindex
52 #define yytable    error_table
53 #define yycheck    error_check
54 #define yyname     error_name
55 #define yyrule     error_rule
56 #define YYPREFIX "error_"
57 #define YYERRCODE 256
58 static const short error_lhs[] = {                       -1,
59     0,
60 };
61 static const short error_len[] = {                        2,
62     1,
63 };
64 static const short error_defred[] = {                     0,
65     1,    0,
66 };
67 static const short error_dgoto[] = {                      2,
68 };
69 static const short error_sindex[] = {                  -256,
70     0,    0,
71 };
72 static const short error_rindex[] = {                     0,
73     0,    0,
74 };
75 static const short error_gindex[] = {                     0,
76 };
77 #define YYTABLESIZE 0
78 static const short error_table[] = {                      1,
79 };
80 static const short error_check[] = {                    256,
81 };
82 #define YYFINAL 2
83 #ifndef YYDEBUG
84 #define YYDEBUG 0
85 #endif
86 #define YYMAXTOKEN 0
87 #if YYDEBUG
88 static const char *error_name[] = {
89
90 "end-of-file",
91 };
92 static const char *error_rule[] = {
93 "$accept : S",
94 "S : error",
95
96 };
97 #endif
98 #ifndef YYSTYPE
99 typedef int YYSTYPE;
100 #endif
101 #if YYDEBUG
102 #include <stdio.h>
103 #endif
104
105 /* define the initial stack-sizes */
106 #ifdef YYSTACKSIZE
107 #undef YYMAXDEPTH
108 #define YYMAXDEPTH  YYSTACKSIZE
109 #else
110 #ifdef YYMAXDEPTH
111 #define YYSTACKSIZE YYMAXDEPTH
112 #else
113 #define YYSTACKSIZE 500
114 #define YYMAXDEPTH  500
115 #endif
116 #endif
117
118 #define YYINITSTACKSIZE 500
119
120 int      yydebug;
121 int      yynerrs;
122 int      yyerrflag;
123 int      yychar;
124 short   *yyssp;
125 YYSTYPE *yyvsp;
126 YYSTYPE  yyval;
127 YYSTYPE  yylval;
128
129 /* variables for the parser stack */
130 static short   *yyss;
131 static short   *yysslim;
132 static YYSTYPE *yyvs;
133 static unsigned yystacksize;
134 #line 4 "error.y"
135 main(){printf("yyparse() = %d\n",yyparse());}
136 yylex(){return-1;}
137 yyerror(s)char*s;{printf("%s\n",s);}
138 #line 139 "error.tab.c"
139 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
140 static int yygrowstack(void)
141 {
142     int i;
143     unsigned newsize;
144     short *newss;
145     YYSTYPE *newvs;
146
147     if ((newsize = yystacksize) == 0)
148         newsize = YYINITSTACKSIZE;
149     else if (newsize >= YYMAXDEPTH)
150         return -1;
151     else if ((newsize *= 2) > YYMAXDEPTH)
152         newsize = YYMAXDEPTH;
153
154     i = yyssp - yyss;
155     newss = (yyss != 0)
156           ? (short *)realloc(yyss, newsize * sizeof(*newss))
157           : (short *)malloc(newsize * sizeof(*newss));
158     if (newss == 0)
159         return -1;
160
161     yyss  = newss;
162     yyssp = newss + i;
163     newvs = (yyvs != 0)
164           ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs))
165           : (YYSTYPE *)malloc(newsize * sizeof(*newvs));
166     if (newvs == 0)
167         return -1;
168
169     yyvs = newvs;
170     yyvsp = newvs + i;
171     yystacksize = newsize;
172     yysslim = yyss + newsize - 1;
173     return 0;
174 }
175
176 #define YYABORT  goto yyabort
177 #define YYREJECT goto yyabort
178 #define YYACCEPT goto yyaccept
179 #define YYERROR  goto yyerrlab
180
181 int
182 YYPARSE_DECL()
183 {
184     int yym, yyn, yystate;
185 #if YYDEBUG
186     const char *yys;
187
188     if ((yys = getenv("YYDEBUG")) != 0)
189     {
190         yyn = *yys;
191         if (yyn >= '0' && yyn <= '9')
192             yydebug = yyn - '0';
193     }
194 #endif
195
196     yynerrs = 0;
197     yyerrflag = 0;
198     yychar = YYEMPTY;
199     yystate = 0;
200
201     if (yyss == NULL && yygrowstack()) goto yyoverflow;
202     yyssp = yyss;
203     yyvsp = yyvs;
204     yystate = 0;
205     *yyssp = 0;
206
207 yyloop:
208     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
209     if (yychar < 0)
210     {
211         if ((yychar = yylex()) < 0) yychar = 0;
212 #if YYDEBUG
213         if (yydebug)
214         {
215             yys = 0;
216             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
217             if (!yys) yys = "illegal-symbol";
218             printf("%sdebug: state %d, reading %d (%s)\n",
219                     YYPREFIX, yystate, yychar, yys);
220         }
221 #endif
222     }
223     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
224             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
225     {
226 #if YYDEBUG
227         if (yydebug)
228             printf("%sdebug: state %d, shifting to state %d\n",
229                     YYPREFIX, yystate, yytable[yyn]);
230 #endif
231         if (yyssp >= yysslim && yygrowstack())
232         {
233             goto yyoverflow;
234         }
235         yystate = yytable[yyn];
236         *++yyssp = yytable[yyn];
237         *++yyvsp = yylval;
238         yychar = YYEMPTY;
239         if (yyerrflag > 0)  --yyerrflag;
240         goto yyloop;
241     }
242     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
243             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
244     {
245         yyn = yytable[yyn];
246         goto yyreduce;
247     }
248     if (yyerrflag) goto yyinrecovery;
249
250     yyerror("syntax error");
251
252     goto yyerrlab;
253
254 yyerrlab:
255     ++yynerrs;
256
257 yyinrecovery:
258     if (yyerrflag < 3)
259     {
260         yyerrflag = 3;
261         for (;;)
262         {
263             if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
264                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
265             {
266 #if YYDEBUG
267                 if (yydebug)
268                     printf("%sdebug: state %d, error recovery shifting\
269  to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
270 #endif
271                 if (yyssp >= yysslim && yygrowstack())
272                 {
273                     goto yyoverflow;
274                 }
275                 yystate = yytable[yyn];
276                 *++yyssp = yytable[yyn];
277                 *++yyvsp = yylval;
278                 goto yyloop;
279             }
280             else
281             {
282 #if YYDEBUG
283                 if (yydebug)
284                     printf("%sdebug: error recovery discarding state %d\n",
285                             YYPREFIX, *yyssp);
286 #endif
287                 if (yyssp <= yyss) goto yyabort;
288                 --yyssp;
289                 --yyvsp;
290             }
291         }
292     }
293     else
294     {
295         if (yychar == 0) goto yyabort;
296 #if YYDEBUG
297         if (yydebug)
298         {
299             yys = 0;
300             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
301             if (!yys) yys = "illegal-symbol";
302             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
303                     YYPREFIX, yystate, yychar, yys);
304         }
305 #endif
306         yychar = YYEMPTY;
307         goto yyloop;
308     }
309
310 yyreduce:
311 #if YYDEBUG
312     if (yydebug)
313         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
314                 YYPREFIX, yystate, yyn, yyrule[yyn]);
315 #endif
316     yym = yylen[yyn];
317     if (yym)
318         yyval = yyvsp[1-yym];
319     else
320         memset(&yyval, 0, sizeof yyval);
321     switch (yyn)
322     {
323     }
324     yyssp -= yym;
325     yystate = *yyssp;
326     yyvsp -= yym;
327     yym = yylhs[yyn];
328     if (yystate == 0 && yym == 0)
329     {
330 #if YYDEBUG
331         if (yydebug)
332             printf("%sdebug: after reduction, shifting from state 0 to\
333  state %d\n", YYPREFIX, YYFINAL);
334 #endif
335         yystate = YYFINAL;
336         *++yyssp = YYFINAL;
337         *++yyvsp = yyval;
338         if (yychar < 0)
339         {
340             if ((yychar = yylex()) < 0) yychar = 0;
341 #if YYDEBUG
342             if (yydebug)
343             {
344                 yys = 0;
345                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
346                 if (!yys) yys = "illegal-symbol";
347                 printf("%sdebug: state %d, reading %d (%s)\n",
348                         YYPREFIX, YYFINAL, yychar, yys);
349             }
350 #endif
351         }
352         if (yychar == 0) goto yyaccept;
353         goto yyloop;
354     }
355     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
356             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
357         yystate = yytable[yyn];
358     else
359         yystate = yydgoto[yym];
360 #if YYDEBUG
361     if (yydebug)
362         printf("%sdebug: after reduction, shifting from state %d \
363 to state %d\n", YYPREFIX, *yyssp, yystate);
364 #endif
365     if (yyssp >= yysslim && yygrowstack())
366     {
367         goto yyoverflow;
368     }
369     *++yyssp = (short) yystate;
370     *++yyvsp = yyval;
371     goto yyloop;
372
373 yyoverflow:
374     yyerror("yacc stack overflow");
375
376 yyabort:
377     return (1);
378
379 yyaccept:
380     return (0);
381 }