1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent of 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_"
122 static void yyerror(const char *);
123 #line 124 "error.tab.c"
125 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
126 /* Default: YYSTYPE is the semantic value type. */
128 # define YYSTYPE_IS_DECLARED 1
131 /* compatibility with bison */
133 /* compatibility with FreeBSD */
134 # ifdef YYPARSE_PARAM_TYPE
135 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
137 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
140 # define YYPARSE_DECL() yyparse(void)
143 /* Parameters sent to lex. */
145 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
146 # define YYLEX yylex(YYLEX_PARAM)
148 # define YYLEX_DECL() yylex(void)
149 # define YYLEX yylex()
152 /* Parameters sent to yyerror. */
154 #define YYERROR_DECL() yyerror(const char *s)
157 #define YYERROR_CALL(msg) yyerror(msg)
160 extern int YYPARSE_DECL();
162 #define YYERRCODE 256
164 static const YYINT error_lhs[] = { -1,
167 static const YYINT error_len[] = { 2,
170 static const YYINT error_defred[] = { 0,
173 static const YYINT error_stos[] = { 0,
176 static const YYINT error_dgoto[] = { 2,
178 static const YYINT error_sindex[] = { -256,
181 static const YYINT error_rindex[] = { 0,
185 static const YYINT error_cindex[] = { 0,
189 static const YYINT error_gindex[] = { 0,
191 #define YYTABLESIZE 0
192 static const YYINT error_table[] = { 1,
194 static const YYINT error_check[] = { 256,
197 static const YYINT error_ctable[] = { -1,
204 #define YYMAXTOKEN 256
205 #define YYUNDFTOKEN 259
206 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
208 static const char *const error_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","S","illegal-symbol",
218 static const char *const error_rule[] = {
232 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
233 YYLTYPE yyloc; /* position returned by actions */
234 YYLTYPE yylloc; /* position from the lexer */
237 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
238 #ifndef YYLLOC_DEFAULT
239 #define YYLLOC_DEFAULT(loc, rhs, n) \
244 (loc).first_line = ((rhs)[-1]).last_line; \
245 (loc).first_column = ((rhs)[-1]).last_column; \
246 (loc).last_line = ((rhs)[-1]).last_line; \
247 (loc).last_column = ((rhs)[-1]).last_column; \
251 (loc).first_line = ((rhs)[ 0 ]).first_line; \
252 (loc).first_column = ((rhs)[ 0 ]).first_column; \
253 (loc).last_line = ((rhs)[n-1]).last_line; \
254 (loc).last_column = ((rhs)[n-1]).last_column; \
257 #endif /* YYLLOC_DEFAULT */
258 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
261 #ifndef YYLVQUEUEGROWTH
262 #define YYLVQUEUEGROWTH 32
264 #endif /* YYBTYACC */
266 /* define the initial stack-sizes */
269 #define YYMAXDEPTH YYSTACKSIZE
272 #define YYSTACKSIZE YYMAXDEPTH
274 #define YYSTACKSIZE 10000
275 #define YYMAXDEPTH 10000
279 #ifndef YYINITSTACKSIZE
280 #define YYINITSTACKSIZE 200
290 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
297 struct YYParseState_s
299 struct YYParseState_s *save; /* Previously saved parser state */
300 YYSTACKDATA yystack; /* saved parser stack */
301 int state; /* saved parser state */
302 int errflag; /* saved error recovery status */
303 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
304 YYINT ctry; /* saved index in yyctable[] for this conflict */
306 typedef struct YYParseState_s YYParseState;
307 #endif /* YYBTYACC */
308 /* variables for the parser stack */
309 static YYSTACKDATA yystack;
312 /* Current parser state */
313 static YYParseState *yyps = 0;
315 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
316 static YYParseState *yypath = 0;
318 /* Base of the lexical value queue */
319 static YYSTYPE *yylvals = 0;
321 /* Current position at lexical value queue */
322 static YYSTYPE *yylvp = 0;
324 /* End position of lexical value queue */
325 static YYSTYPE *yylve = 0;
327 /* The last allocated position at the lexical value queue */
328 static YYSTYPE *yylvlim = 0;
330 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
331 /* Base of the lexical position queue */
332 static YYLTYPE *yylpsns = 0;
334 /* Current position at lexical position queue */
335 static YYLTYPE *yylpp = 0;
337 /* End position of lexical position queue */
338 static YYLTYPE *yylpe = 0;
340 /* The last allocated position at the lexical position queue */
341 static YYLTYPE *yylplim = 0;
344 /* Current position at lexical token queue */
345 static short *yylexp = 0;
347 static short *yylexemes = 0;
348 #endif /* YYBTYACC */
356 printf("yyparse() = %d\n", yyparse());
367 yyerror(const char* s)
371 #line 372 "error.tab.c"
373 /* For use in generated program */
374 #define yydepth (int)(yystack.s_mark - yystack.s_base)
376 #define yytrial (yyps->save)
377 #endif /* YYBTYACC */
380 #include <stdio.h> /* needed for printf */
383 #include <stdlib.h> /* needed for malloc, etc */
384 #include <string.h> /* needed for memset */
386 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
387 static int yygrowstack(YYSTACKDATA *data)
393 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
397 if ((newsize = data->stacksize) == 0)
398 newsize = YYINITSTACKSIZE;
399 else if (newsize >= YYMAXDEPTH)
401 else if ((newsize *= 2) > YYMAXDEPTH)
402 newsize = YYMAXDEPTH;
404 i = (int) (data->s_mark - data->s_base);
405 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
409 data->s_base = newss;
410 data->s_mark = newss + i;
412 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
416 data->l_base = newvs;
417 data->l_mark = newvs + i;
419 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
420 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
424 data->p_base = newps;
425 data->p_mark = newps + i;
428 data->stacksize = newsize;
429 data->s_last = data->s_base + newsize - 1;
433 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
438 #if YYPURE || defined(YY_NO_LEAKS)
439 static void yyfreestack(YYSTACKDATA *data)
443 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
446 memset(data, 0, sizeof(*data));
449 #define yyfreestack(data) /* nothing */
450 #endif /* YYPURE || defined(YY_NO_LEAKS) */
453 static YYParseState *
454 yyNewState(unsigned size)
456 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
457 if (p == NULL) return NULL;
459 p->yystack.stacksize = size;
462 p->yystack.s_base = NULL;
463 p->yystack.l_base = NULL;
464 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
465 p->yystack.p_base = NULL;
469 p->yystack.s_base = (short *) malloc(size * sizeof(short));
470 if (p->yystack.s_base == NULL) return NULL;
471 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
472 if (p->yystack.l_base == NULL) return NULL;
473 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
474 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
475 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
476 if (p->yystack.p_base == NULL) return NULL;
477 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
484 yyFreeState(YYParseState *p)
486 yyfreestack(&p->yystack);
489 #endif /* YYBTYACC */
491 #define YYABORT goto yyabort
492 #define YYREJECT goto yyabort
493 #define YYACCEPT goto yyaccept
494 #define YYERROR goto yyerrlab
496 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
497 #define YYVALID_NESTED do { if (yyps->save && \
498 yyps->save->save == 0) goto yyvalid; } while(0)
499 #endif /* YYBTYACC */
504 int yym, yyn, yystate, yyresult;
507 YYParseState *yyerrctx = NULL;
508 #endif /* YYBTYACC */
509 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
510 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
515 if ((yys = getenv("YYDEBUG")) != 0)
518 if (yyn >= '0' && yyn <= '9')
522 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
526 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
528 #endif /* YYBTYACC */
535 memset(&yystack, 0, sizeof(yystack));
538 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
539 yystack.s_mark = yystack.s_base;
540 yystack.l_mark = yystack.l_base;
541 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
542 yystack.p_mark = yystack.p_base;
548 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
555 /* we're currently re-reading tokens */
557 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
565 /* in trial mode; save scanner results for future parse attempts */
566 if (yylvp == yylvlim)
567 { /* Enlarge lexical value queue */
568 size_t p = (size_t) (yylvp - yylvals);
569 size_t s = (size_t) (yylvlim - yylvals);
571 s += YYLVQUEUEGROWTH;
572 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
573 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
574 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
575 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
577 yylvp = yylve = yylvals + p;
578 yylvlim = yylvals + s;
579 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
580 yylpp = yylpe = yylpsns + p;
581 yylplim = yylpsns + s;
583 yylexp = yylexemes + p;
585 *yylexp = (short) YYLEX;
588 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
595 /* normal operation, no conflict encountered */
596 #endif /* YYBTYACC */
600 #endif /* YYBTYACC */
601 if (yychar < 0) yychar = YYEOF;
602 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
606 yys = yyname[YYTRANSLATE(yychar)];
607 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
608 YYDEBUGSTR, yydepth, yystate, yychar, yys);
609 #ifdef YYSTYPE_TOSTRING
612 #endif /* YYBTYACC */
613 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
621 /* Do we have a conflict? */
622 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
623 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
632 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
633 YYDEBUGSTR, yydepth, yystate);
635 /* Switch to the next conflict context */
640 if (save->state != yystate) YYABORT;
647 /* Unresolved conflict - start/continue trial parse */
652 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
654 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
656 fputs("Starting trial parse.\n", stderr);
659 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
660 if (save == NULL) goto yyenomem;
661 save->save = yyps->save;
662 save->state = yystate;
663 save->errflag = yyerrflag;
664 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
665 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
666 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
667 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
668 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
669 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
670 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
673 if (yyctable[ctry] == -1)
676 if (yydebug && yychar >= YYEOF)
677 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
682 if (yyps->save == NULL)
684 /* If this is a first conflict in the stack, start saving lexemes */
687 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
688 if (yylexemes == NULL) goto yyenomem;
689 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
690 if (yylvals == NULL) goto yyenomem;
691 yylvlim = yylvals + YYLVQUEUEGROWTH;
692 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
693 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
694 if (yylpsns == NULL) goto yyenomem;
695 yylplim = yylpsns + YYLVQUEUEGROWTH;
700 yylvp = yylve = yylvals;
701 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
702 yylpp = yylpe = yylpsns;
708 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
711 *yylexp = (short) yychar;
719 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
725 save->lexeme = (int) (yylvp - yylvals);
728 if (yytable[yyn] == ctry)
732 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
733 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
738 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
743 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
745 yystate = yyctable[ctry];
746 *++yystack.s_mark = (short) yystate;
747 *++yystack.l_mark = yylval;
748 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
749 *++yystack.p_mark = yylloc;
752 if (yyerrflag > 0) --yyerrflag;
757 yyn = yyctable[ctry];
760 } /* End of code dealing with conflicts */
761 #endif /* YYBTYACC */
762 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
763 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
767 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
768 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
770 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
771 yystate = yytable[yyn];
772 *++yystack.s_mark = yytable[yyn];
773 *++yystack.l_mark = yylval;
774 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
775 *++yystack.p_mark = yylloc;
778 if (yyerrflag > 0) --yyerrflag;
781 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
782 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
787 if (yyerrflag != 0) goto yyinrecovery;
800 YYParseState *save = yyps->save;
803 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
804 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
805 (int)(yylvp - yylvals - yyps->save->lexeme));
807 /* Memorize most forward-looking error state in case it's really an error. */
808 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
810 /* Free old saved error context state */
811 if (yyerrctx) yyFreeState(yyerrctx);
812 /* Create and fill out new saved error context state */
813 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
814 if (yyerrctx == NULL) goto yyenomem;
815 yyerrctx->save = yyps->save;
816 yyerrctx->state = yystate;
817 yyerrctx->errflag = yyerrflag;
818 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
819 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
820 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
821 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
822 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
823 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
824 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
826 yyerrctx->lexeme = (int) (yylvp - yylvals);
828 yylvp = yylvals + save->lexeme;
829 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
830 yylpp = yylpsns + save->lexeme;
832 yylexp = yylexemes + save->lexeme;
834 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
835 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
836 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
837 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
838 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
839 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
840 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
843 yystate = save->state;
844 /* We tried shift, try reduce now */
845 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
846 yyps->save = save->save;
850 /* Nothing left on the stack -- error */
855 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
858 /* Restore state as it was in the most forward-advanced error */
859 yylvp = yylvals + yyerrctx->lexeme;
860 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
861 yylpp = yylpsns + yyerrctx->lexeme;
863 yylexp = yylexemes + yyerrctx->lexeme;
866 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
869 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
870 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
871 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
872 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
873 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
874 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
875 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
877 yystate = yyerrctx->state;
878 yyFreeState(yyerrctx);
883 if (yynewerrflag == 0) goto yyinrecovery;
884 #endif /* YYBTYACC */
886 YYERROR_CALL("syntax error");
887 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
888 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
903 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
904 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
908 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
909 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
911 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
912 yystate = yytable[yyn];
913 *++yystack.s_mark = yytable[yyn];
914 *++yystack.l_mark = yylval;
915 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
916 /* lookahead position is error end position */
917 yyerror_loc_range[1] = yylloc;
918 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
919 *++yystack.p_mark = yyloc;
927 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
928 YYDEBUGSTR, yydepth, *yystack.s_mark);
930 if (yystack.s_mark <= yystack.s_base) goto yyabort;
931 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
932 /* the current TOS position is the error start position */
933 yyerror_loc_range[0] = *yystack.p_mark;
935 #if defined(YYDESTRUCT_CALL)
938 #endif /* YYBTYACC */
939 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
940 YYDESTRUCT_CALL("error: discarding state",
941 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
943 YYDESTRUCT_CALL("error: discarding state",
944 yystos[*yystack.s_mark], yystack.l_mark);
945 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
946 #endif /* defined(YYDESTRUCT_CALL) */
949 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
957 if (yychar == YYEOF) goto yyabort;
961 yys = yyname[YYTRANSLATE(yychar)];
962 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
963 YYDEBUGSTR, yydepth, yystate, yychar, yys);
966 #if defined(YYDESTRUCT_CALL)
969 #endif /* YYBTYACC */
970 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
971 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
973 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
974 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
975 #endif /* defined(YYDESTRUCT_CALL) */
985 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
986 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
987 #ifdef YYSTYPE_TOSTRING
990 #endif /* YYBTYACC */
995 for (i = yym; i > 0; i--)
997 if (i != yym) fputs(", ", stderr);
998 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
999 yystack.l_mark[1-i]), stderr);
1004 fputc('\n', stderr);
1008 yyval = yystack.l_mark[1-yym];
1010 memset(&yyval, 0, sizeof yyval);
1011 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1013 /* Perform position reduction */
1014 memset(&yyloc, 0, sizeof(yyloc));
1017 #endif /* YYBTYACC */
1019 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1020 /* just in case YYERROR is invoked within the action, save
1021 the start of the rhs as the error start position */
1022 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1031 yystack.s_mark -= yym;
1032 yystate = *yystack.s_mark;
1033 yystack.l_mark -= yym;
1034 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1035 yystack.p_mark -= yym;
1038 if (yystate == 0 && yym == 0)
1043 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1044 #ifdef YYSTYPE_TOSTRING
1047 #endif /* YYBTYACC */
1048 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1050 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1054 *++yystack.s_mark = YYFINAL;
1055 *++yystack.l_mark = yyval;
1056 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1057 *++yystack.p_mark = yyloc;
1065 /* we're currently re-reading tokens */
1067 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1075 /* in trial mode; save scanner results for future parse attempts */
1076 if (yylvp == yylvlim)
1077 { /* Enlarge lexical value queue */
1078 size_t p = (size_t) (yylvp - yylvals);
1079 size_t s = (size_t) (yylvlim - yylvals);
1081 s += YYLVQUEUEGROWTH;
1082 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1084 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1086 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1087 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1090 yylvp = yylve = yylvals + p;
1091 yylvlim = yylvals + s;
1092 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1093 yylpp = yylpe = yylpsns + p;
1094 yylplim = yylpsns + s;
1096 yylexp = yylexemes + p;
1098 *yylexp = (short) YYLEX;
1101 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1108 /* normal operation, no conflict encountered */
1109 #endif /* YYBTYACC */
1113 #endif /* YYBTYACC */
1114 if (yychar < 0) yychar = YYEOF;
1115 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1119 yys = yyname[YYTRANSLATE(yychar)];
1120 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1121 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1125 if (yychar == YYEOF) goto yyaccept;
1128 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1129 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1130 yystate = yytable[yyn];
1132 yystate = yydgoto[yym];
1136 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1137 #ifdef YYSTYPE_TOSTRING
1140 #endif /* YYBTYACC */
1141 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1143 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1146 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1147 *++yystack.s_mark = (short) yystate;
1148 *++yystack.l_mark = yyval;
1149 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1150 *++yystack.p_mark = yyloc;
1155 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1157 if (yypath) YYABORT;
1160 YYParseState *save = yyps->save;
1161 yyps->save = save->save;
1162 save->save = yypath;
1167 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1168 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1172 yyFreeState(yyerrctx);
1175 yylvp = yylvals + yypath->lexeme;
1176 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1177 yylpp = yylpsns + yypath->lexeme;
1179 yylexp = yylexemes + yypath->lexeme;
1181 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1182 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1183 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1184 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1185 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1186 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1187 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1189 yystate = yypath->state;
1191 #endif /* YYBTYACC */
1194 YYERROR_CALL("yacc stack overflow");
1198 YYERROR_CALL("memory exhausted");
1200 #endif /* YYBTYACC */
1210 if (yyps->save) goto yyvalid;
1211 #endif /* YYBTYACC */
1215 #if defined(YYDESTRUCT_CALL)
1216 if (yychar != YYEOF && yychar != YYEMPTY)
1217 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1218 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1220 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1221 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1225 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1228 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1229 YYDESTRUCT_CALL("cleanup: discarding state",
1230 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1232 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1233 YYDESTRUCT_CALL("cleanup: discarding state",
1234 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1235 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1237 #endif /* defined(YYDESTRUCT_CALL) */
1242 yyFreeState(yyerrctx);
1247 YYParseState *save = yyps;
1254 YYParseState *save = yypath;
1255 yypath = save->save;
1259 #endif /* YYBTYACC */
1260 yyfreestack(&yystack);