2 static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
8 #define YYPATCH 20140101
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
19 #line 2 "pure_error.y"
23 #define YYLEX_PARAM &yylval
24 #define YYLEX_DECL() yylex(YYSTYPE *yylval)
25 #define YYERROR_DECL() yyerror(const char *s)
27 static void YYERROR_DECL();
30 #line 30 "/dev/stdout"
36 /* compatibility with bison */
38 /* compatibility with FreeBSD */
39 # ifdef YYPARSE_PARAM_TYPE
40 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
42 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
45 # define YYPARSE_DECL() yyparse(void)
48 /* Parameters sent to lex. */
50 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
51 # define YYLEX yylex(YYLEX_PARAM)
53 # define YYLEX_DECL() yylex(void)
54 # define YYLEX yylex()
57 /* Parameters sent to yyerror. */
59 #define YYERROR_DECL() yyerror(const char *s)
62 #define YYERROR_CALL(msg) yyerror(msg)
65 extern int YYPARSE_DECL();
68 static const short yylhs[] = { -1,
71 static const short yylen[] = { 2,
74 static const short yydefred[] = { 0,
77 static const short yydgoto[] = { 2,
79 static const short yysindex[] = { -256,
82 static const short yyrindex[] = { 0,
85 static const short yygindex[] = { 0,
88 static const short yytable[] = { 1,
90 static const short yycheck[] = { 256,
97 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
99 static const char *yyname[] = {
101 "end-of-file","illegal-symbol",
103 static const char *yyrule[] = {
118 /* define the initial stack-sizes */
121 #define YYMAXDEPTH YYSTACKSIZE
124 #define YYSTACKSIZE YYMAXDEPTH
126 #define YYSTACKSIZE 10000
127 #define YYMAXDEPTH 10000
131 #define YYINITSTACKSIZE 200
141 /* variables for the parser stack */
142 static YYSTACKDATA yystack;
143 #line 17 "pure_error.y"
148 extern int YYLEX_DECL();
154 printf("yyparse() = %d\n", yyparse());
159 yylex(YYSTYPE *value)
161 return value ? 0 : -1;
165 yyerror(const char* s)
169 #line 168 "/dev/stdout"
172 #include <stdio.h> /* needed for printf */
175 #include <stdlib.h> /* needed for malloc, etc */
176 #include <string.h> /* needed for memset */
178 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
179 static int yygrowstack(YYSTACKDATA *data)
186 if ((newsize = data->stacksize) == 0)
187 newsize = YYINITSTACKSIZE;
188 else if (newsize >= YYMAXDEPTH)
190 else if ((newsize *= 2) > YYMAXDEPTH)
191 newsize = YYMAXDEPTH;
193 i = (int) (data->s_mark - data->s_base);
194 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
198 data->s_base = newss;
199 data->s_mark = newss + i;
201 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
205 data->l_base = newvs;
206 data->l_mark = newvs + i;
208 data->stacksize = newsize;
209 data->s_last = data->s_base + newsize - 1;
213 #if YYPURE || defined(YY_NO_LEAKS)
214 static void yyfreestack(YYSTACKDATA *data)
218 memset(data, 0, sizeof(*data));
221 #define yyfreestack(data) /* nothing */
224 #define YYABORT goto yyabort
225 #define YYREJECT goto yyabort
226 #define YYACCEPT goto yyaccept
227 #define YYERROR goto yyerrlab
232 int yym, yyn, yystate;
236 if ((yys = getenv("YYDEBUG")) != 0)
239 if (yyn >= '0' && yyn <= '9')
250 memset(&yystack, 0, sizeof(yystack));
253 if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
254 yystack.s_mark = yystack.s_base;
255 yystack.l_mark = yystack.l_base;
260 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
263 if ((yychar = YYLEX) < 0) yychar = 0;
267 yys = yyname[YYTRANSLATE(yychar)];
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;
349 yys = yyname[YYTRANSLATE(yychar)];
350 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
351 YYPREFIX, yystate, yychar, yys);
361 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
362 YYPREFIX, yystate, yyn, yyrule[yyn]);
366 yyval = yystack.l_mark[1-yym];
368 memset(&yyval, 0, sizeof yyval);
372 yystack.s_mark -= yym;
373 yystate = *yystack.s_mark;
374 yystack.l_mark -= yym;
376 if (yystate == 0 && yym == 0)
380 printf("%sdebug: after reduction, shifting from state 0 to\
381 state %d\n", YYPREFIX, YYFINAL);
384 *++yystack.s_mark = YYFINAL;
385 *++yystack.l_mark = yyval;
388 if ((yychar = YYLEX) < 0) yychar = 0;
392 yys = yyname[YYTRANSLATE(yychar)];
393 printf("%sdebug: state %d, reading %d (%s)\n",
394 YYPREFIX, YYFINAL, yychar, yys);
398 if (yychar == 0) goto yyaccept;
401 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
402 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
403 yystate = yytable[yyn];
405 yystate = yydgoto[yym];
408 printf("%sdebug: after reduction, shifting from state %d \
409 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
411 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
415 *++yystack.s_mark = (short) yystate;
416 *++yystack.l_mark = yyval;
420 yyerror("yacc stack overflow");
423 yyfreestack(&yystack);
427 yyfreestack(&yystack);