1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
8 #define YYCHECK "yyyymmdd"
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
18 #define YYDEBUGSTR YYPREFIX "debug"
21 #define yyparse error_parse
25 #define yylex error_lex
29 #define yyerror error_error
33 #define yychar error_char
37 #define yyval error_val
41 #define yylval error_lval
45 #define yydebug error_debug
49 #define yynerrs error_nerrs
53 #define yyerrflag error_errflag
54 #endif /* yyerrflag */
57 #define yylhs error_lhs
61 #define yylen error_len
65 #define yydefred error_defred
69 #define yystos error_stos
73 #define yydgoto error_dgoto
77 #define yysindex error_sindex
81 #define yyrindex error_rindex
85 #define yygindex error_gindex
89 #define yytable error_table
93 #define yycheck error_check
97 #define yyname error_name
101 #define yyrule error_rule
107 #define yycindex error_cindex
108 #endif /* yycindex */
111 #define yyctable error_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "error_"
120 #line 2 "code_error.y"
124 static void yyerror(const char *);
127 #line 128 "code_error.code.c"
129 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
130 /* Default: YYSTYPE is the semantic value type. */
132 # define YYSTYPE_IS_DECLARED 1
135 /* compatibility with bison */
137 /* compatibility with FreeBSD */
138 # ifdef YYPARSE_PARAM_TYPE
139 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
141 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
144 # define YYPARSE_DECL() yyparse(void)
147 /* Parameters sent to lex. */
149 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
150 # define YYLEX yylex(YYLEX_PARAM)
152 # define YYLEX_DECL() yylex(void)
153 # define YYLEX yylex()
156 /* Parameters sent to yyerror. */
158 #define YYERROR_DECL() yyerror(const char *s)
161 #define YYERROR_CALL(msg) yyerror(msg)
164 #define YYERRCODE 256
165 #define YYTABLESIZE 0
170 #define YYMAXTOKEN 256
171 #define YYUNDFTOKEN 259
172 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
174 extern int YYPARSE_DECL();
176 extern const YYINT yylhs[];
177 extern const YYINT yylen[];
178 extern const YYINT yydefred[];
179 extern const YYINT yystos[];
180 extern const YYINT yydgoto[];
181 extern const YYINT yysindex[];
182 extern const YYINT yyrindex[];
184 extern const YYINT yycindex[];
185 #endif /* YYBTYACC */
186 extern const YYINT yygindex[];
187 extern const YYINT yytable[];
188 extern const YYINT yycheck[];
190 extern const YYINT yyctable[];
191 #endif /* YYBTYACC */
193 #if YYDEBUG || defined(yytname)
194 extern const char *const yyname[];
197 extern const char *const yyrule[];
210 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
211 YYLTYPE yyloc; /* position returned by actions */
212 YYLTYPE yylloc; /* position from the lexer */
215 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
216 #ifndef YYLLOC_DEFAULT
217 #define YYLLOC_DEFAULT(loc, rhs, n) \
222 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
223 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
224 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
225 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
229 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
230 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
231 (loc).last_line = YYRHSLOC(rhs, n).last_line; \
232 (loc).last_column = YYRHSLOC(rhs, n).last_column; \
235 #endif /* YYLLOC_DEFAULT */
236 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
239 #ifndef YYLVQUEUEGROWTH
240 #define YYLVQUEUEGROWTH 32
242 #endif /* YYBTYACC */
244 /* define the initial stack-sizes */
247 #define YYMAXDEPTH YYSTACKSIZE
250 #define YYSTACKSIZE YYMAXDEPTH
252 #define YYSTACKSIZE 10000
253 #define YYMAXDEPTH 10000
257 #ifndef YYINITSTACKSIZE
258 #define YYINITSTACKSIZE 200
268 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
275 struct YYParseState_s
277 struct YYParseState_s *save; /* Previously saved parser state */
278 YYSTACKDATA yystack; /* saved parser stack */
279 int state; /* saved parser state */
280 int errflag; /* saved error recovery status */
281 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
282 YYINT ctry; /* saved index in yyctable[] for this conflict */
284 typedef struct YYParseState_s YYParseState;
285 #endif /* YYBTYACC */
286 /* variables for the parser stack */
287 static YYSTACKDATA yystack;
290 /* Current parser state */
291 static YYParseState *yyps = 0;
293 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
294 static YYParseState *yypath = 0;
296 /* Base of the lexical value queue */
297 static YYSTYPE *yylvals = 0;
299 /* Current position at lexical value queue */
300 static YYSTYPE *yylvp = 0;
302 /* End position of lexical value queue */
303 static YYSTYPE *yylve = 0;
305 /* The last allocated position at the lexical value queue */
306 static YYSTYPE *yylvlim = 0;
308 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
309 /* Base of the lexical position queue */
310 static YYLTYPE *yylpsns = 0;
312 /* Current position at lexical position queue */
313 static YYLTYPE *yylpp = 0;
315 /* End position of lexical position queue */
316 static YYLTYPE *yylpe = 0;
318 /* The last allocated position at the lexical position queue */
319 static YYLTYPE *yylplim = 0;
322 /* Current position at lexical token queue */
323 static YYINT *yylexp = 0;
325 static YYINT *yylexemes = 0;
326 #endif /* YYBTYACC */
327 #line 12 "code_error.y"
332 extern int YYLEX_DECL();
338 printf("yyparse() = %d\n", yyparse());
349 yyerror(const char* s)
353 #line 354 "code_error.code.c"
355 /* For use in generated program */
356 #define yydepth (int)(yystack.s_mark - yystack.s_base)
358 #define yytrial (yyps->save)
359 #endif /* YYBTYACC */
362 #include <stdio.h> /* needed for printf */
365 #include <stdlib.h> /* needed for malloc, etc */
366 #include <string.h> /* needed for memset */
368 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
369 static int yygrowstack(YYSTACKDATA *data)
375 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
379 if ((newsize = data->stacksize) == 0)
380 newsize = YYINITSTACKSIZE;
381 else if (newsize >= YYMAXDEPTH)
383 else if ((newsize *= 2) > YYMAXDEPTH)
384 newsize = YYMAXDEPTH;
386 i = (int) (data->s_mark - data->s_base);
387 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
391 data->s_base = newss;
392 data->s_mark = newss + i;
394 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
398 data->l_base = newvs;
399 data->l_mark = newvs + i;
401 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
402 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
406 data->p_base = newps;
407 data->p_mark = newps + i;
410 data->stacksize = newsize;
411 data->s_last = data->s_base + newsize - 1;
415 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
420 #if YYPURE || defined(YY_NO_LEAKS)
421 static void yyfreestack(YYSTACKDATA *data)
425 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
428 memset(data, 0, sizeof(*data));
431 #define yyfreestack(data) /* nothing */
432 #endif /* YYPURE || defined(YY_NO_LEAKS) */
435 static YYParseState *
436 yyNewState(unsigned size)
438 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
439 if (p == NULL) return NULL;
441 p->yystack.stacksize = size;
444 p->yystack.s_base = NULL;
445 p->yystack.l_base = NULL;
446 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
447 p->yystack.p_base = NULL;
451 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
452 if (p->yystack.s_base == NULL) return NULL;
453 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
454 if (p->yystack.l_base == NULL) return NULL;
455 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
456 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
457 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
458 if (p->yystack.p_base == NULL) return NULL;
459 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
466 yyFreeState(YYParseState *p)
468 yyfreestack(&p->yystack);
471 #endif /* YYBTYACC */
473 #define YYABORT goto yyabort
474 #define YYREJECT goto yyabort
475 #define YYACCEPT goto yyaccept
476 #define YYERROR goto yyerrlab
478 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
479 #define YYVALID_NESTED do { if (yyps->save && \
480 yyps->save->save == 0) goto yyvalid; } while(0)
481 #endif /* YYBTYACC */
486 int yym, yyn, yystate, yyresult;
489 YYParseState *yyerrctx = NULL;
490 #endif /* YYBTYACC */
491 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
492 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
497 if ((yys = getenv("YYDEBUG")) != 0)
500 if (yyn >= '0' && yyn <= '9')
504 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
506 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
507 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
511 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
513 #endif /* YYBTYACC */
522 memset(&yystack, 0, sizeof(yystack));
525 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
526 yystack.s_mark = yystack.s_base;
527 yystack.l_mark = yystack.l_base;
528 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
529 yystack.p_mark = yystack.p_base;
535 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
542 /* we're currently re-reading tokens */
544 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
552 /* in trial mode; save scanner results for future parse attempts */
553 if (yylvp == yylvlim)
554 { /* Enlarge lexical value queue */
555 size_t p = (size_t) (yylvp - yylvals);
556 size_t s = (size_t) (yylvlim - yylvals);
558 s += YYLVQUEUEGROWTH;
559 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
560 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
561 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
562 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
564 yylvp = yylve = yylvals + p;
565 yylvlim = yylvals + s;
566 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
567 yylpp = yylpe = yylpsns + p;
568 yylplim = yylpsns + s;
570 yylexp = yylexemes + p;
572 *yylexp = (YYINT) YYLEX;
575 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
582 /* normal operation, no conflict encountered */
583 #endif /* YYBTYACC */
587 #endif /* YYBTYACC */
588 if (yychar < 0) yychar = YYEOF;
592 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
593 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
594 YYDEBUGSTR, yydepth, yystate, yychar, yys);
595 #ifdef YYSTYPE_TOSTRING
598 #endif /* YYBTYACC */
599 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
607 /* Do we have a conflict? */
608 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
609 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
618 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
619 YYDEBUGSTR, yydepth, yystate);
621 /* Switch to the next conflict context */
626 if (save->state != yystate) YYABORT;
633 /* Unresolved conflict - start/continue trial parse */
638 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
640 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
642 fputs("Starting trial parse.\n", stderr);
645 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
646 if (save == NULL) goto yyenomem;
647 save->save = yyps->save;
648 save->state = yystate;
649 save->errflag = yyerrflag;
650 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
651 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
652 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
653 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
654 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
655 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
656 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
659 if (yyctable[ctry] == -1)
662 if (yydebug && yychar >= YYEOF)
663 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
668 if (yyps->save == NULL)
670 /* If this is a first conflict in the stack, start saving lexemes */
673 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
674 if (yylexemes == NULL) goto yyenomem;
675 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
676 if (yylvals == NULL) goto yyenomem;
677 yylvlim = yylvals + YYLVQUEUEGROWTH;
678 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
679 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
680 if (yylpsns == NULL) goto yyenomem;
681 yylplim = yylpsns + YYLVQUEUEGROWTH;
686 yylvp = yylve = yylvals;
687 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
688 yylpp = yylpe = yylpsns;
694 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
697 *yylexp = (YYINT) yychar;
705 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
711 save->lexeme = (int) (yylvp - yylvals);
714 if (yytable[yyn] == ctry)
718 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
719 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
724 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
729 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
731 yystate = yyctable[ctry];
732 *++yystack.s_mark = (YYINT) yystate;
733 *++yystack.l_mark = yylval;
734 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
735 *++yystack.p_mark = yylloc;
738 if (yyerrflag > 0) --yyerrflag;
743 yyn = yyctable[ctry];
746 } /* End of code dealing with conflicts */
747 #endif /* YYBTYACC */
748 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
749 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
753 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
754 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
756 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
757 yystate = yytable[yyn];
758 *++yystack.s_mark = yytable[yyn];
759 *++yystack.l_mark = yylval;
760 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
761 *++yystack.p_mark = yylloc;
764 if (yyerrflag > 0) --yyerrflag;
767 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
768 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
773 if (yyerrflag != 0) goto yyinrecovery;
778 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
781 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
782 * before looking for error recovery */
783 yystack.s_mark -= yym;
784 yystate = *yystack.s_mark;
785 yystack.l_mark -= yym;
786 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
787 yystack.p_mark -= yym;
795 YYParseState *save = yyps->save;
798 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
799 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
800 (int)(yylvp - yylvals - yyps->save->lexeme));
802 /* Memorize most forward-looking error state in case it's really an error. */
803 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
805 /* Free old saved error context state */
806 if (yyerrctx) yyFreeState(yyerrctx);
807 /* Create and fill out new saved error context state */
808 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
809 if (yyerrctx == NULL) goto yyenomem;
810 yyerrctx->save = yyps->save;
811 yyerrctx->state = yystate;
812 yyerrctx->errflag = yyerrflag;
813 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
814 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
815 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
816 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
817 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
818 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
819 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
821 yyerrctx->lexeme = (int) (yylvp - yylvals);
823 yylvp = yylvals + save->lexeme;
824 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
825 yylpp = yylpsns + save->lexeme;
827 yylexp = yylexemes + save->lexeme;
829 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
830 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
831 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
832 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
833 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
834 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
835 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
838 yystate = save->state;
839 /* We tried shift, try reduce now */
840 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
841 yyps->save = save->save;
845 /* Nothing left on the stack -- error */
850 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
853 /* Restore state as it was in the most forward-advanced error */
854 yylvp = yylvals + yyerrctx->lexeme;
855 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
856 yylpp = yylpsns + yyerrctx->lexeme;
858 yylexp = yylexemes + yyerrctx->lexeme;
861 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
864 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
865 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
866 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
867 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
868 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
869 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
870 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
872 yystate = yyerrctx->state;
873 yyFreeState(yyerrctx);
878 if (yynewerrflag == 0) goto yyinrecovery;
879 #endif /* YYBTYACC */
881 YYERROR_CALL("syntax error");
882 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
883 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
887 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
898 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
899 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
903 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
904 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
906 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
907 yystate = yytable[yyn];
908 *++yystack.s_mark = yytable[yyn];
909 *++yystack.l_mark = yylval;
910 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
911 /* lookahead position is error end position */
912 yyerror_loc_range[2] = yylloc;
913 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
914 *++yystack.p_mark = yyloc;
922 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
923 YYDEBUGSTR, yydepth, *yystack.s_mark);
925 if (yystack.s_mark <= yystack.s_base) goto yyabort;
926 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
927 /* the current TOS position is the error start position */
928 yyerror_loc_range[1] = *yystack.p_mark;
930 #if defined(YYDESTRUCT_CALL)
933 #endif /* YYBTYACC */
934 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
935 YYDESTRUCT_CALL("error: discarding state",
936 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
938 YYDESTRUCT_CALL("error: discarding state",
939 yystos[*yystack.s_mark], yystack.l_mark);
940 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
941 #endif /* defined(YYDESTRUCT_CALL) */
944 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
952 if (yychar == YYEOF) goto yyabort;
956 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
957 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
958 YYDEBUGSTR, yydepth, yystate, yychar, yys);
961 #if defined(YYDESTRUCT_CALL)
964 #endif /* YYBTYACC */
965 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
966 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
968 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
969 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
970 #endif /* defined(YYDESTRUCT_CALL) */
980 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
981 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
982 #ifdef YYSTYPE_TOSTRING
985 #endif /* YYBTYACC */
990 for (i = yym; i > 0; i--)
992 if (i != yym) fputs(", ", stderr);
993 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
994 yystack.l_mark[1-i]), stderr);
1003 yyval = yystack.l_mark[1-yym];
1005 memset(&yyval, 0, sizeof yyval);
1006 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1008 /* Perform position reduction */
1009 memset(&yyloc, 0, sizeof(yyloc));
1012 #endif /* YYBTYACC */
1014 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
1015 /* just in case YYERROR is invoked within the action, save
1016 the start of the rhs as the error start position */
1017 yyerror_loc_range[1] = yystack.p_mark[1-yym];
1026 yystack.s_mark -= yym;
1027 yystate = *yystack.s_mark;
1028 yystack.l_mark -= yym;
1029 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1030 yystack.p_mark -= yym;
1033 if (yystate == 0 && yym == 0)
1038 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1039 #ifdef YYSTYPE_TOSTRING
1042 #endif /* YYBTYACC */
1043 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1045 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1049 *++yystack.s_mark = YYFINAL;
1050 *++yystack.l_mark = yyval;
1051 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1052 *++yystack.p_mark = yyloc;
1060 /* we're currently re-reading tokens */
1062 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1070 /* in trial mode; save scanner results for future parse attempts */
1071 if (yylvp == yylvlim)
1072 { /* Enlarge lexical value queue */
1073 size_t p = (size_t) (yylvp - yylvals);
1074 size_t s = (size_t) (yylvlim - yylvals);
1076 s += YYLVQUEUEGROWTH;
1077 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1079 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1081 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1082 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1085 yylvp = yylve = yylvals + p;
1086 yylvlim = yylvals + s;
1087 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1088 yylpp = yylpe = yylpsns + p;
1089 yylplim = yylpsns + s;
1091 yylexp = yylexemes + p;
1093 *yylexp = (YYINT) YYLEX;
1096 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1103 /* normal operation, no conflict encountered */
1104 #endif /* YYBTYACC */
1108 #endif /* YYBTYACC */
1109 if (yychar < 0) yychar = YYEOF;
1113 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1114 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1115 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1119 if (yychar == YYEOF) goto yyaccept;
1122 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1123 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1124 yystate = yytable[yyn];
1126 yystate = yydgoto[yym];
1130 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1131 #ifdef YYSTYPE_TOSTRING
1134 #endif /* YYBTYACC */
1135 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1137 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1140 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1141 *++yystack.s_mark = (YYINT) yystate;
1142 *++yystack.l_mark = yyval;
1143 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1144 *++yystack.p_mark = yyloc;
1149 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1151 if (yypath) YYABORT;
1154 YYParseState *save = yyps->save;
1155 yyps->save = save->save;
1156 save->save = yypath;
1161 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1162 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1166 yyFreeState(yyerrctx);
1169 yylvp = yylvals + yypath->lexeme;
1170 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1171 yylpp = yylpsns + yypath->lexeme;
1173 yylexp = yylexemes + yypath->lexeme;
1175 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1176 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1177 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1178 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1179 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1180 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1181 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1183 yystate = yypath->state;
1185 #endif /* YYBTYACC */
1188 YYERROR_CALL("yacc stack overflow");
1192 YYERROR_CALL("memory exhausted");
1194 #endif /* YYBTYACC */
1204 if (yyps->save) goto yyvalid;
1205 #endif /* YYBTYACC */
1209 #if defined(YYDESTRUCT_CALL)
1210 if (yychar != YYEOF && yychar != YYEMPTY)
1211 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1212 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1214 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1215 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1219 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1222 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1223 YYDESTRUCT_CALL("cleanup: discarding state",
1224 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1226 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1227 YYDESTRUCT_CALL("cleanup: discarding state",
1228 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1229 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1231 #endif /* defined(YYDESTRUCT_CALL) */
1236 yyFreeState(yyerrctx);
1241 YYParseState *save = yyps;
1248 YYParseState *save = yypath;
1249 yypath = save->save;
1253 #endif /* YYBTYACC */
1254 yyfreestack(&yystack);