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"
21 #define yyparse error_parse
25 #define yylex error_lex
29 #define yyerror error_error
33 #define yychar error_char
37 #define yyval error_val
41 #define yylval error_lval
45 #define yydebug error_debug
49 #define yynerrs error_nerrs
53 #define yyerrflag error_errflag
54 #endif /* yyerrflag */
57 #define yylhs error_lhs
61 #define yylen error_len
65 #define yydefred error_defred
69 #define yystos error_stos
73 #define yydgoto error_dgoto
77 #define yysindex error_sindex
81 #define yyrindex error_rindex
85 #define yygindex error_gindex
89 #define yytable error_table
93 #define yycheck error_check
97 #define yyname error_name
101 #define yyrule error_rule
107 #define yycindex error_cindex
108 #endif /* yycindex */
111 #define yyctable error_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "error_"
120 #line 2 "code_error.y"
124 static void yyerror(const char *);
127 #line 128 "code_error.code.c"
129 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
130 /* Default: YYSTYPE is the semantic value type. */
132 # define YYSTYPE_IS_DECLARED 1
135 /* compatibility with bison */
137 /* compatibility with FreeBSD */
138 # ifdef YYPARSE_PARAM_TYPE
139 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
141 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
144 # define YYPARSE_DECL() yyparse(void)
147 /* Parameters sent to lex. */
149 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
150 # define YYLEX yylex(YYLEX_PARAM)
152 # define YYLEX_DECL() yylex(void)
153 # define YYLEX yylex()
156 /* Parameters sent to yyerror. */
158 #define YYERROR_DECL() yyerror(const char *s)
161 #define YYERROR_CALL(msg) yyerror(msg)
164 #define YYERRCODE 256
165 #define YYTABLESIZE 0
170 #define YYMAXTOKEN 256
171 #define YYUNDFTOKEN 259
172 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
174 extern int YYPARSE_DECL();
176 extern const YYINT yylhs[];
177 extern const YYINT yylen[];
178 extern const YYINT yydefred[];
179 extern const YYINT yystos[];
180 extern const YYINT yydgoto[];
181 extern const YYINT yysindex[];
182 extern const YYINT yyrindex[];
184 extern const YYINT yycindex[];
185 #endif /* YYBTYACC */
186 extern const YYINT yygindex[];
187 extern const YYINT yytable[];
188 extern const YYINT yycheck[];
190 extern const YYINT yyctable[];
191 #endif /* YYBTYACC */
193 #if YYDEBUG || defined(yytname)
194 extern const char *const yyname[];
197 extern const char *const yyrule[];
207 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
208 YYLTYPE yyloc; /* position returned by actions */
209 YYLTYPE yylloc; /* position from the lexer */
212 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
213 #ifndef YYLLOC_DEFAULT
214 #define YYLLOC_DEFAULT(loc, rhs, n) \
219 (loc).first_line = ((rhs)[-1]).last_line; \
220 (loc).first_column = ((rhs)[-1]).last_column; \
221 (loc).last_line = ((rhs)[-1]).last_line; \
222 (loc).last_column = ((rhs)[-1]).last_column; \
226 (loc).first_line = ((rhs)[ 0 ]).first_line; \
227 (loc).first_column = ((rhs)[ 0 ]).first_column; \
228 (loc).last_line = ((rhs)[n-1]).last_line; \
229 (loc).last_column = ((rhs)[n-1]).last_column; \
232 #endif /* YYLLOC_DEFAULT */
233 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
236 #ifndef YYLVQUEUEGROWTH
237 #define YYLVQUEUEGROWTH 32
239 #endif /* YYBTYACC */
241 /* define the initial stack-sizes */
244 #define YYMAXDEPTH YYSTACKSIZE
247 #define YYSTACKSIZE YYMAXDEPTH
249 #define YYSTACKSIZE 10000
250 #define YYMAXDEPTH 10000
254 #ifndef YYINITSTACKSIZE
255 #define YYINITSTACKSIZE 200
265 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
272 struct YYParseState_s
274 struct YYParseState_s *save; /* Previously saved parser state */
275 YYSTACKDATA yystack; /* saved parser stack */
276 int state; /* saved parser state */
277 int errflag; /* saved error recovery status */
278 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
279 YYINT ctry; /* saved index in yyctable[] for this conflict */
281 typedef struct YYParseState_s YYParseState;
282 #endif /* YYBTYACC */
283 /* variables for the parser stack */
284 static YYSTACKDATA yystack;
287 /* Current parser state */
288 static YYParseState *yyps = 0;
290 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
291 static YYParseState *yypath = 0;
293 /* Base of the lexical value queue */
294 static YYSTYPE *yylvals = 0;
296 /* Current position at lexical value queue */
297 static YYSTYPE *yylvp = 0;
299 /* End position of lexical value queue */
300 static YYSTYPE *yylve = 0;
302 /* The last allocated position at the lexical value queue */
303 static YYSTYPE *yylvlim = 0;
305 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
306 /* Base of the lexical position queue */
307 static YYLTYPE *yylpsns = 0;
309 /* Current position at lexical position queue */
310 static YYLTYPE *yylpp = 0;
312 /* End position of lexical position queue */
313 static YYLTYPE *yylpe = 0;
315 /* The last allocated position at the lexical position queue */
316 static YYLTYPE *yylplim = 0;
319 /* Current position at lexical token queue */
320 static YYINT *yylexp = 0;
322 static YYINT *yylexemes = 0;
323 #endif /* YYBTYACC */
324 #line 12 "code_error.y"
329 extern int YYLEX_DECL();
335 printf("yyparse() = %d\n", yyparse());
346 yyerror(const char* s)
350 #line 351 "code_error.code.c"
352 /* For use in generated program */
353 #define yydepth (int)(yystack.s_mark - yystack.s_base)
355 #define yytrial (yyps->save)
356 #endif /* YYBTYACC */
359 #include <stdio.h> /* needed for printf */
362 #include <stdlib.h> /* needed for malloc, etc */
363 #include <string.h> /* needed for memset */
365 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
366 static int yygrowstack(YYSTACKDATA *data)
372 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
376 if ((newsize = data->stacksize) == 0)
377 newsize = YYINITSTACKSIZE;
378 else if (newsize >= YYMAXDEPTH)
380 else if ((newsize *= 2) > YYMAXDEPTH)
381 newsize = YYMAXDEPTH;
383 i = (int) (data->s_mark - data->s_base);
384 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
388 data->s_base = newss;
389 data->s_mark = newss + i;
391 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
395 data->l_base = newvs;
396 data->l_mark = newvs + i;
398 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
399 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
403 data->p_base = newps;
404 data->p_mark = newps + i;
407 data->stacksize = newsize;
408 data->s_last = data->s_base + newsize - 1;
412 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
417 #if YYPURE || defined(YY_NO_LEAKS)
418 static void yyfreestack(YYSTACKDATA *data)
422 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
425 memset(data, 0, sizeof(*data));
428 #define yyfreestack(data) /* nothing */
429 #endif /* YYPURE || defined(YY_NO_LEAKS) */
432 static YYParseState *
433 yyNewState(unsigned size)
435 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
436 if (p == NULL) return NULL;
438 p->yystack.stacksize = size;
441 p->yystack.s_base = NULL;
442 p->yystack.l_base = NULL;
443 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
444 p->yystack.p_base = NULL;
448 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
449 if (p->yystack.s_base == NULL) return NULL;
450 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
451 if (p->yystack.l_base == NULL) return NULL;
452 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
453 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
454 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
455 if (p->yystack.p_base == NULL) return NULL;
456 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
463 yyFreeState(YYParseState *p)
465 yyfreestack(&p->yystack);
468 #endif /* YYBTYACC */
470 #define YYABORT goto yyabort
471 #define YYREJECT goto yyabort
472 #define YYACCEPT goto yyaccept
473 #define YYERROR goto yyerrlab
475 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
476 #define YYVALID_NESTED do { if (yyps->save && \
477 yyps->save->save == 0) goto yyvalid; } while(0)
478 #endif /* YYBTYACC */
483 int yym, yyn, yystate, yyresult;
486 YYParseState *yyerrctx = NULL;
487 #endif /* YYBTYACC */
488 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
489 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
494 if ((yys = getenv("YYDEBUG")) != 0)
497 if (yyn >= '0' && yyn <= '9')
501 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
505 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
507 #endif /* YYBTYACC */
516 memset(&yystack, 0, sizeof(yystack));
519 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
520 yystack.s_mark = yystack.s_base;
521 yystack.l_mark = yystack.l_base;
522 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
523 yystack.p_mark = yystack.p_base;
529 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
536 /* we're currently re-reading tokens */
538 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
546 /* in trial mode; save scanner results for future parse attempts */
547 if (yylvp == yylvlim)
548 { /* Enlarge lexical value queue */
549 size_t p = (size_t) (yylvp - yylvals);
550 size_t s = (size_t) (yylvlim - yylvals);
552 s += YYLVQUEUEGROWTH;
553 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
554 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
555 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
556 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
558 yylvp = yylve = yylvals + p;
559 yylvlim = yylvals + s;
560 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
561 yylpp = yylpe = yylpsns + p;
562 yylplim = yylpsns + s;
564 yylexp = yylexemes + p;
566 *yylexp = (YYINT) YYLEX;
569 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
576 /* normal operation, no conflict encountered */
577 #endif /* YYBTYACC */
581 #endif /* YYBTYACC */
582 if (yychar < 0) yychar = YYEOF;
586 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
587 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
588 YYDEBUGSTR, yydepth, yystate, yychar, yys);
589 #ifdef YYSTYPE_TOSTRING
592 #endif /* YYBTYACC */
593 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
601 /* Do we have a conflict? */
602 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
603 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
612 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
613 YYDEBUGSTR, yydepth, yystate);
615 /* Switch to the next conflict context */
620 if (save->state != yystate) YYABORT;
627 /* Unresolved conflict - start/continue trial parse */
632 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
634 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
636 fputs("Starting trial parse.\n", stderr);
639 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
640 if (save == NULL) goto yyenomem;
641 save->save = yyps->save;
642 save->state = yystate;
643 save->errflag = yyerrflag;
644 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
645 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
646 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
647 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
648 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
649 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
650 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
653 if (yyctable[ctry] == -1)
656 if (yydebug && yychar >= YYEOF)
657 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
662 if (yyps->save == NULL)
664 /* If this is a first conflict in the stack, start saving lexemes */
667 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
668 if (yylexemes == NULL) goto yyenomem;
669 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
670 if (yylvals == NULL) goto yyenomem;
671 yylvlim = yylvals + YYLVQUEUEGROWTH;
672 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
673 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
674 if (yylpsns == NULL) goto yyenomem;
675 yylplim = yylpsns + YYLVQUEUEGROWTH;
680 yylvp = yylve = yylvals;
681 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
682 yylpp = yylpe = yylpsns;
688 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
691 *yylexp = (YYINT) yychar;
699 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
705 save->lexeme = (int) (yylvp - yylvals);
708 if (yytable[yyn] == ctry)
712 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
713 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
718 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
723 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
725 yystate = yyctable[ctry];
726 *++yystack.s_mark = (YYINT) yystate;
727 *++yystack.l_mark = yylval;
728 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
729 *++yystack.p_mark = yylloc;
732 if (yyerrflag > 0) --yyerrflag;
737 yyn = yyctable[ctry];
740 } /* End of code dealing with conflicts */
741 #endif /* YYBTYACC */
742 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
743 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
747 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
748 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
750 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
751 yystate = yytable[yyn];
752 *++yystack.s_mark = yytable[yyn];
753 *++yystack.l_mark = yylval;
754 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
755 *++yystack.p_mark = yylloc;
758 if (yyerrflag > 0) --yyerrflag;
761 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
762 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
767 if (yyerrflag != 0) goto yyinrecovery;
772 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
775 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
776 * before looking for error recovery */
777 yystack.s_mark -= yym;
778 yystate = *yystack.s_mark;
779 yystack.l_mark -= yym;
780 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
781 yystack.p_mark -= yym;
789 YYParseState *save = yyps->save;
792 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
793 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
794 (int)(yylvp - yylvals - yyps->save->lexeme));
796 /* Memorize most forward-looking error state in case it's really an error. */
797 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
799 /* Free old saved error context state */
800 if (yyerrctx) yyFreeState(yyerrctx);
801 /* Create and fill out new saved error context state */
802 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
803 if (yyerrctx == NULL) goto yyenomem;
804 yyerrctx->save = yyps->save;
805 yyerrctx->state = yystate;
806 yyerrctx->errflag = yyerrflag;
807 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
808 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
809 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
810 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
811 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
812 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
813 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
815 yyerrctx->lexeme = (int) (yylvp - yylvals);
817 yylvp = yylvals + save->lexeme;
818 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
819 yylpp = yylpsns + save->lexeme;
821 yylexp = yylexemes + save->lexeme;
823 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
824 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
825 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
826 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
827 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
828 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
829 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
832 yystate = save->state;
833 /* We tried shift, try reduce now */
834 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
835 yyps->save = save->save;
839 /* Nothing left on the stack -- error */
844 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
847 /* Restore state as it was in the most forward-advanced error */
848 yylvp = yylvals + yyerrctx->lexeme;
849 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
850 yylpp = yylpsns + yyerrctx->lexeme;
852 yylexp = yylexemes + yyerrctx->lexeme;
855 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
858 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
859 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
860 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
861 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
862 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
863 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
864 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
866 yystate = yyerrctx->state;
867 yyFreeState(yyerrctx);
872 if (yynewerrflag == 0) goto yyinrecovery;
873 #endif /* YYBTYACC */
875 YYERROR_CALL("syntax error");
876 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
877 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
881 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
892 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
893 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
897 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
898 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
900 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
901 yystate = yytable[yyn];
902 *++yystack.s_mark = yytable[yyn];
903 *++yystack.l_mark = yylval;
904 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
905 /* lookahead position is error end position */
906 yyerror_loc_range[1] = yylloc;
907 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
908 *++yystack.p_mark = yyloc;
916 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
917 YYDEBUGSTR, yydepth, *yystack.s_mark);
919 if (yystack.s_mark <= yystack.s_base) goto yyabort;
920 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
921 /* the current TOS position is the error start position */
922 yyerror_loc_range[0] = *yystack.p_mark;
924 #if defined(YYDESTRUCT_CALL)
927 #endif /* YYBTYACC */
928 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
929 YYDESTRUCT_CALL("error: discarding state",
930 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
932 YYDESTRUCT_CALL("error: discarding state",
933 yystos[*yystack.s_mark], yystack.l_mark);
934 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
935 #endif /* defined(YYDESTRUCT_CALL) */
938 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
946 if (yychar == YYEOF) goto yyabort;
950 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
951 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
952 YYDEBUGSTR, yydepth, yystate, yychar, yys);
955 #if defined(YYDESTRUCT_CALL)
958 #endif /* YYBTYACC */
959 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
960 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
962 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
963 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
964 #endif /* defined(YYDESTRUCT_CALL) */
974 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
975 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
976 #ifdef YYSTYPE_TOSTRING
979 #endif /* YYBTYACC */
984 for (i = yym; i > 0; i--)
986 if (i != yym) fputs(", ", stderr);
987 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
988 yystack.l_mark[1-i]), stderr);
997 yyval = yystack.l_mark[1-yym];
999 memset(&yyval, 0, sizeof yyval);
1000 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1002 /* Perform position reduction */
1003 memset(&yyloc, 0, sizeof(yyloc));
1006 #endif /* YYBTYACC */
1008 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1009 /* just in case YYERROR is invoked within the action, save
1010 the start of the rhs as the error start position */
1011 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1020 yystack.s_mark -= yym;
1021 yystate = *yystack.s_mark;
1022 yystack.l_mark -= yym;
1023 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1024 yystack.p_mark -= yym;
1027 if (yystate == 0 && yym == 0)
1032 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1033 #ifdef YYSTYPE_TOSTRING
1036 #endif /* YYBTYACC */
1037 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1039 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1043 *++yystack.s_mark = YYFINAL;
1044 *++yystack.l_mark = yyval;
1045 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1046 *++yystack.p_mark = yyloc;
1054 /* we're currently re-reading tokens */
1056 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1064 /* in trial mode; save scanner results for future parse attempts */
1065 if (yylvp == yylvlim)
1066 { /* Enlarge lexical value queue */
1067 size_t p = (size_t) (yylvp - yylvals);
1068 size_t s = (size_t) (yylvlim - yylvals);
1070 s += YYLVQUEUEGROWTH;
1071 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1073 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1075 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1076 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1079 yylvp = yylve = yylvals + p;
1080 yylvlim = yylvals + s;
1081 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1082 yylpp = yylpe = yylpsns + p;
1083 yylplim = yylpsns + s;
1085 yylexp = yylexemes + p;
1087 *yylexp = (YYINT) YYLEX;
1090 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1097 /* normal operation, no conflict encountered */
1098 #endif /* YYBTYACC */
1102 #endif /* YYBTYACC */
1103 if (yychar < 0) yychar = YYEOF;
1107 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1108 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1109 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1113 if (yychar == YYEOF) goto yyaccept;
1116 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1117 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1118 yystate = yytable[yyn];
1120 yystate = yydgoto[yym];
1124 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1125 #ifdef YYSTYPE_TOSTRING
1128 #endif /* YYBTYACC */
1129 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1131 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1134 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1135 *++yystack.s_mark = (YYINT) yystate;
1136 *++yystack.l_mark = yyval;
1137 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1138 *++yystack.p_mark = yyloc;
1143 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1145 if (yypath) YYABORT;
1148 YYParseState *save = yyps->save;
1149 yyps->save = save->save;
1150 save->save = yypath;
1155 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1156 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1160 yyFreeState(yyerrctx);
1163 yylvp = yylvals + yypath->lexeme;
1164 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1165 yylpp = yylpsns + yypath->lexeme;
1167 yylexp = yylexemes + yypath->lexeme;
1169 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1170 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1171 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1172 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1173 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1174 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1175 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1177 yystate = yypath->state;
1179 #endif /* YYBTYACC */
1182 YYERROR_CALL("yacc stack overflow");
1186 YYERROR_CALL("memory exhausted");
1188 #endif /* YYBTYACC */
1198 if (yyps->save) goto yyvalid;
1199 #endif /* YYBTYACC */
1203 #if defined(YYDESTRUCT_CALL)
1204 if (yychar != YYEOF && yychar != YYEMPTY)
1205 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1206 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1208 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1209 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1213 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1216 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1217 YYDESTRUCT_CALL("cleanup: discarding state",
1218 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1220 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1221 YYDESTRUCT_CALL("cleanup: discarding state",
1222 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1223 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1225 #endif /* defined(YYDESTRUCT_CALL) */
1230 yyFreeState(yyerrctx);
1235 YYParseState *save = yyps;
1242 YYParseState *save = yypath;
1243 yypath = save->save;
1247 #endif /* YYBTYACC */
1248 yyfreestack(&yystack);