1 /* $Id: btyaccpar.skel,v 1.11 2018/06/10 00:41:06 Tom.Shields 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[];
67 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
68 YYLTYPE yyloc; /* position returned by actions */
69 YYLTYPE yylloc; /* position from the lexer */
73 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
74 #ifndef YYLLOC_DEFAULT
75 #define YYLLOC_DEFAULT(loc, rhs, n) \
80 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
81 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
82 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
83 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
87 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
88 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
89 (loc).last_line = YYRHSLOC(rhs, n).last_line; \
90 (loc).last_column = YYRHSLOC(rhs, n).last_column; \
93 #endif /* YYLLOC_DEFAULT */
94 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
97 #ifndef YYLVQUEUEGROWTH
98 #define YYLVQUEUEGROWTH 32
102 /* define the initial stack-sizes */
105 #define YYMAXDEPTH YYSTACKSIZE
108 #define YYSTACKSIZE YYMAXDEPTH
110 #define YYSTACKSIZE 10000
111 #define YYMAXDEPTH 10000
115 #ifndef YYINITSTACKSIZE
116 #define YYINITSTACKSIZE 200
126 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
133 struct YYParseState_s
135 struct YYParseState_s *save; /* Previously saved parser state */
136 YYSTACKDATA yystack; /* saved parser stack */
137 int state; /* saved parser state */
138 int errflag; /* saved error recovery status */
139 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
140 YYINT ctry; /* saved index in yyctable[] for this conflict */
142 typedef struct YYParseState_s YYParseState;
145 /* variables for the parser stack */
146 static YYSTACKDATA yystack;
149 /* Current parser state */
150 static YYParseState *yyps = 0;
152 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
153 static YYParseState *yypath = 0;
155 /* Base of the lexical value queue */
156 static YYSTYPE *yylvals = 0;
158 /* Current position at lexical value queue */
159 static YYSTYPE *yylvp = 0;
161 /* End position of lexical value queue */
162 static YYSTYPE *yylve = 0;
164 /* The last allocated position at the lexical value queue */
165 static YYSTYPE *yylvlim = 0;
167 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
168 /* Base of the lexical position queue */
169 static YYLTYPE *yylpsns = 0;
171 /* Current position at lexical position queue */
172 static YYLTYPE *yylpp = 0;
174 /* End position of lexical position queue */
175 static YYLTYPE *yylpe = 0;
177 /* The last allocated position at the lexical position queue */
178 static YYLTYPE *yylplim = 0;
181 /* Current position at lexical token queue */
182 static YYINT *yylexp = 0;
184 static YYINT *yylexemes = 0;
193 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
194 YYLTYPE yyloc; /* position returned by actions */
195 YYLTYPE yylloc; /* position from the lexer */
198 /* variables for the parser stack */
202 /* Current parser state */
203 static YYParseState *yyps = 0;
205 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
206 static YYParseState *yypath = 0;
208 /* Base of the lexical value queue */
209 static YYSTYPE *yylvals = 0;
211 /* Current position at lexical value queue */
212 static YYSTYPE *yylvp = 0;
214 /* End position of lexical value queue */
215 static YYSTYPE *yylve = 0;
217 /* The last allocated position at the lexical value queue */
218 static YYSTYPE *yylvlim = 0;
220 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
221 /* Base of the lexical position queue */
222 static YYLTYPE *yylpsns = 0;
224 /* Current position at lexical position queue */
225 static YYLTYPE *yylpp = 0;
227 /* End position of lexical position queue */
228 static YYLTYPE *yylpe = 0;
230 /* The last allocated position at the lexical position queue */
231 static YYLTYPE *yylplim = 0;
234 /* Current position at lexical token queue */
235 static YYINT *yylexp = 0;
237 static YYINT *yylexemes = 0;
241 /* For use in generated program */
242 #define yydepth (int)(yystack.s_mark - yystack.s_base)
244 #define yytrial (yyps->save)
248 #include <stdio.h> /* needed for printf */
251 #include <stdlib.h> /* needed for malloc, etc */
252 #include <string.h> /* needed for memset */
254 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
255 static int yygrowstack(YYSTACKDATA *data)
261 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
265 if ((newsize = data->stacksize) == 0)
266 newsize = YYINITSTACKSIZE;
267 else if (newsize >= YYMAXDEPTH)
269 else if ((newsize *= 2) > YYMAXDEPTH)
270 newsize = YYMAXDEPTH;
272 i = (int) (data->s_mark - data->s_base);
273 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
277 data->s_base = newss;
278 data->s_mark = newss + i;
280 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
284 data->l_base = newvs;
285 data->l_mark = newvs + i;
287 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
288 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
292 data->p_base = newps;
293 data->p_mark = newps + i;
296 data->stacksize = newsize;
297 data->s_last = data->s_base + newsize - 1;
301 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
306 #if YYPURE || defined(YY_NO_LEAKS)
307 static void yyfreestack(YYSTACKDATA *data)
311 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
314 memset(data, 0, sizeof(*data));
317 #define yyfreestack(data) /* nothing */
318 #endif /* YYPURE || defined(YY_NO_LEAKS) */
321 static YYParseState *
322 yyNewState(unsigned size)
324 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
325 if (p == NULL) return NULL;
327 p->yystack.stacksize = size;
330 p->yystack.s_base = NULL;
331 p->yystack.l_base = NULL;
332 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
333 p->yystack.p_base = NULL;
337 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
338 if (p->yystack.s_base == NULL) return NULL;
339 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
340 if (p->yystack.l_base == NULL) return NULL;
341 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
342 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
343 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
344 if (p->yystack.p_base == NULL) return NULL;
345 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
352 yyFreeState(YYParseState *p)
354 yyfreestack(&p->yystack);
359 #define YYABORT goto yyabort
360 #define YYREJECT goto yyabort
361 #define YYACCEPT goto yyaccept
362 #define YYERROR goto yyerrlab
364 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
365 #define YYVALID_NESTED do { if (yyps->save && \
366 yyps->save->save == 0) goto yyvalid; } while(0)
373 int yym, yyn, yystate, yyresult;
376 YYParseState *yyerrctx = NULL;
378 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
379 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
384 if ((yys = getenv("YYDEBUG")) != 0)
387 if (yyn >= '0' && yyn <= '9')
391 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
393 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
394 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
400 memset(&yyval, 0, sizeof(yyval));
401 memset(&yylval, 0, sizeof(yylval));
402 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
403 memset(&yyloc, 0, sizeof(yyloc));
404 memset(&yylloc, 0, sizeof(yylloc));
409 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
420 memset(&yystack, 0, sizeof(yystack));
423 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
424 yystack.s_mark = yystack.s_base;
425 yystack.l_mark = yystack.l_base;
426 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
427 yystack.p_mark = yystack.p_base;
433 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
440 /* we're currently re-reading tokens */
442 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
450 /* in trial mode; save scanner results for future parse attempts */
451 if (yylvp == yylvlim)
452 { /* Enlarge lexical value queue */
453 size_t p = (size_t) (yylvp - yylvals);
454 size_t s = (size_t) (yylvlim - yylvals);
456 s += YYLVQUEUEGROWTH;
457 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
458 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
459 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
460 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
462 yylvp = yylve = yylvals + p;
463 yylvlim = yylvals + s;
464 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
465 yylpp = yylpe = yylpsns + p;
466 yylplim = yylpsns + s;
468 yylexp = yylexemes + p;
470 *yylexp = (YYINT) YYLEX;
473 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
480 /* normal operation, no conflict encountered */
486 if (yychar < 0) yychar = YYEOF;
490 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
491 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
492 YYDEBUGSTR, yydepth, yystate, yychar, yys);
493 #ifdef YYSTYPE_TOSTRING
497 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
505 /* Do we have a conflict? */
506 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
507 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
516 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
517 YYDEBUGSTR, yydepth, yystate);
519 /* Switch to the next conflict context */
524 if (save->state != yystate) YYABORT;
531 /* Unresolved conflict - start/continue trial parse */
536 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
538 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
540 fputs("Starting trial parse.\n", stderr);
543 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
544 if (save == NULL) goto yyenomem;
545 save->save = yyps->save;
546 save->state = yystate;
547 save->errflag = yyerrflag;
548 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
549 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
550 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
551 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
552 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
553 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
554 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
557 if (yyctable[ctry] == -1)
560 if (yydebug && yychar >= YYEOF)
561 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
566 if (yyps->save == NULL)
568 /* If this is a first conflict in the stack, start saving lexemes */
571 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
572 if (yylexemes == NULL) goto yyenomem;
573 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
574 if (yylvals == NULL) goto yyenomem;
575 yylvlim = yylvals + YYLVQUEUEGROWTH;
576 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
577 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
578 if (yylpsns == NULL) goto yyenomem;
579 yylplim = yylpsns + YYLVQUEUEGROWTH;
584 yylvp = yylve = yylvals;
585 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
586 yylpp = yylpe = yylpsns;
592 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
595 *yylexp = (YYINT) yychar;
603 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
609 save->lexeme = (int) (yylvp - yylvals);
612 if (yytable[yyn] == ctry)
616 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
617 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
622 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
627 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
629 yystate = yyctable[ctry];
630 *++yystack.s_mark = (YYINT) yystate;
631 *++yystack.l_mark = yylval;
632 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
633 *++yystack.p_mark = yylloc;
636 if (yyerrflag > 0) --yyerrflag;
641 yyn = yyctable[ctry];
644 } /* End of code dealing with conflicts */
646 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
647 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
651 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
652 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
654 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
655 yystate = yytable[yyn];
656 *++yystack.s_mark = yytable[yyn];
657 *++yystack.l_mark = yylval;
658 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
659 *++yystack.p_mark = yylloc;
662 if (yyerrflag > 0) --yyerrflag;
665 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
666 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
671 if (yyerrflag != 0) goto yyinrecovery;
676 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
679 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
680 * before looking for error recovery */
681 yystack.s_mark -= yym;
682 yystate = *yystack.s_mark;
683 yystack.l_mark -= yym;
684 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
685 yystack.p_mark -= yym;
693 YYParseState *save = yyps->save;
696 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
697 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
698 (int)(yylvp - yylvals - yyps->save->lexeme));
700 /* Memorize most forward-looking error state in case it's really an error. */
701 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
703 /* Free old saved error context state */
704 if (yyerrctx) yyFreeState(yyerrctx);
705 /* Create and fill out new saved error context state */
706 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
707 if (yyerrctx == NULL) goto yyenomem;
708 yyerrctx->save = yyps->save;
709 yyerrctx->state = yystate;
710 yyerrctx->errflag = yyerrflag;
711 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
712 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
713 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
714 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
715 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
716 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
717 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
719 yyerrctx->lexeme = (int) (yylvp - yylvals);
721 yylvp = yylvals + save->lexeme;
722 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
723 yylpp = yylpsns + save->lexeme;
725 yylexp = yylexemes + save->lexeme;
727 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
728 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
729 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
730 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
731 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
732 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
733 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
736 yystate = save->state;
737 /* We tried shift, try reduce now */
738 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
739 yyps->save = save->save;
743 /* Nothing left on the stack -- error */
748 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
751 /* Restore state as it was in the most forward-advanced error */
752 yylvp = yylvals + yyerrctx->lexeme;
753 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
754 yylpp = yylpsns + yyerrctx->lexeme;
756 yylexp = yylexemes + yyerrctx->lexeme;
759 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
762 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
763 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
764 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
765 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
766 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
767 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
768 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
770 yystate = yyerrctx->state;
771 yyFreeState(yyerrctx);
776 if (yynewerrflag == 0) goto yyinrecovery;
779 YYERROR_CALL("syntax error");
780 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
781 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
785 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
796 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
797 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
801 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
802 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
804 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
805 yystate = yytable[yyn];
806 *++yystack.s_mark = yytable[yyn];
807 *++yystack.l_mark = yylval;
808 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
809 /* lookahead position is error end position */
810 yyerror_loc_range[2] = yylloc;
811 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
812 *++yystack.p_mark = yyloc;
820 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
821 YYDEBUGSTR, yydepth, *yystack.s_mark);
823 if (yystack.s_mark <= yystack.s_base) goto yyabort;
824 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
825 /* the current TOS position is the error start position */
826 yyerror_loc_range[1] = *yystack.p_mark;
828 #if defined(YYDESTRUCT_CALL)
832 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
833 YYDESTRUCT_CALL("error: discarding state",
834 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
836 YYDESTRUCT_CALL("error: discarding state",
837 yystos[*yystack.s_mark], yystack.l_mark);
838 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
839 #endif /* defined(YYDESTRUCT_CALL) */
842 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
850 if (yychar == YYEOF) goto yyabort;
854 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
855 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
856 YYDEBUGSTR, yydepth, yystate, yychar, yys);
859 #if defined(YYDESTRUCT_CALL)
863 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
864 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
866 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
867 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
868 #endif /* defined(YYDESTRUCT_CALL) */
878 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
879 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
880 #ifdef YYSTYPE_TOSTRING
888 for (i = yym; i > 0; i--)
890 if (i != yym) fputs(", ", stderr);
891 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
892 yystack.l_mark[1-i]), stderr);
901 yyval = yystack.l_mark[1-yym];
903 memset(&yyval, 0, sizeof yyval);
904 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
906 /* Perform position reduction */
907 memset(&yyloc, 0, sizeof(yyloc));
912 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
913 /* just in case YYERROR is invoked within the action, save
914 the start of the rhs as the error start position */
915 yyerror_loc_range[1] = yystack.p_mark[1-yym];
925 yystack.s_mark -= yym;
926 yystate = *yystack.s_mark;
927 yystack.l_mark -= yym;
928 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
929 yystack.p_mark -= yym;
932 if (yystate == 0 && yym == 0)
937 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
938 #ifdef YYSTYPE_TOSTRING
942 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
944 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
948 *++yystack.s_mark = YYFINAL;
949 *++yystack.l_mark = yyval;
950 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
951 *++yystack.p_mark = yyloc;
959 /* we're currently re-reading tokens */
961 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
969 /* in trial mode; save scanner results for future parse attempts */
970 if (yylvp == yylvlim)
971 { /* Enlarge lexical value queue */
972 size_t p = (size_t) (yylvp - yylvals);
973 size_t s = (size_t) (yylvlim - yylvals);
975 s += YYLVQUEUEGROWTH;
976 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
978 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
980 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
981 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
984 yylvp = yylve = yylvals + p;
985 yylvlim = yylvals + s;
986 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
987 yylpp = yylpe = yylpsns + p;
988 yylplim = yylpsns + s;
990 yylexp = yylexemes + p;
992 *yylexp = (YYINT) YYLEX;
995 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1002 /* normal operation, no conflict encountered */
1008 if (yychar < 0) yychar = YYEOF;
1012 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1013 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1014 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1018 if (yychar == YYEOF) goto yyaccept;
1021 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1022 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1023 yystate = yytable[yyn];
1025 yystate = yydgoto[yym];
1029 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1030 #ifdef YYSTYPE_TOSTRING
1034 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1036 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1039 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1040 *++yystack.s_mark = (YYINT) yystate;
1041 *++yystack.l_mark = yyval;
1042 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1043 *++yystack.p_mark = yyloc;
1048 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1050 if (yypath) YYABORT;
1053 YYParseState *save = yyps->save;
1054 yyps->save = save->save;
1055 save->save = yypath;
1060 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1061 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1065 yyFreeState(yyerrctx);
1068 yylvp = yylvals + yypath->lexeme;
1069 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1070 yylpp = yylpsns + yypath->lexeme;
1072 yylexp = yylexemes + yypath->lexeme;
1074 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1075 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1076 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1077 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1078 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1079 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1080 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1082 yystate = yypath->state;
1087 YYERROR_CALL("yacc stack overflow");
1091 YYERROR_CALL("memory exhausted");
1103 if (yyps->save) goto yyvalid;
1108 #if defined(YYDESTRUCT_CALL)
1109 if (yychar != YYEOF && yychar != YYEMPTY)
1110 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1111 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1113 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1114 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1118 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1121 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1122 YYDESTRUCT_CALL("cleanup: discarding state",
1123 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1125 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1126 YYDESTRUCT_CALL("cleanup: discarding state",
1127 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1128 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1130 #endif /* defined(YYDESTRUCT_CALL) */
1135 yyFreeState(yyerrctx);
1140 YYParseState *save = yyps;
1147 YYParseState *save = yypath;
1148 yypath = save->save;
1153 yyfreestack(&yystack);