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 static const YYINT empty_stos[] = { 0,
180 static const YYINT empty_dgoto[] = { 1,
182 static const YYINT empty_sindex[] = { 0,
185 static const YYINT empty_rindex[] = { 0,
189 static const YYINT empty_cindex[] = { 0,
193 static const YYINT empty_gindex[] = { 0,
195 #define YYTABLESIZE 0
196 static const YYINT empty_table[] = { 0,
198 static const YYINT empty_check[] = { -1,
204 #define YYMAXTOKEN 256
205 #define YYUNDFTOKEN 259
206 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
208 static const char *const empty_name[] = {
210 "$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,
211 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
212 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,"error","$accept","start",
219 static const char *const empty_rule[] = {
233 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
234 YYLTYPE yyloc; /* position returned by actions */
235 YYLTYPE yylloc; /* position from the lexer */
238 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
239 #ifndef YYLLOC_DEFAULT
240 #define YYLLOC_DEFAULT(loc, rhs, n) \
245 (loc).first_line = ((rhs)[-1]).last_line; \
246 (loc).first_column = ((rhs)[-1]).last_column; \
247 (loc).last_line = ((rhs)[-1]).last_line; \
248 (loc).last_column = ((rhs)[-1]).last_column; \
252 (loc).first_line = ((rhs)[ 0 ]).first_line; \
253 (loc).first_column = ((rhs)[ 0 ]).first_column; \
254 (loc).last_line = ((rhs)[n-1]).last_line; \
255 (loc).last_column = ((rhs)[n-1]).last_column; \
258 #endif /* YYLLOC_DEFAULT */
259 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
262 #ifndef YYLVQUEUEGROWTH
263 #define YYLVQUEUEGROWTH 32
265 #endif /* YYBTYACC */
267 /* define the initial stack-sizes */
270 #define YYMAXDEPTH YYSTACKSIZE
273 #define YYSTACKSIZE YYMAXDEPTH
275 #define YYSTACKSIZE 10000
276 #define YYMAXDEPTH 10000
280 #ifndef YYINITSTACKSIZE
281 #define YYINITSTACKSIZE 200
291 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
298 struct YYParseState_s
300 struct YYParseState_s *save; /* Previously saved parser state */
301 YYSTACKDATA yystack; /* saved parser stack */
302 int state; /* saved parser state */
303 int errflag; /* saved error recovery status */
304 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
305 YYINT ctry; /* saved index in yyctable[] for this conflict */
307 typedef struct YYParseState_s YYParseState;
308 #endif /* YYBTYACC */
309 /* variables for the parser stack */
310 static YYSTACKDATA yystack;
313 /* Current parser state */
314 static YYParseState *yyps = 0;
316 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
317 static YYParseState *yypath = 0;
319 /* Base of the lexical value queue */
320 static YYSTYPE *yylvals = 0;
322 /* Current position at lexical value queue */
323 static YYSTYPE *yylvp = 0;
325 /* End position of lexical value queue */
326 static YYSTYPE *yylve = 0;
328 /* The last allocated position at the lexical value queue */
329 static YYSTYPE *yylvlim = 0;
331 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
332 /* Base of the lexical position queue */
333 static YYLTYPE *yylpsns = 0;
335 /* Current position at lexical position queue */
336 static YYLTYPE *yylpp = 0;
338 /* End position of lexical position queue */
339 static YYLTYPE *yylpe = 0;
341 /* The last allocated position at the lexical position queue */
342 static YYLTYPE *yylplim = 0;
345 /* Current position at lexical token queue */
346 static short *yylexp = 0;
348 static short *yylexemes = 0;
349 #endif /* YYBTYACC */
363 #line 364 "empty.tab.c"
365 /* For use in generated program */
366 #define yydepth (int)(yystack.s_mark - yystack.s_base)
368 #define yytrial (yyps->save)
369 #endif /* YYBTYACC */
372 #include <stdio.h> /* needed for printf */
375 #include <stdlib.h> /* needed for malloc, etc */
376 #include <string.h> /* needed for memset */
378 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
379 static int yygrowstack(YYSTACKDATA *data)
385 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
389 if ((newsize = data->stacksize) == 0)
390 newsize = YYINITSTACKSIZE;
391 else if (newsize >= YYMAXDEPTH)
393 else if ((newsize *= 2) > YYMAXDEPTH)
394 newsize = YYMAXDEPTH;
396 i = (int) (data->s_mark - data->s_base);
397 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
401 data->s_base = newss;
402 data->s_mark = newss + i;
404 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
408 data->l_base = newvs;
409 data->l_mark = newvs + i;
411 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
412 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
416 data->p_base = newps;
417 data->p_mark = newps + i;
420 data->stacksize = newsize;
421 data->s_last = data->s_base + newsize - 1;
425 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
430 #if YYPURE || defined(YY_NO_LEAKS)
431 static void yyfreestack(YYSTACKDATA *data)
435 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
438 memset(data, 0, sizeof(*data));
441 #define yyfreestack(data) /* nothing */
442 #endif /* YYPURE || defined(YY_NO_LEAKS) */
445 static YYParseState *
446 yyNewState(unsigned size)
448 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
449 if (p == NULL) return NULL;
451 p->yystack.stacksize = size;
454 p->yystack.s_base = NULL;
455 p->yystack.l_base = NULL;
456 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
457 p->yystack.p_base = NULL;
461 p->yystack.s_base = (short *) malloc(size * sizeof(short));
462 if (p->yystack.s_base == NULL) return NULL;
463 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
464 if (p->yystack.l_base == NULL) return NULL;
465 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
466 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
467 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
468 if (p->yystack.p_base == NULL) return NULL;
469 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
476 yyFreeState(YYParseState *p)
478 yyfreestack(&p->yystack);
481 #endif /* YYBTYACC */
483 #define YYABORT goto yyabort
484 #define YYREJECT goto yyabort
485 #define YYACCEPT goto yyaccept
486 #define YYERROR goto yyerrlab
488 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
489 #define YYVALID_NESTED do { if (yyps->save && \
490 yyps->save->save == 0) goto yyvalid; } while(0)
491 #endif /* YYBTYACC */
496 int yym, yyn, yystate, yyresult;
499 YYParseState *yyerrctx = NULL;
500 #endif /* YYBTYACC */
501 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
502 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
507 if ((yys = getenv("YYDEBUG")) != 0)
510 if (yyn >= '0' && yyn <= '9')
514 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
518 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
520 #endif /* YYBTYACC */
527 memset(&yystack, 0, sizeof(yystack));
530 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
531 yystack.s_mark = yystack.s_base;
532 yystack.l_mark = yystack.l_base;
533 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
534 yystack.p_mark = yystack.p_base;
540 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
547 /* we're currently re-reading tokens */
549 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
557 /* in trial mode; save scanner results for future parse attempts */
558 if (yylvp == yylvlim)
559 { /* Enlarge lexical value queue */
560 int p = yylvp - yylvals;
561 int s = yylvlim - yylvals;
563 s += YYLVQUEUEGROWTH;
564 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
565 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
566 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
567 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
569 yylvp = yylve = yylvals + p;
570 yylvlim = yylvals + s;
571 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
572 yylpp = yylpe = yylpsns + p;
573 yylplim = yylpsns + s;
575 yylexp = yylexemes + p;
577 *yylexp = (short) YYLEX;
580 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
587 /* normal operation, no conflict encountered */
588 #endif /* YYBTYACC */
592 #endif /* YYBTYACC */
593 if (yychar < 0) yychar = YYEOF;
594 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
598 yys = yyname[YYTRANSLATE(yychar)];
599 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
600 YYDEBUGSTR, yydepth, yystate, yychar, yys);
601 #ifdef YYSTYPE_TOSTRING
604 #endif /* YYBTYACC */
605 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
613 /* Do we have a conflict? */
614 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
615 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
624 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
625 YYDEBUGSTR, yydepth, yystate);
627 /* Switch to the next conflict context */
632 if (save->state != yystate) YYABORT;
639 /* Unresolved conflict - start/continue trial parse */
644 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
646 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
648 fputs("Starting trial parse.\n", stderr);
651 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
652 if (save == NULL) goto yyenomem;
653 save->save = yyps->save;
654 save->state = yystate;
655 save->errflag = yyerrflag;
656 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
657 memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
658 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
659 memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
660 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
661 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
662 memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
665 if (yyctable[ctry] == -1)
668 if (yydebug && yychar >= YYEOF)
669 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
674 if (yyps->save == NULL)
676 /* If this is a first conflict in the stack, start saving lexemes */
679 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
680 if (yylexemes == NULL) goto yyenomem;
681 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
682 if (yylvals == NULL) goto yyenomem;
683 yylvlim = yylvals + YYLVQUEUEGROWTH;
684 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
685 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
686 if (yylpsns == NULL) goto yyenomem;
687 yylplim = yylpsns + YYLVQUEUEGROWTH;
692 yylvp = yylve = yylvals;
693 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
694 yylpp = yylpe = yylpsns;
700 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
703 *yylexp = (short) yychar;
711 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
717 save->lexeme = yylvp - yylvals;
720 if (yytable[yyn] == ctry)
724 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
725 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
730 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
735 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
737 yystate = yyctable[ctry];
738 *++yystack.s_mark = (short) yystate;
739 *++yystack.l_mark = yylval;
740 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
741 *++yystack.p_mark = yylloc;
744 if (yyerrflag > 0) --yyerrflag;
749 yyn = yyctable[ctry];
752 } /* End of code dealing with conflicts */
753 #endif /* YYBTYACC */
754 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
755 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
759 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
760 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
762 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
763 yystate = yytable[yyn];
764 *++yystack.s_mark = yytable[yyn];
765 *++yystack.l_mark = yylval;
766 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
767 *++yystack.p_mark = yylloc;
770 if (yyerrflag > 0) --yyerrflag;
773 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
774 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
779 if (yyerrflag != 0) goto yyinrecovery;
792 YYParseState *save = yyps->save;
795 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
796 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
797 (int)(yylvp - yylvals - yyps->save->lexeme));
799 /* Memorize most forward-looking error state in case it's really an error. */
800 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
802 /* Free old saved error context state */
803 if (yyerrctx) yyFreeState(yyerrctx);
804 /* Create and fill out new saved error context state */
805 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
806 if (yyerrctx == NULL) goto yyenomem;
807 yyerrctx->save = yyps->save;
808 yyerrctx->state = yystate;
809 yyerrctx->errflag = yyerrflag;
810 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
811 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
812 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
813 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
814 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
815 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
816 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
818 yyerrctx->lexeme = yylvp - yylvals;
820 yylvp = yylvals + save->lexeme;
821 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
822 yylpp = yylpsns + save->lexeme;
824 yylexp = yylexemes + save->lexeme;
826 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
827 memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
828 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
829 memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
830 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
831 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
832 memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
835 yystate = save->state;
836 /* We tried shift, try reduce now */
837 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
838 yyps->save = save->save;
842 /* Nothing left on the stack -- error */
847 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
850 /* Restore state as it was in the most forward-advanced error */
851 yylvp = yylvals + yyerrctx->lexeme;
852 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
853 yylpp = yylpsns + yyerrctx->lexeme;
855 yylexp = yylexemes + yyerrctx->lexeme;
858 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
861 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
862 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
863 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
864 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
865 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
866 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
867 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
869 yystate = yyerrctx->state;
870 yyFreeState(yyerrctx);
875 if (yynewerrflag == 0) goto yyinrecovery;
876 #endif /* YYBTYACC */
878 YYERROR_CALL("syntax error");
879 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
880 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
895 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
896 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
900 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
901 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
903 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
904 yystate = yytable[yyn];
905 *++yystack.s_mark = yytable[yyn];
906 *++yystack.l_mark = yylval;
907 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
908 /* lookahead position is error end position */
909 yyerror_loc_range[1] = yylloc;
910 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
911 *++yystack.p_mark = yyloc;
919 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
920 YYDEBUGSTR, yydepth, *yystack.s_mark);
922 if (yystack.s_mark <= yystack.s_base) goto yyabort;
923 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
924 /* the current TOS position is the error start position */
925 yyerror_loc_range[0] = *yystack.p_mark;
927 #if defined(YYDESTRUCT_CALL)
930 #endif /* YYBTYACC */
931 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
932 YYDESTRUCT_CALL("error: discarding state",
933 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
935 YYDESTRUCT_CALL("error: discarding state",
936 yystos[*yystack.s_mark], yystack.l_mark);
937 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
938 #endif /* defined(YYDESTRUCT_CALL) */
941 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
949 if (yychar == YYEOF) goto yyabort;
953 yys = yyname[YYTRANSLATE(yychar)];
954 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
955 YYDEBUGSTR, yydepth, yystate, yychar, yys);
958 #if defined(YYDESTRUCT_CALL)
961 #endif /* YYBTYACC */
962 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
963 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
965 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
966 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
967 #endif /* defined(YYDESTRUCT_CALL) */
977 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
978 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
979 #ifdef YYSTYPE_TOSTRING
982 #endif /* YYBTYACC */
987 for (i = yym; i > 0; i--)
989 if (i != yym) fputs(", ", stderr);
990 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
991 yystack.l_mark[1-i]), stderr);
1000 yyval = yystack.l_mark[1-yym];
1002 memset(&yyval, 0, sizeof yyval);
1003 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1005 /* Perform position reduction */
1006 memset(&yyloc, 0, sizeof(yyloc));
1009 #endif /* YYBTYACC */
1011 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1012 /* just in case YYERROR is invoked within the action, save
1013 the start of the rhs as the error start position */
1014 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1023 yystack.s_mark -= yym;
1024 yystate = *yystack.s_mark;
1025 yystack.l_mark -= yym;
1026 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1027 yystack.p_mark -= yym;
1030 if (yystate == 0 && yym == 0)
1035 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1036 #ifdef YYSTYPE_TOSTRING
1039 #endif /* YYBTYACC */
1040 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1042 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1046 *++yystack.s_mark = YYFINAL;
1047 *++yystack.l_mark = yyval;
1048 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1049 *++yystack.p_mark = yyloc;
1057 /* we're currently re-reading tokens */
1059 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1067 /* in trial mode; save scanner results for future parse attempts */
1068 if (yylvp == yylvlim)
1069 { /* Enlarge lexical value queue */
1070 int p = yylvp - yylvals;
1071 int s = yylvlim - yylvals;
1073 s += YYLVQUEUEGROWTH;
1074 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1076 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1078 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1079 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1082 yylvp = yylve = yylvals + p;
1083 yylvlim = yylvals + s;
1084 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1085 yylpp = yylpe = yylpsns + p;
1086 yylplim = yylpsns + s;
1088 yylexp = yylexemes + p;
1090 *yylexp = (short) YYLEX;
1093 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1100 /* normal operation, no conflict encountered */
1101 #endif /* YYBTYACC */
1105 #endif /* YYBTYACC */
1106 if (yychar < 0) yychar = YYEOF;
1107 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1111 yys = yyname[YYTRANSLATE(yychar)];
1112 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1113 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1117 if (yychar == YYEOF) goto yyaccept;
1120 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1121 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1122 yystate = yytable[yyn];
1124 yystate = yydgoto[yym];
1128 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1129 #ifdef YYSTYPE_TOSTRING
1132 #endif /* YYBTYACC */
1133 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1135 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1138 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1139 *++yystack.s_mark = (short) yystate;
1140 *++yystack.l_mark = yyval;
1141 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1142 *++yystack.p_mark = yyloc;
1147 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1149 if (yypath) YYABORT;
1152 YYParseState *save = yyps->save;
1153 yyps->save = save->save;
1154 save->save = yypath;
1159 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1160 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1164 yyFreeState(yyerrctx);
1167 yylvp = yylvals + yypath->lexeme;
1168 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1169 yylpp = yylpsns + yypath->lexeme;
1171 yylexp = yylexemes + yypath->lexeme;
1173 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1174 memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1175 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1176 memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1177 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1178 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1179 memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1181 yystate = yypath->state;
1183 #endif /* YYBTYACC */
1186 YYERROR_CALL("yacc stack overflow");
1190 YYERROR_CALL("memory exhausted");
1192 #endif /* YYBTYACC */
1202 if (yyps->save) goto yyvalid;
1203 #endif /* YYBTYACC */
1207 #if defined(YYDESTRUCT_CALL)
1208 if (yychar != YYEOF && yychar != YYEMPTY)
1209 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1210 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1212 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1213 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1217 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1220 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1221 YYDESTRUCT_CALL("cleanup: discarding state",
1222 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1224 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1225 YYDESTRUCT_CALL("cleanup: discarding state",
1226 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1227 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1229 #endif /* defined(YYDESTRUCT_CALL) */
1234 yyFreeState(yyerrctx);
1239 YYParseState *save = yyps;
1246 YYParseState *save = yypath;
1247 yypath = save->save;
1251 #endif /* YYBTYACC */
1252 yyfreestack(&yystack);