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[];
207 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
208 YYLTYPE yyloc; /* position returned by actions */
209 YYLTYPE yylloc; /* position from the lexer */
212 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
213 #ifndef YYLLOC_DEFAULT
214 #define YYLLOC_DEFAULT(loc, rhs, n) \
219 (loc).first_line = ((rhs)[-1]).last_line; \
220 (loc).first_column = ((rhs)[-1]).last_column; \
221 (loc).last_line = ((rhs)[-1]).last_line; \
222 (loc).last_column = ((rhs)[-1]).last_column; \
226 (loc).first_line = ((rhs)[ 0 ]).first_line; \
227 (loc).first_column = ((rhs)[ 0 ]).first_column; \
228 (loc).last_line = ((rhs)[n-1]).last_line; \
229 (loc).last_column = ((rhs)[n-1]).last_column; \
232 #endif /* YYLLOC_DEFAULT */
233 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
236 #ifndef YYLVQUEUEGROWTH
237 #define YYLVQUEUEGROWTH 32
239 #endif /* YYBTYACC */
241 /* define the initial stack-sizes */
244 #define YYMAXDEPTH YYSTACKSIZE
247 #define YYSTACKSIZE YYMAXDEPTH
249 #define YYSTACKSIZE 10000
250 #define YYMAXDEPTH 10000
254 #ifndef YYINITSTACKSIZE
255 #define YYINITSTACKSIZE 200
265 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
272 struct YYParseState_s
274 struct YYParseState_s *save; /* Previously saved parser state */
275 YYSTACKDATA yystack; /* saved parser stack */
276 int state; /* saved parser state */
277 int errflag; /* saved error recovery status */
278 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
279 YYINT ctry; /* saved index in yyctable[] for this conflict */
281 typedef struct YYParseState_s YYParseState;
282 #endif /* YYBTYACC */
283 /* variables for the parser stack */
284 static YYSTACKDATA yystack;
287 /* Current parser state */
288 static YYParseState *yyps = 0;
290 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
291 static YYParseState *yypath = 0;
293 /* Base of the lexical value queue */
294 static YYSTYPE *yylvals = 0;
296 /* Current position at lexical value queue */
297 static YYSTYPE *yylvp = 0;
299 /* End position of lexical value queue */
300 static YYSTYPE *yylve = 0;
302 /* The last allocated position at the lexical value queue */
303 static YYSTYPE *yylvlim = 0;
305 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
306 /* Base of the lexical position queue */
307 static YYLTYPE *yylpsns = 0;
309 /* Current position at lexical position queue */
310 static YYLTYPE *yylpp = 0;
312 /* End position of lexical position queue */
313 static YYLTYPE *yylpe = 0;
315 /* The last allocated position at the lexical position queue */
316 static YYLTYPE *yylplim = 0;
319 /* Current position at lexical token queue */
320 static YYINT *yylexp = 0;
322 static YYINT *yylexemes = 0;
323 #endif /* YYBTYACC */
324 #line 12 "code_error.y"
329 extern int YYLEX_DECL();
335 printf("yyparse() = %d\n", yyparse());
346 yyerror(const char* s)
350 #line 351 "code_error.code.c"
352 /* For use in generated program */
353 #define yydepth (int)(yystack.s_mark - yystack.s_base)
355 #define yytrial (yyps->save)
356 #endif /* YYBTYACC */
359 #include <stdio.h> /* needed for printf */
362 #include <stdlib.h> /* needed for malloc, etc */
363 #include <string.h> /* needed for memset */
365 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
366 static int yygrowstack(YYSTACKDATA *data)
372 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
376 if ((newsize = data->stacksize) == 0)
377 newsize = YYINITSTACKSIZE;
378 else if (newsize >= YYMAXDEPTH)
380 else if ((newsize *= 2) > YYMAXDEPTH)
381 newsize = YYMAXDEPTH;
383 i = (int) (data->s_mark - data->s_base);
384 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
388 data->s_base = newss;
389 data->s_mark = newss + i;
391 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
395 data->l_base = newvs;
396 data->l_mark = newvs + i;
398 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
399 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
403 data->p_base = newps;
404 data->p_mark = newps + i;
407 data->stacksize = newsize;
408 data->s_last = data->s_base + newsize - 1;
412 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
417 #if YYPURE || defined(YY_NO_LEAKS)
418 static void yyfreestack(YYSTACKDATA *data)
422 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
425 memset(data, 0, sizeof(*data));
428 #define yyfreestack(data) /* nothing */
429 #endif /* YYPURE || defined(YY_NO_LEAKS) */
432 static YYParseState *
433 yyNewState(unsigned size)
435 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
436 if (p == NULL) return NULL;
438 p->yystack.stacksize = size;
441 p->yystack.s_base = NULL;
442 p->yystack.l_base = NULL;
443 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
444 p->yystack.p_base = NULL;
448 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
449 if (p->yystack.s_base == NULL) return NULL;
450 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
451 if (p->yystack.l_base == NULL) return NULL;
452 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
453 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
454 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
455 if (p->yystack.p_base == NULL) return NULL;
456 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
463 yyFreeState(YYParseState *p)
465 yyfreestack(&p->yystack);
468 #endif /* YYBTYACC */
470 #define YYABORT goto yyabort
471 #define YYREJECT goto yyabort
472 #define YYACCEPT goto yyaccept
473 #define YYERROR goto yyerrlab
475 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
476 #define YYVALID_NESTED do { if (yyps->save && \
477 yyps->save->save == 0) goto yyvalid; } while(0)
478 #endif /* YYBTYACC */
483 int yym, yyn, yystate, yyresult;
486 YYParseState *yyerrctx = NULL;
487 #endif /* YYBTYACC */
488 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
489 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
494 if ((yys = getenv("YYDEBUG")) != 0)
497 if (yyn >= '0' && yyn <= '9')
501 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
503 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
504 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
508 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
510 #endif /* YYBTYACC */
519 memset(&yystack, 0, sizeof(yystack));
522 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
523 yystack.s_mark = yystack.s_base;
524 yystack.l_mark = yystack.l_base;
525 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
526 yystack.p_mark = yystack.p_base;
532 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
539 /* we're currently re-reading tokens */
541 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
549 /* in trial mode; save scanner results for future parse attempts */
550 if (yylvp == yylvlim)
551 { /* Enlarge lexical value queue */
552 size_t p = (size_t) (yylvp - yylvals);
553 size_t s = (size_t) (yylvlim - yylvals);
555 s += YYLVQUEUEGROWTH;
556 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
557 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
558 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
559 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
561 yylvp = yylve = yylvals + p;
562 yylvlim = yylvals + s;
563 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
564 yylpp = yylpe = yylpsns + p;
565 yylplim = yylpsns + s;
567 yylexp = yylexemes + p;
569 *yylexp = (YYINT) YYLEX;
572 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
579 /* normal operation, no conflict encountered */
580 #endif /* YYBTYACC */
584 #endif /* YYBTYACC */
585 if (yychar < 0) yychar = YYEOF;
589 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
590 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
591 YYDEBUGSTR, yydepth, yystate, yychar, yys);
592 #ifdef YYSTYPE_TOSTRING
595 #endif /* YYBTYACC */
596 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
604 /* Do we have a conflict? */
605 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
606 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
615 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
616 YYDEBUGSTR, yydepth, yystate);
618 /* Switch to the next conflict context */
623 if (save->state != yystate) YYABORT;
630 /* Unresolved conflict - start/continue trial parse */
635 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
637 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
639 fputs("Starting trial parse.\n", stderr);
642 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
643 if (save == NULL) goto yyenomem;
644 save->save = yyps->save;
645 save->state = yystate;
646 save->errflag = yyerrflag;
647 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
648 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
649 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
650 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
651 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
652 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
653 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
656 if (yyctable[ctry] == -1)
659 if (yydebug && yychar >= YYEOF)
660 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
665 if (yyps->save == NULL)
667 /* If this is a first conflict in the stack, start saving lexemes */
670 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
671 if (yylexemes == NULL) goto yyenomem;
672 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
673 if (yylvals == NULL) goto yyenomem;
674 yylvlim = yylvals + YYLVQUEUEGROWTH;
675 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
676 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
677 if (yylpsns == NULL) goto yyenomem;
678 yylplim = yylpsns + YYLVQUEUEGROWTH;
683 yylvp = yylve = yylvals;
684 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
685 yylpp = yylpe = yylpsns;
691 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
694 *yylexp = (YYINT) yychar;
702 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
708 save->lexeme = (int) (yylvp - yylvals);
711 if (yytable[yyn] == ctry)
715 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
716 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
721 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
726 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
728 yystate = yyctable[ctry];
729 *++yystack.s_mark = (YYINT) yystate;
730 *++yystack.l_mark = yylval;
731 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
732 *++yystack.p_mark = yylloc;
735 if (yyerrflag > 0) --yyerrflag;
740 yyn = yyctable[ctry];
743 } /* End of code dealing with conflicts */
744 #endif /* YYBTYACC */
745 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
746 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
750 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
751 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
753 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
754 yystate = yytable[yyn];
755 *++yystack.s_mark = yytable[yyn];
756 *++yystack.l_mark = yylval;
757 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
758 *++yystack.p_mark = yylloc;
761 if (yyerrflag > 0) --yyerrflag;
764 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
765 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
770 if (yyerrflag != 0) goto yyinrecovery;
775 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
778 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
779 * before looking for error recovery */
780 yystack.s_mark -= yym;
781 yystate = *yystack.s_mark;
782 yystack.l_mark -= yym;
783 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
784 yystack.p_mark -= yym;
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, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
812 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
813 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (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, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
818 yyerrctx->lexeme = (int) (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, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
828 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
829 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (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, (size_t) (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, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
863 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
864 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (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, (size_t) (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 */
884 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
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 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
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 size_t p = (size_t) (yylvp - yylvals);
1071 size_t s = (size_t) (yylvlim - yylvals);
1073 s += YYLVQUEUEGROWTH;
1074 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1076 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1078 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1079 if ((yylpsns = 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 = (YYINT) 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;
1110 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1111 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1112 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1116 if (yychar == YYEOF) goto yyaccept;
1119 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1120 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1121 yystate = yytable[yyn];
1123 yystate = yydgoto[yym];
1127 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1128 #ifdef YYSTYPE_TOSTRING
1131 #endif /* YYBTYACC */
1132 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1134 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1137 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1138 *++yystack.s_mark = (YYINT) yystate;
1139 *++yystack.l_mark = yyval;
1140 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1141 *++yystack.p_mark = yyloc;
1146 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1148 if (yypath) YYABORT;
1151 YYParseState *save = yyps->save;
1152 yyps->save = save->save;
1153 save->save = yypath;
1158 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1159 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1163 yyFreeState(yyerrctx);
1166 yylvp = yylvals + yypath->lexeme;
1167 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1168 yylpp = yylpsns + yypath->lexeme;
1170 yylexp = yylexemes + yypath->lexeme;
1172 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1173 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1174 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1175 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1176 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1177 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1178 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1180 yystate = yypath->state;
1182 #endif /* YYBTYACC */
1185 YYERROR_CALL("yacc stack overflow");
1189 YYERROR_CALL("memory exhausted");
1191 #endif /* YYBTYACC */
1201 if (yyps->save) goto yyvalid;
1202 #endif /* YYBTYACC */
1206 #if defined(YYDESTRUCT_CALL)
1207 if (yychar != YYEOF && yychar != YYEMPTY)
1208 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1209 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1211 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1212 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1216 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1219 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1220 YYDESTRUCT_CALL("cleanup: discarding state",
1221 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1223 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1224 YYDESTRUCT_CALL("cleanup: discarding state",
1225 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1226 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1228 #endif /* defined(YYDESTRUCT_CALL) */
1233 yyFreeState(yyerrctx);
1238 YYParseState *save = yyps;
1245 YYParseState *save = yypath;
1246 yypath = save->save;
1250 #endif /* YYBTYACC */
1251 yyfreestack(&yystack);