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')
339 memset(&yyval, 0, sizeof(yyval));
340 memset(&yylval, 0, sizeof(yylval));
350 memset(&yystack, 0, sizeof(yystack));
353 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
354 yystack.s_mark = yystack.s_base;
355 yystack.l_mark = yystack.l_base;
360 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
364 if (yychar < 0) yychar = YYEOF;
368 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
369 printf("%sdebug: state %d, reading %d (%s)\n",
370 YYPREFIX, yystate, yychar, yys);
374 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
375 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
379 printf("%sdebug: state %d, shifting to state %d\n",
380 YYPREFIX, yystate, yytable[yyn]);
382 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
383 yystate = yytable[yyn];
384 *++yystack.s_mark = yytable[yyn];
385 *++yystack.l_mark = yylval;
387 if (yyerrflag > 0) --yyerrflag;
390 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
391 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
396 if (yyerrflag != 0) goto yyinrecovery;
398 YYERROR_CALL("syntax error");
400 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
410 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
411 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
415 printf("%sdebug: state %d, error recovery shifting\
416 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
418 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
419 yystate = yytable[yyn];
420 *++yystack.s_mark = yytable[yyn];
421 *++yystack.l_mark = yylval;
428 printf("%sdebug: error recovery discarding state %d\n",
429 YYPREFIX, *yystack.s_mark);
431 if (yystack.s_mark <= yystack.s_base) goto yyabort;
439 if (yychar == YYEOF) goto yyabort;
443 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
444 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
445 YYPREFIX, yystate, yychar, yys);
455 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
456 YYPREFIX, yystate, yyn, yyrule[yyn]);
460 yyval = yystack.l_mark[1-yym];
462 memset(&yyval, 0, sizeof yyval);
467 yystack.s_mark -= yym;
468 yystate = *yystack.s_mark;
469 yystack.l_mark -= yym;
471 if (yystate == 0 && yym == 0)
475 printf("%sdebug: after reduction, shifting from state 0 to\
476 state %d\n", YYPREFIX, YYFINAL);
479 *++yystack.s_mark = YYFINAL;
480 *++yystack.l_mark = yyval;
484 if (yychar < 0) yychar = YYEOF;
488 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
489 printf("%sdebug: state %d, reading %d (%s)\n",
490 YYPREFIX, YYFINAL, yychar, yys);
494 if (yychar == YYEOF) goto yyaccept;
497 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
498 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
499 yystate = yytable[yyn];
501 yystate = yydgoto[yym];
504 printf("%sdebug: after reduction, shifting from state %d \
505 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
507 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
508 *++yystack.s_mark = (YYINT) yystate;
509 *++yystack.l_mark = yyval;
513 YYERROR_CALL("yacc stack overflow");
516 yyfreestack(&yystack);
520 yyfreestack(&yystack);