1 /* Id: btyaccpar.skel,v 1.1 2014/04/02 22:44:41 tom Exp */
5 /* If the skeleton is changed, the banner should be changed so that */
6 /* the altered version can be easily distinguished from the original. */
8 /* The #defines included with the banner are there because they are */
9 /* useful in subsequent code. The macros #defined in the header or */
10 /* the body either are not useful outside of semantic actions or */
11 /* are conditional. */
14 /* original parser id follows */
15 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
16 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
19 %% insert VERSION here
22 #define yyclearin (yychar = YYEMPTY)
23 #define yyerrok (yyerrflag = 0)
24 #define YYRECOVERING() (yyerrflag != 0)
29 extern int YYPARSE_DECL();
31 extern const YYINT yylhs[];
32 extern const YYINT yylen[];
33 extern const YYINT yydefred[];
34 extern const YYINT yystos[];
35 extern const YYINT yydgoto[];
36 extern const YYINT yysindex[];
37 extern const YYINT yyrindex[];
39 extern const YYINT yycindex[];
41 extern const YYINT yygindex[];
42 extern const YYINT yytable[];
43 extern const YYINT yycheck[];
45 extern const YYINT yyctable[];
49 extern const char *const yyname[];
50 extern const char *const yyrule[];
62 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
63 YYLTYPE yyloc; /* position returned by actions */
64 YYLTYPE yylloc; /* position from the lexer */
68 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
69 #ifndef YYLLOC_DEFAULT
70 #define YYLLOC_DEFAULT(loc, rhs, n) \
75 (loc).first_line = ((rhs)[-1]).last_line; \
76 (loc).first_column = ((rhs)[-1]).last_column; \
77 (loc).last_line = ((rhs)[-1]).last_line; \
78 (loc).last_column = ((rhs)[-1]).last_column; \
82 (loc).first_line = ((rhs)[ 0 ]).first_line; \
83 (loc).first_column = ((rhs)[ 0 ]).first_column; \
84 (loc).last_line = ((rhs)[n-1]).last_line; \
85 (loc).last_column = ((rhs)[n-1]).last_column; \
88 #endif /* YYLLOC_DEFAULT */
89 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
92 #ifndef YYLVQUEUEGROWTH
93 #define YYLVQUEUEGROWTH 32
97 /* define the initial stack-sizes */
100 #define YYMAXDEPTH YYSTACKSIZE
103 #define YYSTACKSIZE YYMAXDEPTH
105 #define YYSTACKSIZE 10000
106 #define YYMAXDEPTH 10000
110 #ifndef YYINITSTACKSIZE
111 #define YYINITSTACKSIZE 200
121 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
128 struct YYParseState_s
130 struct YYParseState_s *save; /* Previously saved parser state */
131 YYSTACKDATA yystack; /* saved parser stack */
132 int state; /* saved parser state */
133 int errflag; /* saved error recovery status */
134 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
135 YYINT ctry; /* saved index in yyctable[] for this conflict */
137 typedef struct YYParseState_s YYParseState;
140 /* variables for the parser stack */
141 static YYSTACKDATA yystack;
144 /* Current parser state */
145 static YYParseState *yyps = 0;
147 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
148 static YYParseState *yypath = 0;
150 /* Base of the lexical value queue */
151 static YYSTYPE *yylvals = 0;
153 /* Current position at lexical value queue */
154 static YYSTYPE *yylvp = 0;
156 /* End position of lexical value queue */
157 static YYSTYPE *yylve = 0;
159 /* The last allocated position at the lexical value queue */
160 static YYSTYPE *yylvlim = 0;
162 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
163 /* Base of the lexical position queue */
164 static YYLTYPE *yylpsns = 0;
166 /* Current position at lexical position queue */
167 static YYLTYPE *yylpp = 0;
169 /* End position of lexical position queue */
170 static YYLTYPE *yylpe = 0;
172 /* The last allocated position at the lexical position queue */
173 static YYLTYPE *yylplim = 0;
176 /* Current position at lexical token queue */
177 static YYINT *yylexp = 0;
179 static YYINT *yylexemes = 0;
186 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
187 YYLTYPE yyloc; /* position returned by actions */
188 YYLTYPE yylloc; /* position from the lexer */
191 /* variables for the parser stack */
195 /* Current parser state */
196 static YYParseState *yyps = 0;
198 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
199 static YYParseState *yypath = 0;
201 /* Base of the lexical value queue */
202 static YYSTYPE *yylvals = 0;
204 /* Current position at lexical value queue */
205 static YYSTYPE *yylvp = 0;
207 /* End position of lexical value queue */
208 static YYSTYPE *yylve = 0;
210 /* The last allocated position at the lexical value queue */
211 static YYSTYPE *yylvlim = 0;
213 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
214 /* Base of the lexical position queue */
215 static YYLTYPE *yylpsns = 0;
217 /* Current position at lexical position queue */
218 static YYLTYPE *yylpp = 0;
220 /* End position of lexical position queue */
221 static YYLTYPE *yylpe = 0;
223 /* The last allocated position at the lexical position queue */
224 static YYLTYPE *yylplim = 0;
227 /* Current position at lexical token queue */
228 static YYINT *yylexp = 0;
230 static YYINT *yylexemes = 0;
234 /* For use in generated program */
235 #define yydepth (int)(yystack.s_mark - yystack.s_base)
237 #define yytrial (yyps->save)
241 #include <stdio.h> /* needed for printf */
244 #include <stdlib.h> /* needed for malloc, etc */
245 #include <string.h> /* needed for memset */
247 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
248 static int yygrowstack(YYSTACKDATA *data)
254 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
258 if ((newsize = data->stacksize) == 0)
259 newsize = YYINITSTACKSIZE;
260 else if (newsize >= YYMAXDEPTH)
262 else if ((newsize *= 2) > YYMAXDEPTH)
263 newsize = YYMAXDEPTH;
265 i = (int) (data->s_mark - data->s_base);
266 newss = realloc(data->s_base, newsize * sizeof(*newss));
270 data->s_base = newss;
271 data->s_mark = newss + i;
273 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
277 data->l_base = newvs;
278 data->l_mark = newvs + i;
280 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
281 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
285 data->p_base = newps;
286 data->p_mark = newps + i;
289 data->stacksize = newsize;
290 data->s_last = data->s_base + newsize - 1;
294 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
299 #if YYPURE || defined(YY_NO_LEAKS)
300 static void yyfreestack(YYSTACKDATA *data)
304 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
307 memset(data, 0, sizeof(*data));
310 #define yyfreestack(data) /* nothing */
311 #endif /* YYPURE || defined(YY_NO_LEAKS) */
314 static YYParseState *
315 yyNewState(unsigned size)
317 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
318 if (p == NULL) return NULL;
320 p->yystack.stacksize = size;
323 p->yystack.s_base = NULL;
324 p->yystack.l_base = NULL;
325 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
326 p->yystack.p_base = NULL;
330 p->yystack.s_base = malloc(size * sizeof(YYINT));
331 if (p->yystack.s_base == NULL) return NULL;
332 p->yystack.l_base = malloc(size * sizeof(YYSTYPE));
333 if (p->yystack.l_base == NULL) return NULL;
334 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
335 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
336 p->yystack.p_base = malloc(size * sizeof(YYLTYPE));
337 if (p->yystack.p_base == NULL) return NULL;
338 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
345 yyFreeState(YYParseState *p)
347 yyfreestack(&p->yystack);
352 #define YYABORT goto yyabort
353 #define YYREJECT goto yyabort
354 #define YYACCEPT goto yyaccept
355 #define YYERROR goto yyerrlab
357 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
358 #define YYVALID_NESTED do { if (yyps->save && \
359 yyps->save->save == 0) goto yyvalid; } while(0)
366 int yym, yyn, yystate, yyresult;
369 YYParseState *yyerrctx = NULL;
371 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
372 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
377 if ((yys = getenv("YYDEBUG")) != 0)
380 if (yyn >= '0' && yyn <= '9')
384 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
388 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
397 memset(&yystack, 0, sizeof(yystack));
400 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
401 yystack.s_mark = yystack.s_base;
402 yystack.l_mark = yystack.l_base;
403 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
404 yystack.p_mark = yystack.p_base;
410 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
417 /* we're currently re-reading tokens */
419 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
427 /* in trial mode; save scanner results for future parse attempts */
428 if (yylvp == yylvlim)
429 { /* Enlarge lexical value queue */
430 int p = yylvp - yylvals;
431 int s = yylvlim - yylvals;
433 s += YYLVQUEUEGROWTH;
434 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
435 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
436 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
437 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
439 yylvp = yylve = yylvals + p;
440 yylvlim = yylvals + s;
441 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
442 yylpp = yylpe = yylpsns + p;
443 yylplim = yylpsns + s;
445 yylexp = yylexemes + p;
447 *yylexp = (YYINT) YYLEX;
450 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
457 /* normal operation, no conflict encountered */
463 if (yychar < 0) yychar = YYEOF;
464 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
468 yys = yyname[YYTRANSLATE(yychar)];
469 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
470 YYDEBUGSTR, yydepth, yystate, yychar, yys);
471 #ifdef YYSTYPE_TOSTRING
475 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
483 /* Do we have a conflict? */
484 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
485 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
494 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
495 YYDEBUGSTR, yydepth, yystate);
497 /* Switch to the next conflict context */
502 if (save->state != yystate) YYABORT;
509 /* Unresolved conflict - start/continue trial parse */
514 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
516 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
518 fputs("Starting trial parse.\n", stderr);
521 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
522 if (save == NULL) goto yyenomem;
523 save->save = yyps->save;
524 save->state = yystate;
525 save->errflag = yyerrflag;
526 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
527 memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
528 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
529 memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
530 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
531 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
532 memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
535 if (yyctable[ctry] == -1)
538 if (yydebug && yychar >= YYEOF)
539 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
544 if (yyps->save == NULL)
546 /* If this is a first conflict in the stack, start saving lexemes */
549 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
550 if (yylexemes == NULL) goto yyenomem;
551 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
552 if (yylvals == NULL) goto yyenomem;
553 yylvlim = yylvals + YYLVQUEUEGROWTH;
554 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
555 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
556 if (yylpsns == NULL) goto yyenomem;
557 yylplim = yylpsns + YYLVQUEUEGROWTH;
562 yylvp = yylve = yylvals;
563 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
564 yylpp = yylpe = yylpsns;
570 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
573 *yylexp = (YYINT) yychar;
581 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
587 save->lexeme = yylvp - yylvals;
590 if (yytable[yyn] == ctry)
594 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
595 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
600 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
605 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
607 yystate = yyctable[ctry];
608 *++yystack.s_mark = (YYINT) yystate;
609 *++yystack.l_mark = yylval;
610 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
611 *++yystack.p_mark = yylloc;
614 if (yyerrflag > 0) --yyerrflag;
619 yyn = yyctable[ctry];
622 } /* End of code dealing with conflicts */
624 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
625 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
629 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
630 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
632 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
633 yystate = yytable[yyn];
634 *++yystack.s_mark = yytable[yyn];
635 *++yystack.l_mark = yylval;
636 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
637 *++yystack.p_mark = yylloc;
640 if (yyerrflag > 0) --yyerrflag;
643 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
644 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
649 if (yyerrflag != 0) goto yyinrecovery;
662 YYParseState *save = yyps->save;
665 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
666 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
667 (int)(yylvp - yylvals - yyps->save->lexeme));
669 /* Memorize most forward-looking error state in case it's really an error. */
670 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
672 /* Free old saved error context state */
673 if (yyerrctx) yyFreeState(yyerrctx);
674 /* Create and fill out new saved error context state */
675 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
676 if (yyerrctx == NULL) goto yyenomem;
677 yyerrctx->save = yyps->save;
678 yyerrctx->state = yystate;
679 yyerrctx->errflag = yyerrflag;
680 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
681 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
682 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
683 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
684 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
685 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
686 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
688 yyerrctx->lexeme = yylvp - yylvals;
690 yylvp = yylvals + save->lexeme;
691 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
692 yylpp = yylpsns + save->lexeme;
694 yylexp = yylexemes + save->lexeme;
696 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
697 memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
698 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
699 memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
700 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
701 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
702 memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
705 yystate = save->state;
706 /* We tried shift, try reduce now */
707 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
708 yyps->save = save->save;
712 /* Nothing left on the stack -- error */
717 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
720 /* Restore state as it was in the most forward-advanced error */
721 yylvp = yylvals + yyerrctx->lexeme;
722 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
723 yylpp = yylpsns + yyerrctx->lexeme;
725 yylexp = yylexemes + yyerrctx->lexeme;
728 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
731 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
732 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
733 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
734 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
735 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
736 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
737 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
739 yystate = yyerrctx->state;
740 yyFreeState(yyerrctx);
745 if (yynewerrflag == 0) goto yyinrecovery;
748 YYERROR_CALL("syntax error");
749 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
750 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
765 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
766 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
770 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
771 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
773 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
774 yystate = yytable[yyn];
775 *++yystack.s_mark = yytable[yyn];
776 *++yystack.l_mark = yylval;
777 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
778 /* lookahead position is error end position */
779 yyerror_loc_range[1] = yylloc;
780 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
781 *++yystack.p_mark = yyloc;
789 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
790 YYDEBUGSTR, yydepth, *yystack.s_mark);
792 if (yystack.s_mark <= yystack.s_base) goto yyabort;
793 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
794 /* the current TOS position is the error start position */
795 yyerror_loc_range[0] = *yystack.p_mark;
797 #if defined(YYDESTRUCT_CALL)
801 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
802 YYDESTRUCT_CALL("error: discarding state",
803 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
805 YYDESTRUCT_CALL("error: discarding state",
806 yystos[*yystack.s_mark], yystack.l_mark);
807 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
808 #endif /* defined(YYDESTRUCT_CALL) */
811 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
819 if (yychar == YYEOF) goto yyabort;
823 yys = yyname[YYTRANSLATE(yychar)];
824 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
825 YYDEBUGSTR, yydepth, yystate, yychar, yys);
828 #if defined(YYDESTRUCT_CALL)
832 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
833 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
835 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
836 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
837 #endif /* defined(YYDESTRUCT_CALL) */
847 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
848 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
849 #ifdef YYSTYPE_TOSTRING
857 for (i = yym; i > 0; i--)
859 if (i != yym) fputs(", ", stderr);
860 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
861 yystack.l_mark[1-i]), stderr);
870 yyval = yystack.l_mark[1-yym];
872 memset(&yyval, 0, sizeof yyval);
873 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
875 /* Perform position reduction */
876 memset(&yyloc, 0, sizeof(yyloc));
881 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
882 /* just in case YYERROR is invoked within the action, save
883 the start of the rhs as the error start position */
884 yyerror_loc_range[0] = yystack.p_mark[1-yym];
894 yystack.s_mark -= yym;
895 yystate = *yystack.s_mark;
896 yystack.l_mark -= yym;
897 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
898 yystack.p_mark -= yym;
901 if (yystate == 0 && yym == 0)
906 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
907 #ifdef YYSTYPE_TOSTRING
911 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
913 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
917 *++yystack.s_mark = YYFINAL;
918 *++yystack.l_mark = yyval;
919 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
920 *++yystack.p_mark = yyloc;
928 /* we're currently re-reading tokens */
930 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
938 /* in trial mode; save scanner results for future parse attempts */
939 if (yylvp == yylvlim)
940 { /* Enlarge lexical value queue */
941 int p = yylvp - yylvals;
942 int s = yylvlim - yylvals;
944 s += YYLVQUEUEGROWTH;
945 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
947 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
949 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
950 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
953 yylvp = yylve = yylvals + p;
954 yylvlim = yylvals + s;
955 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
956 yylpp = yylpe = yylpsns + p;
957 yylplim = yylpsns + s;
959 yylexp = yylexemes + p;
961 *yylexp = (YYINT) YYLEX;
964 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
971 /* normal operation, no conflict encountered */
977 if (yychar < 0) yychar = YYEOF;
978 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
982 yys = yyname[YYTRANSLATE(yychar)];
983 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
984 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
988 if (yychar == YYEOF) goto yyaccept;
991 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
992 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
993 yystate = yytable[yyn];
995 yystate = yydgoto[yym];
999 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1000 #ifdef YYSTYPE_TOSTRING
1004 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1006 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1009 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1010 *++yystack.s_mark = (YYINT) yystate;
1011 *++yystack.l_mark = yyval;
1012 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1013 *++yystack.p_mark = yyloc;
1018 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1020 if (yypath) YYABORT;
1023 YYParseState *save = yyps->save;
1024 yyps->save = save->save;
1025 save->save = yypath;
1030 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1031 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1035 yyFreeState(yyerrctx);
1038 yylvp = yylvals + yypath->lexeme;
1039 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1040 yylpp = yylpsns + yypath->lexeme;
1042 yylexp = yylexemes + yypath->lexeme;
1044 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1045 memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1046 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1047 memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1048 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1049 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1050 memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1052 yystate = yypath->state;
1057 YYERROR_CALL("yacc stack overflow");
1061 YYERROR_CALL("memory exhausted");
1073 if (yyps->save) goto yyvalid;
1078 #if defined(YYDESTRUCT_CALL)
1079 if (yychar != YYEOF && yychar != YYEMPTY)
1080 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1081 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1083 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1084 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1088 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1091 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1092 YYDESTRUCT_CALL("cleanup: discarding state",
1093 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1095 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1096 YYDESTRUCT_CALL("cleanup: discarding state",
1097 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1098 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1100 #endif /* defined(YYDESTRUCT_CALL) */
1105 yyFreeState(yyerrctx);
1110 YYParseState *save = yyps;
1117 YYParseState *save = yypath;
1118 yypath = save->save;
1123 yyfreestack(&yystack);