1 /* $Id: btyaccpar.skel,v 1.5 2016/12/02 22:02:28 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[];
48 #if YYDEBUG || defined(yytname)
49 extern const char *const yyname[];
52 extern const char *const yyrule[];
64 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
65 YYLTYPE yyloc; /* position returned by actions */
66 YYLTYPE yylloc; /* position from the lexer */
70 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
71 #ifndef YYLLOC_DEFAULT
72 #define YYLLOC_DEFAULT(loc, rhs, n) \
77 (loc).first_line = ((rhs)[-1]).last_line; \
78 (loc).first_column = ((rhs)[-1]).last_column; \
79 (loc).last_line = ((rhs)[-1]).last_line; \
80 (loc).last_column = ((rhs)[-1]).last_column; \
84 (loc).first_line = ((rhs)[ 0 ]).first_line; \
85 (loc).first_column = ((rhs)[ 0 ]).first_column; \
86 (loc).last_line = ((rhs)[n-1]).last_line; \
87 (loc).last_column = ((rhs)[n-1]).last_column; \
90 #endif /* YYLLOC_DEFAULT */
91 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
94 #ifndef YYLVQUEUEGROWTH
95 #define YYLVQUEUEGROWTH 32
99 /* define the initial stack-sizes */
102 #define YYMAXDEPTH YYSTACKSIZE
105 #define YYSTACKSIZE YYMAXDEPTH
107 #define YYSTACKSIZE 10000
108 #define YYMAXDEPTH 10000
112 #ifndef YYINITSTACKSIZE
113 #define YYINITSTACKSIZE 200
123 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
130 struct YYParseState_s
132 struct YYParseState_s *save; /* Previously saved parser state */
133 YYSTACKDATA yystack; /* saved parser stack */
134 int state; /* saved parser state */
135 int errflag; /* saved error recovery status */
136 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
137 YYINT ctry; /* saved index in yyctable[] for this conflict */
139 typedef struct YYParseState_s YYParseState;
142 /* variables for the parser stack */
143 static YYSTACKDATA yystack;
146 /* Current parser state */
147 static YYParseState *yyps = 0;
149 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
150 static YYParseState *yypath = 0;
152 /* Base of the lexical value queue */
153 static YYSTYPE *yylvals = 0;
155 /* Current position at lexical value queue */
156 static YYSTYPE *yylvp = 0;
158 /* End position of lexical value queue */
159 static YYSTYPE *yylve = 0;
161 /* The last allocated position at the lexical value queue */
162 static YYSTYPE *yylvlim = 0;
164 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
165 /* Base of the lexical position queue */
166 static YYLTYPE *yylpsns = 0;
168 /* Current position at lexical position queue */
169 static YYLTYPE *yylpp = 0;
171 /* End position of lexical position queue */
172 static YYLTYPE *yylpe = 0;
174 /* The last allocated position at the lexical position queue */
175 static YYLTYPE *yylplim = 0;
178 /* Current position at lexical token queue */
179 static YYINT *yylexp = 0;
181 static YYINT *yylexemes = 0;
188 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
189 YYLTYPE yyloc; /* position returned by actions */
190 YYLTYPE yylloc; /* position from the lexer */
193 /* variables for the parser stack */
197 /* Current parser state */
198 static YYParseState *yyps = 0;
200 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
201 static YYParseState *yypath = 0;
203 /* Base of the lexical value queue */
204 static YYSTYPE *yylvals = 0;
206 /* Current position at lexical value queue */
207 static YYSTYPE *yylvp = 0;
209 /* End position of lexical value queue */
210 static YYSTYPE *yylve = 0;
212 /* The last allocated position at the lexical value queue */
213 static YYSTYPE *yylvlim = 0;
215 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
216 /* Base of the lexical position queue */
217 static YYLTYPE *yylpsns = 0;
219 /* Current position at lexical position queue */
220 static YYLTYPE *yylpp = 0;
222 /* End position of lexical position queue */
223 static YYLTYPE *yylpe = 0;
225 /* The last allocated position at the lexical position queue */
226 static YYLTYPE *yylplim = 0;
229 /* Current position at lexical token queue */
230 static YYINT *yylexp = 0;
232 static YYINT *yylexemes = 0;
236 /* For use in generated program */
237 #define yydepth (int)(yystack.s_mark - yystack.s_base)
239 #define yytrial (yyps->save)
243 #include <stdio.h> /* needed for printf */
246 #include <stdlib.h> /* needed for malloc, etc */
247 #include <string.h> /* needed for memset */
249 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
250 static int yygrowstack(YYSTACKDATA *data)
256 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
260 if ((newsize = data->stacksize) == 0)
261 newsize = YYINITSTACKSIZE;
262 else if (newsize >= YYMAXDEPTH)
264 else if ((newsize *= 2) > YYMAXDEPTH)
265 newsize = YYMAXDEPTH;
267 i = (int) (data->s_mark - data->s_base);
268 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
272 data->s_base = newss;
273 data->s_mark = newss + i;
275 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
279 data->l_base = newvs;
280 data->l_mark = newvs + i;
282 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
283 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
287 data->p_base = newps;
288 data->p_mark = newps + i;
291 data->stacksize = newsize;
292 data->s_last = data->s_base + newsize - 1;
296 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
301 #if YYPURE || defined(YY_NO_LEAKS)
302 static void yyfreestack(YYSTACKDATA *data)
306 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
309 memset(data, 0, sizeof(*data));
312 #define yyfreestack(data) /* nothing */
313 #endif /* YYPURE || defined(YY_NO_LEAKS) */
316 static YYParseState *
317 yyNewState(unsigned size)
319 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
320 if (p == NULL) return NULL;
322 p->yystack.stacksize = size;
325 p->yystack.s_base = NULL;
326 p->yystack.l_base = NULL;
327 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
328 p->yystack.p_base = NULL;
332 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
333 if (p->yystack.s_base == NULL) return NULL;
334 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
335 if (p->yystack.l_base == NULL) return NULL;
336 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
337 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
338 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
339 if (p->yystack.p_base == NULL) return NULL;
340 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
347 yyFreeState(YYParseState *p)
349 yyfreestack(&p->yystack);
354 #define YYABORT goto yyabort
355 #define YYREJECT goto yyabort
356 #define YYACCEPT goto yyaccept
357 #define YYERROR goto yyerrlab
359 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
360 #define YYVALID_NESTED do { if (yyps->save && \
361 yyps->save->save == 0) goto yyvalid; } while(0)
368 int yym, yyn, yystate, yyresult;
371 YYParseState *yyerrctx = NULL;
373 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
374 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
379 if ((yys = getenv("YYDEBUG")) != 0)
382 if (yyn >= '0' && yyn <= '9')
386 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
391 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
402 memset(&yystack, 0, sizeof(yystack));
405 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
406 yystack.s_mark = yystack.s_base;
407 yystack.l_mark = yystack.l_base;
408 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
409 yystack.p_mark = yystack.p_base;
415 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
422 /* we're currently re-reading tokens */
424 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
432 /* in trial mode; save scanner results for future parse attempts */
433 if (yylvp == yylvlim)
434 { /* Enlarge lexical value queue */
435 size_t p = (size_t) (yylvp - yylvals);
436 size_t s = (size_t) (yylvlim - yylvals);
438 s += YYLVQUEUEGROWTH;
439 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
440 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
441 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
442 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
444 yylvp = yylve = yylvals + p;
445 yylvlim = yylvals + s;
446 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
447 yylpp = yylpe = yylpsns + p;
448 yylplim = yylpsns + s;
450 yylexp = yylexemes + p;
452 *yylexp = (YYINT) YYLEX;
455 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
462 /* normal operation, no conflict encountered */
468 if (yychar < 0) yychar = YYEOF;
472 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
473 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
474 YYDEBUGSTR, yydepth, yystate, yychar, yys);
475 #ifdef YYSTYPE_TOSTRING
479 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
487 /* Do we have a conflict? */
488 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
489 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
498 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
499 YYDEBUGSTR, yydepth, yystate);
501 /* Switch to the next conflict context */
506 if (save->state != yystate) YYABORT;
513 /* Unresolved conflict - start/continue trial parse */
518 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
520 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
522 fputs("Starting trial parse.\n", stderr);
525 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
526 if (save == NULL) goto yyenomem;
527 save->save = yyps->save;
528 save->state = yystate;
529 save->errflag = yyerrflag;
530 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
531 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
532 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
533 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
534 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
535 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
536 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
539 if (yyctable[ctry] == -1)
542 if (yydebug && yychar >= YYEOF)
543 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
548 if (yyps->save == NULL)
550 /* If this is a first conflict in the stack, start saving lexemes */
553 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
554 if (yylexemes == NULL) goto yyenomem;
555 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
556 if (yylvals == NULL) goto yyenomem;
557 yylvlim = yylvals + YYLVQUEUEGROWTH;
558 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
559 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
560 if (yylpsns == NULL) goto yyenomem;
561 yylplim = yylpsns + YYLVQUEUEGROWTH;
566 yylvp = yylve = yylvals;
567 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
568 yylpp = yylpe = yylpsns;
574 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
577 *yylexp = (YYINT) yychar;
585 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
591 save->lexeme = (int) (yylvp - yylvals);
594 if (yytable[yyn] == ctry)
598 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
599 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
604 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
609 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
611 yystate = yyctable[ctry];
612 *++yystack.s_mark = (YYINT) yystate;
613 *++yystack.l_mark = yylval;
614 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
615 *++yystack.p_mark = yylloc;
618 if (yyerrflag > 0) --yyerrflag;
623 yyn = yyctable[ctry];
626 } /* End of code dealing with conflicts */
628 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
629 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
633 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
634 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
636 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
637 yystate = yytable[yyn];
638 *++yystack.s_mark = yytable[yyn];
639 *++yystack.l_mark = yylval;
640 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
641 *++yystack.p_mark = yylloc;
644 if (yyerrflag > 0) --yyerrflag;
647 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
648 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
653 if (yyerrflag != 0) goto yyinrecovery;
658 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
661 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
662 * before looking for error recovery */
663 yystack.s_mark -= yym;
664 yystate = *yystack.s_mark;
665 yystack.l_mark -= yym;
666 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
667 yystack.p_mark -= yym;
675 YYParseState *save = yyps->save;
678 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
679 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
680 (int)(yylvp - yylvals - yyps->save->lexeme));
682 /* Memorize most forward-looking error state in case it's really an error. */
683 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
685 /* Free old saved error context state */
686 if (yyerrctx) yyFreeState(yyerrctx);
687 /* Create and fill out new saved error context state */
688 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
689 if (yyerrctx == NULL) goto yyenomem;
690 yyerrctx->save = yyps->save;
691 yyerrctx->state = yystate;
692 yyerrctx->errflag = yyerrflag;
693 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
694 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
695 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
696 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
697 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
698 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
699 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
701 yyerrctx->lexeme = (int) (yylvp - yylvals);
703 yylvp = yylvals + save->lexeme;
704 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
705 yylpp = yylpsns + save->lexeme;
707 yylexp = yylexemes + save->lexeme;
709 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
710 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
711 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
712 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
713 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
714 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
715 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
718 yystate = save->state;
719 /* We tried shift, try reduce now */
720 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
721 yyps->save = save->save;
725 /* Nothing left on the stack -- error */
730 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
733 /* Restore state as it was in the most forward-advanced error */
734 yylvp = yylvals + yyerrctx->lexeme;
735 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
736 yylpp = yylpsns + yyerrctx->lexeme;
738 yylexp = yylexemes + yyerrctx->lexeme;
741 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
744 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
745 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
746 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
747 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
748 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
749 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
750 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
752 yystate = yyerrctx->state;
753 yyFreeState(yyerrctx);
758 if (yynewerrflag == 0) goto yyinrecovery;
761 YYERROR_CALL("syntax error");
762 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
763 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
767 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
778 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
779 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
783 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
784 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
786 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
787 yystate = yytable[yyn];
788 *++yystack.s_mark = yytable[yyn];
789 *++yystack.l_mark = yylval;
790 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
791 /* lookahead position is error end position */
792 yyerror_loc_range[1] = yylloc;
793 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
794 *++yystack.p_mark = yyloc;
802 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
803 YYDEBUGSTR, yydepth, *yystack.s_mark);
805 if (yystack.s_mark <= yystack.s_base) goto yyabort;
806 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
807 /* the current TOS position is the error start position */
808 yyerror_loc_range[0] = *yystack.p_mark;
810 #if defined(YYDESTRUCT_CALL)
814 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
815 YYDESTRUCT_CALL("error: discarding state",
816 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
818 YYDESTRUCT_CALL("error: discarding state",
819 yystos[*yystack.s_mark], yystack.l_mark);
820 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
821 #endif /* defined(YYDESTRUCT_CALL) */
824 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
832 if (yychar == YYEOF) goto yyabort;
836 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
837 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
838 YYDEBUGSTR, yydepth, yystate, yychar, yys);
841 #if defined(YYDESTRUCT_CALL)
845 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
846 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
848 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
849 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
850 #endif /* defined(YYDESTRUCT_CALL) */
860 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
861 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
862 #ifdef YYSTYPE_TOSTRING
870 for (i = yym; i > 0; i--)
872 if (i != yym) fputs(", ", stderr);
873 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
874 yystack.l_mark[1-i]), stderr);
883 yyval = yystack.l_mark[1-yym];
885 memset(&yyval, 0, sizeof yyval);
886 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
888 /* Perform position reduction */
889 memset(&yyloc, 0, sizeof(yyloc));
894 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
895 /* just in case YYERROR is invoked within the action, save
896 the start of the rhs as the error start position */
897 yyerror_loc_range[0] = yystack.p_mark[1-yym];
907 yystack.s_mark -= yym;
908 yystate = *yystack.s_mark;
909 yystack.l_mark -= yym;
910 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
911 yystack.p_mark -= yym;
914 if (yystate == 0 && yym == 0)
919 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
920 #ifdef YYSTYPE_TOSTRING
924 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
926 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
930 *++yystack.s_mark = YYFINAL;
931 *++yystack.l_mark = yyval;
932 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
933 *++yystack.p_mark = yyloc;
941 /* we're currently re-reading tokens */
943 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
951 /* in trial mode; save scanner results for future parse attempts */
952 if (yylvp == yylvlim)
953 { /* Enlarge lexical value queue */
954 size_t p = (size_t) (yylvp - yylvals);
955 size_t s = (size_t) (yylvlim - yylvals);
957 s += YYLVQUEUEGROWTH;
958 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
960 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
962 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
963 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
966 yylvp = yylve = yylvals + p;
967 yylvlim = yylvals + s;
968 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
969 yylpp = yylpe = yylpsns + p;
970 yylplim = yylpsns + s;
972 yylexp = yylexemes + p;
974 *yylexp = (YYINT) YYLEX;
977 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
984 /* normal operation, no conflict encountered */
990 if (yychar < 0) yychar = YYEOF;
994 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
995 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
996 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1000 if (yychar == YYEOF) goto yyaccept;
1003 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1004 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1005 yystate = yytable[yyn];
1007 yystate = yydgoto[yym];
1011 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1012 #ifdef YYSTYPE_TOSTRING
1016 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1018 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1021 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1022 *++yystack.s_mark = (YYINT) yystate;
1023 *++yystack.l_mark = yyval;
1024 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1025 *++yystack.p_mark = yyloc;
1030 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1032 if (yypath) YYABORT;
1035 YYParseState *save = yyps->save;
1036 yyps->save = save->save;
1037 save->save = yypath;
1042 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1043 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1047 yyFreeState(yyerrctx);
1050 yylvp = yylvals + yypath->lexeme;
1051 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1052 yylpp = yylpsns + yypath->lexeme;
1054 yylexp = yylexemes + yypath->lexeme;
1056 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1057 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1058 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1059 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1060 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1061 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1062 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1064 yystate = yypath->state;
1069 YYERROR_CALL("yacc stack overflow");
1073 YYERROR_CALL("memory exhausted");
1085 if (yyps->save) goto yyvalid;
1090 #if defined(YYDESTRUCT_CALL)
1091 if (yychar != YYEOF && yychar != YYEMPTY)
1092 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1093 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1095 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1096 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1100 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1103 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1104 YYDESTRUCT_CALL("cleanup: discarding state",
1105 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1107 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1108 YYDESTRUCT_CALL("cleanup: discarding state",
1109 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1110 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1112 #endif /* defined(YYDESTRUCT_CALL) */
1117 yyFreeState(yyerrctx);
1122 YYParseState *save = yyps;
1129 YYParseState *save = yypath;
1130 yypath = save->save;
1135 yyfreestack(&yystack);