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 err_syntax10_parse
25 #define yylex err_syntax10_lex
29 #define yyerror err_syntax10_error
33 #define yychar err_syntax10_char
37 #define yyval err_syntax10_val
41 #define yylval err_syntax10_lval
45 #define yydebug err_syntax10_debug
49 #define yynerrs err_syntax10_nerrs
53 #define yyerrflag err_syntax10_errflag
54 #endif /* yyerrflag */
57 #define yylhs err_syntax10_lhs
61 #define yylen err_syntax10_len
65 #define yydefred err_syntax10_defred
69 #define yystos err_syntax10_stos
73 #define yydgoto err_syntax10_dgoto
77 #define yysindex err_syntax10_sindex
81 #define yyrindex err_syntax10_rindex
85 #define yygindex err_syntax10_gindex
89 #define yytable err_syntax10_table
93 #define yycheck err_syntax10_check
97 #define yyname err_syntax10_name
101 #define yyrule err_syntax10_rule
107 #define yycindex err_syntax10_cindex
108 #endif /* yycindex */
111 #define yyctable err_syntax10_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "err_syntax10_"
120 #line 2 "err_syntax10.y"
122 static void yyerror(const char *);
123 #line 124 "err_syntax10.tab.c"
125 /* compatibility with bison */
127 /* compatibility with FreeBSD */
128 # ifdef YYPARSE_PARAM_TYPE
129 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
131 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
134 # define YYPARSE_DECL() yyparse(void)
137 /* Parameters sent to lex. */
139 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
140 # define YYLEX yylex(YYLEX_PARAM)
142 # define YYLEX_DECL() yylex(void)
143 # define YYLEX yylex()
146 /* Parameters sent to yyerror. */
148 #define YYERROR_DECL() yyerror(const char *s)
151 #define YYERROR_CALL(msg) yyerror(msg)
154 extern int YYPARSE_DECL();
156 #define YYERRCODE 256
158 static const YYINT err_syntax10_lhs[] = { -1,
161 static const YYINT err_syntax10_len[] = { 2,
164 static const YYINT err_syntax10_defred[] = { 0,
167 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
168 static const YYINT err_syntax10_stos[] = { 0,
171 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
172 static const YYINT err_syntax10_dgoto[] = { 2,
174 static const YYINT err_syntax10_sindex[] = { -256,
177 static const YYINT err_syntax10_rindex[] = { 0,
181 static const YYINT err_syntax10_cindex[] = { 0,
185 static const YYINT err_syntax10_gindex[] = { 0,
187 #define YYTABLESIZE 0
188 static const YYINT err_syntax10_table[] = { 1,
190 static const YYINT err_syntax10_check[] = { 256,
193 static const YYINT err_syntax10_ctable[] = { -1,
200 #define YYMAXTOKEN 256
201 #define YYUNDFTOKEN 259
202 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
204 static const char *const err_syntax10_name[] = {
206 "$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,
207 0,"'&'",0,"'('",0,"'*'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
208 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
209 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
210 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,"error","$accept","S",
215 static const char *const err_syntax10_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 = YYRHSLOC(rhs, 0).last_line; \
245 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
246 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
247 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
251 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
252 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
253 (loc).last_line = YYRHSLOC(rhs, n).last_line; \
254 (loc).last_column = YYRHSLOC(rhs, n).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 YYINT *yylexp = 0;
347 static YYINT *yylexemes = 0;
348 #endif /* YYBTYACC */
349 #line 12 "err_syntax10.y"
356 printf("yyparse() = %d\n", yyparse());
367 yyerror(const char* s)
371 #line 372 "err_syntax10.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 = (YYINT *)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 = (YYINT *) malloc(size * sizeof(YYINT));
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[3]; /* position of error start/end (0 unused) */
515 if ((yys = getenv("YYDEBUG")) != 0)
518 if (yyn >= '0' && yyn <= '9')
522 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
524 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
525 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
529 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
531 #endif /* YYBTYACC */
540 memset(&yystack, 0, sizeof(yystack));
543 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
544 yystack.s_mark = yystack.s_base;
545 yystack.l_mark = yystack.l_base;
546 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
547 yystack.p_mark = yystack.p_base;
553 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
560 /* we're currently re-reading tokens */
562 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
570 /* in trial mode; save scanner results for future parse attempts */
571 if (yylvp == yylvlim)
572 { /* Enlarge lexical value queue */
573 size_t p = (size_t) (yylvp - yylvals);
574 size_t s = (size_t) (yylvlim - yylvals);
576 s += YYLVQUEUEGROWTH;
577 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
578 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
579 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
580 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
582 yylvp = yylve = yylvals + p;
583 yylvlim = yylvals + s;
584 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
585 yylpp = yylpe = yylpsns + p;
586 yylplim = yylpsns + s;
588 yylexp = yylexemes + p;
590 *yylexp = (YYINT) YYLEX;
593 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
600 /* normal operation, no conflict encountered */
601 #endif /* YYBTYACC */
605 #endif /* YYBTYACC */
606 if (yychar < 0) yychar = YYEOF;
610 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
611 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
612 YYDEBUGSTR, yydepth, yystate, yychar, yys);
613 #ifdef YYSTYPE_TOSTRING
616 #endif /* YYBTYACC */
617 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
625 /* Do we have a conflict? */
626 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
627 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
636 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
637 YYDEBUGSTR, yydepth, yystate);
639 /* Switch to the next conflict context */
644 if (save->state != yystate) YYABORT;
651 /* Unresolved conflict - start/continue trial parse */
656 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
658 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
660 fputs("Starting trial parse.\n", stderr);
663 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
664 if (save == NULL) goto yyenomem;
665 save->save = yyps->save;
666 save->state = yystate;
667 save->errflag = yyerrflag;
668 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
669 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
670 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
671 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
672 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
673 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
674 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
677 if (yyctable[ctry] == -1)
680 if (yydebug && yychar >= YYEOF)
681 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
686 if (yyps->save == NULL)
688 /* If this is a first conflict in the stack, start saving lexemes */
691 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
692 if (yylexemes == NULL) goto yyenomem;
693 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
694 if (yylvals == NULL) goto yyenomem;
695 yylvlim = yylvals + YYLVQUEUEGROWTH;
696 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
697 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
698 if (yylpsns == NULL) goto yyenomem;
699 yylplim = yylpsns + YYLVQUEUEGROWTH;
704 yylvp = yylve = yylvals;
705 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
706 yylpp = yylpe = yylpsns;
712 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
715 *yylexp = (YYINT) yychar;
723 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
729 save->lexeme = (int) (yylvp - yylvals);
732 if (yytable[yyn] == ctry)
736 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
737 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
742 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
747 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
749 yystate = yyctable[ctry];
750 *++yystack.s_mark = (YYINT) yystate;
751 *++yystack.l_mark = yylval;
752 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
753 *++yystack.p_mark = yylloc;
756 if (yyerrflag > 0) --yyerrflag;
761 yyn = yyctable[ctry];
764 } /* End of code dealing with conflicts */
765 #endif /* YYBTYACC */
766 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
767 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
771 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
772 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
774 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
775 yystate = yytable[yyn];
776 *++yystack.s_mark = yytable[yyn];
777 *++yystack.l_mark = yylval;
778 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
779 *++yystack.p_mark = yylloc;
782 if (yyerrflag > 0) --yyerrflag;
785 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
786 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
791 if (yyerrflag != 0) goto yyinrecovery;
796 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
799 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
800 * before looking for error recovery */
801 yystack.s_mark -= yym;
802 yystate = *yystack.s_mark;
803 yystack.l_mark -= yym;
804 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
805 yystack.p_mark -= yym;
813 YYParseState *save = yyps->save;
816 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
817 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
818 (int)(yylvp - yylvals - yyps->save->lexeme));
820 /* Memorize most forward-looking error state in case it's really an error. */
821 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
823 /* Free old saved error context state */
824 if (yyerrctx) yyFreeState(yyerrctx);
825 /* Create and fill out new saved error context state */
826 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
827 if (yyerrctx == NULL) goto yyenomem;
828 yyerrctx->save = yyps->save;
829 yyerrctx->state = yystate;
830 yyerrctx->errflag = yyerrflag;
831 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
832 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
833 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
834 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
835 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
836 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
837 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
839 yyerrctx->lexeme = (int) (yylvp - yylvals);
841 yylvp = yylvals + save->lexeme;
842 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
843 yylpp = yylpsns + save->lexeme;
845 yylexp = yylexemes + save->lexeme;
847 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
848 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
849 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
850 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
851 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
852 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
853 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
856 yystate = save->state;
857 /* We tried shift, try reduce now */
858 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
859 yyps->save = save->save;
863 /* Nothing left on the stack -- error */
868 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
871 /* Restore state as it was in the most forward-advanced error */
872 yylvp = yylvals + yyerrctx->lexeme;
873 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
874 yylpp = yylpsns + yyerrctx->lexeme;
876 yylexp = yylexemes + yyerrctx->lexeme;
879 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
882 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
883 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
884 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
885 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
886 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
887 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
888 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
890 yystate = yyerrctx->state;
891 yyFreeState(yyerrctx);
896 if (yynewerrflag == 0) goto yyinrecovery;
897 #endif /* YYBTYACC */
899 YYERROR_CALL("syntax error");
900 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
901 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
905 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
916 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
917 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
921 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
922 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
924 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
925 yystate = yytable[yyn];
926 *++yystack.s_mark = yytable[yyn];
927 *++yystack.l_mark = yylval;
928 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
929 /* lookahead position is error end position */
930 yyerror_loc_range[2] = yylloc;
931 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
932 *++yystack.p_mark = yyloc;
940 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
941 YYDEBUGSTR, yydepth, *yystack.s_mark);
943 if (yystack.s_mark <= yystack.s_base) goto yyabort;
944 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
945 /* the current TOS position is the error start position */
946 yyerror_loc_range[1] = *yystack.p_mark;
948 #if defined(YYDESTRUCT_CALL)
951 #endif /* YYBTYACC */
952 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
953 YYDESTRUCT_CALL("error: discarding state",
954 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
956 YYDESTRUCT_CALL("error: discarding state",
957 yystos[*yystack.s_mark], yystack.l_mark);
958 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
959 #endif /* defined(YYDESTRUCT_CALL) */
962 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
970 if (yychar == YYEOF) goto yyabort;
974 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
975 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
976 YYDEBUGSTR, yydepth, yystate, yychar, yys);
979 #if defined(YYDESTRUCT_CALL)
982 #endif /* YYBTYACC */
983 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
984 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
986 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
987 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
988 #endif /* defined(YYDESTRUCT_CALL) */
998 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
999 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1000 #ifdef YYSTYPE_TOSTRING
1003 #endif /* YYBTYACC */
1008 for (i = yym; i > 0; i--)
1010 if (i != yym) fputs(", ", stderr);
1011 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1012 yystack.l_mark[1-i]), stderr);
1017 fputc('\n', stderr);
1021 yyval = yystack.l_mark[1-yym];
1023 memset(&yyval, 0, sizeof yyval);
1024 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1026 /* Perform position reduction */
1027 memset(&yyloc, 0, sizeof(yyloc));
1030 #endif /* YYBTYACC */
1032 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
1033 /* just in case YYERROR is invoked within the action, save
1034 the start of the rhs as the error start position */
1035 yyerror_loc_range[1] = yystack.p_mark[1-yym];
1044 yystack.s_mark -= yym;
1045 yystate = *yystack.s_mark;
1046 yystack.l_mark -= yym;
1047 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1048 yystack.p_mark -= yym;
1051 if (yystate == 0 && yym == 0)
1056 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1057 #ifdef YYSTYPE_TOSTRING
1060 #endif /* YYBTYACC */
1061 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1063 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1067 *++yystack.s_mark = YYFINAL;
1068 *++yystack.l_mark = yyval;
1069 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1070 *++yystack.p_mark = yyloc;
1078 /* we're currently re-reading tokens */
1080 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1088 /* in trial mode; save scanner results for future parse attempts */
1089 if (yylvp == yylvlim)
1090 { /* Enlarge lexical value queue */
1091 size_t p = (size_t) (yylvp - yylvals);
1092 size_t s = (size_t) (yylvlim - yylvals);
1094 s += YYLVQUEUEGROWTH;
1095 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1097 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1099 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1100 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1103 yylvp = yylve = yylvals + p;
1104 yylvlim = yylvals + s;
1105 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1106 yylpp = yylpe = yylpsns + p;
1107 yylplim = yylpsns + s;
1109 yylexp = yylexemes + p;
1111 *yylexp = (YYINT) YYLEX;
1114 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1121 /* normal operation, no conflict encountered */
1122 #endif /* YYBTYACC */
1126 #endif /* YYBTYACC */
1127 if (yychar < 0) yychar = YYEOF;
1131 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1132 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1133 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1137 if (yychar == YYEOF) goto yyaccept;
1140 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1141 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1142 yystate = yytable[yyn];
1144 yystate = yydgoto[yym];
1148 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1149 #ifdef YYSTYPE_TOSTRING
1152 #endif /* YYBTYACC */
1153 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1155 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1158 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1159 *++yystack.s_mark = (YYINT) yystate;
1160 *++yystack.l_mark = yyval;
1161 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1162 *++yystack.p_mark = yyloc;
1167 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1169 if (yypath) YYABORT;
1172 YYParseState *save = yyps->save;
1173 yyps->save = save->save;
1174 save->save = yypath;
1179 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1180 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1184 yyFreeState(yyerrctx);
1187 yylvp = yylvals + yypath->lexeme;
1188 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1189 yylpp = yylpsns + yypath->lexeme;
1191 yylexp = yylexemes + yypath->lexeme;
1193 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1194 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1195 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1196 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1197 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1198 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1199 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1201 yystate = yypath->state;
1203 #endif /* YYBTYACC */
1206 YYERROR_CALL("yacc stack overflow");
1210 YYERROR_CALL("memory exhausted");
1212 #endif /* YYBTYACC */
1222 if (yyps->save) goto yyvalid;
1223 #endif /* YYBTYACC */
1227 #if defined(YYDESTRUCT_CALL)
1228 if (yychar != YYEOF && yychar != YYEMPTY)
1229 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1230 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1232 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1233 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1237 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1240 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1241 YYDESTRUCT_CALL("cleanup: discarding state",
1242 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1244 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1245 YYDESTRUCT_CALL("cleanup: discarding state",
1246 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1247 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1249 #endif /* defined(YYDESTRUCT_CALL) */
1254 yyFreeState(yyerrctx);
1259 YYParseState *save = yyps;
1266 YYParseState *save = yypath;
1267 yypath = save->save;
1271 #endif /* YYBTYACC */
1272 yyfreestack(&yystack);