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[];
181 /* define the initial stack-sizes */
184 #define YYMAXDEPTH YYSTACKSIZE
187 #define YYSTACKSIZE YYMAXDEPTH
189 #define YYSTACKSIZE 10000
190 #define YYMAXDEPTH 10000
194 #define YYINITSTACKSIZE 200
204 /* variables for the parser stack */
205 static YYSTACKDATA yystack;
206 #line 12 "code_error.y"
211 extern int YYLEX_DECL();
217 printf("yyparse() = %d\n", yyparse());
228 yyerror(const char* s)
232 #line 233 "code_error.code.c"
235 #include <stdio.h> /* needed for printf */
238 #include <stdlib.h> /* needed for malloc, etc */
239 #include <string.h> /* needed for memset */
241 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
242 static int yygrowstack(YYSTACKDATA *data)
249 if ((newsize = data->stacksize) == 0)
250 newsize = YYINITSTACKSIZE;
251 else if (newsize >= YYMAXDEPTH)
253 else if ((newsize *= 2) > YYMAXDEPTH)
254 newsize = YYMAXDEPTH;
256 i = (int) (data->s_mark - data->s_base);
257 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
261 data->s_base = newss;
262 data->s_mark = newss + i;
264 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
268 data->l_base = newvs;
269 data->l_mark = newvs + i;
271 data->stacksize = newsize;
272 data->s_last = data->s_base + newsize - 1;
276 #if YYPURE || defined(YY_NO_LEAKS)
277 static void yyfreestack(YYSTACKDATA *data)
281 memset(data, 0, sizeof(*data));
284 #define yyfreestack(data) /* nothing */
287 #define YYABORT goto yyabort
288 #define YYREJECT goto yyabort
289 #define YYACCEPT goto yyaccept
290 #define YYERROR goto yyerrlab
295 int yym, yyn, yystate;
299 if ((yys = getenv("YYDEBUG")) != 0)
302 if (yyn >= '0' && yyn <= '9')
315 memset(&yystack, 0, sizeof(yystack));
318 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
319 yystack.s_mark = yystack.s_base;
320 yystack.l_mark = yystack.l_base;
325 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
329 if (yychar < 0) yychar = YYEOF;
333 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
334 printf("%sdebug: state %d, reading %d (%s)\n",
335 YYPREFIX, yystate, yychar, yys);
339 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
340 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
344 printf("%sdebug: state %d, shifting to state %d\n",
345 YYPREFIX, yystate, yytable[yyn]);
347 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
348 yystate = yytable[yyn];
349 *++yystack.s_mark = yytable[yyn];
350 *++yystack.l_mark = yylval;
352 if (yyerrflag > 0) --yyerrflag;
355 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
356 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
361 if (yyerrflag != 0) goto yyinrecovery;
363 YYERROR_CALL("syntax error");
365 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
375 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
376 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
380 printf("%sdebug: state %d, error recovery shifting\
381 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
383 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
384 yystate = yytable[yyn];
385 *++yystack.s_mark = yytable[yyn];
386 *++yystack.l_mark = yylval;
393 printf("%sdebug: error recovery discarding state %d\n",
394 YYPREFIX, *yystack.s_mark);
396 if (yystack.s_mark <= yystack.s_base) goto yyabort;
404 if (yychar == YYEOF) goto yyabort;
408 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
409 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
410 YYPREFIX, yystate, yychar, yys);
420 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
421 YYPREFIX, yystate, yyn, yyrule[yyn]);
425 yyval = yystack.l_mark[1-yym];
427 memset(&yyval, 0, sizeof yyval);
432 yystack.s_mark -= yym;
433 yystate = *yystack.s_mark;
434 yystack.l_mark -= yym;
436 if (yystate == 0 && yym == 0)
440 printf("%sdebug: after reduction, shifting from state 0 to\
441 state %d\n", YYPREFIX, YYFINAL);
444 *++yystack.s_mark = YYFINAL;
445 *++yystack.l_mark = yyval;
449 if (yychar < 0) yychar = YYEOF;
453 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
454 printf("%sdebug: state %d, reading %d (%s)\n",
455 YYPREFIX, YYFINAL, yychar, yys);
459 if (yychar == YYEOF) goto yyaccept;
462 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
463 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
464 yystate = yytable[yyn];
466 yystate = yydgoto[yym];
469 printf("%sdebug: after reduction, shifting from state %d \
470 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
472 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
473 *++yystack.s_mark = (YYINT) yystate;
474 *++yystack.l_mark = yyval;
478 YYERROR_CALL("yacc stack overflow");
481 yyfreestack(&yystack);
485 yyfreestack(&yystack);