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 empty_parse
25 #define yylex empty_lex
29 #define yyerror empty_error
33 #define yychar empty_char
37 #define yyval empty_val
41 #define yylval empty_lval
45 #define yydebug empty_debug
49 #define yynerrs empty_nerrs
53 #define yyerrflag empty_errflag
54 #endif /* yyerrflag */
57 #define yylhs empty_lhs
61 #define yylen empty_len
65 #define yydefred empty_defred
69 #define yystos empty_stos
73 #define yydgoto empty_dgoto
77 #define yysindex empty_sindex
81 #define yyrindex empty_rindex
85 #define yygindex empty_gindex
89 #define yytable empty_table
93 #define yycheck empty_check
97 #define yyname empty_name
101 #define yyrule empty_rule
107 #define yycindex empty_cindex
108 #endif /* yycindex */
111 #define yyctable empty_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "empty_"
122 #define YYLEX_DECL() yylex(void)
123 #define YYERROR_DECL() yyerror(const char *s)
124 static int YYLEX_DECL();
125 static void YYERROR_DECL();
127 #line 128 "empty.tab.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 extern int YYPARSE_DECL();
166 #define YYERRCODE 256
168 static const YYINT empty_lhs[] = { -1,
171 static const YYINT empty_len[] = { 2,
174 static const YYINT empty_defred[] = { 1,
177 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
178 static const YYINT empty_stos[] = { 0,
181 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
182 static const YYINT empty_dgoto[] = { 1,
184 static const YYINT empty_sindex[] = { 0,
187 static const YYINT empty_rindex[] = { 0,
191 static const YYINT empty_cindex[] = { 0,
195 static const YYINT empty_gindex[] = { 0,
197 #define YYTABLESIZE 0
198 static const YYINT empty_table[] = { 0,
200 static const YYINT empty_check[] = { -1,
203 static const YYINT empty_ctable[] = { -1,
210 #define YYMAXTOKEN 256
211 #define YYUNDFTOKEN 259
212 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
214 static const char *const empty_name[] = {
216 "$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,
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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
219 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
220 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
221 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
222 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","start",
225 static const char *const empty_rule[] = {
242 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
243 YYLTYPE yyloc; /* position returned by actions */
244 YYLTYPE yylloc; /* position from the lexer */
247 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
248 #ifndef YYLLOC_DEFAULT
249 #define YYLLOC_DEFAULT(loc, rhs, n) \
254 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
255 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
256 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
257 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
261 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
262 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
263 (loc).last_line = YYRHSLOC(rhs, n).last_line; \
264 (loc).last_column = YYRHSLOC(rhs, n).last_column; \
267 #endif /* YYLLOC_DEFAULT */
268 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
271 #ifndef YYLVQUEUEGROWTH
272 #define YYLVQUEUEGROWTH 32
274 #endif /* YYBTYACC */
276 /* define the initial stack-sizes */
279 #define YYMAXDEPTH YYSTACKSIZE
282 #define YYSTACKSIZE YYMAXDEPTH
284 #define YYSTACKSIZE 10000
285 #define YYMAXDEPTH 10000
289 #ifndef YYINITSTACKSIZE
290 #define YYINITSTACKSIZE 200
300 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
307 struct YYParseState_s
309 struct YYParseState_s *save; /* Previously saved parser state */
310 YYSTACKDATA yystack; /* saved parser stack */
311 int state; /* saved parser state */
312 int errflag; /* saved error recovery status */
313 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
314 YYINT ctry; /* saved index in yyctable[] for this conflict */
316 typedef struct YYParseState_s YYParseState;
317 #endif /* YYBTYACC */
318 /* variables for the parser stack */
319 static YYSTACKDATA yystack;
322 /* Current parser state */
323 static YYParseState *yyps = 0;
325 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
326 static YYParseState *yypath = 0;
328 /* Base of the lexical value queue */
329 static YYSTYPE *yylvals = 0;
331 /* Current position at lexical value queue */
332 static YYSTYPE *yylvp = 0;
334 /* End position of lexical value queue */
335 static YYSTYPE *yylve = 0;
337 /* The last allocated position at the lexical value queue */
338 static YYSTYPE *yylvlim = 0;
340 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
341 /* Base of the lexical position queue */
342 static YYLTYPE *yylpsns = 0;
344 /* Current position at lexical position queue */
345 static YYLTYPE *yylpp = 0;
347 /* End position of lexical position queue */
348 static YYLTYPE *yylpe = 0;
350 /* The last allocated position at the lexical position queue */
351 static YYLTYPE *yylplim = 0;
354 /* Current position at lexical token queue */
355 static YYINT *yylexp = 0;
357 static YYINT *yylexemes = 0;
358 #endif /* YYBTYACC */
372 #line 373 "empty.tab.c"
374 /* For use in generated program */
375 #define yydepth (int)(yystack.s_mark - yystack.s_base)
377 #define yytrial (yyps->save)
378 #endif /* YYBTYACC */
381 #include <stdio.h> /* needed for printf */
384 #include <stdlib.h> /* needed for malloc, etc */
385 #include <string.h> /* needed for memset */
387 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
388 static int yygrowstack(YYSTACKDATA *data)
394 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
398 if ((newsize = data->stacksize) == 0)
399 newsize = YYINITSTACKSIZE;
400 else if (newsize >= YYMAXDEPTH)
402 else if ((newsize *= 2) > YYMAXDEPTH)
403 newsize = YYMAXDEPTH;
405 i = (int) (data->s_mark - data->s_base);
406 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
410 data->s_base = newss;
411 data->s_mark = newss + i;
413 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
417 data->l_base = newvs;
418 data->l_mark = newvs + i;
420 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
421 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
425 data->p_base = newps;
426 data->p_mark = newps + i;
429 data->stacksize = newsize;
430 data->s_last = data->s_base + newsize - 1;
434 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
439 #if YYPURE || defined(YY_NO_LEAKS)
440 static void yyfreestack(YYSTACKDATA *data)
444 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
447 memset(data, 0, sizeof(*data));
450 #define yyfreestack(data) /* nothing */
451 #endif /* YYPURE || defined(YY_NO_LEAKS) */
454 static YYParseState *
455 yyNewState(unsigned size)
457 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
458 if (p == NULL) return NULL;
460 p->yystack.stacksize = size;
463 p->yystack.s_base = NULL;
464 p->yystack.l_base = NULL;
465 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
466 p->yystack.p_base = NULL;
470 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
471 if (p->yystack.s_base == NULL) return NULL;
472 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
473 if (p->yystack.l_base == NULL) return NULL;
474 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
475 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
476 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
477 if (p->yystack.p_base == NULL) return NULL;
478 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
485 yyFreeState(YYParseState *p)
487 yyfreestack(&p->yystack);
490 #endif /* YYBTYACC */
492 #define YYABORT goto yyabort
493 #define YYREJECT goto yyabort
494 #define YYACCEPT goto yyaccept
495 #define YYERROR goto yyerrlab
497 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
498 #define YYVALID_NESTED do { if (yyps->save && \
499 yyps->save->save == 0) goto yyvalid; } while(0)
500 #endif /* YYBTYACC */
505 int yym, yyn, yystate, yyresult;
508 YYParseState *yyerrctx = NULL;
509 #endif /* YYBTYACC */
510 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
511 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
516 if ((yys = getenv("YYDEBUG")) != 0)
519 if (yyn >= '0' && yyn <= '9')
523 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
525 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
526 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
530 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
532 #endif /* YYBTYACC */
541 memset(&yystack, 0, sizeof(yystack));
544 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
545 yystack.s_mark = yystack.s_base;
546 yystack.l_mark = yystack.l_base;
547 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
548 yystack.p_mark = yystack.p_base;
554 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
561 /* we're currently re-reading tokens */
563 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
571 /* in trial mode; save scanner results for future parse attempts */
572 if (yylvp == yylvlim)
573 { /* Enlarge lexical value queue */
574 size_t p = (size_t) (yylvp - yylvals);
575 size_t s = (size_t) (yylvlim - yylvals);
577 s += YYLVQUEUEGROWTH;
578 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
579 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
580 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
581 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
583 yylvp = yylve = yylvals + p;
584 yylvlim = yylvals + s;
585 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
586 yylpp = yylpe = yylpsns + p;
587 yylplim = yylpsns + s;
589 yylexp = yylexemes + p;
591 *yylexp = (YYINT) YYLEX;
594 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
601 /* normal operation, no conflict encountered */
602 #endif /* YYBTYACC */
606 #endif /* YYBTYACC */
607 if (yychar < 0) yychar = YYEOF;
611 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
612 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
613 YYDEBUGSTR, yydepth, yystate, yychar, yys);
614 #ifdef YYSTYPE_TOSTRING
617 #endif /* YYBTYACC */
618 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
626 /* Do we have a conflict? */
627 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
628 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
637 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
638 YYDEBUGSTR, yydepth, yystate);
640 /* Switch to the next conflict context */
645 if (save->state != yystate) YYABORT;
652 /* Unresolved conflict - start/continue trial parse */
657 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
659 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
661 fputs("Starting trial parse.\n", stderr);
664 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
665 if (save == NULL) goto yyenomem;
666 save->save = yyps->save;
667 save->state = yystate;
668 save->errflag = yyerrflag;
669 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
670 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
671 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
672 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
673 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
674 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
675 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
678 if (yyctable[ctry] == -1)
681 if (yydebug && yychar >= YYEOF)
682 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
687 if (yyps->save == NULL)
689 /* If this is a first conflict in the stack, start saving lexemes */
692 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
693 if (yylexemes == NULL) goto yyenomem;
694 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
695 if (yylvals == NULL) goto yyenomem;
696 yylvlim = yylvals + YYLVQUEUEGROWTH;
697 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
698 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
699 if (yylpsns == NULL) goto yyenomem;
700 yylplim = yylpsns + YYLVQUEUEGROWTH;
705 yylvp = yylve = yylvals;
706 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
707 yylpp = yylpe = yylpsns;
713 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
716 *yylexp = (YYINT) yychar;
724 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
730 save->lexeme = (int) (yylvp - yylvals);
733 if (yytable[yyn] == ctry)
737 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
738 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
743 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
748 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
750 yystate = yyctable[ctry];
751 *++yystack.s_mark = (YYINT) yystate;
752 *++yystack.l_mark = yylval;
753 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
754 *++yystack.p_mark = yylloc;
757 if (yyerrflag > 0) --yyerrflag;
762 yyn = yyctable[ctry];
765 } /* End of code dealing with conflicts */
766 #endif /* YYBTYACC */
767 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
768 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
772 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
773 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
775 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
776 yystate = yytable[yyn];
777 *++yystack.s_mark = yytable[yyn];
778 *++yystack.l_mark = yylval;
779 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
780 *++yystack.p_mark = yylloc;
783 if (yyerrflag > 0) --yyerrflag;
786 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
787 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
792 if (yyerrflag != 0) goto yyinrecovery;
797 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
800 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
801 * before looking for error recovery */
802 yystack.s_mark -= yym;
803 yystate = *yystack.s_mark;
804 yystack.l_mark -= yym;
805 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
806 yystack.p_mark -= yym;
814 YYParseState *save = yyps->save;
817 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
818 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
819 (int)(yylvp - yylvals - yyps->save->lexeme));
821 /* Memorize most forward-looking error state in case it's really an error. */
822 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
824 /* Free old saved error context state */
825 if (yyerrctx) yyFreeState(yyerrctx);
826 /* Create and fill out new saved error context state */
827 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
828 if (yyerrctx == NULL) goto yyenomem;
829 yyerrctx->save = yyps->save;
830 yyerrctx->state = yystate;
831 yyerrctx->errflag = yyerrflag;
832 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
833 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
834 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
835 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
836 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
837 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
838 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
840 yyerrctx->lexeme = (int) (yylvp - yylvals);
842 yylvp = yylvals + save->lexeme;
843 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
844 yylpp = yylpsns + save->lexeme;
846 yylexp = yylexemes + save->lexeme;
848 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
849 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
850 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
851 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
852 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
853 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
854 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
857 yystate = save->state;
858 /* We tried shift, try reduce now */
859 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
860 yyps->save = save->save;
864 /* Nothing left on the stack -- error */
869 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
872 /* Restore state as it was in the most forward-advanced error */
873 yylvp = yylvals + yyerrctx->lexeme;
874 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
875 yylpp = yylpsns + yyerrctx->lexeme;
877 yylexp = yylexemes + yyerrctx->lexeme;
880 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
883 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
884 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
885 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
886 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
887 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
888 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
889 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
891 yystate = yyerrctx->state;
892 yyFreeState(yyerrctx);
897 if (yynewerrflag == 0) goto yyinrecovery;
898 #endif /* YYBTYACC */
900 YYERROR_CALL("syntax error");
901 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
902 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
906 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
917 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
918 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
922 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
923 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
925 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
926 yystate = yytable[yyn];
927 *++yystack.s_mark = yytable[yyn];
928 *++yystack.l_mark = yylval;
929 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
930 /* lookahead position is error end position */
931 yyerror_loc_range[2] = yylloc;
932 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
933 *++yystack.p_mark = yyloc;
941 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
942 YYDEBUGSTR, yydepth, *yystack.s_mark);
944 if (yystack.s_mark <= yystack.s_base) goto yyabort;
945 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
946 /* the current TOS position is the error start position */
947 yyerror_loc_range[1] = *yystack.p_mark;
949 #if defined(YYDESTRUCT_CALL)
952 #endif /* YYBTYACC */
953 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
954 YYDESTRUCT_CALL("error: discarding state",
955 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
957 YYDESTRUCT_CALL("error: discarding state",
958 yystos[*yystack.s_mark], yystack.l_mark);
959 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
960 #endif /* defined(YYDESTRUCT_CALL) */
963 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
971 if (yychar == YYEOF) goto yyabort;
975 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
976 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
977 YYDEBUGSTR, yydepth, yystate, yychar, yys);
980 #if defined(YYDESTRUCT_CALL)
983 #endif /* YYBTYACC */
984 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
985 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
987 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
988 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
989 #endif /* defined(YYDESTRUCT_CALL) */
999 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1000 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1001 #ifdef YYSTYPE_TOSTRING
1004 #endif /* YYBTYACC */
1009 for (i = yym; i > 0; i--)
1011 if (i != yym) fputs(", ", stderr);
1012 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1013 yystack.l_mark[1-i]), stderr);
1018 fputc('\n', stderr);
1022 yyval = yystack.l_mark[1-yym];
1024 memset(&yyval, 0, sizeof yyval);
1025 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1027 /* Perform position reduction */
1028 memset(&yyloc, 0, sizeof(yyloc));
1031 #endif /* YYBTYACC */
1033 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
1034 /* just in case YYERROR is invoked within the action, save
1035 the start of the rhs as the error start position */
1036 yyerror_loc_range[1] = yystack.p_mark[1-yym];
1045 yystack.s_mark -= yym;
1046 yystate = *yystack.s_mark;
1047 yystack.l_mark -= yym;
1048 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1049 yystack.p_mark -= yym;
1052 if (yystate == 0 && yym == 0)
1057 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1058 #ifdef YYSTYPE_TOSTRING
1061 #endif /* YYBTYACC */
1062 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1064 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1068 *++yystack.s_mark = YYFINAL;
1069 *++yystack.l_mark = yyval;
1070 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1071 *++yystack.p_mark = yyloc;
1079 /* we're currently re-reading tokens */
1081 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1089 /* in trial mode; save scanner results for future parse attempts */
1090 if (yylvp == yylvlim)
1091 { /* Enlarge lexical value queue */
1092 size_t p = (size_t) (yylvp - yylvals);
1093 size_t s = (size_t) (yylvlim - yylvals);
1095 s += YYLVQUEUEGROWTH;
1096 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1098 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1100 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1101 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1104 yylvp = yylve = yylvals + p;
1105 yylvlim = yylvals + s;
1106 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1107 yylpp = yylpe = yylpsns + p;
1108 yylplim = yylpsns + s;
1110 yylexp = yylexemes + p;
1112 *yylexp = (YYINT) YYLEX;
1115 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1122 /* normal operation, no conflict encountered */
1123 #endif /* YYBTYACC */
1127 #endif /* YYBTYACC */
1128 if (yychar < 0) yychar = YYEOF;
1132 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1133 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1134 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1138 if (yychar == YYEOF) goto yyaccept;
1141 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1142 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1143 yystate = yytable[yyn];
1145 yystate = yydgoto[yym];
1149 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1150 #ifdef YYSTYPE_TOSTRING
1153 #endif /* YYBTYACC */
1154 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1156 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1159 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1160 *++yystack.s_mark = (YYINT) yystate;
1161 *++yystack.l_mark = yyval;
1162 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1163 *++yystack.p_mark = yyloc;
1168 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1170 if (yypath) YYABORT;
1173 YYParseState *save = yyps->save;
1174 yyps->save = save->save;
1175 save->save = yypath;
1180 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1181 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1185 yyFreeState(yyerrctx);
1188 yylvp = yylvals + yypath->lexeme;
1189 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1190 yylpp = yylpsns + yypath->lexeme;
1192 yylexp = yylexemes + yypath->lexeme;
1194 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1195 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1196 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1197 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1198 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1199 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1200 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1202 yystate = yypath->state;
1204 #endif /* YYBTYACC */
1207 YYERROR_CALL("yacc stack overflow");
1211 YYERROR_CALL("memory exhausted");
1213 #endif /* YYBTYACC */
1223 if (yyps->save) goto yyvalid;
1224 #endif /* YYBTYACC */
1228 #if defined(YYDESTRUCT_CALL)
1229 if (yychar != YYEOF && yychar != YYEMPTY)
1230 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1231 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1233 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1234 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1238 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1241 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1242 YYDESTRUCT_CALL("cleanup: discarding state",
1243 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1245 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1246 YYDESTRUCT_CALL("cleanup: discarding state",
1247 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1248 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1250 #endif /* defined(YYDESTRUCT_CALL) */
1255 yyFreeState(yyerrctx);
1260 YYParseState *save = yyps;
1267 YYParseState *save = yypath;
1268 yypath = save->save;
1272 #endif /* YYBTYACC */
1273 yyfreestack(&yystack);