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 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 static const YYINT err_syntax20_stos[] = { 0,
171 static const YYINT err_syntax20_dgoto[] = { 2,
173 static const YYINT err_syntax20_sindex[] = { -40,
176 static const YYINT err_syntax20_rindex[] = { 0,
180 static const YYINT err_syntax20_cindex[] = { 0,
184 static const YYINT err_syntax20_gindex[] = { 0,
186 #define YYTABLESIZE 2
187 static const YYINT err_syntax20_table[] = { 1,
190 static const YYINT err_syntax20_check[] = { 40,
194 static const YYINT err_syntax20_ctable[] = { -1,
202 #define YYMAXTOKEN 257
203 #define YYUNDFTOKEN 260
204 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
206 static const char *const err_syntax20_name[] = {
208 "$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,
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,
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,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,"error","recur","$accept","expr",
217 static const char *const err_syntax20_rule[] = {
219 "expr : '(' recur ')'",
231 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
232 YYLTYPE yyloc; /* position returned by actions */
233 YYLTYPE yylloc; /* position from the lexer */
236 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
237 #ifndef YYLLOC_DEFAULT
238 #define YYLLOC_DEFAULT(loc, rhs, n) \
243 (loc).first_line = ((rhs)[-1]).last_line; \
244 (loc).first_column = ((rhs)[-1]).last_column; \
245 (loc).last_line = ((rhs)[-1]).last_line; \
246 (loc).last_column = ((rhs)[-1]).last_column; \
250 (loc).first_line = ((rhs)[ 0 ]).first_line; \
251 (loc).first_column = ((rhs)[ 0 ]).first_column; \
252 (loc).last_line = ((rhs)[n-1]).last_line; \
253 (loc).last_column = ((rhs)[n-1]).last_column; \
256 #endif /* YYLLOC_DEFAULT */
257 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
260 #ifndef YYLVQUEUEGROWTH
261 #define YYLVQUEUEGROWTH 32
263 #endif /* YYBTYACC */
265 /* define the initial stack-sizes */
268 #define YYMAXDEPTH YYSTACKSIZE
271 #define YYSTACKSIZE YYMAXDEPTH
273 #define YYSTACKSIZE 10000
274 #define YYMAXDEPTH 10000
278 #ifndef YYINITSTACKSIZE
279 #define YYINITSTACKSIZE 200
289 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
296 struct YYParseState_s
298 struct YYParseState_s *save; /* Previously saved parser state */
299 YYSTACKDATA yystack; /* saved parser stack */
300 int state; /* saved parser state */
301 int errflag; /* saved error recovery status */
302 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
303 YYINT ctry; /* saved index in yyctable[] for this conflict */
305 typedef struct YYParseState_s YYParseState;
306 #endif /* YYBTYACC */
307 /* variables for the parser stack */
308 static YYSTACKDATA yystack;
311 /* Current parser state */
312 static YYParseState *yyps = 0;
314 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
315 static YYParseState *yypath = 0;
317 /* Base of the lexical value queue */
318 static YYSTYPE *yylvals = 0;
320 /* Current position at lexical value queue */
321 static YYSTYPE *yylvp = 0;
323 /* End position of lexical value queue */
324 static YYSTYPE *yylve = 0;
326 /* The last allocated position at the lexical value queue */
327 static YYSTYPE *yylvlim = 0;
329 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
330 /* Base of the lexical position queue */
331 static YYLTYPE *yylpsns = 0;
333 /* Current position at lexical position queue */
334 static YYLTYPE *yylpp = 0;
336 /* End position of lexical position queue */
337 static YYLTYPE *yylpe = 0;
339 /* The last allocated position at the lexical position queue */
340 static YYLTYPE *yylplim = 0;
343 /* Current position at lexical token queue */
344 static short *yylexp = 0;
346 static short *yylexemes = 0;
347 #endif /* YYBTYACC */
348 #line 16 "err_syntax20.y"
355 printf("yyparse() = %d\n", yyparse());
366 yyerror(const char* s)
370 #line 371 "err_syntax20.tab.c"
372 /* For use in generated program */
373 #define yydepth (int)(yystack.s_mark - yystack.s_base)
375 #define yytrial (yyps->save)
376 #endif /* YYBTYACC */
379 #include <stdio.h> /* needed for printf */
382 #include <stdlib.h> /* needed for malloc, etc */
383 #include <string.h> /* needed for memset */
385 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
386 static int yygrowstack(YYSTACKDATA *data)
392 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
396 if ((newsize = data->stacksize) == 0)
397 newsize = YYINITSTACKSIZE;
398 else if (newsize >= YYMAXDEPTH)
400 else if ((newsize *= 2) > YYMAXDEPTH)
401 newsize = YYMAXDEPTH;
403 i = (int) (data->s_mark - data->s_base);
404 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
408 data->s_base = newss;
409 data->s_mark = newss + i;
411 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
415 data->l_base = newvs;
416 data->l_mark = newvs + i;
418 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
419 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
423 data->p_base = newps;
424 data->p_mark = newps + i;
427 data->stacksize = newsize;
428 data->s_last = data->s_base + newsize - 1;
432 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
437 #if YYPURE || defined(YY_NO_LEAKS)
438 static void yyfreestack(YYSTACKDATA *data)
442 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
445 memset(data, 0, sizeof(*data));
448 #define yyfreestack(data) /* nothing */
449 #endif /* YYPURE || defined(YY_NO_LEAKS) */
452 static YYParseState *
453 yyNewState(unsigned size)
455 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
456 if (p == NULL) return NULL;
458 p->yystack.stacksize = size;
461 p->yystack.s_base = NULL;
462 p->yystack.l_base = NULL;
463 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
464 p->yystack.p_base = NULL;
468 p->yystack.s_base = (short *) malloc(size * sizeof(short));
469 if (p->yystack.s_base == NULL) return NULL;
470 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
471 if (p->yystack.l_base == NULL) return NULL;
472 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
473 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
474 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
475 if (p->yystack.p_base == NULL) return NULL;
476 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
483 yyFreeState(YYParseState *p)
485 yyfreestack(&p->yystack);
488 #endif /* YYBTYACC */
490 #define YYABORT goto yyabort
491 #define YYREJECT goto yyabort
492 #define YYACCEPT goto yyaccept
493 #define YYERROR goto yyerrlab
495 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
496 #define YYVALID_NESTED do { if (yyps->save && \
497 yyps->save->save == 0) goto yyvalid; } while(0)
498 #endif /* YYBTYACC */
503 int yym, yyn, yystate, yyresult;
506 YYParseState *yyerrctx = NULL;
507 #endif /* YYBTYACC */
508 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
509 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
514 if ((yys = getenv("YYDEBUG")) != 0)
517 if (yyn >= '0' && yyn <= '9')
521 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
525 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
527 #endif /* YYBTYACC */
534 memset(&yystack, 0, sizeof(yystack));
537 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
538 yystack.s_mark = yystack.s_base;
539 yystack.l_mark = yystack.l_base;
540 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
541 yystack.p_mark = yystack.p_base;
547 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
554 /* we're currently re-reading tokens */
556 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
564 /* in trial mode; save scanner results for future parse attempts */
565 if (yylvp == yylvlim)
566 { /* Enlarge lexical value queue */
567 size_t p = (size_t) (yylvp - yylvals);
568 size_t s = (size_t) (yylvlim - yylvals);
570 s += YYLVQUEUEGROWTH;
571 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
572 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
573 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
574 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
576 yylvp = yylve = yylvals + p;
577 yylvlim = yylvals + s;
578 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
579 yylpp = yylpe = yylpsns + p;
580 yylplim = yylpsns + s;
582 yylexp = yylexemes + p;
584 *yylexp = (short) YYLEX;
587 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
594 /* normal operation, no conflict encountered */
595 #endif /* YYBTYACC */
599 #endif /* YYBTYACC */
600 if (yychar < 0) yychar = YYEOF;
601 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
605 yys = yyname[YYTRANSLATE(yychar)];
606 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
607 YYDEBUGSTR, yydepth, yystate, yychar, yys);
608 #ifdef YYSTYPE_TOSTRING
611 #endif /* YYBTYACC */
612 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
620 /* Do we have a conflict? */
621 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
622 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
631 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
632 YYDEBUGSTR, yydepth, yystate);
634 /* Switch to the next conflict context */
639 if (save->state != yystate) YYABORT;
646 /* Unresolved conflict - start/continue trial parse */
651 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
653 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
655 fputs("Starting trial parse.\n", stderr);
658 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
659 if (save == NULL) goto yyenomem;
660 save->save = yyps->save;
661 save->state = yystate;
662 save->errflag = yyerrflag;
663 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
664 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
665 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
666 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
667 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
668 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
669 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
672 if (yyctable[ctry] == -1)
675 if (yydebug && yychar >= YYEOF)
676 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
681 if (yyps->save == NULL)
683 /* If this is a first conflict in the stack, start saving lexemes */
686 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
687 if (yylexemes == NULL) goto yyenomem;
688 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
689 if (yylvals == NULL) goto yyenomem;
690 yylvlim = yylvals + YYLVQUEUEGROWTH;
691 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
692 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
693 if (yylpsns == NULL) goto yyenomem;
694 yylplim = yylpsns + YYLVQUEUEGROWTH;
699 yylvp = yylve = yylvals;
700 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
701 yylpp = yylpe = yylpsns;
707 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
710 *yylexp = (short) yychar;
718 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
724 save->lexeme = (int) (yylvp - yylvals);
727 if (yytable[yyn] == ctry)
731 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
732 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
737 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
742 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
744 yystate = yyctable[ctry];
745 *++yystack.s_mark = (short) yystate;
746 *++yystack.l_mark = yylval;
747 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
748 *++yystack.p_mark = yylloc;
751 if (yyerrflag > 0) --yyerrflag;
756 yyn = yyctable[ctry];
759 } /* End of code dealing with conflicts */
760 #endif /* YYBTYACC */
761 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
762 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
766 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
767 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
769 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
770 yystate = yytable[yyn];
771 *++yystack.s_mark = yytable[yyn];
772 *++yystack.l_mark = yylval;
773 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
774 *++yystack.p_mark = yylloc;
777 if (yyerrflag > 0) --yyerrflag;
780 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
781 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
786 if (yyerrflag != 0) goto yyinrecovery;
799 YYParseState *save = yyps->save;
802 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
803 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
804 (int)(yylvp - yylvals - yyps->save->lexeme));
806 /* Memorize most forward-looking error state in case it's really an error. */
807 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
809 /* Free old saved error context state */
810 if (yyerrctx) yyFreeState(yyerrctx);
811 /* Create and fill out new saved error context state */
812 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
813 if (yyerrctx == NULL) goto yyenomem;
814 yyerrctx->save = yyps->save;
815 yyerrctx->state = yystate;
816 yyerrctx->errflag = yyerrflag;
817 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
818 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
819 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
820 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
821 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
822 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
823 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
825 yyerrctx->lexeme = (int) (yylvp - yylvals);
827 yylvp = yylvals + save->lexeme;
828 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
829 yylpp = yylpsns + save->lexeme;
831 yylexp = yylexemes + save->lexeme;
833 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
834 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
835 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
836 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
837 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
838 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
839 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
842 yystate = save->state;
843 /* We tried shift, try reduce now */
844 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
845 yyps->save = save->save;
849 /* Nothing left on the stack -- error */
854 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
857 /* Restore state as it was in the most forward-advanced error */
858 yylvp = yylvals + yyerrctx->lexeme;
859 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
860 yylpp = yylpsns + yyerrctx->lexeme;
862 yylexp = yylexemes + yyerrctx->lexeme;
865 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
868 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
869 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
870 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
871 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
872 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
873 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
874 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
876 yystate = yyerrctx->state;
877 yyFreeState(yyerrctx);
882 if (yynewerrflag == 0) goto yyinrecovery;
883 #endif /* YYBTYACC */
885 YYERROR_CALL("syntax error");
886 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
887 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
902 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
903 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
907 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
908 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
910 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
911 yystate = yytable[yyn];
912 *++yystack.s_mark = yytable[yyn];
913 *++yystack.l_mark = yylval;
914 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
915 /* lookahead position is error end position */
916 yyerror_loc_range[1] = yylloc;
917 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
918 *++yystack.p_mark = yyloc;
926 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
927 YYDEBUGSTR, yydepth, *yystack.s_mark);
929 if (yystack.s_mark <= yystack.s_base) goto yyabort;
930 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
931 /* the current TOS position is the error start position */
932 yyerror_loc_range[0] = *yystack.p_mark;
934 #if defined(YYDESTRUCT_CALL)
937 #endif /* YYBTYACC */
938 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
939 YYDESTRUCT_CALL("error: discarding state",
940 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
942 YYDESTRUCT_CALL("error: discarding state",
943 yystos[*yystack.s_mark], yystack.l_mark);
944 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
945 #endif /* defined(YYDESTRUCT_CALL) */
948 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
956 if (yychar == YYEOF) goto yyabort;
960 yys = yyname[YYTRANSLATE(yychar)];
961 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
962 YYDEBUGSTR, yydepth, yystate, yychar, yys);
965 #if defined(YYDESTRUCT_CALL)
968 #endif /* YYBTYACC */
969 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
970 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
972 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
973 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
974 #endif /* defined(YYDESTRUCT_CALL) */
984 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
985 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
986 #ifdef YYSTYPE_TOSTRING
989 #endif /* YYBTYACC */
994 for (i = yym; i > 0; i--)
996 if (i != yym) fputs(", ", stderr);
997 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
998 yystack.l_mark[1-i]), stderr);
1003 fputc('\n', stderr);
1007 yyval = yystack.l_mark[1-yym];
1009 memset(&yyval, 0, sizeof yyval);
1010 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1012 /* Perform position reduction */
1013 memset(&yyloc, 0, sizeof(yyloc));
1016 #endif /* YYBTYACC */
1018 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1019 /* just in case YYERROR is invoked within the action, save
1020 the start of the rhs as the error start position */
1021 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1028 #line 12 "err_syntax20.y"
1029 { yystack.l_mark[-1].rechk = 3; }
1031 #line 1032 "err_syntax20.tab.c"
1035 yystack.s_mark -= yym;
1036 yystate = *yystack.s_mark;
1037 yystack.l_mark -= yym;
1038 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1039 yystack.p_mark -= yym;
1042 if (yystate == 0 && yym == 0)
1047 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1048 #ifdef YYSTYPE_TOSTRING
1051 #endif /* YYBTYACC */
1052 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1054 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1058 *++yystack.s_mark = YYFINAL;
1059 *++yystack.l_mark = yyval;
1060 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1061 *++yystack.p_mark = yyloc;
1069 /* we're currently re-reading tokens */
1071 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1079 /* in trial mode; save scanner results for future parse attempts */
1080 if (yylvp == yylvlim)
1081 { /* Enlarge lexical value queue */
1082 size_t p = (size_t) (yylvp - yylvals);
1083 size_t s = (size_t) (yylvlim - yylvals);
1085 s += YYLVQUEUEGROWTH;
1086 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1088 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1090 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1091 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1094 yylvp = yylve = yylvals + p;
1095 yylvlim = yylvals + s;
1096 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1097 yylpp = yylpe = yylpsns + p;
1098 yylplim = yylpsns + s;
1100 yylexp = yylexemes + p;
1102 *yylexp = (short) YYLEX;
1105 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1112 /* normal operation, no conflict encountered */
1113 #endif /* YYBTYACC */
1117 #endif /* YYBTYACC */
1118 if (yychar < 0) yychar = YYEOF;
1119 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1123 yys = yyname[YYTRANSLATE(yychar)];
1124 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1125 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1129 if (yychar == YYEOF) goto yyaccept;
1132 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1133 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1134 yystate = yytable[yyn];
1136 yystate = yydgoto[yym];
1140 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1141 #ifdef YYSTYPE_TOSTRING
1144 #endif /* YYBTYACC */
1145 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1147 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1150 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1151 *++yystack.s_mark = (short) yystate;
1152 *++yystack.l_mark = yyval;
1153 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1154 *++yystack.p_mark = yyloc;
1159 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1161 if (yypath) YYABORT;
1164 YYParseState *save = yyps->save;
1165 yyps->save = save->save;
1166 save->save = yypath;
1171 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1172 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1176 yyFreeState(yyerrctx);
1179 yylvp = yylvals + yypath->lexeme;
1180 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1181 yylpp = yylpsns + yypath->lexeme;
1183 yylexp = yylexemes + yypath->lexeme;
1185 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1186 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1187 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1188 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1189 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1190 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1191 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1193 yystate = yypath->state;
1195 #endif /* YYBTYACC */
1198 YYERROR_CALL("yacc stack overflow");
1202 YYERROR_CALL("memory exhausted");
1204 #endif /* YYBTYACC */
1214 if (yyps->save) goto yyvalid;
1215 #endif /* YYBTYACC */
1219 #if defined(YYDESTRUCT_CALL)
1220 if (yychar != YYEOF && yychar != YYEMPTY)
1221 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1222 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1224 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1225 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1229 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1232 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1233 YYDESTRUCT_CALL("cleanup: discarding state",
1234 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1236 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1237 YYDESTRUCT_CALL("cleanup: discarding state",
1238 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1239 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1241 #endif /* defined(YYDESTRUCT_CALL) */
1246 yyFreeState(yyerrctx);
1251 YYParseState *save = yyps;
1258 YYParseState *save = yypath;
1259 yypath = save->save;
1263 #endif /* YYBTYACC */
1264 yyfreestack(&yystack);