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 ')'",
241 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
242 YYLTYPE yyloc; /* position returned by actions */
243 YYLTYPE yylloc; /* position from the lexer */
246 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
247 #ifndef YYLLOC_DEFAULT
248 #define YYLLOC_DEFAULT(loc, rhs, n) \
253 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
254 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
255 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
256 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
260 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
261 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
262 (loc).last_line = YYRHSLOC(rhs, n).last_line; \
263 (loc).last_column = YYRHSLOC(rhs, n).last_column; \
266 #endif /* YYLLOC_DEFAULT */
267 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
270 #ifndef YYLVQUEUEGROWTH
271 #define YYLVQUEUEGROWTH 32
273 #endif /* YYBTYACC */
275 /* define the initial stack-sizes */
278 #define YYMAXDEPTH YYSTACKSIZE
281 #define YYSTACKSIZE YYMAXDEPTH
283 #define YYSTACKSIZE 10000
284 #define YYMAXDEPTH 10000
288 #ifndef YYINITSTACKSIZE
289 #define YYINITSTACKSIZE 200
299 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
306 struct YYParseState_s
308 struct YYParseState_s *save; /* Previously saved parser state */
309 YYSTACKDATA yystack; /* saved parser stack */
310 int state; /* saved parser state */
311 int errflag; /* saved error recovery status */
312 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
313 YYINT ctry; /* saved index in yyctable[] for this conflict */
315 typedef struct YYParseState_s YYParseState;
316 #endif /* YYBTYACC */
317 /* variables for the parser stack */
318 static YYSTACKDATA yystack;
321 /* Current parser state */
322 static YYParseState *yyps = 0;
324 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
325 static YYParseState *yypath = 0;
327 /* Base of the lexical value queue */
328 static YYSTYPE *yylvals = 0;
330 /* Current position at lexical value queue */
331 static YYSTYPE *yylvp = 0;
333 /* End position of lexical value queue */
334 static YYSTYPE *yylve = 0;
336 /* The last allocated position at the lexical value queue */
337 static YYSTYPE *yylvlim = 0;
339 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
340 /* Base of the lexical position queue */
341 static YYLTYPE *yylpsns = 0;
343 /* Current position at lexical position queue */
344 static YYLTYPE *yylpp = 0;
346 /* End position of lexical position queue */
347 static YYLTYPE *yylpe = 0;
349 /* The last allocated position at the lexical position queue */
350 static YYLTYPE *yylplim = 0;
353 /* Current position at lexical token queue */
354 static YYINT *yylexp = 0;
356 static YYINT *yylexemes = 0;
357 #endif /* YYBTYACC */
358 #line 13 "err_syntax18.y"
365 printf("yyparse() = %d\n", yyparse());
376 yyerror(const char* s)
380 #line 381 "err_syntax18.tab.c"
382 /* For use in generated program */
383 #define yydepth (int)(yystack.s_mark - yystack.s_base)
385 #define yytrial (yyps->save)
386 #endif /* YYBTYACC */
389 #include <stdio.h> /* needed for printf */
392 #include <stdlib.h> /* needed for malloc, etc */
393 #include <string.h> /* needed for memset */
395 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
396 static int yygrowstack(YYSTACKDATA *data)
402 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
406 if ((newsize = data->stacksize) == 0)
407 newsize = YYINITSTACKSIZE;
408 else if (newsize >= YYMAXDEPTH)
410 else if ((newsize *= 2) > YYMAXDEPTH)
411 newsize = YYMAXDEPTH;
413 i = (int) (data->s_mark - data->s_base);
414 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
418 data->s_base = newss;
419 data->s_mark = newss + i;
421 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
425 data->l_base = newvs;
426 data->l_mark = newvs + i;
428 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
429 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
433 data->p_base = newps;
434 data->p_mark = newps + i;
437 data->stacksize = newsize;
438 data->s_last = data->s_base + newsize - 1;
442 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
447 #if YYPURE || defined(YY_NO_LEAKS)
448 static void yyfreestack(YYSTACKDATA *data)
452 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
455 memset(data, 0, sizeof(*data));
458 #define yyfreestack(data) /* nothing */
459 #endif /* YYPURE || defined(YY_NO_LEAKS) */
462 static YYParseState *
463 yyNewState(unsigned size)
465 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
466 if (p == NULL) return NULL;
468 p->yystack.stacksize = size;
471 p->yystack.s_base = NULL;
472 p->yystack.l_base = NULL;
473 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
474 p->yystack.p_base = NULL;
478 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
479 if (p->yystack.s_base == NULL) return NULL;
480 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
481 if (p->yystack.l_base == NULL) return NULL;
482 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
483 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
484 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
485 if (p->yystack.p_base == NULL) return NULL;
486 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
493 yyFreeState(YYParseState *p)
495 yyfreestack(&p->yystack);
498 #endif /* YYBTYACC */
500 #define YYABORT goto yyabort
501 #define YYREJECT goto yyabort
502 #define YYACCEPT goto yyaccept
503 #define YYERROR goto yyerrlab
505 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
506 #define YYVALID_NESTED do { if (yyps->save && \
507 yyps->save->save == 0) goto yyvalid; } while(0)
508 #endif /* YYBTYACC */
513 int yym, yyn, yystate, yyresult;
516 YYParseState *yyerrctx = NULL;
517 #endif /* YYBTYACC */
518 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
519 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
524 if ((yys = getenv("YYDEBUG")) != 0)
527 if (yyn >= '0' && yyn <= '9')
531 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
533 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
534 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
538 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
540 #endif /* YYBTYACC */
549 memset(&yystack, 0, sizeof(yystack));
552 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
553 yystack.s_mark = yystack.s_base;
554 yystack.l_mark = yystack.l_base;
555 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
556 yystack.p_mark = yystack.p_base;
562 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
569 /* we're currently re-reading tokens */
571 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
579 /* in trial mode; save scanner results for future parse attempts */
580 if (yylvp == yylvlim)
581 { /* Enlarge lexical value queue */
582 size_t p = (size_t) (yylvp - yylvals);
583 size_t s = (size_t) (yylvlim - yylvals);
585 s += YYLVQUEUEGROWTH;
586 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
587 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
588 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
589 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
591 yylvp = yylve = yylvals + p;
592 yylvlim = yylvals + s;
593 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
594 yylpp = yylpe = yylpsns + p;
595 yylplim = yylpsns + s;
597 yylexp = yylexemes + p;
599 *yylexp = (YYINT) YYLEX;
602 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
609 /* normal operation, no conflict encountered */
610 #endif /* YYBTYACC */
614 #endif /* YYBTYACC */
615 if (yychar < 0) yychar = YYEOF;
619 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
620 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
621 YYDEBUGSTR, yydepth, yystate, yychar, yys);
622 #ifdef YYSTYPE_TOSTRING
625 #endif /* YYBTYACC */
626 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
634 /* Do we have a conflict? */
635 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
636 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
645 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
646 YYDEBUGSTR, yydepth, yystate);
648 /* Switch to the next conflict context */
653 if (save->state != yystate) YYABORT;
660 /* Unresolved conflict - start/continue trial parse */
665 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
667 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
669 fputs("Starting trial parse.\n", stderr);
672 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
673 if (save == NULL) goto yyenomem;
674 save->save = yyps->save;
675 save->state = yystate;
676 save->errflag = yyerrflag;
677 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
678 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
679 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
680 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
681 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
682 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
683 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
686 if (yyctable[ctry] == -1)
689 if (yydebug && yychar >= YYEOF)
690 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
695 if (yyps->save == NULL)
697 /* If this is a first conflict in the stack, start saving lexemes */
700 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
701 if (yylexemes == NULL) goto yyenomem;
702 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
703 if (yylvals == NULL) goto yyenomem;
704 yylvlim = yylvals + YYLVQUEUEGROWTH;
705 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
706 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
707 if (yylpsns == NULL) goto yyenomem;
708 yylplim = yylpsns + YYLVQUEUEGROWTH;
713 yylvp = yylve = yylvals;
714 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
715 yylpp = yylpe = yylpsns;
721 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
724 *yylexp = (YYINT) yychar;
732 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
738 save->lexeme = (int) (yylvp - yylvals);
741 if (yytable[yyn] == ctry)
745 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
746 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
751 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
756 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
758 yystate = yyctable[ctry];
759 *++yystack.s_mark = (YYINT) yystate;
760 *++yystack.l_mark = yylval;
761 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
762 *++yystack.p_mark = yylloc;
765 if (yyerrflag > 0) --yyerrflag;
770 yyn = yyctable[ctry];
773 } /* End of code dealing with conflicts */
774 #endif /* YYBTYACC */
775 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
776 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
780 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
781 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
783 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
784 yystate = yytable[yyn];
785 *++yystack.s_mark = yytable[yyn];
786 *++yystack.l_mark = yylval;
787 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
788 *++yystack.p_mark = yylloc;
791 if (yyerrflag > 0) --yyerrflag;
794 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
795 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
800 if (yyerrflag != 0) goto yyinrecovery;
805 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
808 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
809 * before looking for error recovery */
810 yystack.s_mark -= yym;
811 yystate = *yystack.s_mark;
812 yystack.l_mark -= yym;
813 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
814 yystack.p_mark -= yym;
822 YYParseState *save = yyps->save;
825 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
826 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
827 (int)(yylvp - yylvals - yyps->save->lexeme));
829 /* Memorize most forward-looking error state in case it's really an error. */
830 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
832 /* Free old saved error context state */
833 if (yyerrctx) yyFreeState(yyerrctx);
834 /* Create and fill out new saved error context state */
835 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
836 if (yyerrctx == NULL) goto yyenomem;
837 yyerrctx->save = yyps->save;
838 yyerrctx->state = yystate;
839 yyerrctx->errflag = yyerrflag;
840 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
841 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
842 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
843 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
844 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
845 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
846 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
848 yyerrctx->lexeme = (int) (yylvp - yylvals);
850 yylvp = yylvals + save->lexeme;
851 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
852 yylpp = yylpsns + save->lexeme;
854 yylexp = yylexemes + save->lexeme;
856 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
857 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
858 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
859 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
860 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
861 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
862 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
865 yystate = save->state;
866 /* We tried shift, try reduce now */
867 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
868 yyps->save = save->save;
872 /* Nothing left on the stack -- error */
877 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
880 /* Restore state as it was in the most forward-advanced error */
881 yylvp = yylvals + yyerrctx->lexeme;
882 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
883 yylpp = yylpsns + yyerrctx->lexeme;
885 yylexp = yylexemes + yyerrctx->lexeme;
888 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
891 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
892 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
893 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
894 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
895 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
896 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
897 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
899 yystate = yyerrctx->state;
900 yyFreeState(yyerrctx);
905 if (yynewerrflag == 0) goto yyinrecovery;
906 #endif /* YYBTYACC */
908 YYERROR_CALL("syntax error");
909 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
910 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
914 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
925 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
926 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
930 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
931 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
933 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
934 yystate = yytable[yyn];
935 *++yystack.s_mark = yytable[yyn];
936 *++yystack.l_mark = yylval;
937 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
938 /* lookahead position is error end position */
939 yyerror_loc_range[2] = yylloc;
940 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
941 *++yystack.p_mark = yyloc;
949 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
950 YYDEBUGSTR, yydepth, *yystack.s_mark);
952 if (yystack.s_mark <= yystack.s_base) goto yyabort;
953 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
954 /* the current TOS position is the error start position */
955 yyerror_loc_range[1] = *yystack.p_mark;
957 #if defined(YYDESTRUCT_CALL)
960 #endif /* YYBTYACC */
961 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
962 YYDESTRUCT_CALL("error: discarding state",
963 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
965 YYDESTRUCT_CALL("error: discarding state",
966 yystos[*yystack.s_mark], yystack.l_mark);
967 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
968 #endif /* defined(YYDESTRUCT_CALL) */
971 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
979 if (yychar == YYEOF) goto yyabort;
983 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
984 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
985 YYDEBUGSTR, yydepth, yystate, yychar, yys);
988 #if defined(YYDESTRUCT_CALL)
991 #endif /* YYBTYACC */
992 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
993 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
995 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
996 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
997 #endif /* defined(YYDESTRUCT_CALL) */
1007 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1008 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1009 #ifdef YYSTYPE_TOSTRING
1012 #endif /* YYBTYACC */
1017 for (i = yym; i > 0; i--)
1019 if (i != yym) fputs(", ", stderr);
1020 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1021 yystack.l_mark[1-i]), stderr);
1026 fputc('\n', stderr);
1030 yyval = yystack.l_mark[1-yym];
1032 memset(&yyval, 0, sizeof yyval);
1033 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1035 /* Perform position reduction */
1036 memset(&yyloc, 0, sizeof(yyloc));
1039 #endif /* YYBTYACC */
1041 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
1042 /* just in case YYERROR is invoked within the action, save
1043 the start of the rhs as the error start position */
1044 yyerror_loc_range[1] = yystack.p_mark[1-yym];
1051 #line 9 "err_syntax18.y"
1052 { yyval = yystack.l_mark[1]; }
1054 #line 1055 "err_syntax18.tab.c"
1058 yystack.s_mark -= yym;
1059 yystate = *yystack.s_mark;
1060 yystack.l_mark -= yym;
1061 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1062 yystack.p_mark -= yym;
1065 if (yystate == 0 && yym == 0)
1070 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1071 #ifdef YYSTYPE_TOSTRING
1074 #endif /* YYBTYACC */
1075 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1077 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1081 *++yystack.s_mark = YYFINAL;
1082 *++yystack.l_mark = yyval;
1083 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1084 *++yystack.p_mark = yyloc;
1092 /* we're currently re-reading tokens */
1094 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1102 /* in trial mode; save scanner results for future parse attempts */
1103 if (yylvp == yylvlim)
1104 { /* Enlarge lexical value queue */
1105 size_t p = (size_t) (yylvp - yylvals);
1106 size_t s = (size_t) (yylvlim - yylvals);
1108 s += YYLVQUEUEGROWTH;
1109 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1111 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1113 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1114 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1117 yylvp = yylve = yylvals + p;
1118 yylvlim = yylvals + s;
1119 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1120 yylpp = yylpe = yylpsns + p;
1121 yylplim = yylpsns + s;
1123 yylexp = yylexemes + p;
1125 *yylexp = (YYINT) YYLEX;
1128 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1135 /* normal operation, no conflict encountered */
1136 #endif /* YYBTYACC */
1140 #endif /* YYBTYACC */
1141 if (yychar < 0) yychar = YYEOF;
1145 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1146 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1147 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1151 if (yychar == YYEOF) goto yyaccept;
1154 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1155 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1156 yystate = yytable[yyn];
1158 yystate = yydgoto[yym];
1162 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1163 #ifdef YYSTYPE_TOSTRING
1166 #endif /* YYBTYACC */
1167 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1169 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1172 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1173 *++yystack.s_mark = (YYINT) yystate;
1174 *++yystack.l_mark = yyval;
1175 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1176 *++yystack.p_mark = yyloc;
1181 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1183 if (yypath) YYABORT;
1186 YYParseState *save = yyps->save;
1187 yyps->save = save->save;
1188 save->save = yypath;
1193 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1194 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1198 yyFreeState(yyerrctx);
1201 yylvp = yylvals + yypath->lexeme;
1202 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1203 yylpp = yylpsns + yypath->lexeme;
1205 yylexp = yylexemes + yypath->lexeme;
1207 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1208 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1209 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1210 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1211 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1212 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1213 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1215 yystate = yypath->state;
1217 #endif /* YYBTYACC */
1220 YYERROR_CALL("yacc stack overflow");
1224 YYERROR_CALL("memory exhausted");
1226 #endif /* YYBTYACC */
1236 if (yyps->save) goto yyvalid;
1237 #endif /* YYBTYACC */
1241 #if defined(YYDESTRUCT_CALL)
1242 if (yychar != YYEOF && yychar != YYEMPTY)
1243 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1244 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1246 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1247 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1251 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1254 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1255 YYDESTRUCT_CALL("cleanup: discarding state",
1256 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1258 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1259 YYDESTRUCT_CALL("cleanup: discarding state",
1260 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1261 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1263 #endif /* defined(YYDESTRUCT_CALL) */
1268 yyFreeState(yyerrctx);
1273 YYParseState *save = yyps;
1280 YYParseState *save = yypath;
1281 yypath = save->save;
1285 #endif /* YYBTYACC */
1286 yyfreestack(&yystack);