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 YYDEBUGSTR YYPREFIX "debug"
19 #line 20 "rename_debug.c"
20 #include "rename_debug.i"
21 #include "rename_debug.h"
23 static const YYINT yylhs[] = { -1,
26 static const YYINT yylen[] = { 2,
29 static const YYINT yydefred[] = { 0,
32 static const YYINT yystos[] = { 0,
35 static const YYINT yydgoto[] = { 2,
37 static const YYINT yysindex[] = { -256,
40 static const YYINT yyrindex[] = { 0,
44 static const YYINT yycindex[] = { 0,
48 static const YYINT yygindex[] = { 0,
51 static const YYINT yytable[] = { 1,
53 static const YYINT yycheck[] = { 256,
56 static const YYINT yyctable[] = { -1,
63 #define YYMAXTOKEN 256
64 #define YYUNDFTOKEN 259
65 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
67 static const char *const yyname[] = {
69 "$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
70 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
71 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
72 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
73 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
74 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
75 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S","illegal-symbol",
77 static const char *const yyrule[] = {
91 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
92 YYLTYPE yyloc; /* position returned by actions */
93 YYLTYPE yylloc; /* position from the lexer */
96 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
97 #ifndef YYLLOC_DEFAULT
98 #define YYLLOC_DEFAULT(loc, rhs, n) \
103 (loc).first_line = ((rhs)[-1]).last_line; \
104 (loc).first_column = ((rhs)[-1]).last_column; \
105 (loc).last_line = ((rhs)[-1]).last_line; \
106 (loc).last_column = ((rhs)[-1]).last_column; \
110 (loc).first_line = ((rhs)[ 0 ]).first_line; \
111 (loc).first_column = ((rhs)[ 0 ]).first_column; \
112 (loc).last_line = ((rhs)[n-1]).last_line; \
113 (loc).last_column = ((rhs)[n-1]).last_column; \
116 #endif /* YYLLOC_DEFAULT */
117 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
120 #ifndef YYLVQUEUEGROWTH
121 #define YYLVQUEUEGROWTH 32
123 #endif /* YYBTYACC */
125 /* define the initial stack-sizes */
128 #define YYMAXDEPTH YYSTACKSIZE
131 #define YYSTACKSIZE YYMAXDEPTH
133 #define YYSTACKSIZE 10000
134 #define YYMAXDEPTH 10000
138 #ifndef YYINITSTACKSIZE
139 #define YYINITSTACKSIZE 200
149 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
156 struct YYParseState_s
158 struct YYParseState_s *save; /* Previously saved parser state */
159 YYSTACKDATA yystack; /* saved parser stack */
160 int state; /* saved parser state */
161 int errflag; /* saved error recovery status */
162 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
163 YYINT ctry; /* saved index in yyctable[] for this conflict */
165 typedef struct YYParseState_s YYParseState;
166 #endif /* YYBTYACC */
167 /* variables for the parser stack */
168 static YYSTACKDATA yystack;
171 /* Current parser state */
172 static YYParseState *yyps = 0;
174 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
175 static YYParseState *yypath = 0;
177 /* Base of the lexical value queue */
178 static YYSTYPE *yylvals = 0;
180 /* Current position at lexical value queue */
181 static YYSTYPE *yylvp = 0;
183 /* End position of lexical value queue */
184 static YYSTYPE *yylve = 0;
186 /* The last allocated position at the lexical value queue */
187 static YYSTYPE *yylvlim = 0;
189 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
190 /* Base of the lexical position queue */
191 static YYLTYPE *yylpsns = 0;
193 /* Current position at lexical position queue */
194 static YYLTYPE *yylpp = 0;
196 /* End position of lexical position queue */
197 static YYLTYPE *yylpe = 0;
199 /* The last allocated position at the lexical position queue */
200 static YYLTYPE *yylplim = 0;
203 /* Current position at lexical token queue */
204 static short *yylexp = 0;
206 static short *yylexemes = 0;
207 #endif /* YYBTYACC */
208 #line 12 "code_debug.y"
213 extern int YYLEX_DECL();
219 printf("yyparse() = %d\n", yyparse());
230 yyerror(const char* s)
234 #line 236 "rename_debug.c"
236 /* For use in generated program */
237 #define yydepth (int)(yystack.s_mark - yystack.s_base)
239 #define yytrial (yyps->save)
240 #endif /* YYBTYACC */
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);
352 #endif /* YYBTYACC */
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)
362 #endif /* YYBTYACC */
367 int yym, yyn, yystate, yyresult;
370 YYParseState *yyerrctx = NULL;
371 #endif /* YYBTYACC */
372 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
373 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
378 if ((yys = getenv("YYDEBUG")) != 0)
381 if (yyn >= '0' && yyn <= '9')
385 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
389 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
391 #endif /* YYBTYACC */
400 memset(&yystack, 0, sizeof(yystack));
403 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
404 yystack.s_mark = yystack.s_base;
405 yystack.l_mark = yystack.l_base;
406 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
407 yystack.p_mark = yystack.p_base;
413 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
420 /* we're currently re-reading tokens */
422 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
430 /* in trial mode; save scanner results for future parse attempts */
431 if (yylvp == yylvlim)
432 { /* Enlarge lexical value queue */
433 size_t p = (size_t) (yylvp - yylvals);
434 size_t s = (size_t) (yylvlim - yylvals);
436 s += YYLVQUEUEGROWTH;
437 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
438 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
439 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
440 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
442 yylvp = yylve = yylvals + p;
443 yylvlim = yylvals + s;
444 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
445 yylpp = yylpe = yylpsns + p;
446 yylplim = yylpsns + s;
448 yylexp = yylexemes + p;
450 *yylexp = (short) YYLEX;
453 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
460 /* normal operation, no conflict encountered */
461 #endif /* YYBTYACC */
465 #endif /* YYBTYACC */
466 if (yychar < 0) yychar = YYEOF;
470 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
471 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
472 YYDEBUGSTR, yydepth, yystate, yychar, yys);
473 #ifdef YYSTYPE_TOSTRING
476 #endif /* YYBTYACC */
477 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
485 /* Do we have a conflict? */
486 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
487 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
496 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
497 YYDEBUGSTR, yydepth, yystate);
499 /* Switch to the next conflict context */
504 if (save->state != yystate) YYABORT;
511 /* Unresolved conflict - start/continue trial parse */
516 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
518 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
520 fputs("Starting trial parse.\n", stderr);
523 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
524 if (save == NULL) goto yyenomem;
525 save->save = yyps->save;
526 save->state = yystate;
527 save->errflag = yyerrflag;
528 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
529 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
530 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
531 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
532 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
533 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
534 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
537 if (yyctable[ctry] == -1)
540 if (yydebug && yychar >= YYEOF)
541 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
546 if (yyps->save == NULL)
548 /* If this is a first conflict in the stack, start saving lexemes */
551 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
552 if (yylexemes == NULL) goto yyenomem;
553 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
554 if (yylvals == NULL) goto yyenomem;
555 yylvlim = yylvals + YYLVQUEUEGROWTH;
556 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
557 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
558 if (yylpsns == NULL) goto yyenomem;
559 yylplim = yylpsns + YYLVQUEUEGROWTH;
564 yylvp = yylve = yylvals;
565 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
566 yylpp = yylpe = yylpsns;
572 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
575 *yylexp = (short) yychar;
583 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
589 save->lexeme = (int) (yylvp - yylvals);
592 if (yytable[yyn] == ctry)
596 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
597 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
602 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
607 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
609 yystate = yyctable[ctry];
610 *++yystack.s_mark = (YYINT) yystate;
611 *++yystack.l_mark = yylval;
612 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
613 *++yystack.p_mark = yylloc;
616 if (yyerrflag > 0) --yyerrflag;
621 yyn = yyctable[ctry];
624 } /* End of code dealing with conflicts */
625 #endif /* YYBTYACC */
626 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
627 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
631 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
632 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
634 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
635 yystate = yytable[yyn];
636 *++yystack.s_mark = yytable[yyn];
637 *++yystack.l_mark = yylval;
638 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
639 *++yystack.p_mark = yylloc;
642 if (yyerrflag > 0) --yyerrflag;
645 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
646 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
651 if (yyerrflag != 0) goto yyinrecovery;
656 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
659 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
660 * before looking for error recovery */
661 yystack.s_mark -= yym;
662 yystate = *yystack.s_mark;
663 yystack.l_mark -= yym;
664 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
665 yystack.p_mark -= yym;
673 YYParseState *save = yyps->save;
676 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
677 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
678 (int)(yylvp - yylvals - yyps->save->lexeme));
680 /* Memorize most forward-looking error state in case it's really an error. */
681 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
683 /* Free old saved error context state */
684 if (yyerrctx) yyFreeState(yyerrctx);
685 /* Create and fill out new saved error context state */
686 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
687 if (yyerrctx == NULL) goto yyenomem;
688 yyerrctx->save = yyps->save;
689 yyerrctx->state = yystate;
690 yyerrctx->errflag = yyerrflag;
691 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
692 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
693 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
694 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
695 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
696 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
697 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
699 yyerrctx->lexeme = (int) (yylvp - yylvals);
701 yylvp = yylvals + save->lexeme;
702 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
703 yylpp = yylpsns + save->lexeme;
705 yylexp = yylexemes + save->lexeme;
707 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
708 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
709 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
710 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
711 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
712 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
713 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
716 yystate = save->state;
717 /* We tried shift, try reduce now */
718 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
719 yyps->save = save->save;
723 /* Nothing left on the stack -- error */
728 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
731 /* Restore state as it was in the most forward-advanced error */
732 yylvp = yylvals + yyerrctx->lexeme;
733 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
734 yylpp = yylpsns + yyerrctx->lexeme;
736 yylexp = yylexemes + yyerrctx->lexeme;
739 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
742 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
743 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
744 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
745 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
746 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
747 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
748 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
750 yystate = yyerrctx->state;
751 yyFreeState(yyerrctx);
756 if (yynewerrflag == 0) goto yyinrecovery;
757 #endif /* YYBTYACC */
759 YYERROR_CALL("syntax error");
760 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
761 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
765 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
776 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
777 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
781 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
782 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
784 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
785 yystate = yytable[yyn];
786 *++yystack.s_mark = yytable[yyn];
787 *++yystack.l_mark = yylval;
788 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
789 /* lookahead position is error end position */
790 yyerror_loc_range[1] = yylloc;
791 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
792 *++yystack.p_mark = yyloc;
800 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
801 YYDEBUGSTR, yydepth, *yystack.s_mark);
803 if (yystack.s_mark <= yystack.s_base) goto yyabort;
804 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
805 /* the current TOS position is the error start position */
806 yyerror_loc_range[0] = *yystack.p_mark;
808 #if defined(YYDESTRUCT_CALL)
811 #endif /* YYBTYACC */
812 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
813 YYDESTRUCT_CALL("error: discarding state",
814 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
816 YYDESTRUCT_CALL("error: discarding state",
817 yystos[*yystack.s_mark], yystack.l_mark);
818 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
819 #endif /* defined(YYDESTRUCT_CALL) */
822 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
830 if (yychar == YYEOF) goto yyabort;
834 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
835 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
836 YYDEBUGSTR, yydepth, yystate, yychar, yys);
839 #if defined(YYDESTRUCT_CALL)
842 #endif /* YYBTYACC */
843 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
844 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
846 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
847 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
848 #endif /* defined(YYDESTRUCT_CALL) */
858 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
859 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
860 #ifdef YYSTYPE_TOSTRING
863 #endif /* YYBTYACC */
868 for (i = yym; i > 0; i--)
870 if (i != yym) fputs(", ", stderr);
871 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
872 yystack.l_mark[1-i]), stderr);
881 yyval = yystack.l_mark[1-yym];
883 memset(&yyval, 0, sizeof yyval);
884 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
886 /* Perform position reduction */
887 memset(&yyloc, 0, sizeof(yyloc));
890 #endif /* YYBTYACC */
892 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
893 /* just in case YYERROR is invoked within the action, save
894 the start of the rhs as the error start position */
895 yyerror_loc_range[0] = yystack.p_mark[1-yym];
904 yystack.s_mark -= yym;
905 yystate = *yystack.s_mark;
906 yystack.l_mark -= yym;
907 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
908 yystack.p_mark -= yym;
911 if (yystate == 0 && yym == 0)
916 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
917 #ifdef YYSTYPE_TOSTRING
920 #endif /* YYBTYACC */
921 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
923 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
927 *++yystack.s_mark = YYFINAL;
928 *++yystack.l_mark = yyval;
929 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
930 *++yystack.p_mark = yyloc;
938 /* we're currently re-reading tokens */
940 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
948 /* in trial mode; save scanner results for future parse attempts */
949 if (yylvp == yylvlim)
950 { /* Enlarge lexical value queue */
951 size_t p = (size_t) (yylvp - yylvals);
952 size_t s = (size_t) (yylvlim - yylvals);
954 s += YYLVQUEUEGROWTH;
955 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
957 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
959 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
960 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
963 yylvp = yylve = yylvals + p;
964 yylvlim = yylvals + s;
965 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
966 yylpp = yylpe = yylpsns + p;
967 yylplim = yylpsns + s;
969 yylexp = yylexemes + p;
971 *yylexp = (short) YYLEX;
974 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
981 /* normal operation, no conflict encountered */
982 #endif /* YYBTYACC */
986 #endif /* YYBTYACC */
987 if (yychar < 0) yychar = YYEOF;
991 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
992 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
993 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
997 if (yychar == YYEOF) goto yyaccept;
1000 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1001 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1002 yystate = yytable[yyn];
1004 yystate = yydgoto[yym];
1008 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1009 #ifdef YYSTYPE_TOSTRING
1012 #endif /* YYBTYACC */
1013 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1015 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1018 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1019 *++yystack.s_mark = (YYINT) yystate;
1020 *++yystack.l_mark = yyval;
1021 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1022 *++yystack.p_mark = yyloc;
1027 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1029 if (yypath) YYABORT;
1032 YYParseState *save = yyps->save;
1033 yyps->save = save->save;
1034 save->save = yypath;
1039 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1040 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1044 yyFreeState(yyerrctx);
1047 yylvp = yylvals + yypath->lexeme;
1048 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1049 yylpp = yylpsns + yypath->lexeme;
1051 yylexp = yylexemes + yypath->lexeme;
1053 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1054 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1055 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1056 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1057 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1058 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1059 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1061 yystate = yypath->state;
1063 #endif /* YYBTYACC */
1066 YYERROR_CALL("yacc stack overflow");
1070 YYERROR_CALL("memory exhausted");
1072 #endif /* YYBTYACC */
1082 if (yyps->save) goto yyvalid;
1083 #endif /* YYBTYACC */
1087 #if defined(YYDESTRUCT_CALL)
1088 if (yychar != YYEOF && yychar != YYEMPTY)
1089 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1090 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1092 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1093 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1097 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1100 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1101 YYDESTRUCT_CALL("cleanup: discarding state",
1102 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1104 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1105 YYDESTRUCT_CALL("cleanup: discarding state",
1106 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1107 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1109 #endif /* defined(YYDESTRUCT_CALL) */
1114 yyFreeState(yyerrctx);
1119 YYParseState *save = yyps;
1126 YYParseState *save = yypath;
1127 yypath = save->save;
1131 #endif /* YYBTYACC */
1132 yyfreestack(&yystack);