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 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,
197 #define YYMAXTOKEN 257
198 #define YYUNDFTOKEN 260
199 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
201 static const char *const err_syntax20_name[] = {
203 "$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,
204 0,0,0,"'('","')'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
205 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
206 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,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,"error","recur","$accept","expr",
212 static const char *const err_syntax20_rule[] = {
214 "expr : '(' recur ')'",
226 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
227 YYLTYPE yyloc; /* position returned by actions */
228 YYLTYPE yylloc; /* position from the lexer */
231 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
232 #ifndef YYLLOC_DEFAULT
233 #define YYLLOC_DEFAULT(loc, rhs, n) \
238 (loc).first_line = ((rhs)[-1]).last_line; \
239 (loc).first_column = ((rhs)[-1]).last_column; \
240 (loc).last_line = ((rhs)[-1]).last_line; \
241 (loc).last_column = ((rhs)[-1]).last_column; \
245 (loc).first_line = ((rhs)[ 0 ]).first_line; \
246 (loc).first_column = ((rhs)[ 0 ]).first_column; \
247 (loc).last_line = ((rhs)[n-1]).last_line; \
248 (loc).last_column = ((rhs)[n-1]).last_column; \
251 #endif /* YYLLOC_DEFAULT */
252 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
255 #ifndef YYLVQUEUEGROWTH
256 #define YYLVQUEUEGROWTH 32
258 #endif /* YYBTYACC */
260 /* define the initial stack-sizes */
263 #define YYMAXDEPTH YYSTACKSIZE
266 #define YYSTACKSIZE YYMAXDEPTH
268 #define YYSTACKSIZE 10000
269 #define YYMAXDEPTH 10000
273 #ifndef YYINITSTACKSIZE
274 #define YYINITSTACKSIZE 200
284 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
291 struct YYParseState_s
293 struct YYParseState_s *save; /* Previously saved parser state */
294 YYSTACKDATA yystack; /* saved parser stack */
295 int state; /* saved parser state */
296 int errflag; /* saved error recovery status */
297 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
298 YYINT ctry; /* saved index in yyctable[] for this conflict */
300 typedef struct YYParseState_s YYParseState;
301 #endif /* YYBTYACC */
302 /* variables for the parser stack */
303 static YYSTACKDATA yystack;
306 /* Current parser state */
307 static YYParseState *yyps = 0;
309 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
310 static YYParseState *yypath = 0;
312 /* Base of the lexical value queue */
313 static YYSTYPE *yylvals = 0;
315 /* Current position at lexical value queue */
316 static YYSTYPE *yylvp = 0;
318 /* End position of lexical value queue */
319 static YYSTYPE *yylve = 0;
321 /* The last allocated position at the lexical value queue */
322 static YYSTYPE *yylvlim = 0;
324 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
325 /* Base of the lexical position queue */
326 static YYLTYPE *yylpsns = 0;
328 /* Current position at lexical position queue */
329 static YYLTYPE *yylpp = 0;
331 /* End position of lexical position queue */
332 static YYLTYPE *yylpe = 0;
334 /* The last allocated position at the lexical position queue */
335 static YYLTYPE *yylplim = 0;
338 /* Current position at lexical token queue */
339 static short *yylexp = 0;
341 static short *yylexemes = 0;
342 #endif /* YYBTYACC */
343 #line 16 "err_syntax20.y"
350 printf("yyparse() = %d\n", yyparse());
361 yyerror(const char* s)
365 #line 366 "err_syntax20.tab.c"
367 /* For use in generated program */
368 #define yydepth (int)(yystack.s_mark - yystack.s_base)
370 #define yytrial (yyps->save)
371 #endif /* YYBTYACC */
374 #include <stdio.h> /* needed for printf */
377 #include <stdlib.h> /* needed for malloc, etc */
378 #include <string.h> /* needed for memset */
380 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
381 static int yygrowstack(YYSTACKDATA *data)
387 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
391 if ((newsize = data->stacksize) == 0)
392 newsize = YYINITSTACKSIZE;
393 else if (newsize >= YYMAXDEPTH)
395 else if ((newsize *= 2) > YYMAXDEPTH)
396 newsize = YYMAXDEPTH;
398 i = (int) (data->s_mark - data->s_base);
399 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
403 data->s_base = newss;
404 data->s_mark = newss + i;
406 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
410 data->l_base = newvs;
411 data->l_mark = newvs + i;
413 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
414 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
418 data->p_base = newps;
419 data->p_mark = newps + i;
422 data->stacksize = newsize;
423 data->s_last = data->s_base + newsize - 1;
427 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
432 #if YYPURE || defined(YY_NO_LEAKS)
433 static void yyfreestack(YYSTACKDATA *data)
437 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
440 memset(data, 0, sizeof(*data));
443 #define yyfreestack(data) /* nothing */
444 #endif /* YYPURE || defined(YY_NO_LEAKS) */
447 static YYParseState *
448 yyNewState(unsigned size)
450 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
451 if (p == NULL) return NULL;
453 p->yystack.stacksize = size;
456 p->yystack.s_base = NULL;
457 p->yystack.l_base = NULL;
458 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
459 p->yystack.p_base = NULL;
463 p->yystack.s_base = (short *) malloc(size * sizeof(short));
464 if (p->yystack.s_base == NULL) return NULL;
465 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
466 if (p->yystack.l_base == NULL) return NULL;
467 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
468 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
469 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
470 if (p->yystack.p_base == NULL) return NULL;
471 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
478 yyFreeState(YYParseState *p)
480 yyfreestack(&p->yystack);
483 #endif /* YYBTYACC */
485 #define YYABORT goto yyabort
486 #define YYREJECT goto yyabort
487 #define YYACCEPT goto yyaccept
488 #define YYERROR goto yyerrlab
490 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
491 #define YYVALID_NESTED do { if (yyps->save && \
492 yyps->save->save == 0) goto yyvalid; } while(0)
493 #endif /* YYBTYACC */
498 int yym, yyn, yystate, yyresult;
501 YYParseState *yyerrctx = NULL;
502 #endif /* YYBTYACC */
503 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
504 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
509 if ((yys = getenv("YYDEBUG")) != 0)
512 if (yyn >= '0' && yyn <= '9')
516 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
520 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
522 #endif /* YYBTYACC */
529 memset(&yystack, 0, sizeof(yystack));
532 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
533 yystack.s_mark = yystack.s_base;
534 yystack.l_mark = yystack.l_base;
535 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
536 yystack.p_mark = yystack.p_base;
542 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
549 /* we're currently re-reading tokens */
551 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
559 /* in trial mode; save scanner results for future parse attempts */
560 if (yylvp == yylvlim)
561 { /* Enlarge lexical value queue */
562 int p = yylvp - yylvals;
563 int s = yylvlim - yylvals;
565 s += YYLVQUEUEGROWTH;
566 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
567 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
568 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
569 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
571 yylvp = yylve = yylvals + p;
572 yylvlim = yylvals + s;
573 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
574 yylpp = yylpe = yylpsns + p;
575 yylplim = yylpsns + s;
577 yylexp = yylexemes + p;
579 *yylexp = (short) YYLEX;
582 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
589 /* normal operation, no conflict encountered */
590 #endif /* YYBTYACC */
594 #endif /* YYBTYACC */
595 if (yychar < 0) yychar = YYEOF;
596 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
600 yys = yyname[YYTRANSLATE(yychar)];
601 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
602 YYDEBUGSTR, yydepth, yystate, yychar, yys);
603 #ifdef YYSTYPE_TOSTRING
606 #endif /* YYBTYACC */
607 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
615 /* Do we have a conflict? */
616 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
617 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
626 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
627 YYDEBUGSTR, yydepth, yystate);
629 /* Switch to the next conflict context */
634 if (save->state != yystate) YYABORT;
641 /* Unresolved conflict - start/continue trial parse */
646 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
648 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
650 fputs("Starting trial parse.\n", stderr);
653 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
654 if (save == NULL) goto yyenomem;
655 save->save = yyps->save;
656 save->state = yystate;
657 save->errflag = yyerrflag;
658 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
659 memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
660 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
661 memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
662 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
663 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
664 memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
667 if (yyctable[ctry] == -1)
670 if (yydebug && yychar >= YYEOF)
671 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
676 if (yyps->save == NULL)
678 /* If this is a first conflict in the stack, start saving lexemes */
681 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
682 if (yylexemes == NULL) goto yyenomem;
683 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
684 if (yylvals == NULL) goto yyenomem;
685 yylvlim = yylvals + YYLVQUEUEGROWTH;
686 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
687 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
688 if (yylpsns == NULL) goto yyenomem;
689 yylplim = yylpsns + YYLVQUEUEGROWTH;
694 yylvp = yylve = yylvals;
695 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
696 yylpp = yylpe = yylpsns;
702 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
705 *yylexp = (short) yychar;
713 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
719 save->lexeme = yylvp - yylvals;
722 if (yytable[yyn] == ctry)
726 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
727 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
732 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
737 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
739 yystate = yyctable[ctry];
740 *++yystack.s_mark = (short) yystate;
741 *++yystack.l_mark = yylval;
742 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
743 *++yystack.p_mark = yylloc;
746 if (yyerrflag > 0) --yyerrflag;
751 yyn = yyctable[ctry];
754 } /* End of code dealing with conflicts */
755 #endif /* YYBTYACC */
756 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
757 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
761 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
762 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
764 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
765 yystate = yytable[yyn];
766 *++yystack.s_mark = yytable[yyn];
767 *++yystack.l_mark = yylval;
768 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
769 *++yystack.p_mark = yylloc;
772 if (yyerrflag > 0) --yyerrflag;
775 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
776 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
781 if (yyerrflag != 0) goto yyinrecovery;
794 YYParseState *save = yyps->save;
797 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
798 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
799 (int)(yylvp - yylvals - yyps->save->lexeme));
801 /* Memorize most forward-looking error state in case it's really an error. */
802 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
804 /* Free old saved error context state */
805 if (yyerrctx) yyFreeState(yyerrctx);
806 /* Create and fill out new saved error context state */
807 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
808 if (yyerrctx == NULL) goto yyenomem;
809 yyerrctx->save = yyps->save;
810 yyerrctx->state = yystate;
811 yyerrctx->errflag = yyerrflag;
812 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
813 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
814 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
815 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
816 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
817 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
818 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
820 yyerrctx->lexeme = yylvp - yylvals;
822 yylvp = yylvals + save->lexeme;
823 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
824 yylpp = yylpsns + save->lexeme;
826 yylexp = yylexemes + save->lexeme;
828 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
829 memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
830 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
831 memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
832 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
833 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
834 memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
837 yystate = save->state;
838 /* We tried shift, try reduce now */
839 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
840 yyps->save = save->save;
844 /* Nothing left on the stack -- error */
849 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
852 /* Restore state as it was in the most forward-advanced error */
853 yylvp = yylvals + yyerrctx->lexeme;
854 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
855 yylpp = yylpsns + yyerrctx->lexeme;
857 yylexp = yylexemes + yyerrctx->lexeme;
860 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
863 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
864 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
865 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
866 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
867 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
868 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
869 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
871 yystate = yyerrctx->state;
872 yyFreeState(yyerrctx);
877 if (yynewerrflag == 0) goto yyinrecovery;
878 #endif /* YYBTYACC */
880 YYERROR_CALL("syntax error");
881 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
882 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
897 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
898 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
902 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
903 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
905 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
906 yystate = yytable[yyn];
907 *++yystack.s_mark = yytable[yyn];
908 *++yystack.l_mark = yylval;
909 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
910 /* lookahead position is error end position */
911 yyerror_loc_range[1] = yylloc;
912 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
913 *++yystack.p_mark = yyloc;
921 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
922 YYDEBUGSTR, yydepth, *yystack.s_mark);
924 if (yystack.s_mark <= yystack.s_base) goto yyabort;
925 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
926 /* the current TOS position is the error start position */
927 yyerror_loc_range[0] = *yystack.p_mark;
929 #if defined(YYDESTRUCT_CALL)
932 #endif /* YYBTYACC */
933 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
934 YYDESTRUCT_CALL("error: discarding state",
935 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
937 YYDESTRUCT_CALL("error: discarding state",
938 yystos[*yystack.s_mark], yystack.l_mark);
939 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
940 #endif /* defined(YYDESTRUCT_CALL) */
943 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
951 if (yychar == YYEOF) goto yyabort;
955 yys = yyname[YYTRANSLATE(yychar)];
956 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
957 YYDEBUGSTR, yydepth, yystate, yychar, yys);
960 #if defined(YYDESTRUCT_CALL)
963 #endif /* YYBTYACC */
964 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
965 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
967 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
968 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
969 #endif /* defined(YYDESTRUCT_CALL) */
979 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
980 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
981 #ifdef YYSTYPE_TOSTRING
984 #endif /* YYBTYACC */
989 for (i = yym; i > 0; i--)
991 if (i != yym) fputs(", ", stderr);
992 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
993 yystack.l_mark[1-i]), stderr);
1002 yyval = yystack.l_mark[1-yym];
1004 memset(&yyval, 0, sizeof yyval);
1005 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1007 /* Perform position reduction */
1008 memset(&yyloc, 0, sizeof(yyloc));
1011 #endif /* YYBTYACC */
1013 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1014 /* just in case YYERROR is invoked within the action, save
1015 the start of the rhs as the error start position */
1016 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1023 #line 12 "err_syntax20.y"
1024 { yystack.l_mark[-1].rechk = 3; }
1026 #line 1027 "err_syntax20.tab.c"
1030 yystack.s_mark -= yym;
1031 yystate = *yystack.s_mark;
1032 yystack.l_mark -= yym;
1033 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1034 yystack.p_mark -= yym;
1037 if (yystate == 0 && yym == 0)
1042 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1043 #ifdef YYSTYPE_TOSTRING
1046 #endif /* YYBTYACC */
1047 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1049 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1053 *++yystack.s_mark = YYFINAL;
1054 *++yystack.l_mark = yyval;
1055 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1056 *++yystack.p_mark = yyloc;
1064 /* we're currently re-reading tokens */
1066 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1074 /* in trial mode; save scanner results for future parse attempts */
1075 if (yylvp == yylvlim)
1076 { /* Enlarge lexical value queue */
1077 int p = yylvp - yylvals;
1078 int s = yylvlim - yylvals;
1080 s += YYLVQUEUEGROWTH;
1081 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1083 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1085 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1086 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1089 yylvp = yylve = yylvals + p;
1090 yylvlim = yylvals + s;
1091 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1092 yylpp = yylpe = yylpsns + p;
1093 yylplim = yylpsns + s;
1095 yylexp = yylexemes + p;
1097 *yylexp = (short) YYLEX;
1100 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1107 /* normal operation, no conflict encountered */
1108 #endif /* YYBTYACC */
1112 #endif /* YYBTYACC */
1113 if (yychar < 0) yychar = YYEOF;
1114 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1118 yys = yyname[YYTRANSLATE(yychar)];
1119 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1120 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1124 if (yychar == YYEOF) goto yyaccept;
1127 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1128 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1129 yystate = yytable[yyn];
1131 yystate = yydgoto[yym];
1135 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1136 #ifdef YYSTYPE_TOSTRING
1139 #endif /* YYBTYACC */
1140 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1142 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1145 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1146 *++yystack.s_mark = (short) yystate;
1147 *++yystack.l_mark = yyval;
1148 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1149 *++yystack.p_mark = yyloc;
1154 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1156 if (yypath) YYABORT;
1159 YYParseState *save = yyps->save;
1160 yyps->save = save->save;
1161 save->save = yypath;
1166 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1167 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1171 yyFreeState(yyerrctx);
1174 yylvp = yylvals + yypath->lexeme;
1175 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1176 yylpp = yylpsns + yypath->lexeme;
1178 yylexp = yylexemes + yypath->lexeme;
1180 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1181 memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1182 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1183 memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1184 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1185 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1186 memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1188 yystate = yypath->state;
1190 #endif /* YYBTYACC */
1193 YYERROR_CALL("yacc stack overflow");
1197 YYERROR_CALL("memory exhausted");
1199 #endif /* YYBTYACC */
1209 if (yyps->save) goto yyvalid;
1210 #endif /* YYBTYACC */
1214 #if defined(YYDESTRUCT_CALL)
1215 if (yychar != YYEOF && yychar != YYEMPTY)
1216 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1217 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1219 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1220 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1224 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1227 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1228 YYDESTRUCT_CALL("cleanup: discarding state",
1229 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1231 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1232 YYDESTRUCT_CALL("cleanup: discarding state",
1233 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1234 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1236 #endif /* defined(YYDESTRUCT_CALL) */
1241 yyFreeState(yyerrctx);
1246 YYParseState *save = yyps;
1253 YYParseState *save = yypath;
1254 yypath = save->save;
1258 #endif /* YYBTYACC */
1259 yyfreestack(&yystack);