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_syntax20_parse
25 #define yylex err_syntax20_lex
29 #define yyerror err_syntax20_error
33 #define yychar err_syntax20_char
37 #define yyval err_syntax20_val
41 #define yylval err_syntax20_lval
45 #define yydebug err_syntax20_debug
49 #define yynerrs err_syntax20_nerrs
53 #define yyerrflag err_syntax20_errflag
54 #endif /* yyerrflag */
57 #define yylhs err_syntax20_lhs
61 #define yylen err_syntax20_len
65 #define yydefred err_syntax20_defred
69 #define yystos err_syntax20_stos
73 #define yydgoto err_syntax20_dgoto
77 #define yysindex err_syntax20_sindex
81 #define yyrindex err_syntax20_rindex
85 #define yygindex err_syntax20_gindex
89 #define yytable err_syntax20_table
93 #define yycheck err_syntax20_check
97 #define yyname err_syntax20_name
101 #define yyrule err_syntax20_rule
107 #define yycindex err_syntax20_cindex
108 #endif /* yycindex */
111 #define yyctable err_syntax20_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "err_syntax20_"
120 #line 2 "err_syntax20.y"
122 static void yyerror(const char *);
123 #line 124 "err_syntax20.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();
157 #define YYERRCODE 256
159 static const YYINT err_syntax20_lhs[] = { -1,
162 static const YYINT err_syntax20_len[] = { 2,
165 static const YYINT err_syntax20_defred[] = { 0,
168 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
169 static const YYINT err_syntax20_stos[] = { 0,
172 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
173 static const YYINT err_syntax20_dgoto[] = { 2,
175 static const YYINT err_syntax20_sindex[] = { -40,
178 static const YYINT err_syntax20_rindex[] = { 0,
182 static const YYINT err_syntax20_cindex[] = { 0,
186 static const YYINT err_syntax20_gindex[] = { 0,
188 #define YYTABLESIZE 2
189 static const YYINT err_syntax20_table[] = { 1,
192 static const YYINT err_syntax20_check[] = { 40,
196 static const YYINT err_syntax20_ctable[] = { -1,
204 #define YYMAXTOKEN 257
205 #define YYUNDFTOKEN 260
206 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
208 static const char *const err_syntax20_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,
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,0,0,0,0,"error","recur","$accept","expr",
219 static const char *const err_syntax20_rule[] = {
221 "expr : '(' recur ')'",
236 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
237 YYLTYPE yyloc; /* position returned by actions */
238 YYLTYPE yylloc; /* position from the lexer */
241 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
242 #ifndef YYLLOC_DEFAULT
243 #define YYLLOC_DEFAULT(loc, rhs, n) \
248 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
249 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
250 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
251 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
255 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
256 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
257 (loc).last_line = YYRHSLOC(rhs, n).last_line; \
258 (loc).last_column = YYRHSLOC(rhs, n).last_column; \
261 #endif /* YYLLOC_DEFAULT */
262 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
265 #ifndef YYLVQUEUEGROWTH
266 #define YYLVQUEUEGROWTH 32
268 #endif /* YYBTYACC */
270 /* define the initial stack-sizes */
273 #define YYMAXDEPTH YYSTACKSIZE
276 #define YYSTACKSIZE YYMAXDEPTH
278 #define YYSTACKSIZE 10000
279 #define YYMAXDEPTH 10000
283 #ifndef YYINITSTACKSIZE
284 #define YYINITSTACKSIZE 200
294 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
301 struct YYParseState_s
303 struct YYParseState_s *save; /* Previously saved parser state */
304 YYSTACKDATA yystack; /* saved parser stack */
305 int state; /* saved parser state */
306 int errflag; /* saved error recovery status */
307 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
308 YYINT ctry; /* saved index in yyctable[] for this conflict */
310 typedef struct YYParseState_s YYParseState;
311 #endif /* YYBTYACC */
312 /* variables for the parser stack */
313 static YYSTACKDATA yystack;
316 /* Current parser state */
317 static YYParseState *yyps = 0;
319 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
320 static YYParseState *yypath = 0;
322 /* Base of the lexical value queue */
323 static YYSTYPE *yylvals = 0;
325 /* Current position at lexical value queue */
326 static YYSTYPE *yylvp = 0;
328 /* End position of lexical value queue */
329 static YYSTYPE *yylve = 0;
331 /* The last allocated position at the lexical value queue */
332 static YYSTYPE *yylvlim = 0;
334 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
335 /* Base of the lexical position queue */
336 static YYLTYPE *yylpsns = 0;
338 /* Current position at lexical position queue */
339 static YYLTYPE *yylpp = 0;
341 /* End position of lexical position queue */
342 static YYLTYPE *yylpe = 0;
344 /* The last allocated position at the lexical position queue */
345 static YYLTYPE *yylplim = 0;
348 /* Current position at lexical token queue */
349 static YYINT *yylexp = 0;
351 static YYINT *yylexemes = 0;
352 #endif /* YYBTYACC */
353 #line 16 "err_syntax20.y"
360 printf("yyparse() = %d\n", yyparse());
371 yyerror(const char* s)
375 #line 376 "err_syntax20.tab.c"
377 /* For use in generated program */
378 #define yydepth (int)(yystack.s_mark - yystack.s_base)
380 #define yytrial (yyps->save)
381 #endif /* YYBTYACC */
384 #include <stdio.h> /* needed for printf */
387 #include <stdlib.h> /* needed for malloc, etc */
388 #include <string.h> /* needed for memset */
390 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
391 static int yygrowstack(YYSTACKDATA *data)
397 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
401 if ((newsize = data->stacksize) == 0)
402 newsize = YYINITSTACKSIZE;
403 else if (newsize >= YYMAXDEPTH)
405 else if ((newsize *= 2) > YYMAXDEPTH)
406 newsize = YYMAXDEPTH;
408 i = (int) (data->s_mark - data->s_base);
409 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
413 data->s_base = newss;
414 data->s_mark = newss + i;
416 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
420 data->l_base = newvs;
421 data->l_mark = newvs + i;
423 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
424 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
428 data->p_base = newps;
429 data->p_mark = newps + i;
432 data->stacksize = newsize;
433 data->s_last = data->s_base + newsize - 1;
437 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
442 #if YYPURE || defined(YY_NO_LEAKS)
443 static void yyfreestack(YYSTACKDATA *data)
447 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
450 memset(data, 0, sizeof(*data));
453 #define yyfreestack(data) /* nothing */
454 #endif /* YYPURE || defined(YY_NO_LEAKS) */
457 static YYParseState *
458 yyNewState(unsigned size)
460 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
461 if (p == NULL) return NULL;
463 p->yystack.stacksize = size;
466 p->yystack.s_base = NULL;
467 p->yystack.l_base = NULL;
468 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
469 p->yystack.p_base = NULL;
473 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
474 if (p->yystack.s_base == NULL) return NULL;
475 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
476 if (p->yystack.l_base == NULL) return NULL;
477 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
478 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
479 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
480 if (p->yystack.p_base == NULL) return NULL;
481 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
488 yyFreeState(YYParseState *p)
490 yyfreestack(&p->yystack);
493 #endif /* YYBTYACC */
495 #define YYABORT goto yyabort
496 #define YYREJECT goto yyabort
497 #define YYACCEPT goto yyaccept
498 #define YYERROR goto yyerrlab
500 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
501 #define YYVALID_NESTED do { if (yyps->save && \
502 yyps->save->save == 0) goto yyvalid; } while(0)
503 #endif /* YYBTYACC */
508 int yym, yyn, yystate, yyresult;
511 YYParseState *yyerrctx = NULL;
512 #endif /* YYBTYACC */
513 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
514 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
519 if ((yys = getenv("YYDEBUG")) != 0)
522 if (yyn >= '0' && yyn <= '9')
526 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
528 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
529 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
533 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
535 #endif /* YYBTYACC */
544 memset(&yystack, 0, sizeof(yystack));
547 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
548 yystack.s_mark = yystack.s_base;
549 yystack.l_mark = yystack.l_base;
550 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
551 yystack.p_mark = yystack.p_base;
557 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
564 /* we're currently re-reading tokens */
566 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
574 /* in trial mode; save scanner results for future parse attempts */
575 if (yylvp == yylvlim)
576 { /* Enlarge lexical value queue */
577 size_t p = (size_t) (yylvp - yylvals);
578 size_t s = (size_t) (yylvlim - yylvals);
580 s += YYLVQUEUEGROWTH;
581 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
582 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
583 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
584 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
586 yylvp = yylve = yylvals + p;
587 yylvlim = yylvals + s;
588 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
589 yylpp = yylpe = yylpsns + p;
590 yylplim = yylpsns + s;
592 yylexp = yylexemes + p;
594 *yylexp = (YYINT) YYLEX;
597 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
604 /* normal operation, no conflict encountered */
605 #endif /* YYBTYACC */
609 #endif /* YYBTYACC */
610 if (yychar < 0) yychar = YYEOF;
614 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
615 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
616 YYDEBUGSTR, yydepth, yystate, yychar, yys);
617 #ifdef YYSTYPE_TOSTRING
620 #endif /* YYBTYACC */
621 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
629 /* Do we have a conflict? */
630 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
631 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
640 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
641 YYDEBUGSTR, yydepth, yystate);
643 /* Switch to the next conflict context */
648 if (save->state != yystate) YYABORT;
655 /* Unresolved conflict - start/continue trial parse */
660 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
662 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
664 fputs("Starting trial parse.\n", stderr);
667 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
668 if (save == NULL) goto yyenomem;
669 save->save = yyps->save;
670 save->state = yystate;
671 save->errflag = yyerrflag;
672 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
673 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
674 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
675 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
676 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
677 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
678 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
681 if (yyctable[ctry] == -1)
684 if (yydebug && yychar >= YYEOF)
685 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
690 if (yyps->save == NULL)
692 /* If this is a first conflict in the stack, start saving lexemes */
695 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
696 if (yylexemes == NULL) goto yyenomem;
697 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
698 if (yylvals == NULL) goto yyenomem;
699 yylvlim = yylvals + YYLVQUEUEGROWTH;
700 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
701 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
702 if (yylpsns == NULL) goto yyenomem;
703 yylplim = yylpsns + YYLVQUEUEGROWTH;
708 yylvp = yylve = yylvals;
709 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
710 yylpp = yylpe = yylpsns;
716 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
719 *yylexp = (YYINT) yychar;
727 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
733 save->lexeme = (int) (yylvp - yylvals);
736 if (yytable[yyn] == ctry)
740 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
741 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
746 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
751 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
753 yystate = yyctable[ctry];
754 *++yystack.s_mark = (YYINT) yystate;
755 *++yystack.l_mark = yylval;
756 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
757 *++yystack.p_mark = yylloc;
760 if (yyerrflag > 0) --yyerrflag;
765 yyn = yyctable[ctry];
768 } /* End of code dealing with conflicts */
769 #endif /* YYBTYACC */
770 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
771 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
775 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
776 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
778 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
779 yystate = yytable[yyn];
780 *++yystack.s_mark = yytable[yyn];
781 *++yystack.l_mark = yylval;
782 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
783 *++yystack.p_mark = yylloc;
786 if (yyerrflag > 0) --yyerrflag;
789 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
790 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
795 if (yyerrflag != 0) goto yyinrecovery;
800 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
803 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
804 * before looking for error recovery */
805 yystack.s_mark -= yym;
806 yystate = *yystack.s_mark;
807 yystack.l_mark -= yym;
808 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
809 yystack.p_mark -= yym;
817 YYParseState *save = yyps->save;
820 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
821 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
822 (int)(yylvp - yylvals - yyps->save->lexeme));
824 /* Memorize most forward-looking error state in case it's really an error. */
825 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
827 /* Free old saved error context state */
828 if (yyerrctx) yyFreeState(yyerrctx);
829 /* Create and fill out new saved error context state */
830 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
831 if (yyerrctx == NULL) goto yyenomem;
832 yyerrctx->save = yyps->save;
833 yyerrctx->state = yystate;
834 yyerrctx->errflag = yyerrflag;
835 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
836 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
837 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
838 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
839 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
840 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
841 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
843 yyerrctx->lexeme = (int) (yylvp - yylvals);
845 yylvp = yylvals + save->lexeme;
846 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
847 yylpp = yylpsns + save->lexeme;
849 yylexp = yylexemes + save->lexeme;
851 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
852 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
853 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
854 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
855 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
856 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
857 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
860 yystate = save->state;
861 /* We tried shift, try reduce now */
862 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
863 yyps->save = save->save;
867 /* Nothing left on the stack -- error */
872 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
875 /* Restore state as it was in the most forward-advanced error */
876 yylvp = yylvals + yyerrctx->lexeme;
877 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
878 yylpp = yylpsns + yyerrctx->lexeme;
880 yylexp = yylexemes + yyerrctx->lexeme;
883 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
886 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
887 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
888 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
889 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
890 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
891 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
892 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
894 yystate = yyerrctx->state;
895 yyFreeState(yyerrctx);
900 if (yynewerrflag == 0) goto yyinrecovery;
901 #endif /* YYBTYACC */
903 YYERROR_CALL("syntax error");
904 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
905 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
909 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
920 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
921 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
925 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
926 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
928 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
929 yystate = yytable[yyn];
930 *++yystack.s_mark = yytable[yyn];
931 *++yystack.l_mark = yylval;
932 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
933 /* lookahead position is error end position */
934 yyerror_loc_range[2] = yylloc;
935 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
936 *++yystack.p_mark = yyloc;
944 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
945 YYDEBUGSTR, yydepth, *yystack.s_mark);
947 if (yystack.s_mark <= yystack.s_base) goto yyabort;
948 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
949 /* the current TOS position is the error start position */
950 yyerror_loc_range[1] = *yystack.p_mark;
952 #if defined(YYDESTRUCT_CALL)
955 #endif /* YYBTYACC */
956 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
957 YYDESTRUCT_CALL("error: discarding state",
958 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
960 YYDESTRUCT_CALL("error: discarding state",
961 yystos[*yystack.s_mark], yystack.l_mark);
962 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
963 #endif /* defined(YYDESTRUCT_CALL) */
966 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
974 if (yychar == YYEOF) goto yyabort;
978 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
979 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
980 YYDEBUGSTR, yydepth, yystate, yychar, yys);
983 #if defined(YYDESTRUCT_CALL)
986 #endif /* YYBTYACC */
987 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
988 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
990 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
991 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
992 #endif /* defined(YYDESTRUCT_CALL) */
1002 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1003 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1004 #ifdef YYSTYPE_TOSTRING
1007 #endif /* YYBTYACC */
1012 for (i = yym; i > 0; i--)
1014 if (i != yym) fputs(", ", stderr);
1015 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1016 yystack.l_mark[1-i]), stderr);
1021 fputc('\n', stderr);
1025 yyval = yystack.l_mark[1-yym];
1027 memset(&yyval, 0, sizeof yyval);
1028 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1030 /* Perform position reduction */
1031 memset(&yyloc, 0, sizeof(yyloc));
1034 #endif /* YYBTYACC */
1036 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
1037 /* just in case YYERROR is invoked within the action, save
1038 the start of the rhs as the error start position */
1039 yyerror_loc_range[1] = yystack.p_mark[1-yym];
1046 #line 12 "err_syntax20.y"
1047 { yystack.l_mark[-1].rechk = 3; }
1049 #line 1050 "err_syntax20.tab.c"
1053 yystack.s_mark -= yym;
1054 yystate = *yystack.s_mark;
1055 yystack.l_mark -= yym;
1056 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1057 yystack.p_mark -= yym;
1060 if (yystate == 0 && yym == 0)
1065 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1066 #ifdef YYSTYPE_TOSTRING
1069 #endif /* YYBTYACC */
1070 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1072 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1076 *++yystack.s_mark = YYFINAL;
1077 *++yystack.l_mark = yyval;
1078 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1079 *++yystack.p_mark = yyloc;
1087 /* we're currently re-reading tokens */
1089 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1097 /* in trial mode; save scanner results for future parse attempts */
1098 if (yylvp == yylvlim)
1099 { /* Enlarge lexical value queue */
1100 size_t p = (size_t) (yylvp - yylvals);
1101 size_t s = (size_t) (yylvlim - yylvals);
1103 s += YYLVQUEUEGROWTH;
1104 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1106 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1108 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1109 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1112 yylvp = yylve = yylvals + p;
1113 yylvlim = yylvals + s;
1114 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1115 yylpp = yylpe = yylpsns + p;
1116 yylplim = yylpsns + s;
1118 yylexp = yylexemes + p;
1120 *yylexp = (YYINT) YYLEX;
1123 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1130 /* normal operation, no conflict encountered */
1131 #endif /* YYBTYACC */
1135 #endif /* YYBTYACC */
1136 if (yychar < 0) yychar = YYEOF;
1140 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1141 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1142 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1146 if (yychar == YYEOF) goto yyaccept;
1149 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1150 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1151 yystate = yytable[yyn];
1153 yystate = yydgoto[yym];
1157 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1158 #ifdef YYSTYPE_TOSTRING
1161 #endif /* YYBTYACC */
1162 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1164 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1167 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1168 *++yystack.s_mark = (YYINT) yystate;
1169 *++yystack.l_mark = yyval;
1170 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1171 *++yystack.p_mark = yyloc;
1176 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1178 if (yypath) YYABORT;
1181 YYParseState *save = yyps->save;
1182 yyps->save = save->save;
1183 save->save = yypath;
1188 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1189 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1193 yyFreeState(yyerrctx);
1196 yylvp = yylvals + yypath->lexeme;
1197 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1198 yylpp = yylpsns + yypath->lexeme;
1200 yylexp = yylexemes + yypath->lexeme;
1202 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1203 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1204 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1205 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1206 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1207 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1208 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1210 yystate = yypath->state;
1212 #endif /* YYBTYACC */
1215 YYERROR_CALL("yacc stack overflow");
1219 YYERROR_CALL("memory exhausted");
1221 #endif /* YYBTYACC */
1231 if (yyps->save) goto yyvalid;
1232 #endif /* YYBTYACC */
1236 #if defined(YYDESTRUCT_CALL)
1237 if (yychar != YYEOF && yychar != YYEMPTY)
1238 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1239 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1241 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1242 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1246 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1249 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1250 YYDESTRUCT_CALL("cleanup: discarding state",
1251 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1253 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1254 YYDESTRUCT_CALL("cleanup: discarding state",
1255 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1256 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1258 #endif /* defined(YYDESTRUCT_CALL) */
1263 yyFreeState(yyerrctx);
1268 YYParseState *save = yyps;
1275 YYParseState *save = yypath;
1276 yypath = save->save;
1280 #endif /* YYBTYACC */
1281 yyfreestack(&yystack);