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 "code_error.y"
104 static void yyerror(const char *);
107 #line 108 "code_error.code.c"
109 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
110 /* Default: YYSTYPE is the semantic value type. */
112 # define YYSTYPE_IS_DECLARED 1
115 /* compatibility with bison */
117 /* compatibility with FreeBSD */
118 # ifdef YYPARSE_PARAM_TYPE
119 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
121 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
124 # define YYPARSE_DECL() yyparse(void)
127 /* Parameters sent to lex. */
129 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
130 # define YYLEX yylex(YYLEX_PARAM)
132 # define YYLEX_DECL() yylex(void)
133 # define YYLEX yylex()
136 /* Parameters sent to yyerror. */
138 #define YYERROR_DECL() yyerror(const char *s)
141 #define YYERROR_CALL(msg) yyerror(msg)
144 #define YYERRCODE 256
145 #define YYTABLESIZE 0
150 #define YYMAXTOKEN 256
151 #define YYUNDFTOKEN 259
152 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
154 extern int YYPARSE_DECL();
156 extern YYINT yylhs[];
157 extern YYINT yylen[];
158 extern YYINT yydefred[];
159 extern YYINT yydgoto[];
160 extern YYINT yysindex[];
161 extern YYINT yyrindex[];
162 extern YYINT yygindex[];
163 extern YYINT yytable[];
164 extern YYINT yycheck[];
166 #if YYDEBUG || defined(yytname)
167 extern char *yyname[];
170 extern char *yyrule[];
183 /* define the initial stack-sizes */
186 #define YYMAXDEPTH YYSTACKSIZE
189 #define YYSTACKSIZE YYMAXDEPTH
191 #define YYSTACKSIZE 10000
192 #define YYMAXDEPTH 10000
196 #define YYINITSTACKSIZE 200
206 /* variables for the parser stack */
207 static YYSTACKDATA yystack;
208 #line 12 "code_error.y"
213 extern int YYLEX_DECL();
219 printf("yyparse() = %d\n", yyparse());
230 yyerror(const char* s)
234 #line 235 "code_error.code.c"
237 #include <stdio.h> /* needed for printf */
240 #include <stdlib.h> /* needed for malloc, etc */
241 #include <string.h> /* needed for memset */
243 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
244 static int yygrowstack(YYSTACKDATA *data)
251 if ((newsize = data->stacksize) == 0)
252 newsize = YYINITSTACKSIZE;
253 else if (newsize >= YYMAXDEPTH)
255 else if ((newsize *= 2) > YYMAXDEPTH)
256 newsize = YYMAXDEPTH;
258 i = (int) (data->s_mark - data->s_base);
259 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
263 data->s_base = newss;
264 data->s_mark = newss + i;
266 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
270 data->l_base = newvs;
271 data->l_mark = newvs + i;
273 data->stacksize = newsize;
274 data->s_last = data->s_base + newsize - 1;
278 #if YYPURE || defined(YY_NO_LEAKS)
279 static void yyfreestack(YYSTACKDATA *data)
283 memset(data, 0, sizeof(*data));
286 #define yyfreestack(data) /* nothing */
289 #define YYABORT goto yyabort
290 #define YYREJECT goto yyabort
291 #define YYACCEPT goto yyaccept
292 #define YYERROR goto yyerrlab
297 int yym, yyn, yystate;
301 if ((yys = getenv("YYDEBUG")) != 0)
304 if (yyn >= '0' && yyn <= '9')
317 memset(&yystack, 0, sizeof(yystack));
320 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
321 yystack.s_mark = yystack.s_base;
322 yystack.l_mark = yystack.l_base;
327 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
331 if (yychar < 0) yychar = YYEOF;
335 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
336 printf("%sdebug: state %d, reading %d (%s)\n",
337 YYPREFIX, yystate, yychar, yys);
341 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
342 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
346 printf("%sdebug: state %d, shifting to state %d\n",
347 YYPREFIX, yystate, yytable[yyn]);
349 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
350 yystate = yytable[yyn];
351 *++yystack.s_mark = yytable[yyn];
352 *++yystack.l_mark = yylval;
354 if (yyerrflag > 0) --yyerrflag;
357 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
358 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
363 if (yyerrflag != 0) goto yyinrecovery;
365 YYERROR_CALL("syntax error");
367 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
377 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
378 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
382 printf("%sdebug: state %d, error recovery shifting\
383 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
385 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
386 yystate = yytable[yyn];
387 *++yystack.s_mark = yytable[yyn];
388 *++yystack.l_mark = yylval;
395 printf("%sdebug: error recovery discarding state %d\n",
396 YYPREFIX, *yystack.s_mark);
398 if (yystack.s_mark <= yystack.s_base) goto yyabort;
406 if (yychar == YYEOF) goto yyabort;
410 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
411 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
412 YYPREFIX, yystate, yychar, yys);
422 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
423 YYPREFIX, yystate, yyn, yyrule[yyn]);
427 yyval = yystack.l_mark[1-yym];
429 memset(&yyval, 0, sizeof yyval);
434 yystack.s_mark -= yym;
435 yystate = *yystack.s_mark;
436 yystack.l_mark -= yym;
438 if (yystate == 0 && yym == 0)
442 printf("%sdebug: after reduction, shifting from state 0 to\
443 state %d\n", YYPREFIX, YYFINAL);
446 *++yystack.s_mark = YYFINAL;
447 *++yystack.l_mark = yyval;
451 if (yychar < 0) yychar = YYEOF;
455 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
456 printf("%sdebug: state %d, reading %d (%s)\n",
457 YYPREFIX, YYFINAL, yychar, yys);
461 if (yychar == YYEOF) goto yyaccept;
464 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
465 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
466 yystate = yytable[yyn];
468 yystate = yydgoto[yym];
471 printf("%sdebug: after reduction, shifting from state %d \
472 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
474 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
475 *++yystack.s_mark = (YYINT) yystate;
476 *++yystack.l_mark = yyval;
480 YYERROR_CALL("yacc stack overflow");
483 yyfreestack(&yystack);
487 yyfreestack(&yystack);