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_"
122 static void yyerror(const char *);
123 #line 124 "error.tab.c"
125 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
126 /* Default: YYSTYPE is the semantic value type. */
128 # define YYSTYPE_IS_DECLARED 1
131 /* compatibility with bison */
133 /* compatibility with FreeBSD */
134 # ifdef YYPARSE_PARAM_TYPE
135 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
137 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
140 # define YYPARSE_DECL() yyparse(void)
143 /* Parameters sent to lex. */
145 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
146 # define YYLEX yylex(YYLEX_PARAM)
148 # define YYLEX_DECL() yylex(void)
149 # define YYLEX yylex()
152 /* Parameters sent to yyerror. */
154 #define YYERROR_DECL() yyerror(const char *s)
157 #define YYERROR_CALL(msg) yyerror(msg)
160 extern int YYPARSE_DECL();
162 #define YYERRCODE 256
164 static const YYINT error_lhs[] = { -1,
167 static const YYINT error_len[] = { 2,
170 static const YYINT error_defred[] = { 0,
173 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
174 static const YYINT error_stos[] = { 0,
177 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
178 static const YYINT error_dgoto[] = { 2,
180 static const YYINT error_sindex[] = { -256,
183 static const YYINT error_rindex[] = { 0,
187 static const YYINT error_cindex[] = { 0,
191 static const YYINT error_gindex[] = { 0,
193 #define YYTABLESIZE 0
194 static const YYINT error_table[] = { 1,
196 static const YYINT error_check[] = { 256,
199 static const YYINT error_ctable[] = { -1,
206 #define YYMAXTOKEN 256
207 #define YYUNDFTOKEN 259
208 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
210 static const char *const error_name[] = {
212 "$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,
213 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,
214 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,
215 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,
216 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,
217 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,
218 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S","illegal-symbol",
220 static const char *const error_rule[] = {
234 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
235 YYLTYPE yyloc; /* position returned by actions */
236 YYLTYPE yylloc; /* position from the lexer */
239 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
240 #ifndef YYLLOC_DEFAULT
241 #define YYLLOC_DEFAULT(loc, rhs, n) \
246 (loc).first_line = ((rhs)[-1]).last_line; \
247 (loc).first_column = ((rhs)[-1]).last_column; \
248 (loc).last_line = ((rhs)[-1]).last_line; \
249 (loc).last_column = ((rhs)[-1]).last_column; \
253 (loc).first_line = ((rhs)[ 0 ]).first_line; \
254 (loc).first_column = ((rhs)[ 0 ]).first_column; \
255 (loc).last_line = ((rhs)[n-1]).last_line; \
256 (loc).last_column = ((rhs)[n-1]).last_column; \
259 #endif /* YYLLOC_DEFAULT */
260 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
263 #ifndef YYLVQUEUEGROWTH
264 #define YYLVQUEUEGROWTH 32
266 #endif /* YYBTYACC */
268 /* define the initial stack-sizes */
271 #define YYMAXDEPTH YYSTACKSIZE
274 #define YYSTACKSIZE YYMAXDEPTH
276 #define YYSTACKSIZE 10000
277 #define YYMAXDEPTH 10000
281 #ifndef YYINITSTACKSIZE
282 #define YYINITSTACKSIZE 200
292 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
299 struct YYParseState_s
301 struct YYParseState_s *save; /* Previously saved parser state */
302 YYSTACKDATA yystack; /* saved parser stack */
303 int state; /* saved parser state */
304 int errflag; /* saved error recovery status */
305 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
306 YYINT ctry; /* saved index in yyctable[] for this conflict */
308 typedef struct YYParseState_s YYParseState;
309 #endif /* YYBTYACC */
310 /* variables for the parser stack */
311 static YYSTACKDATA yystack;
314 /* Current parser state */
315 static YYParseState *yyps = 0;
317 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
318 static YYParseState *yypath = 0;
320 /* Base of the lexical value queue */
321 static YYSTYPE *yylvals = 0;
323 /* Current position at lexical value queue */
324 static YYSTYPE *yylvp = 0;
326 /* End position of lexical value queue */
327 static YYSTYPE *yylve = 0;
329 /* The last allocated position at the lexical value queue */
330 static YYSTYPE *yylvlim = 0;
332 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
333 /* Base of the lexical position queue */
334 static YYLTYPE *yylpsns = 0;
336 /* Current position at lexical position queue */
337 static YYLTYPE *yylpp = 0;
339 /* End position of lexical position queue */
340 static YYLTYPE *yylpe = 0;
342 /* The last allocated position at the lexical position queue */
343 static YYLTYPE *yylplim = 0;
346 /* Current position at lexical token queue */
347 static YYINT *yylexp = 0;
349 static YYINT *yylexemes = 0;
350 #endif /* YYBTYACC */
358 printf("yyparse() = %d\n", yyparse());
369 yyerror(const char* s)
373 #line 374 "error.tab.c"
375 /* For use in generated program */
376 #define yydepth (int)(yystack.s_mark - yystack.s_base)
378 #define yytrial (yyps->save)
379 #endif /* YYBTYACC */
382 #include <stdio.h> /* needed for printf */
385 #include <stdlib.h> /* needed for malloc, etc */
386 #include <string.h> /* needed for memset */
388 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
389 static int yygrowstack(YYSTACKDATA *data)
395 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
399 if ((newsize = data->stacksize) == 0)
400 newsize = YYINITSTACKSIZE;
401 else if (newsize >= YYMAXDEPTH)
403 else if ((newsize *= 2) > YYMAXDEPTH)
404 newsize = YYMAXDEPTH;
406 i = (int) (data->s_mark - data->s_base);
407 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
411 data->s_base = newss;
412 data->s_mark = newss + i;
414 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
418 data->l_base = newvs;
419 data->l_mark = newvs + i;
421 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
422 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
426 data->p_base = newps;
427 data->p_mark = newps + i;
430 data->stacksize = newsize;
431 data->s_last = data->s_base + newsize - 1;
435 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
440 #if YYPURE || defined(YY_NO_LEAKS)
441 static void yyfreestack(YYSTACKDATA *data)
445 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
448 memset(data, 0, sizeof(*data));
451 #define yyfreestack(data) /* nothing */
452 #endif /* YYPURE || defined(YY_NO_LEAKS) */
455 static YYParseState *
456 yyNewState(unsigned size)
458 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
459 if (p == NULL) return NULL;
461 p->yystack.stacksize = size;
464 p->yystack.s_base = NULL;
465 p->yystack.l_base = NULL;
466 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
467 p->yystack.p_base = NULL;
471 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
472 if (p->yystack.s_base == NULL) return NULL;
473 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
474 if (p->yystack.l_base == NULL) return NULL;
475 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
476 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
477 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
478 if (p->yystack.p_base == NULL) return NULL;
479 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
486 yyFreeState(YYParseState *p)
488 yyfreestack(&p->yystack);
491 #endif /* YYBTYACC */
493 #define YYABORT goto yyabort
494 #define YYREJECT goto yyabort
495 #define YYACCEPT goto yyaccept
496 #define YYERROR goto yyerrlab
498 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
499 #define YYVALID_NESTED do { if (yyps->save && \
500 yyps->save->save == 0) goto yyvalid; } while(0)
501 #endif /* YYBTYACC */
506 int yym, yyn, yystate, yyresult;
509 YYParseState *yyerrctx = NULL;
510 #endif /* YYBTYACC */
511 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
512 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
517 if ((yys = getenv("YYDEBUG")) != 0)
520 if (yyn >= '0' && yyn <= '9')
524 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
526 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
527 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
531 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
533 #endif /* YYBTYACC */
542 memset(&yystack, 0, sizeof(yystack));
545 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
546 yystack.s_mark = yystack.s_base;
547 yystack.l_mark = yystack.l_base;
548 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
549 yystack.p_mark = yystack.p_base;
555 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
562 /* we're currently re-reading tokens */
564 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
572 /* in trial mode; save scanner results for future parse attempts */
573 if (yylvp == yylvlim)
574 { /* Enlarge lexical value queue */
575 size_t p = (size_t) (yylvp - yylvals);
576 size_t s = (size_t) (yylvlim - yylvals);
578 s += YYLVQUEUEGROWTH;
579 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
580 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
581 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
582 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
584 yylvp = yylve = yylvals + p;
585 yylvlim = yylvals + s;
586 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
587 yylpp = yylpe = yylpsns + p;
588 yylplim = yylpsns + s;
590 yylexp = yylexemes + p;
592 *yylexp = (YYINT) YYLEX;
595 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
602 /* normal operation, no conflict encountered */
603 #endif /* YYBTYACC */
607 #endif /* YYBTYACC */
608 if (yychar < 0) yychar = YYEOF;
612 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
613 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
614 YYDEBUGSTR, yydepth, yystate, yychar, yys);
615 #ifdef YYSTYPE_TOSTRING
618 #endif /* YYBTYACC */
619 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
627 /* Do we have a conflict? */
628 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
629 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
638 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
639 YYDEBUGSTR, yydepth, yystate);
641 /* Switch to the next conflict context */
646 if (save->state != yystate) YYABORT;
653 /* Unresolved conflict - start/continue trial parse */
658 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
660 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
662 fputs("Starting trial parse.\n", stderr);
665 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
666 if (save == NULL) goto yyenomem;
667 save->save = yyps->save;
668 save->state = yystate;
669 save->errflag = yyerrflag;
670 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
671 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
672 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
673 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
674 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
675 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
676 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
679 if (yyctable[ctry] == -1)
682 if (yydebug && yychar >= YYEOF)
683 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
688 if (yyps->save == NULL)
690 /* If this is a first conflict in the stack, start saving lexemes */
693 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
694 if (yylexemes == NULL) goto yyenomem;
695 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
696 if (yylvals == NULL) goto yyenomem;
697 yylvlim = yylvals + YYLVQUEUEGROWTH;
698 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
699 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
700 if (yylpsns == NULL) goto yyenomem;
701 yylplim = yylpsns + YYLVQUEUEGROWTH;
706 yylvp = yylve = yylvals;
707 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
708 yylpp = yylpe = yylpsns;
714 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
717 *yylexp = (YYINT) yychar;
725 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
731 save->lexeme = (int) (yylvp - yylvals);
734 if (yytable[yyn] == ctry)
738 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
739 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
744 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
749 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
751 yystate = yyctable[ctry];
752 *++yystack.s_mark = (YYINT) yystate;
753 *++yystack.l_mark = yylval;
754 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
755 *++yystack.p_mark = yylloc;
758 if (yyerrflag > 0) --yyerrflag;
763 yyn = yyctable[ctry];
766 } /* End of code dealing with conflicts */
767 #endif /* YYBTYACC */
768 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
769 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
773 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
774 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
776 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
777 yystate = yytable[yyn];
778 *++yystack.s_mark = yytable[yyn];
779 *++yystack.l_mark = yylval;
780 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
781 *++yystack.p_mark = yylloc;
784 if (yyerrflag > 0) --yyerrflag;
787 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
788 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
793 if (yyerrflag != 0) goto yyinrecovery;
798 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
801 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
802 * before looking for error recovery */
803 yystack.s_mark -= yym;
804 yystate = *yystack.s_mark;
805 yystack.l_mark -= yym;
806 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
807 yystack.p_mark -= yym;
815 YYParseState *save = yyps->save;
818 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
819 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
820 (int)(yylvp - yylvals - yyps->save->lexeme));
822 /* Memorize most forward-looking error state in case it's really an error. */
823 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
825 /* Free old saved error context state */
826 if (yyerrctx) yyFreeState(yyerrctx);
827 /* Create and fill out new saved error context state */
828 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
829 if (yyerrctx == NULL) goto yyenomem;
830 yyerrctx->save = yyps->save;
831 yyerrctx->state = yystate;
832 yyerrctx->errflag = yyerrflag;
833 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
834 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
835 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
836 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
837 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
838 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
839 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
841 yyerrctx->lexeme = (int) (yylvp - yylvals);
843 yylvp = yylvals + save->lexeme;
844 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
845 yylpp = yylpsns + save->lexeme;
847 yylexp = yylexemes + save->lexeme;
849 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
850 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
851 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
852 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
853 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
854 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
855 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
858 yystate = save->state;
859 /* We tried shift, try reduce now */
860 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
861 yyps->save = save->save;
865 /* Nothing left on the stack -- error */
870 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
873 /* Restore state as it was in the most forward-advanced error */
874 yylvp = yylvals + yyerrctx->lexeme;
875 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
876 yylpp = yylpsns + yyerrctx->lexeme;
878 yylexp = yylexemes + yyerrctx->lexeme;
881 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
884 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
885 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
886 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
887 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
888 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
889 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
890 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
892 yystate = yyerrctx->state;
893 yyFreeState(yyerrctx);
898 if (yynewerrflag == 0) goto yyinrecovery;
899 #endif /* YYBTYACC */
901 YYERROR_CALL("syntax error");
902 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
903 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
907 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
918 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
919 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
923 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
924 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
926 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
927 yystate = yytable[yyn];
928 *++yystack.s_mark = yytable[yyn];
929 *++yystack.l_mark = yylval;
930 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
931 /* lookahead position is error end position */
932 yyerror_loc_range[1] = yylloc;
933 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
934 *++yystack.p_mark = yyloc;
942 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
943 YYDEBUGSTR, yydepth, *yystack.s_mark);
945 if (yystack.s_mark <= yystack.s_base) goto yyabort;
946 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
947 /* the current TOS position is the error start position */
948 yyerror_loc_range[0] = *yystack.p_mark;
950 #if defined(YYDESTRUCT_CALL)
953 #endif /* YYBTYACC */
954 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
955 YYDESTRUCT_CALL("error: discarding state",
956 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
958 YYDESTRUCT_CALL("error: discarding state",
959 yystos[*yystack.s_mark], yystack.l_mark);
960 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
961 #endif /* defined(YYDESTRUCT_CALL) */
964 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
972 if (yychar == YYEOF) goto yyabort;
976 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
977 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
978 YYDEBUGSTR, yydepth, yystate, yychar, yys);
981 #if defined(YYDESTRUCT_CALL)
984 #endif /* YYBTYACC */
985 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
986 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
988 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
989 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
990 #endif /* defined(YYDESTRUCT_CALL) */
1000 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1001 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1002 #ifdef YYSTYPE_TOSTRING
1005 #endif /* YYBTYACC */
1010 for (i = yym; i > 0; i--)
1012 if (i != yym) fputs(", ", stderr);
1013 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1014 yystack.l_mark[1-i]), stderr);
1019 fputc('\n', stderr);
1023 yyval = yystack.l_mark[1-yym];
1025 memset(&yyval, 0, sizeof yyval);
1026 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1028 /* Perform position reduction */
1029 memset(&yyloc, 0, sizeof(yyloc));
1032 #endif /* YYBTYACC */
1034 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1035 /* just in case YYERROR is invoked within the action, save
1036 the start of the rhs as the error start position */
1037 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1046 yystack.s_mark -= yym;
1047 yystate = *yystack.s_mark;
1048 yystack.l_mark -= yym;
1049 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1050 yystack.p_mark -= yym;
1053 if (yystate == 0 && yym == 0)
1058 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1059 #ifdef YYSTYPE_TOSTRING
1062 #endif /* YYBTYACC */
1063 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1065 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1069 *++yystack.s_mark = YYFINAL;
1070 *++yystack.l_mark = yyval;
1071 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1072 *++yystack.p_mark = yyloc;
1080 /* we're currently re-reading tokens */
1082 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1090 /* in trial mode; save scanner results for future parse attempts */
1091 if (yylvp == yylvlim)
1092 { /* Enlarge lexical value queue */
1093 size_t p = (size_t) (yylvp - yylvals);
1094 size_t s = (size_t) (yylvlim - yylvals);
1096 s += YYLVQUEUEGROWTH;
1097 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1099 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1101 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1102 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1105 yylvp = yylve = yylvals + p;
1106 yylvlim = yylvals + s;
1107 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1108 yylpp = yylpe = yylpsns + p;
1109 yylplim = yylpsns + s;
1111 yylexp = yylexemes + p;
1113 *yylexp = (YYINT) YYLEX;
1116 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1123 /* normal operation, no conflict encountered */
1124 #endif /* YYBTYACC */
1128 #endif /* YYBTYACC */
1129 if (yychar < 0) yychar = YYEOF;
1133 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1134 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1135 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1139 if (yychar == YYEOF) goto yyaccept;
1142 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1143 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1144 yystate = yytable[yyn];
1146 yystate = yydgoto[yym];
1150 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1151 #ifdef YYSTYPE_TOSTRING
1154 #endif /* YYBTYACC */
1155 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1157 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1160 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1161 *++yystack.s_mark = (YYINT) yystate;
1162 *++yystack.l_mark = yyval;
1163 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1164 *++yystack.p_mark = yyloc;
1169 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1171 if (yypath) YYABORT;
1174 YYParseState *save = yyps->save;
1175 yyps->save = save->save;
1176 save->save = yypath;
1181 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1182 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1186 yyFreeState(yyerrctx);
1189 yylvp = yylvals + yypath->lexeme;
1190 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1191 yylpp = yylpsns + yypath->lexeme;
1193 yylexp = yylexemes + yypath->lexeme;
1195 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1196 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1197 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1198 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1199 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1200 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1201 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1203 yystate = yypath->state;
1205 #endif /* YYBTYACC */
1208 YYERROR_CALL("yacc stack overflow");
1212 YYERROR_CALL("memory exhausted");
1214 #endif /* YYBTYACC */
1224 if (yyps->save) goto yyvalid;
1225 #endif /* YYBTYACC */
1229 #if defined(YYDESTRUCT_CALL)
1230 if (yychar != YYEOF && yychar != YYEMPTY)
1231 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1232 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1234 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1235 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1239 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1242 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1243 YYDESTRUCT_CALL("cleanup: discarding state",
1244 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1246 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1247 YYDESTRUCT_CALL("cleanup: discarding state",
1248 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1249 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1251 #endif /* defined(YYDESTRUCT_CALL) */
1256 yyFreeState(yyerrctx);
1261 YYParseState *save = yyps;
1268 YYParseState *save = yypath;
1269 yypath = save->save;
1273 #endif /* YYBTYACC */
1274 yyfreestack(&yystack);