2 static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
10 #define yyclearin (yychar = YYEMPTY)
11 #define yyerrok (yyerrflag = 0)
12 #define YYRECOVERING() (yyerrflag != 0)
18 #line 2 "pure_error.y"
22 #define YYLEX_PARAM &yylval
23 #define YYLEX_DECL() yylex(YYSTYPE *yylval)
24 #define YYERROR_DECL() yyerror(const char *s)
26 static void YYERROR_DECL();
29 #line 29 "/dev/stdout"
35 /* compatibility with bison */
37 /* compatibility with FreeBSD */
38 # ifdef YYPARSE_PARAM_TYPE
39 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
41 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
44 # define YYPARSE_DECL() yyparse(void)
47 /* Parameters sent to lex. */
49 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
50 # define YYLEX yylex(YYLEX_PARAM)
52 # define YYLEX_DECL() yylex(void)
53 # define YYLEX yylex()
56 /* Parameters sent to yyerror. */
58 #define YYERROR_DECL() yyerror(const char *s)
61 #define YYERROR_CALL(msg) yyerror(msg)
64 extern int YYPARSE_DECL();
67 static const short yylhs[] = { -1,
70 static const short yylen[] = { 2,
73 static const short yydefred[] = { 0,
76 static const short yydgoto[] = { 2,
78 static const short yysindex[] = { -256,
81 static const short yyrindex[] = { 0,
84 static const short yygindex[] = { 0,
87 static const short yytable[] = { 1,
89 static const short yycheck[] = { 256,
97 static const char *yyname[] = {
101 static const char *yyrule[] = {
116 /* define the initial stack-sizes */
119 #define YYMAXDEPTH YYSTACKSIZE
122 #define YYSTACKSIZE YYMAXDEPTH
124 #define YYSTACKSIZE 500
125 #define YYMAXDEPTH 500
129 #define YYINITSTACKSIZE 500
139 /* variables for the parser stack */
140 static YYSTACKDATA yystack;
141 #line 17 "pure_error.y"
146 extern int YYLEX_DECL();
152 printf("yyparse() = %d\n", yyparse());
157 yylex(YYSTYPE *value)
159 return value ? 0 : -1;
163 yyerror(const char* s)
167 #line 167 "/dev/stdout"
170 #include <stdio.h> /* needed for printf */
173 #include <stdlib.h> /* needed for malloc, etc */
174 #include <string.h> /* needed for memset */
176 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
177 static int yygrowstack(YYSTACKDATA *data)
184 if ((newsize = data->stacksize) == 0)
185 newsize = YYINITSTACKSIZE;
186 else if (newsize >= YYMAXDEPTH)
188 else if ((newsize *= 2) > YYMAXDEPTH)
189 newsize = YYMAXDEPTH;
191 i = data->s_mark - data->s_base;
192 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
196 data->s_base = newss;
197 data->s_mark = newss + i;
199 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
203 data->l_base = newvs;
204 data->l_mark = newvs + i;
206 data->stacksize = newsize;
207 data->s_last = data->s_base + newsize - 1;
211 #if YYPURE || defined(YY_NO_LEAKS)
212 static void yyfreestack(YYSTACKDATA *data)
216 memset(data, 0, sizeof(*data));
219 #define yyfreestack(data) /* nothing */
222 #define YYABORT goto yyabort
223 #define YYREJECT goto yyabort
224 #define YYACCEPT goto yyaccept
225 #define YYERROR goto yyerrlab
230 int yym, yyn, yystate;
234 if ((yys = getenv("YYDEBUG")) != 0)
237 if (yyn >= '0' && yyn <= '9')
248 memset(&yystack, 0, sizeof(yystack));
251 if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
252 yystack.s_mark = yystack.s_base;
253 yystack.l_mark = yystack.l_base;
258 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
261 if ((yychar = YYLEX) < 0) yychar = 0;
266 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
267 if (!yys) yys = "illegal-symbol";
268 printf("%sdebug: state %d, reading %d (%s)\n",
269 YYPREFIX, yystate, yychar, yys);
273 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
274 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
278 printf("%sdebug: state %d, shifting to state %d\n",
279 YYPREFIX, yystate, yytable[yyn]);
281 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
285 yystate = yytable[yyn];
286 *++yystack.s_mark = yytable[yyn];
287 *++yystack.l_mark = yylval;
289 if (yyerrflag > 0) --yyerrflag;
292 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
293 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
298 if (yyerrflag) goto yyinrecovery;
300 yyerror("syntax error");
313 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
314 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
318 printf("%sdebug: state %d, error recovery shifting\
319 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
321 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
325 yystate = yytable[yyn];
326 *++yystack.s_mark = yytable[yyn];
327 *++yystack.l_mark = yylval;
334 printf("%sdebug: error recovery discarding state %d\n",
335 YYPREFIX, *yystack.s_mark);
337 if (yystack.s_mark <= yystack.s_base) goto yyabort;
345 if (yychar == 0) goto yyabort;
350 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
351 if (!yys) yys = "illegal-symbol";
352 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
353 YYPREFIX, yystate, yychar, yys);
363 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
364 YYPREFIX, yystate, yyn, yyrule[yyn]);
368 yyval = yystack.l_mark[1-yym];
370 memset(&yyval, 0, sizeof yyval);
374 yystack.s_mark -= yym;
375 yystate = *yystack.s_mark;
376 yystack.l_mark -= yym;
378 if (yystate == 0 && yym == 0)
382 printf("%sdebug: after reduction, shifting from state 0 to\
383 state %d\n", YYPREFIX, YYFINAL);
386 *++yystack.s_mark = YYFINAL;
387 *++yystack.l_mark = yyval;
390 if ((yychar = YYLEX) < 0) yychar = 0;
395 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
396 if (!yys) yys = "illegal-symbol";
397 printf("%sdebug: state %d, reading %d (%s)\n",
398 YYPREFIX, YYFINAL, yychar, yys);
402 if (yychar == 0) goto yyaccept;
405 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
406 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
407 yystate = yytable[yyn];
409 yystate = yydgoto[yym];
412 printf("%sdebug: after reduction, shifting from state %d \
413 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
415 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
419 *++yystack.s_mark = (short) yystate;
420 *++yystack.l_mark = yyval;
424 yyerror("yacc stack overflow");
427 yyfreestack(&yystack);
431 yyfreestack(&yystack);