1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
8 #define YYCHECK "yyyymmdd"
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
18 #define yyparse error_parse
22 #define yylex error_lex
26 #define yyerror error_error
30 #define yychar error_char
34 #define yyval error_val
38 #define yylval error_lval
42 #define yydebug error_debug
46 #define yynerrs error_nerrs
50 #define yyerrflag error_errflag
51 #endif /* yyerrflag */
54 #define yylhs error_lhs
58 #define yylen error_len
62 #define yydefred error_defred
66 #define yydgoto error_dgoto
70 #define yysindex error_sindex
74 #define yyrindex error_rindex
78 #define yygindex error_gindex
82 #define yytable error_table
86 #define yycheck error_check
90 #define yyname error_name
94 #define yyrule error_rule
96 #define YYPREFIX "error_"
100 #line 2 "pure_error.y"
104 #define YYLEX_PARAM &yylval
105 #define YYLEX_DECL() yylex(YYSTYPE *yylval)
106 #define YYERROR_DECL() yyerror(const char *s)
108 static void YYERROR_DECL();
111 #line 112 "pure_error.tab.c"
113 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
114 /* Default: YYSTYPE is the semantic value type. */
116 # define YYSTYPE_IS_DECLARED 1
119 /* compatibility with bison */
121 /* compatibility with FreeBSD */
122 # ifdef YYPARSE_PARAM_TYPE
123 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
125 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
128 # define YYPARSE_DECL() yyparse(void)
131 /* Parameters sent to lex. */
133 # ifdef YYLEX_PARAM_TYPE
134 # define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
136 # define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
138 # define YYLEX yylex(&yylval, YYLEX_PARAM)
140 # define YYLEX_DECL() yylex(YYSTYPE *yylval)
141 # define YYLEX yylex(&yylval)
144 /* Parameters sent to yyerror. */
146 #define YYERROR_DECL() yyerror(const char *s)
149 #define YYERROR_CALL(msg) yyerror(msg)
152 extern int YYPARSE_DECL();
154 #define YYERRCODE 256
156 static const YYINT error_lhs[] = { -1,
159 static const YYINT error_len[] = { 2,
162 static const YYINT error_defred[] = { 0,
165 static const YYINT error_dgoto[] = { 2,
167 static const YYINT error_sindex[] = { -256,
170 static const YYINT error_rindex[] = { 0,
173 static const YYINT error_gindex[] = { 0,
175 #define YYTABLESIZE 0
176 static const YYINT error_table[] = { 1,
178 static const YYINT error_check[] = { 256,
184 #define YYMAXTOKEN 256
185 #define YYUNDFTOKEN 259
186 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
188 static const char *const error_name[] = {
190 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
191 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
192 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
193 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
194 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
195 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
196 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"illegal-symbol",
198 static const char *const error_rule[] = {
208 /* define the initial stack-sizes */
211 #define YYMAXDEPTH YYSTACKSIZE
214 #define YYSTACKSIZE YYMAXDEPTH
216 #define YYSTACKSIZE 10000
217 #define YYMAXDEPTH 10000
221 #define YYINITSTACKSIZE 200
231 #line 17 "pure_error.y"
236 extern int YYLEX_DECL();
242 printf("yyparse() = %d\n", yyparse());
247 yylex(YYSTYPE *value)
249 return value ? 0 : -1;
253 yyerror(const char* s)
257 #line 258 "pure_error.tab.c"
260 #include <stdio.h> /* needed for printf */
263 #include <stdlib.h> /* needed for malloc, etc */
264 #include <string.h> /* needed for memset */
266 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
267 static int yygrowstack(YYSTACKDATA *data)
274 if ((newsize = data->stacksize) == 0)
275 newsize = YYINITSTACKSIZE;
276 else if (newsize >= YYMAXDEPTH)
278 else if ((newsize *= 2) > YYMAXDEPTH)
279 newsize = YYMAXDEPTH;
281 i = (int) (data->s_mark - data->s_base);
282 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
286 data->s_base = newss;
287 data->s_mark = newss + i;
289 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
293 data->l_base = newvs;
294 data->l_mark = newvs + i;
296 data->stacksize = newsize;
297 data->s_last = data->s_base + newsize - 1;
301 #if YYPURE || defined(YY_NO_LEAKS)
302 static void yyfreestack(YYSTACKDATA *data)
306 memset(data, 0, sizeof(*data));
309 #define yyfreestack(data) /* nothing */
312 #define YYABORT goto yyabort
313 #define YYREJECT goto yyabort
314 #define YYACCEPT goto yyaccept
315 #define YYERROR goto yyerrlab
325 /* variables for the parser stack */
327 int yym, yyn, yystate;
331 if ((yys = getenv("YYDEBUG")) != 0)
334 if (yyn >= '0' && yyn <= '9')
347 memset(&yystack, 0, sizeof(yystack));
350 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
351 yystack.s_mark = yystack.s_base;
352 yystack.l_mark = yystack.l_base;
357 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
361 if (yychar < 0) yychar = YYEOF;
365 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
366 printf("%sdebug: state %d, reading %d (%s)\n",
367 YYPREFIX, yystate, yychar, yys);
371 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
372 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
376 printf("%sdebug: state %d, shifting to state %d\n",
377 YYPREFIX, yystate, yytable[yyn]);
379 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
380 yystate = yytable[yyn];
381 *++yystack.s_mark = yytable[yyn];
382 *++yystack.l_mark = yylval;
384 if (yyerrflag > 0) --yyerrflag;
387 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
388 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
393 if (yyerrflag != 0) goto yyinrecovery;
395 YYERROR_CALL("syntax error");
397 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
407 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
408 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
412 printf("%sdebug: state %d, error recovery shifting\
413 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
415 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
416 yystate = yytable[yyn];
417 *++yystack.s_mark = yytable[yyn];
418 *++yystack.l_mark = yylval;
425 printf("%sdebug: error recovery discarding state %d\n",
426 YYPREFIX, *yystack.s_mark);
428 if (yystack.s_mark <= yystack.s_base) goto yyabort;
436 if (yychar == YYEOF) goto yyabort;
440 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
441 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
442 YYPREFIX, yystate, yychar, yys);
452 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
453 YYPREFIX, yystate, yyn, yyrule[yyn]);
457 yyval = yystack.l_mark[1-yym];
459 memset(&yyval, 0, sizeof yyval);
464 yystack.s_mark -= yym;
465 yystate = *yystack.s_mark;
466 yystack.l_mark -= yym;
468 if (yystate == 0 && yym == 0)
472 printf("%sdebug: after reduction, shifting from state 0 to\
473 state %d\n", YYPREFIX, YYFINAL);
476 *++yystack.s_mark = YYFINAL;
477 *++yystack.l_mark = yyval;
481 if (yychar < 0) yychar = YYEOF;
485 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
486 printf("%sdebug: state %d, reading %d (%s)\n",
487 YYPREFIX, YYFINAL, yychar, yys);
491 if (yychar == YYEOF) goto yyaccept;
494 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
495 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
496 yystate = yytable[yyn];
498 yystate = yydgoto[yym];
501 printf("%sdebug: after reduction, shifting from state %d \
502 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
504 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
505 *++yystack.s_mark = (YYINT) yystate;
506 *++yystack.l_mark = yyval;
510 YYERROR_CALL("yacc stack overflow");
513 yyfreestack(&yystack);
517 yyfreestack(&yystack);