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[] = {
239 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
240 YYLTYPE yyloc; /* position returned by actions */
241 YYLTYPE yylloc; /* position from the lexer */
244 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
245 #ifndef YYLLOC_DEFAULT
246 #define YYLLOC_DEFAULT(loc, rhs, n) \
251 (loc).first_line = ((rhs)[-1]).last_line; \
252 (loc).first_column = ((rhs)[-1]).last_column; \
253 (loc).last_line = ((rhs)[-1]).last_line; \
254 (loc).last_column = ((rhs)[-1]).last_column; \
258 (loc).first_line = ((rhs)[ 0 ]).first_line; \
259 (loc).first_column = ((rhs)[ 0 ]).first_column; \
260 (loc).last_line = ((rhs)[n-1]).last_line; \
261 (loc).last_column = ((rhs)[n-1]).last_column; \
264 #endif /* YYLLOC_DEFAULT */
265 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
268 #ifndef YYLVQUEUEGROWTH
269 #define YYLVQUEUEGROWTH 32
271 #endif /* YYBTYACC */
273 /* define the initial stack-sizes */
276 #define YYMAXDEPTH YYSTACKSIZE
279 #define YYSTACKSIZE YYMAXDEPTH
281 #define YYSTACKSIZE 10000
282 #define YYMAXDEPTH 10000
286 #ifndef YYINITSTACKSIZE
287 #define YYINITSTACKSIZE 200
297 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
304 struct YYParseState_s
306 struct YYParseState_s *save; /* Previously saved parser state */
307 YYSTACKDATA yystack; /* saved parser stack */
308 int state; /* saved parser state */
309 int errflag; /* saved error recovery status */
310 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
311 YYINT ctry; /* saved index in yyctable[] for this conflict */
313 typedef struct YYParseState_s YYParseState;
314 #endif /* YYBTYACC */
315 /* variables for the parser stack */
316 static YYSTACKDATA yystack;
319 /* Current parser state */
320 static YYParseState *yyps = 0;
322 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
323 static YYParseState *yypath = 0;
325 /* Base of the lexical value queue */
326 static YYSTYPE *yylvals = 0;
328 /* Current position at lexical value queue */
329 static YYSTYPE *yylvp = 0;
331 /* End position of lexical value queue */
332 static YYSTYPE *yylve = 0;
334 /* The last allocated position at the lexical value queue */
335 static YYSTYPE *yylvlim = 0;
337 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
338 /* Base of the lexical position queue */
339 static YYLTYPE *yylpsns = 0;
341 /* Current position at lexical position queue */
342 static YYLTYPE *yylpp = 0;
344 /* End position of lexical position queue */
345 static YYLTYPE *yylpe = 0;
347 /* The last allocated position at the lexical position queue */
348 static YYLTYPE *yylplim = 0;
351 /* Current position at lexical token queue */
352 static YYINT *yylexp = 0;
354 static YYINT *yylexemes = 0;
355 #endif /* YYBTYACC */
369 #line 370 "empty.tab.c"
371 /* For use in generated program */
372 #define yydepth (int)(yystack.s_mark - yystack.s_base)
374 #define yytrial (yyps->save)
375 #endif /* YYBTYACC */
378 #include <stdio.h> /* needed for printf */
381 #include <stdlib.h> /* needed for malloc, etc */
382 #include <string.h> /* needed for memset */
384 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
385 static int yygrowstack(YYSTACKDATA *data)
391 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
395 if ((newsize = data->stacksize) == 0)
396 newsize = YYINITSTACKSIZE;
397 else if (newsize >= YYMAXDEPTH)
399 else if ((newsize *= 2) > YYMAXDEPTH)
400 newsize = YYMAXDEPTH;
402 i = (int) (data->s_mark - data->s_base);
403 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
407 data->s_base = newss;
408 data->s_mark = newss + i;
410 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
414 data->l_base = newvs;
415 data->l_mark = newvs + i;
417 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
418 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
422 data->p_base = newps;
423 data->p_mark = newps + i;
426 data->stacksize = newsize;
427 data->s_last = data->s_base + newsize - 1;
431 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
436 #if YYPURE || defined(YY_NO_LEAKS)
437 static void yyfreestack(YYSTACKDATA *data)
441 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
444 memset(data, 0, sizeof(*data));
447 #define yyfreestack(data) /* nothing */
448 #endif /* YYPURE || defined(YY_NO_LEAKS) */
451 static YYParseState *
452 yyNewState(unsigned size)
454 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
455 if (p == NULL) return NULL;
457 p->yystack.stacksize = size;
460 p->yystack.s_base = NULL;
461 p->yystack.l_base = NULL;
462 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
463 p->yystack.p_base = NULL;
467 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
468 if (p->yystack.s_base == NULL) return NULL;
469 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
470 if (p->yystack.l_base == NULL) return NULL;
471 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
472 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
473 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
474 if (p->yystack.p_base == NULL) return NULL;
475 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
482 yyFreeState(YYParseState *p)
484 yyfreestack(&p->yystack);
487 #endif /* YYBTYACC */
489 #define YYABORT goto yyabort
490 #define YYREJECT goto yyabort
491 #define YYACCEPT goto yyaccept
492 #define YYERROR goto yyerrlab
494 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
495 #define YYVALID_NESTED do { if (yyps->save && \
496 yyps->save->save == 0) goto yyvalid; } while(0)
497 #endif /* YYBTYACC */
502 int yym, yyn, yystate, yyresult;
505 YYParseState *yyerrctx = NULL;
506 #endif /* YYBTYACC */
507 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
508 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
513 if ((yys = getenv("YYDEBUG")) != 0)
516 if (yyn >= '0' && yyn <= '9')
520 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
522 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
523 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
527 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
529 #endif /* YYBTYACC */
538 memset(&yystack, 0, sizeof(yystack));
541 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
542 yystack.s_mark = yystack.s_base;
543 yystack.l_mark = yystack.l_base;
544 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
545 yystack.p_mark = yystack.p_base;
551 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
558 /* we're currently re-reading tokens */
560 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
568 /* in trial mode; save scanner results for future parse attempts */
569 if (yylvp == yylvlim)
570 { /* Enlarge lexical value queue */
571 size_t p = (size_t) (yylvp - yylvals);
572 size_t s = (size_t) (yylvlim - yylvals);
574 s += YYLVQUEUEGROWTH;
575 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
576 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
577 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
578 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
580 yylvp = yylve = yylvals + p;
581 yylvlim = yylvals + s;
582 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
583 yylpp = yylpe = yylpsns + p;
584 yylplim = yylpsns + s;
586 yylexp = yylexemes + p;
588 *yylexp = (YYINT) YYLEX;
591 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
598 /* normal operation, no conflict encountered */
599 #endif /* YYBTYACC */
603 #endif /* YYBTYACC */
604 if (yychar < 0) yychar = YYEOF;
608 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
609 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
610 YYDEBUGSTR, yydepth, yystate, yychar, yys);
611 #ifdef YYSTYPE_TOSTRING
614 #endif /* YYBTYACC */
615 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
623 /* Do we have a conflict? */
624 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
625 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
634 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
635 YYDEBUGSTR, yydepth, yystate);
637 /* Switch to the next conflict context */
642 if (save->state != yystate) YYABORT;
649 /* Unresolved conflict - start/continue trial parse */
654 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
656 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
658 fputs("Starting trial parse.\n", stderr);
661 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
662 if (save == NULL) goto yyenomem;
663 save->save = yyps->save;
664 save->state = yystate;
665 save->errflag = yyerrflag;
666 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
667 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
668 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
669 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
670 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
671 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
672 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
675 if (yyctable[ctry] == -1)
678 if (yydebug && yychar >= YYEOF)
679 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
684 if (yyps->save == NULL)
686 /* If this is a first conflict in the stack, start saving lexemes */
689 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
690 if (yylexemes == NULL) goto yyenomem;
691 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
692 if (yylvals == NULL) goto yyenomem;
693 yylvlim = yylvals + YYLVQUEUEGROWTH;
694 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
695 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
696 if (yylpsns == NULL) goto yyenomem;
697 yylplim = yylpsns + YYLVQUEUEGROWTH;
702 yylvp = yylve = yylvals;
703 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
704 yylpp = yylpe = yylpsns;
710 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
713 *yylexp = (YYINT) yychar;
721 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
727 save->lexeme = (int) (yylvp - yylvals);
730 if (yytable[yyn] == ctry)
734 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
735 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
740 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
745 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
747 yystate = yyctable[ctry];
748 *++yystack.s_mark = (YYINT) yystate;
749 *++yystack.l_mark = yylval;
750 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
751 *++yystack.p_mark = yylloc;
754 if (yyerrflag > 0) --yyerrflag;
759 yyn = yyctable[ctry];
762 } /* End of code dealing with conflicts */
763 #endif /* YYBTYACC */
764 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
765 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
769 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
770 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
772 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
773 yystate = yytable[yyn];
774 *++yystack.s_mark = yytable[yyn];
775 *++yystack.l_mark = yylval;
776 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
777 *++yystack.p_mark = yylloc;
780 if (yyerrflag > 0) --yyerrflag;
783 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
784 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
789 if (yyerrflag != 0) goto yyinrecovery;
794 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
797 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
798 * before looking for error recovery */
799 yystack.s_mark -= yym;
800 yystate = *yystack.s_mark;
801 yystack.l_mark -= yym;
802 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
803 yystack.p_mark -= yym;
811 YYParseState *save = yyps->save;
814 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
815 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
816 (int)(yylvp - yylvals - yyps->save->lexeme));
818 /* Memorize most forward-looking error state in case it's really an error. */
819 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
821 /* Free old saved error context state */
822 if (yyerrctx) yyFreeState(yyerrctx);
823 /* Create and fill out new saved error context state */
824 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
825 if (yyerrctx == NULL) goto yyenomem;
826 yyerrctx->save = yyps->save;
827 yyerrctx->state = yystate;
828 yyerrctx->errflag = yyerrflag;
829 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
830 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
831 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
832 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
833 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
834 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
835 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
837 yyerrctx->lexeme = (int) (yylvp - yylvals);
839 yylvp = yylvals + save->lexeme;
840 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
841 yylpp = yylpsns + save->lexeme;
843 yylexp = yylexemes + save->lexeme;
845 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
846 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
847 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
848 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
849 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
850 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
851 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
854 yystate = save->state;
855 /* We tried shift, try reduce now */
856 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
857 yyps->save = save->save;
861 /* Nothing left on the stack -- error */
866 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
869 /* Restore state as it was in the most forward-advanced error */
870 yylvp = yylvals + yyerrctx->lexeme;
871 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
872 yylpp = yylpsns + yyerrctx->lexeme;
874 yylexp = yylexemes + yyerrctx->lexeme;
877 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
880 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
881 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
882 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
883 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
884 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
885 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
886 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
888 yystate = yyerrctx->state;
889 yyFreeState(yyerrctx);
894 if (yynewerrflag == 0) goto yyinrecovery;
895 #endif /* YYBTYACC */
897 YYERROR_CALL("syntax error");
898 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
899 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
903 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
914 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
915 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
919 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
920 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
922 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
923 yystate = yytable[yyn];
924 *++yystack.s_mark = yytable[yyn];
925 *++yystack.l_mark = yylval;
926 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
927 /* lookahead position is error end position */
928 yyerror_loc_range[1] = yylloc;
929 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
930 *++yystack.p_mark = yyloc;
938 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
939 YYDEBUGSTR, yydepth, *yystack.s_mark);
941 if (yystack.s_mark <= yystack.s_base) goto yyabort;
942 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
943 /* the current TOS position is the error start position */
944 yyerror_loc_range[0] = *yystack.p_mark;
946 #if defined(YYDESTRUCT_CALL)
949 #endif /* YYBTYACC */
950 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
951 YYDESTRUCT_CALL("error: discarding state",
952 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
954 YYDESTRUCT_CALL("error: discarding state",
955 yystos[*yystack.s_mark], yystack.l_mark);
956 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
957 #endif /* defined(YYDESTRUCT_CALL) */
960 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
968 if (yychar == YYEOF) goto yyabort;
972 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
973 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
974 YYDEBUGSTR, yydepth, yystate, yychar, yys);
977 #if defined(YYDESTRUCT_CALL)
980 #endif /* YYBTYACC */
981 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
982 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
984 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
985 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
986 #endif /* defined(YYDESTRUCT_CALL) */
996 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
997 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
998 #ifdef YYSTYPE_TOSTRING
1001 #endif /* YYBTYACC */
1006 for (i = yym; i > 0; i--)
1008 if (i != yym) fputs(", ", stderr);
1009 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1010 yystack.l_mark[1-i]), stderr);
1015 fputc('\n', stderr);
1019 yyval = yystack.l_mark[1-yym];
1021 memset(&yyval, 0, sizeof yyval);
1022 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1024 /* Perform position reduction */
1025 memset(&yyloc, 0, sizeof(yyloc));
1028 #endif /* YYBTYACC */
1030 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1031 /* just in case YYERROR is invoked within the action, save
1032 the start of the rhs as the error start position */
1033 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1042 yystack.s_mark -= yym;
1043 yystate = *yystack.s_mark;
1044 yystack.l_mark -= yym;
1045 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1046 yystack.p_mark -= yym;
1049 if (yystate == 0 && yym == 0)
1054 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1055 #ifdef YYSTYPE_TOSTRING
1058 #endif /* YYBTYACC */
1059 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1061 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1065 *++yystack.s_mark = YYFINAL;
1066 *++yystack.l_mark = yyval;
1067 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1068 *++yystack.p_mark = yyloc;
1076 /* we're currently re-reading tokens */
1078 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1086 /* in trial mode; save scanner results for future parse attempts */
1087 if (yylvp == yylvlim)
1088 { /* Enlarge lexical value queue */
1089 size_t p = (size_t) (yylvp - yylvals);
1090 size_t s = (size_t) (yylvlim - yylvals);
1092 s += YYLVQUEUEGROWTH;
1093 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1095 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1097 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1098 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1101 yylvp = yylve = yylvals + p;
1102 yylvlim = yylvals + s;
1103 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1104 yylpp = yylpe = yylpsns + p;
1105 yylplim = yylpsns + s;
1107 yylexp = yylexemes + p;
1109 *yylexp = (YYINT) YYLEX;
1112 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1119 /* normal operation, no conflict encountered */
1120 #endif /* YYBTYACC */
1124 #endif /* YYBTYACC */
1125 if (yychar < 0) yychar = YYEOF;
1129 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1130 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1131 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1135 if (yychar == YYEOF) goto yyaccept;
1138 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1139 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1140 yystate = yytable[yyn];
1142 yystate = yydgoto[yym];
1146 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1147 #ifdef YYSTYPE_TOSTRING
1150 #endif /* YYBTYACC */
1151 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1153 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1156 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1157 *++yystack.s_mark = (YYINT) yystate;
1158 *++yystack.l_mark = yyval;
1159 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1160 *++yystack.p_mark = yyloc;
1165 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1167 if (yypath) YYABORT;
1170 YYParseState *save = yyps->save;
1171 yyps->save = save->save;
1172 save->save = yypath;
1177 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1178 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1182 yyFreeState(yyerrctx);
1185 yylvp = yylvals + yypath->lexeme;
1186 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1187 yylpp = yylpsns + yypath->lexeme;
1189 yylexp = yylexemes + yypath->lexeme;
1191 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1192 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1193 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1194 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1195 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1196 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1197 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1199 yystate = yypath->state;
1201 #endif /* YYBTYACC */
1204 YYERROR_CALL("yacc stack overflow");
1208 YYERROR_CALL("memory exhausted");
1210 #endif /* YYBTYACC */
1220 if (yyps->save) goto yyvalid;
1221 #endif /* YYBTYACC */
1225 #if defined(YYDESTRUCT_CALL)
1226 if (yychar != YYEOF && yychar != YYEMPTY)
1227 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1228 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1230 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1231 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1235 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1238 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1239 YYDESTRUCT_CALL("cleanup: discarding state",
1240 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1242 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1243 YYDESTRUCT_CALL("cleanup: discarding state",
1244 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1245 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1247 #endif /* defined(YYDESTRUCT_CALL) */
1252 yyFreeState(yyerrctx);
1257 YYParseState *save = yyps;
1264 YYParseState *save = yypath;
1265 yypath = save->save;
1269 #endif /* YYBTYACC */
1270 yyfreestack(&yystack);