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_syntax18_parse
25 #define yylex err_syntax18_lex
29 #define yyerror err_syntax18_error
33 #define yychar err_syntax18_char
37 #define yyval err_syntax18_val
41 #define yylval err_syntax18_lval
45 #define yydebug err_syntax18_debug
49 #define yynerrs err_syntax18_nerrs
53 #define yyerrflag err_syntax18_errflag
54 #endif /* yyerrflag */
57 #define yylhs err_syntax18_lhs
61 #define yylen err_syntax18_len
65 #define yydefred err_syntax18_defred
69 #define yystos err_syntax18_stos
73 #define yydgoto err_syntax18_dgoto
77 #define yysindex err_syntax18_sindex
81 #define yyrindex err_syntax18_rindex
85 #define yygindex err_syntax18_gindex
89 #define yytable err_syntax18_table
93 #define yycheck err_syntax18_check
97 #define yyname err_syntax18_name
101 #define yyrule err_syntax18_rule
107 #define yycindex err_syntax18_cindex
108 #endif /* yycindex */
111 #define yyctable err_syntax18_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "err_syntax18_"
120 #line 2 "err_syntax18.y"
122 static void yyerror(const char *);
123 #line 124 "err_syntax18.tab.c"
125 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
126 /* Default: YYSTYPE is the semantic value type. */
128 # define YYSTYPE_IS_DECLARED 1
131 /* compatibility with bison */
133 /* compatibility with FreeBSD */
134 # ifdef YYPARSE_PARAM_TYPE
135 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
137 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
140 # define YYPARSE_DECL() yyparse(void)
143 /* Parameters sent to lex. */
145 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
146 # define YYLEX yylex(YYLEX_PARAM)
148 # define YYLEX_DECL() yylex(void)
149 # define YYLEX yylex()
152 /* Parameters sent to yyerror. */
154 #define YYERROR_DECL() yyerror(const char *s)
157 #define YYERROR_CALL(msg) yyerror(msg)
160 extern int YYPARSE_DECL();
162 #define YYERRCODE 256
164 static const YYINT err_syntax18_lhs[] = { -1,
167 static const YYINT err_syntax18_len[] = { 2,
170 static const YYINT err_syntax18_defred[] = { 0,
173 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
174 static const YYINT err_syntax18_stos[] = { 0,
177 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
178 static const YYINT err_syntax18_dgoto[] = { 2,
180 static const YYINT err_syntax18_sindex[] = { -40,
183 static const YYINT err_syntax18_rindex[] = { 0,
187 static const YYINT err_syntax18_cindex[] = { 0,
191 static const YYINT err_syntax18_gindex[] = { 2,
193 #define YYTABLESIZE 3
194 static const YYINT err_syntax18_table[] = { 1,
197 static const YYINT err_syntax18_check[] = { 40,
201 static const YYINT err_syntax18_ctable[] = { -1,
209 #define YYMAXTOKEN 256
210 #define YYUNDFTOKEN 259
211 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
213 static const char *const err_syntax18_name[] = {
215 "$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,
216 0,0,0,"'('","')'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
217 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
218 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
219 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
220 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
221 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","expr",
224 static const char *const err_syntax18_rule[] = {
226 "expr : '(' expr ')'",
238 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
239 YYLTYPE yyloc; /* position returned by actions */
240 YYLTYPE yylloc; /* position from the lexer */
243 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
244 #ifndef YYLLOC_DEFAULT
245 #define YYLLOC_DEFAULT(loc, rhs, n) \
250 (loc).first_line = ((rhs)[-1]).last_line; \
251 (loc).first_column = ((rhs)[-1]).last_column; \
252 (loc).last_line = ((rhs)[-1]).last_line; \
253 (loc).last_column = ((rhs)[-1]).last_column; \
257 (loc).first_line = ((rhs)[ 0 ]).first_line; \
258 (loc).first_column = ((rhs)[ 0 ]).first_column; \
259 (loc).last_line = ((rhs)[n-1]).last_line; \
260 (loc).last_column = ((rhs)[n-1]).last_column; \
263 #endif /* YYLLOC_DEFAULT */
264 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
267 #ifndef YYLVQUEUEGROWTH
268 #define YYLVQUEUEGROWTH 32
270 #endif /* YYBTYACC */
272 /* define the initial stack-sizes */
275 #define YYMAXDEPTH YYSTACKSIZE
278 #define YYSTACKSIZE YYMAXDEPTH
280 #define YYSTACKSIZE 10000
281 #define YYMAXDEPTH 10000
285 #ifndef YYINITSTACKSIZE
286 #define YYINITSTACKSIZE 200
296 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
303 struct YYParseState_s
305 struct YYParseState_s *save; /* Previously saved parser state */
306 YYSTACKDATA yystack; /* saved parser stack */
307 int state; /* saved parser state */
308 int errflag; /* saved error recovery status */
309 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
310 YYINT ctry; /* saved index in yyctable[] for this conflict */
312 typedef struct YYParseState_s YYParseState;
313 #endif /* YYBTYACC */
314 /* variables for the parser stack */
315 static YYSTACKDATA yystack;
318 /* Current parser state */
319 static YYParseState *yyps = 0;
321 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
322 static YYParseState *yypath = 0;
324 /* Base of the lexical value queue */
325 static YYSTYPE *yylvals = 0;
327 /* Current position at lexical value queue */
328 static YYSTYPE *yylvp = 0;
330 /* End position of lexical value queue */
331 static YYSTYPE *yylve = 0;
333 /* The last allocated position at the lexical value queue */
334 static YYSTYPE *yylvlim = 0;
336 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
337 /* Base of the lexical position queue */
338 static YYLTYPE *yylpsns = 0;
340 /* Current position at lexical position queue */
341 static YYLTYPE *yylpp = 0;
343 /* End position of lexical position queue */
344 static YYLTYPE *yylpe = 0;
346 /* The last allocated position at the lexical position queue */
347 static YYLTYPE *yylplim = 0;
350 /* Current position at lexical token queue */
351 static YYINT *yylexp = 0;
353 static YYINT *yylexemes = 0;
354 #endif /* YYBTYACC */
355 #line 13 "err_syntax18.y"
362 printf("yyparse() = %d\n", yyparse());
373 yyerror(const char* s)
377 #line 378 "err_syntax18.tab.c"
379 /* For use in generated program */
380 #define yydepth (int)(yystack.s_mark - yystack.s_base)
382 #define yytrial (yyps->save)
383 #endif /* YYBTYACC */
386 #include <stdio.h> /* needed for printf */
389 #include <stdlib.h> /* needed for malloc, etc */
390 #include <string.h> /* needed for memset */
392 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
393 static int yygrowstack(YYSTACKDATA *data)
399 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
403 if ((newsize = data->stacksize) == 0)
404 newsize = YYINITSTACKSIZE;
405 else if (newsize >= YYMAXDEPTH)
407 else if ((newsize *= 2) > YYMAXDEPTH)
408 newsize = YYMAXDEPTH;
410 i = (int) (data->s_mark - data->s_base);
411 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
415 data->s_base = newss;
416 data->s_mark = newss + i;
418 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
422 data->l_base = newvs;
423 data->l_mark = newvs + i;
425 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
426 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
430 data->p_base = newps;
431 data->p_mark = newps + i;
434 data->stacksize = newsize;
435 data->s_last = data->s_base + newsize - 1;
439 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
444 #if YYPURE || defined(YY_NO_LEAKS)
445 static void yyfreestack(YYSTACKDATA *data)
449 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
452 memset(data, 0, sizeof(*data));
455 #define yyfreestack(data) /* nothing */
456 #endif /* YYPURE || defined(YY_NO_LEAKS) */
459 static YYParseState *
460 yyNewState(unsigned size)
462 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
463 if (p == NULL) return NULL;
465 p->yystack.stacksize = size;
468 p->yystack.s_base = NULL;
469 p->yystack.l_base = NULL;
470 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
471 p->yystack.p_base = NULL;
475 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
476 if (p->yystack.s_base == NULL) return NULL;
477 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
478 if (p->yystack.l_base == NULL) return NULL;
479 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
480 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
481 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
482 if (p->yystack.p_base == NULL) return NULL;
483 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
490 yyFreeState(YYParseState *p)
492 yyfreestack(&p->yystack);
495 #endif /* YYBTYACC */
497 #define YYABORT goto yyabort
498 #define YYREJECT goto yyabort
499 #define YYACCEPT goto yyaccept
500 #define YYERROR goto yyerrlab
502 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
503 #define YYVALID_NESTED do { if (yyps->save && \
504 yyps->save->save == 0) goto yyvalid; } while(0)
505 #endif /* YYBTYACC */
510 int yym, yyn, yystate, yyresult;
513 YYParseState *yyerrctx = NULL;
514 #endif /* YYBTYACC */
515 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
516 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
521 if ((yys = getenv("YYDEBUG")) != 0)
524 if (yyn >= '0' && yyn <= '9')
528 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
530 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
531 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
535 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
537 #endif /* YYBTYACC */
546 memset(&yystack, 0, sizeof(yystack));
549 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
550 yystack.s_mark = yystack.s_base;
551 yystack.l_mark = yystack.l_base;
552 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
553 yystack.p_mark = yystack.p_base;
559 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
566 /* we're currently re-reading tokens */
568 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
576 /* in trial mode; save scanner results for future parse attempts */
577 if (yylvp == yylvlim)
578 { /* Enlarge lexical value queue */
579 size_t p = (size_t) (yylvp - yylvals);
580 size_t s = (size_t) (yylvlim - yylvals);
582 s += YYLVQUEUEGROWTH;
583 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
584 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
585 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
586 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
588 yylvp = yylve = yylvals + p;
589 yylvlim = yylvals + s;
590 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
591 yylpp = yylpe = yylpsns + p;
592 yylplim = yylpsns + s;
594 yylexp = yylexemes + p;
596 *yylexp = (YYINT) YYLEX;
599 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
606 /* normal operation, no conflict encountered */
607 #endif /* YYBTYACC */
611 #endif /* YYBTYACC */
612 if (yychar < 0) yychar = YYEOF;
616 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
617 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
618 YYDEBUGSTR, yydepth, yystate, yychar, yys);
619 #ifdef YYSTYPE_TOSTRING
622 #endif /* YYBTYACC */
623 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
631 /* Do we have a conflict? */
632 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
633 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
642 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
643 YYDEBUGSTR, yydepth, yystate);
645 /* Switch to the next conflict context */
650 if (save->state != yystate) YYABORT;
657 /* Unresolved conflict - start/continue trial parse */
662 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
664 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
666 fputs("Starting trial parse.\n", stderr);
669 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
670 if (save == NULL) goto yyenomem;
671 save->save = yyps->save;
672 save->state = yystate;
673 save->errflag = yyerrflag;
674 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
675 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
676 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
677 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
678 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
679 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
680 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
683 if (yyctable[ctry] == -1)
686 if (yydebug && yychar >= YYEOF)
687 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
692 if (yyps->save == NULL)
694 /* If this is a first conflict in the stack, start saving lexemes */
697 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
698 if (yylexemes == NULL) goto yyenomem;
699 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
700 if (yylvals == NULL) goto yyenomem;
701 yylvlim = yylvals + YYLVQUEUEGROWTH;
702 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
703 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
704 if (yylpsns == NULL) goto yyenomem;
705 yylplim = yylpsns + YYLVQUEUEGROWTH;
710 yylvp = yylve = yylvals;
711 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
712 yylpp = yylpe = yylpsns;
718 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
721 *yylexp = (YYINT) yychar;
729 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
735 save->lexeme = (int) (yylvp - yylvals);
738 if (yytable[yyn] == ctry)
742 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
743 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
748 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
753 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
755 yystate = yyctable[ctry];
756 *++yystack.s_mark = (YYINT) yystate;
757 *++yystack.l_mark = yylval;
758 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
759 *++yystack.p_mark = yylloc;
762 if (yyerrflag > 0) --yyerrflag;
767 yyn = yyctable[ctry];
770 } /* End of code dealing with conflicts */
771 #endif /* YYBTYACC */
772 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
773 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
777 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
778 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
780 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
781 yystate = yytable[yyn];
782 *++yystack.s_mark = yytable[yyn];
783 *++yystack.l_mark = yylval;
784 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
785 *++yystack.p_mark = yylloc;
788 if (yyerrflag > 0) --yyerrflag;
791 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
792 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
797 if (yyerrflag != 0) goto yyinrecovery;
802 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
805 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
806 * before looking for error recovery */
807 yystack.s_mark -= yym;
808 yystate = *yystack.s_mark;
809 yystack.l_mark -= yym;
810 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
811 yystack.p_mark -= yym;
819 YYParseState *save = yyps->save;
822 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
823 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
824 (int)(yylvp - yylvals - yyps->save->lexeme));
826 /* Memorize most forward-looking error state in case it's really an error. */
827 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
829 /* Free old saved error context state */
830 if (yyerrctx) yyFreeState(yyerrctx);
831 /* Create and fill out new saved error context state */
832 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
833 if (yyerrctx == NULL) goto yyenomem;
834 yyerrctx->save = yyps->save;
835 yyerrctx->state = yystate;
836 yyerrctx->errflag = yyerrflag;
837 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
838 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
839 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
840 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
841 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
842 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
843 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
845 yyerrctx->lexeme = (int) (yylvp - yylvals);
847 yylvp = yylvals + save->lexeme;
848 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
849 yylpp = yylpsns + save->lexeme;
851 yylexp = yylexemes + save->lexeme;
853 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
854 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
855 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
856 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
857 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
858 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
859 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
862 yystate = save->state;
863 /* We tried shift, try reduce now */
864 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
865 yyps->save = save->save;
869 /* Nothing left on the stack -- error */
874 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
877 /* Restore state as it was in the most forward-advanced error */
878 yylvp = yylvals + yyerrctx->lexeme;
879 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
880 yylpp = yylpsns + yyerrctx->lexeme;
882 yylexp = yylexemes + yyerrctx->lexeme;
885 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
888 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
889 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
890 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
891 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
892 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
893 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
894 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
896 yystate = yyerrctx->state;
897 yyFreeState(yyerrctx);
902 if (yynewerrflag == 0) goto yyinrecovery;
903 #endif /* YYBTYACC */
905 YYERROR_CALL("syntax error");
906 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
907 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
911 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
922 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
923 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
927 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
928 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
930 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
931 yystate = yytable[yyn];
932 *++yystack.s_mark = yytable[yyn];
933 *++yystack.l_mark = yylval;
934 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
935 /* lookahead position is error end position */
936 yyerror_loc_range[1] = yylloc;
937 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
938 *++yystack.p_mark = yyloc;
946 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
947 YYDEBUGSTR, yydepth, *yystack.s_mark);
949 if (yystack.s_mark <= yystack.s_base) goto yyabort;
950 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
951 /* the current TOS position is the error start position */
952 yyerror_loc_range[0] = *yystack.p_mark;
954 #if defined(YYDESTRUCT_CALL)
957 #endif /* YYBTYACC */
958 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
959 YYDESTRUCT_CALL("error: discarding state",
960 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
962 YYDESTRUCT_CALL("error: discarding state",
963 yystos[*yystack.s_mark], yystack.l_mark);
964 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
965 #endif /* defined(YYDESTRUCT_CALL) */
968 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
976 if (yychar == YYEOF) goto yyabort;
980 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
981 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
982 YYDEBUGSTR, yydepth, yystate, yychar, yys);
985 #if defined(YYDESTRUCT_CALL)
988 #endif /* YYBTYACC */
989 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
990 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
992 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
993 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
994 #endif /* defined(YYDESTRUCT_CALL) */
1004 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1005 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1006 #ifdef YYSTYPE_TOSTRING
1009 #endif /* YYBTYACC */
1014 for (i = yym; i > 0; i--)
1016 if (i != yym) fputs(", ", stderr);
1017 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1018 yystack.l_mark[1-i]), stderr);
1023 fputc('\n', stderr);
1027 yyval = yystack.l_mark[1-yym];
1029 memset(&yyval, 0, sizeof yyval);
1030 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1032 /* Perform position reduction */
1033 memset(&yyloc, 0, sizeof(yyloc));
1036 #endif /* YYBTYACC */
1038 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1039 /* just in case YYERROR is invoked within the action, save
1040 the start of the rhs as the error start position */
1041 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1048 #line 9 "err_syntax18.y"
1049 { yyval = yystack.l_mark[1]; }
1051 #line 1052 "err_syntax18.tab.c"
1055 yystack.s_mark -= yym;
1056 yystate = *yystack.s_mark;
1057 yystack.l_mark -= yym;
1058 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1059 yystack.p_mark -= yym;
1062 if (yystate == 0 && yym == 0)
1067 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1068 #ifdef YYSTYPE_TOSTRING
1071 #endif /* YYBTYACC */
1072 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1074 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1078 *++yystack.s_mark = YYFINAL;
1079 *++yystack.l_mark = yyval;
1080 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1081 *++yystack.p_mark = yyloc;
1089 /* we're currently re-reading tokens */
1091 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1099 /* in trial mode; save scanner results for future parse attempts */
1100 if (yylvp == yylvlim)
1101 { /* Enlarge lexical value queue */
1102 size_t p = (size_t) (yylvp - yylvals);
1103 size_t s = (size_t) (yylvlim - yylvals);
1105 s += YYLVQUEUEGROWTH;
1106 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1108 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1110 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1111 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1114 yylvp = yylve = yylvals + p;
1115 yylvlim = yylvals + s;
1116 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1117 yylpp = yylpe = yylpsns + p;
1118 yylplim = yylpsns + s;
1120 yylexp = yylexemes + p;
1122 *yylexp = (YYINT) YYLEX;
1125 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1132 /* normal operation, no conflict encountered */
1133 #endif /* YYBTYACC */
1137 #endif /* YYBTYACC */
1138 if (yychar < 0) yychar = YYEOF;
1142 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1143 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1144 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1148 if (yychar == YYEOF) goto yyaccept;
1151 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1152 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1153 yystate = yytable[yyn];
1155 yystate = yydgoto[yym];
1159 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1160 #ifdef YYSTYPE_TOSTRING
1163 #endif /* YYBTYACC */
1164 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1166 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1169 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1170 *++yystack.s_mark = (YYINT) yystate;
1171 *++yystack.l_mark = yyval;
1172 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1173 *++yystack.p_mark = yyloc;
1178 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1180 if (yypath) YYABORT;
1183 YYParseState *save = yyps->save;
1184 yyps->save = save->save;
1185 save->save = yypath;
1190 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1191 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1195 yyFreeState(yyerrctx);
1198 yylvp = yylvals + yypath->lexeme;
1199 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1200 yylpp = yylpsns + yypath->lexeme;
1202 yylexp = yylexemes + yypath->lexeme;
1204 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1205 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1206 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1207 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1208 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1209 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1210 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1212 yystate = yypath->state;
1214 #endif /* YYBTYACC */
1217 YYERROR_CALL("yacc stack overflow");
1221 YYERROR_CALL("memory exhausted");
1223 #endif /* YYBTYACC */
1233 if (yyps->save) goto yyvalid;
1234 #endif /* YYBTYACC */
1238 #if defined(YYDESTRUCT_CALL)
1239 if (yychar != YYEOF && yychar != YYEMPTY)
1240 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1241 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1243 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1244 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1248 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1251 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1252 YYDESTRUCT_CALL("cleanup: discarding state",
1253 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1255 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1256 YYDESTRUCT_CALL("cleanup: discarding state",
1257 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1258 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1260 #endif /* defined(YYDESTRUCT_CALL) */
1265 yyFreeState(yyerrctx);
1270 YYParseState *save = yyps;
1277 YYParseState *save = yypath;
1278 yypath = save->save;
1282 #endif /* YYBTYACC */
1283 yyfreestack(&yystack);