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 "pure_error.y"
124 #define YYLEX_PARAM &yylval
125 #define YYLEX_DECL() yylex(YYSTYPE *yylval)
126 #define YYERROR_DECL() yyerror(const char *s)
128 static void YYERROR_DECL();
131 #line 132 "pure_error.tab.c"
133 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
134 /* Default: YYSTYPE is the semantic value type. */
136 # define YYSTYPE_IS_DECLARED 1
139 /* compatibility with bison */
141 /* compatibility with FreeBSD */
142 # ifdef YYPARSE_PARAM_TYPE
143 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
145 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
148 # define YYPARSE_DECL() yyparse(void)
151 /* Parameters sent to lex. */
153 # ifdef YYLEX_PARAM_TYPE
154 # define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
156 # define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
158 # define YYLEX yylex(&yylval, YYLEX_PARAM)
160 # define YYLEX_DECL() yylex(YYSTYPE *yylval)
161 # define YYLEX yylex(&yylval)
164 /* Parameters sent to yyerror. */
166 #define YYERROR_DECL() yyerror(const char *s)
169 #define YYERROR_CALL(msg) yyerror(msg)
172 extern int YYPARSE_DECL();
174 #define YYERRCODE 256
176 static const YYINT error_lhs[] = { -1,
179 static const YYINT error_len[] = { 2,
182 static const YYINT error_defred[] = { 0,
185 static const YYINT error_stos[] = { 0,
188 static const YYINT error_dgoto[] = { 2,
190 static const YYINT error_sindex[] = { -256,
193 static const YYINT error_rindex[] = { 0,
197 static const YYINT error_cindex[] = { 0,
201 static const YYINT error_gindex[] = { 0,
203 #define YYTABLESIZE 0
204 static const YYINT error_table[] = { 1,
206 static const YYINT error_check[] = { 256,
209 static const YYINT error_ctable[] = { -1,
216 #define YYMAXTOKEN 256
217 #define YYUNDFTOKEN 259
218 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
220 static const char *const error_name[] = {
222 "$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,
223 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,
224 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,
225 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,
226 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,
227 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,
228 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S","illegal-symbol",
230 static const char *const error_rule[] = {
240 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
241 #ifndef YYLLOC_DEFAULT
242 #define YYLLOC_DEFAULT(loc, rhs, n) \
247 (loc).first_line = ((rhs)[-1]).last_line; \
248 (loc).first_column = ((rhs)[-1]).last_column; \
249 (loc).last_line = ((rhs)[-1]).last_line; \
250 (loc).last_column = ((rhs)[-1]).last_column; \
254 (loc).first_line = ((rhs)[ 0 ]).first_line; \
255 (loc).first_column = ((rhs)[ 0 ]).first_column; \
256 (loc).last_line = ((rhs)[n-1]).last_line; \
257 (loc).last_column = ((rhs)[n-1]).last_column; \
260 #endif /* YYLLOC_DEFAULT */
261 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
264 #ifndef YYLVQUEUEGROWTH
265 #define YYLVQUEUEGROWTH 32
267 #endif /* YYBTYACC */
269 /* define the initial stack-sizes */
272 #define YYMAXDEPTH YYSTACKSIZE
275 #define YYSTACKSIZE YYMAXDEPTH
277 #define YYSTACKSIZE 10000
278 #define YYMAXDEPTH 10000
282 #ifndef YYINITSTACKSIZE
283 #define YYINITSTACKSIZE 200
293 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
300 struct YYParseState_s
302 struct YYParseState_s *save; /* Previously saved parser state */
303 YYSTACKDATA yystack; /* saved parser stack */
304 int state; /* saved parser state */
305 int errflag; /* saved error recovery status */
306 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
307 YYINT ctry; /* saved index in yyctable[] for this conflict */
309 typedef struct YYParseState_s YYParseState;
310 #endif /* YYBTYACC */
311 #line 17 "pure_error.y"
316 extern int YYLEX_DECL();
322 printf("yyparse() = %d\n", yyparse());
327 yylex(YYSTYPE *value)
329 return value ? 0 : -1;
333 yyerror(const char* s)
337 #line 338 "pure_error.tab.c"
339 /* For use in generated program */
340 #define yydepth (int)(yystack.s_mark - yystack.s_base)
342 #define yytrial (yyps->save)
343 #endif /* YYBTYACC */
346 #include <stdio.h> /* needed for printf */
349 #include <stdlib.h> /* needed for malloc, etc */
350 #include <string.h> /* needed for memset */
352 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
353 static int yygrowstack(YYSTACKDATA *data)
359 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
363 if ((newsize = data->stacksize) == 0)
364 newsize = YYINITSTACKSIZE;
365 else if (newsize >= YYMAXDEPTH)
367 else if ((newsize *= 2) > YYMAXDEPTH)
368 newsize = YYMAXDEPTH;
370 i = (int) (data->s_mark - data->s_base);
371 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
375 data->s_base = newss;
376 data->s_mark = newss + i;
378 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
382 data->l_base = newvs;
383 data->l_mark = newvs + i;
385 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
386 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
390 data->p_base = newps;
391 data->p_mark = newps + i;
394 data->stacksize = newsize;
395 data->s_last = data->s_base + newsize - 1;
399 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
404 #if YYPURE || defined(YY_NO_LEAKS)
405 static void yyfreestack(YYSTACKDATA *data)
409 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
412 memset(data, 0, sizeof(*data));
415 #define yyfreestack(data) /* nothing */
416 #endif /* YYPURE || defined(YY_NO_LEAKS) */
419 static YYParseState *
420 yyNewState(unsigned size)
422 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
423 if (p == NULL) return NULL;
425 p->yystack.stacksize = size;
428 p->yystack.s_base = NULL;
429 p->yystack.l_base = NULL;
430 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
431 p->yystack.p_base = NULL;
435 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
436 if (p->yystack.s_base == NULL) return NULL;
437 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
438 if (p->yystack.l_base == NULL) return NULL;
439 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
440 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
441 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
442 if (p->yystack.p_base == NULL) return NULL;
443 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
450 yyFreeState(YYParseState *p)
452 yyfreestack(&p->yystack);
455 #endif /* YYBTYACC */
457 #define YYABORT goto yyabort
458 #define YYREJECT goto yyabort
459 #define YYACCEPT goto yyaccept
460 #define YYERROR goto yyerrlab
462 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
463 #define YYVALID_NESTED do { if (yyps->save && \
464 yyps->save->save == 0) goto yyvalid; } while(0)
465 #endif /* YYBTYACC */
474 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
475 YYLTYPE yyloc; /* position returned by actions */
476 YYLTYPE yylloc; /* position from the lexer */
479 /* variables for the parser stack */
483 /* Current parser state */
484 static YYParseState *yyps = 0;
486 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
487 static YYParseState *yypath = 0;
489 /* Base of the lexical value queue */
490 static YYSTYPE *yylvals = 0;
492 /* Current position at lexical value queue */
493 static YYSTYPE *yylvp = 0;
495 /* End position of lexical value queue */
496 static YYSTYPE *yylve = 0;
498 /* The last allocated position at the lexical value queue */
499 static YYSTYPE *yylvlim = 0;
501 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
502 /* Base of the lexical position queue */
503 static YYLTYPE *yylpsns = 0;
505 /* Current position at lexical position queue */
506 static YYLTYPE *yylpp = 0;
508 /* End position of lexical position queue */
509 static YYLTYPE *yylpe = 0;
511 /* The last allocated position at the lexical position queue */
512 static YYLTYPE *yylplim = 0;
515 /* Current position at lexical token queue */
516 static short *yylexp = 0;
518 static short *yylexemes = 0;
519 #endif /* YYBTYACC */
520 int yym, yyn, yystate, yyresult;
523 YYParseState *yyerrctx = NULL;
524 #endif /* YYBTYACC */
525 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
526 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
531 if ((yys = getenv("YYDEBUG")) != 0)
534 if (yyn >= '0' && yyn <= '9')
538 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
542 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
544 #endif /* YYBTYACC */
553 memset(&yystack, 0, sizeof(yystack));
556 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
557 yystack.s_mark = yystack.s_base;
558 yystack.l_mark = yystack.l_base;
559 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
560 yystack.p_mark = yystack.p_base;
566 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
573 /* we're currently re-reading tokens */
575 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
583 /* in trial mode; save scanner results for future parse attempts */
584 if (yylvp == yylvlim)
585 { /* Enlarge lexical value queue */
586 size_t p = (size_t) (yylvp - yylvals);
587 size_t s = (size_t) (yylvlim - yylvals);
589 s += YYLVQUEUEGROWTH;
590 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
591 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
592 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
593 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
595 yylvp = yylve = yylvals + p;
596 yylvlim = yylvals + s;
597 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
598 yylpp = yylpe = yylpsns + p;
599 yylplim = yylpsns + s;
601 yylexp = yylexemes + p;
603 *yylexp = (short) YYLEX;
606 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
613 /* normal operation, no conflict encountered */
614 #endif /* YYBTYACC */
618 #endif /* YYBTYACC */
619 if (yychar < 0) yychar = YYEOF;
623 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
624 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
625 YYDEBUGSTR, yydepth, yystate, yychar, yys);
626 #ifdef YYSTYPE_TOSTRING
629 #endif /* YYBTYACC */
630 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
638 /* Do we have a conflict? */
639 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
640 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
649 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
650 YYDEBUGSTR, yydepth, yystate);
652 /* Switch to the next conflict context */
657 if (save->state != yystate) YYABORT;
664 /* Unresolved conflict - start/continue trial parse */
669 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
671 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
673 fputs("Starting trial parse.\n", stderr);
676 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
677 if (save == NULL) goto yyenomem;
678 save->save = yyps->save;
679 save->state = yystate;
680 save->errflag = yyerrflag;
681 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
682 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
683 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
684 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
685 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
686 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
687 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
690 if (yyctable[ctry] == -1)
693 if (yydebug && yychar >= YYEOF)
694 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
699 if (yyps->save == NULL)
701 /* If this is a first conflict in the stack, start saving lexemes */
704 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
705 if (yylexemes == NULL) goto yyenomem;
706 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
707 if (yylvals == NULL) goto yyenomem;
708 yylvlim = yylvals + YYLVQUEUEGROWTH;
709 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
710 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
711 if (yylpsns == NULL) goto yyenomem;
712 yylplim = yylpsns + YYLVQUEUEGROWTH;
717 yylvp = yylve = yylvals;
718 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
719 yylpp = yylpe = yylpsns;
725 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
728 *yylexp = (short) yychar;
736 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
742 save->lexeme = (int) (yylvp - yylvals);
745 if (yytable[yyn] == ctry)
749 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
750 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
755 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
760 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
762 yystate = yyctable[ctry];
763 *++yystack.s_mark = (YYINT) yystate;
764 *++yystack.l_mark = yylval;
765 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
766 *++yystack.p_mark = yylloc;
769 if (yyerrflag > 0) --yyerrflag;
774 yyn = yyctable[ctry];
777 } /* End of code dealing with conflicts */
778 #endif /* YYBTYACC */
779 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
780 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
784 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
785 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
787 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
788 yystate = yytable[yyn];
789 *++yystack.s_mark = yytable[yyn];
790 *++yystack.l_mark = yylval;
791 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
792 *++yystack.p_mark = yylloc;
795 if (yyerrflag > 0) --yyerrflag;
798 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
799 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
804 if (yyerrflag != 0) goto yyinrecovery;
809 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
812 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
813 * before looking for error recovery */
814 yystack.s_mark -= yym;
815 yystate = *yystack.s_mark;
816 yystack.l_mark -= yym;
817 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
818 yystack.p_mark -= yym;
826 YYParseState *save = yyps->save;
829 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
830 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
831 (int)(yylvp - yylvals - yyps->save->lexeme));
833 /* Memorize most forward-looking error state in case it's really an error. */
834 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
836 /* Free old saved error context state */
837 if (yyerrctx) yyFreeState(yyerrctx);
838 /* Create and fill out new saved error context state */
839 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
840 if (yyerrctx == NULL) goto yyenomem;
841 yyerrctx->save = yyps->save;
842 yyerrctx->state = yystate;
843 yyerrctx->errflag = yyerrflag;
844 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
845 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
846 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
847 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
848 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
849 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
850 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
852 yyerrctx->lexeme = (int) (yylvp - yylvals);
854 yylvp = yylvals + save->lexeme;
855 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
856 yylpp = yylpsns + save->lexeme;
858 yylexp = yylexemes + save->lexeme;
860 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
861 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
862 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
863 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
864 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
865 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
866 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
869 yystate = save->state;
870 /* We tried shift, try reduce now */
871 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
872 yyps->save = save->save;
876 /* Nothing left on the stack -- error */
881 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
884 /* Restore state as it was in the most forward-advanced error */
885 yylvp = yylvals + yyerrctx->lexeme;
886 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
887 yylpp = yylpsns + yyerrctx->lexeme;
889 yylexp = yylexemes + yyerrctx->lexeme;
892 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
895 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
896 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
897 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
898 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
899 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
900 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
901 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
903 yystate = yyerrctx->state;
904 yyFreeState(yyerrctx);
909 if (yynewerrflag == 0) goto yyinrecovery;
910 #endif /* YYBTYACC */
912 YYERROR_CALL("syntax error");
913 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
914 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
918 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
929 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
930 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
934 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
935 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
937 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
938 yystate = yytable[yyn];
939 *++yystack.s_mark = yytable[yyn];
940 *++yystack.l_mark = yylval;
941 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
942 /* lookahead position is error end position */
943 yyerror_loc_range[1] = yylloc;
944 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
945 *++yystack.p_mark = yyloc;
953 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
954 YYDEBUGSTR, yydepth, *yystack.s_mark);
956 if (yystack.s_mark <= yystack.s_base) goto yyabort;
957 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
958 /* the current TOS position is the error start position */
959 yyerror_loc_range[0] = *yystack.p_mark;
961 #if defined(YYDESTRUCT_CALL)
964 #endif /* YYBTYACC */
965 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
966 YYDESTRUCT_CALL("error: discarding state",
967 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
969 YYDESTRUCT_CALL("error: discarding state",
970 yystos[*yystack.s_mark], yystack.l_mark);
971 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
972 #endif /* defined(YYDESTRUCT_CALL) */
975 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
983 if (yychar == YYEOF) goto yyabort;
987 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
988 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
989 YYDEBUGSTR, yydepth, yystate, yychar, yys);
992 #if defined(YYDESTRUCT_CALL)
995 #endif /* YYBTYACC */
996 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
997 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
999 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1000 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1001 #endif /* defined(YYDESTRUCT_CALL) */
1011 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1012 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1013 #ifdef YYSTYPE_TOSTRING
1016 #endif /* YYBTYACC */
1021 for (i = yym; i > 0; i--)
1023 if (i != yym) fputs(", ", stderr);
1024 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1025 yystack.l_mark[1-i]), stderr);
1030 fputc('\n', stderr);
1034 yyval = yystack.l_mark[1-yym];
1036 memset(&yyval, 0, sizeof yyval);
1037 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1039 /* Perform position reduction */
1040 memset(&yyloc, 0, sizeof(yyloc));
1043 #endif /* YYBTYACC */
1045 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1046 /* just in case YYERROR is invoked within the action, save
1047 the start of the rhs as the error start position */
1048 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1057 yystack.s_mark -= yym;
1058 yystate = *yystack.s_mark;
1059 yystack.l_mark -= yym;
1060 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1061 yystack.p_mark -= yym;
1064 if (yystate == 0 && yym == 0)
1069 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1070 #ifdef YYSTYPE_TOSTRING
1073 #endif /* YYBTYACC */
1074 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1076 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1080 *++yystack.s_mark = YYFINAL;
1081 *++yystack.l_mark = yyval;
1082 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1083 *++yystack.p_mark = yyloc;
1091 /* we're currently re-reading tokens */
1093 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1101 /* in trial mode; save scanner results for future parse attempts */
1102 if (yylvp == yylvlim)
1103 { /* Enlarge lexical value queue */
1104 size_t p = (size_t) (yylvp - yylvals);
1105 size_t s = (size_t) (yylvlim - yylvals);
1107 s += YYLVQUEUEGROWTH;
1108 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1110 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1112 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1113 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1116 yylvp = yylve = yylvals + p;
1117 yylvlim = yylvals + s;
1118 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1119 yylpp = yylpe = yylpsns + p;
1120 yylplim = yylpsns + s;
1122 yylexp = yylexemes + p;
1124 *yylexp = (short) YYLEX;
1127 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1134 /* normal operation, no conflict encountered */
1135 #endif /* YYBTYACC */
1139 #endif /* YYBTYACC */
1140 if (yychar < 0) yychar = YYEOF;
1144 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1145 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1146 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1150 if (yychar == YYEOF) goto yyaccept;
1153 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1154 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1155 yystate = yytable[yyn];
1157 yystate = yydgoto[yym];
1161 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1162 #ifdef YYSTYPE_TOSTRING
1165 #endif /* YYBTYACC */
1166 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1168 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1171 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1172 *++yystack.s_mark = (YYINT) yystate;
1173 *++yystack.l_mark = yyval;
1174 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1175 *++yystack.p_mark = yyloc;
1180 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1182 if (yypath) YYABORT;
1185 YYParseState *save = yyps->save;
1186 yyps->save = save->save;
1187 save->save = yypath;
1192 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1193 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1197 yyFreeState(yyerrctx);
1200 yylvp = yylvals + yypath->lexeme;
1201 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1202 yylpp = yylpsns + yypath->lexeme;
1204 yylexp = yylexemes + yypath->lexeme;
1206 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1207 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1208 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1209 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1210 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1211 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1212 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1214 yystate = yypath->state;
1216 #endif /* YYBTYACC */
1219 YYERROR_CALL("yacc stack overflow");
1223 YYERROR_CALL("memory exhausted");
1225 #endif /* YYBTYACC */
1235 if (yyps->save) goto yyvalid;
1236 #endif /* YYBTYACC */
1240 #if defined(YYDESTRUCT_CALL)
1241 if (yychar != YYEOF && yychar != YYEMPTY)
1242 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1243 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1245 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1246 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1250 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1253 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1254 YYDESTRUCT_CALL("cleanup: discarding state",
1255 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1257 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1258 YYDESTRUCT_CALL("cleanup: discarding state",
1259 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1260 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1262 #endif /* defined(YYDESTRUCT_CALL) */
1267 yyFreeState(yyerrctx);
1272 YYParseState *save = yyps;
1279 YYParseState *save = yypath;
1280 yypath = save->save;
1284 #endif /* YYBTYACC */
1285 yyfreestack(&yystack);