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_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 static const YYINT err_syntax18_stos[] = { 0,
176 static const YYINT err_syntax18_dgoto[] = { 2,
178 static const YYINT err_syntax18_sindex[] = { -40,
181 static const YYINT err_syntax18_rindex[] = { 0,
185 static const YYINT err_syntax18_cindex[] = { 0,
189 static const YYINT err_syntax18_gindex[] = { 2,
191 #define YYTABLESIZE 3
192 static const YYINT err_syntax18_table[] = { 1,
195 static const YYINT err_syntax18_check[] = { 40,
199 static const YYINT err_syntax18_ctable[] = { -1,
207 #define YYMAXTOKEN 256
208 #define YYUNDFTOKEN 259
209 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
211 static const char *const err_syntax18_name[] = {
213 "$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,
214 0,0,0,"'('","')'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
215 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
216 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,"error","$accept","expr",
222 static const char *const err_syntax18_rule[] = {
224 "expr : '(' expr ')'",
236 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
237 YYLTYPE yyloc; /* position returned by actions */
238 YYLTYPE yylloc; /* position from the lexer */
241 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
242 #ifndef YYLLOC_DEFAULT
243 #define YYLLOC_DEFAULT(loc, rhs, n) \
248 (loc).first_line = ((rhs)[-1]).last_line; \
249 (loc).first_column = ((rhs)[-1]).last_column; \
250 (loc).last_line = ((rhs)[-1]).last_line; \
251 (loc).last_column = ((rhs)[-1]).last_column; \
255 (loc).first_line = ((rhs)[ 0 ]).first_line; \
256 (loc).first_column = ((rhs)[ 0 ]).first_column; \
257 (loc).last_line = ((rhs)[n-1]).last_line; \
258 (loc).last_column = ((rhs)[n-1]).last_column; \
261 #endif /* YYLLOC_DEFAULT */
262 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
265 #ifndef YYLVQUEUEGROWTH
266 #define YYLVQUEUEGROWTH 32
268 #endif /* YYBTYACC */
270 /* define the initial stack-sizes */
273 #define YYMAXDEPTH YYSTACKSIZE
276 #define YYSTACKSIZE YYMAXDEPTH
278 #define YYSTACKSIZE 10000
279 #define YYMAXDEPTH 10000
283 #ifndef YYINITSTACKSIZE
284 #define YYINITSTACKSIZE 200
294 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
301 struct YYParseState_s
303 struct YYParseState_s *save; /* Previously saved parser state */
304 YYSTACKDATA yystack; /* saved parser stack */
305 int state; /* saved parser state */
306 int errflag; /* saved error recovery status */
307 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
308 YYINT ctry; /* saved index in yyctable[] for this conflict */
310 typedef struct YYParseState_s YYParseState;
311 #endif /* YYBTYACC */
312 /* variables for the parser stack */
313 static YYSTACKDATA yystack;
316 /* Current parser state */
317 static YYParseState *yyps = 0;
319 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
320 static YYParseState *yypath = 0;
322 /* Base of the lexical value queue */
323 static YYSTYPE *yylvals = 0;
325 /* Current position at lexical value queue */
326 static YYSTYPE *yylvp = 0;
328 /* End position of lexical value queue */
329 static YYSTYPE *yylve = 0;
331 /* The last allocated position at the lexical value queue */
332 static YYSTYPE *yylvlim = 0;
334 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
335 /* Base of the lexical position queue */
336 static YYLTYPE *yylpsns = 0;
338 /* Current position at lexical position queue */
339 static YYLTYPE *yylpp = 0;
341 /* End position of lexical position queue */
342 static YYLTYPE *yylpe = 0;
344 /* The last allocated position at the lexical position queue */
345 static YYLTYPE *yylplim = 0;
348 /* Current position at lexical token queue */
349 static short *yylexp = 0;
351 static short *yylexemes = 0;
352 #endif /* YYBTYACC */
353 #line 13 "err_syntax18.y"
360 printf("yyparse() = %d\n", yyparse());
371 yyerror(const char* s)
375 #line 376 "err_syntax18.tab.c"
377 /* For use in generated program */
378 #define yydepth (int)(yystack.s_mark - yystack.s_base)
380 #define yytrial (yyps->save)
381 #endif /* YYBTYACC */
384 #include <stdio.h> /* needed for printf */
387 #include <stdlib.h> /* needed for malloc, etc */
388 #include <string.h> /* needed for memset */
390 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
391 static int yygrowstack(YYSTACKDATA *data)
397 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
401 if ((newsize = data->stacksize) == 0)
402 newsize = YYINITSTACKSIZE;
403 else if (newsize >= YYMAXDEPTH)
405 else if ((newsize *= 2) > YYMAXDEPTH)
406 newsize = YYMAXDEPTH;
408 i = (int) (data->s_mark - data->s_base);
409 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
413 data->s_base = newss;
414 data->s_mark = newss + i;
416 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
420 data->l_base = newvs;
421 data->l_mark = newvs + i;
423 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
424 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
428 data->p_base = newps;
429 data->p_mark = newps + i;
432 data->stacksize = newsize;
433 data->s_last = data->s_base + newsize - 1;
437 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
442 #if YYPURE || defined(YY_NO_LEAKS)
443 static void yyfreestack(YYSTACKDATA *data)
447 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
450 memset(data, 0, sizeof(*data));
453 #define yyfreestack(data) /* nothing */
454 #endif /* YYPURE || defined(YY_NO_LEAKS) */
457 static YYParseState *
458 yyNewState(unsigned size)
460 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
461 if (p == NULL) return NULL;
463 p->yystack.stacksize = size;
466 p->yystack.s_base = NULL;
467 p->yystack.l_base = NULL;
468 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
469 p->yystack.p_base = NULL;
473 p->yystack.s_base = (short *) malloc(size * sizeof(short));
474 if (p->yystack.s_base == NULL) return NULL;
475 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
476 if (p->yystack.l_base == NULL) return NULL;
477 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
478 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
479 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
480 if (p->yystack.p_base == NULL) return NULL;
481 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
488 yyFreeState(YYParseState *p)
490 yyfreestack(&p->yystack);
493 #endif /* YYBTYACC */
495 #define YYABORT goto yyabort
496 #define YYREJECT goto yyabort
497 #define YYACCEPT goto yyaccept
498 #define YYERROR goto yyerrlab
500 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
501 #define YYVALID_NESTED do { if (yyps->save && \
502 yyps->save->save == 0) goto yyvalid; } while(0)
503 #endif /* YYBTYACC */
508 int yym, yyn, yystate, yyresult;
511 YYParseState *yyerrctx = NULL;
512 #endif /* YYBTYACC */
513 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
514 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
519 if ((yys = getenv("YYDEBUG")) != 0)
522 if (yyn >= '0' && yyn <= '9')
526 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
530 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
532 #endif /* YYBTYACC */
539 memset(&yystack, 0, sizeof(yystack));
542 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
543 yystack.s_mark = yystack.s_base;
544 yystack.l_mark = yystack.l_base;
545 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
546 yystack.p_mark = yystack.p_base;
552 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
559 /* we're currently re-reading tokens */
561 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
569 /* in trial mode; save scanner results for future parse attempts */
570 if (yylvp == yylvlim)
571 { /* Enlarge lexical value queue */
572 size_t p = (size_t) (yylvp - yylvals);
573 size_t s = (size_t) (yylvlim - yylvals);
575 s += YYLVQUEUEGROWTH;
576 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
577 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
578 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
579 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
581 yylvp = yylve = yylvals + p;
582 yylvlim = yylvals + s;
583 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
584 yylpp = yylpe = yylpsns + p;
585 yylplim = yylpsns + s;
587 yylexp = yylexemes + p;
589 *yylexp = (short) YYLEX;
592 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
599 /* normal operation, no conflict encountered */
600 #endif /* YYBTYACC */
604 #endif /* YYBTYACC */
605 if (yychar < 0) yychar = YYEOF;
606 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
610 yys = yyname[YYTRANSLATE(yychar)];
611 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
612 YYDEBUGSTR, yydepth, yystate, yychar, yys);
613 #ifdef YYSTYPE_TOSTRING
616 #endif /* YYBTYACC */
617 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
625 /* Do we have a conflict? */
626 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
627 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
636 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
637 YYDEBUGSTR, yydepth, yystate);
639 /* Switch to the next conflict context */
644 if (save->state != yystate) YYABORT;
651 /* Unresolved conflict - start/continue trial parse */
656 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
658 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
660 fputs("Starting trial parse.\n", stderr);
663 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
664 if (save == NULL) goto yyenomem;
665 save->save = yyps->save;
666 save->state = yystate;
667 save->errflag = yyerrflag;
668 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
669 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
670 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
671 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
672 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
673 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
674 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
677 if (yyctable[ctry] == -1)
680 if (yydebug && yychar >= YYEOF)
681 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
686 if (yyps->save == NULL)
688 /* If this is a first conflict in the stack, start saving lexemes */
691 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
692 if (yylexemes == NULL) goto yyenomem;
693 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
694 if (yylvals == NULL) goto yyenomem;
695 yylvlim = yylvals + YYLVQUEUEGROWTH;
696 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
697 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
698 if (yylpsns == NULL) goto yyenomem;
699 yylplim = yylpsns + YYLVQUEUEGROWTH;
704 yylvp = yylve = yylvals;
705 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
706 yylpp = yylpe = yylpsns;
712 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
715 *yylexp = (short) yychar;
723 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
729 save->lexeme = (int) (yylvp - yylvals);
732 if (yytable[yyn] == ctry)
736 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
737 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
742 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
747 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
749 yystate = yyctable[ctry];
750 *++yystack.s_mark = (short) yystate;
751 *++yystack.l_mark = yylval;
752 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
753 *++yystack.p_mark = yylloc;
756 if (yyerrflag > 0) --yyerrflag;
761 yyn = yyctable[ctry];
764 } /* End of code dealing with conflicts */
765 #endif /* YYBTYACC */
766 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
767 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
771 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
772 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
774 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
775 yystate = yytable[yyn];
776 *++yystack.s_mark = yytable[yyn];
777 *++yystack.l_mark = yylval;
778 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
779 *++yystack.p_mark = yylloc;
782 if (yyerrflag > 0) --yyerrflag;
785 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
786 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
791 if (yyerrflag != 0) goto yyinrecovery;
804 YYParseState *save = yyps->save;
807 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
808 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
809 (int)(yylvp - yylvals - yyps->save->lexeme));
811 /* Memorize most forward-looking error state in case it's really an error. */
812 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
814 /* Free old saved error context state */
815 if (yyerrctx) yyFreeState(yyerrctx);
816 /* Create and fill out new saved error context state */
817 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
818 if (yyerrctx == NULL) goto yyenomem;
819 yyerrctx->save = yyps->save;
820 yyerrctx->state = yystate;
821 yyerrctx->errflag = yyerrflag;
822 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
823 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
824 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
825 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
826 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
827 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
828 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
830 yyerrctx->lexeme = (int) (yylvp - yylvals);
832 yylvp = yylvals + save->lexeme;
833 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
834 yylpp = yylpsns + save->lexeme;
836 yylexp = yylexemes + save->lexeme;
838 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
839 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
840 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
841 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
842 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
843 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
844 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
847 yystate = save->state;
848 /* We tried shift, try reduce now */
849 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
850 yyps->save = save->save;
854 /* Nothing left on the stack -- error */
859 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
862 /* Restore state as it was in the most forward-advanced error */
863 yylvp = yylvals + yyerrctx->lexeme;
864 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
865 yylpp = yylpsns + yyerrctx->lexeme;
867 yylexp = yylexemes + yyerrctx->lexeme;
870 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
873 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
874 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
875 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
876 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
877 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
878 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
879 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
881 yystate = yyerrctx->state;
882 yyFreeState(yyerrctx);
887 if (yynewerrflag == 0) goto yyinrecovery;
888 #endif /* YYBTYACC */
890 YYERROR_CALL("syntax error");
891 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
892 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
907 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
908 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
912 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
913 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
915 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
916 yystate = yytable[yyn];
917 *++yystack.s_mark = yytable[yyn];
918 *++yystack.l_mark = yylval;
919 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
920 /* lookahead position is error end position */
921 yyerror_loc_range[1] = yylloc;
922 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
923 *++yystack.p_mark = yyloc;
931 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
932 YYDEBUGSTR, yydepth, *yystack.s_mark);
934 if (yystack.s_mark <= yystack.s_base) goto yyabort;
935 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
936 /* the current TOS position is the error start position */
937 yyerror_loc_range[0] = *yystack.p_mark;
939 #if defined(YYDESTRUCT_CALL)
942 #endif /* YYBTYACC */
943 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
944 YYDESTRUCT_CALL("error: discarding state",
945 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
947 YYDESTRUCT_CALL("error: discarding state",
948 yystos[*yystack.s_mark], yystack.l_mark);
949 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
950 #endif /* defined(YYDESTRUCT_CALL) */
953 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
961 if (yychar == YYEOF) goto yyabort;
965 yys = yyname[YYTRANSLATE(yychar)];
966 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
967 YYDEBUGSTR, yydepth, yystate, yychar, yys);
970 #if defined(YYDESTRUCT_CALL)
973 #endif /* YYBTYACC */
974 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
975 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
977 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
978 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
979 #endif /* defined(YYDESTRUCT_CALL) */
989 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
990 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
991 #ifdef YYSTYPE_TOSTRING
994 #endif /* YYBTYACC */
999 for (i = yym; i > 0; i--)
1001 if (i != yym) fputs(", ", stderr);
1002 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1003 yystack.l_mark[1-i]), stderr);
1008 fputc('\n', stderr);
1012 yyval = yystack.l_mark[1-yym];
1014 memset(&yyval, 0, sizeof yyval);
1015 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1017 /* Perform position reduction */
1018 memset(&yyloc, 0, sizeof(yyloc));
1021 #endif /* YYBTYACC */
1023 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1024 /* just in case YYERROR is invoked within the action, save
1025 the start of the rhs as the error start position */
1026 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1033 #line 9 "err_syntax18.y"
1034 { yyval = yystack.l_mark[1]; }
1036 #line 1037 "err_syntax18.tab.c"
1040 yystack.s_mark -= yym;
1041 yystate = *yystack.s_mark;
1042 yystack.l_mark -= yym;
1043 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1044 yystack.p_mark -= yym;
1047 if (yystate == 0 && yym == 0)
1052 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1053 #ifdef YYSTYPE_TOSTRING
1056 #endif /* YYBTYACC */
1057 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1059 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1063 *++yystack.s_mark = YYFINAL;
1064 *++yystack.l_mark = yyval;
1065 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1066 *++yystack.p_mark = yyloc;
1074 /* we're currently re-reading tokens */
1076 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1084 /* in trial mode; save scanner results for future parse attempts */
1085 if (yylvp == yylvlim)
1086 { /* Enlarge lexical value queue */
1087 size_t p = (size_t) (yylvp - yylvals);
1088 size_t s = (size_t) (yylvlim - yylvals);
1090 s += YYLVQUEUEGROWTH;
1091 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1093 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1095 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1096 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1099 yylvp = yylve = yylvals + p;
1100 yylvlim = yylvals + s;
1101 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1102 yylpp = yylpe = yylpsns + p;
1103 yylplim = yylpsns + s;
1105 yylexp = yylexemes + p;
1107 *yylexp = (short) YYLEX;
1110 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1117 /* normal operation, no conflict encountered */
1118 #endif /* YYBTYACC */
1122 #endif /* YYBTYACC */
1123 if (yychar < 0) yychar = YYEOF;
1124 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1128 yys = yyname[YYTRANSLATE(yychar)];
1129 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1130 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1134 if (yychar == YYEOF) goto yyaccept;
1137 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1138 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1139 yystate = yytable[yyn];
1141 yystate = yydgoto[yym];
1145 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1146 #ifdef YYSTYPE_TOSTRING
1149 #endif /* YYBTYACC */
1150 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1152 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1155 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1156 *++yystack.s_mark = (short) yystate;
1157 *++yystack.l_mark = yyval;
1158 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1159 *++yystack.p_mark = yyloc;
1164 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1166 if (yypath) YYABORT;
1169 YYParseState *save = yyps->save;
1170 yyps->save = save->save;
1171 save->save = yypath;
1176 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1177 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1181 yyFreeState(yyerrctx);
1184 yylvp = yylvals + yypath->lexeme;
1185 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1186 yylpp = yylpsns + yypath->lexeme;
1188 yylexp = yylexemes + yypath->lexeme;
1190 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1191 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1192 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1193 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1194 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1195 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1196 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1198 yystate = yypath->state;
1200 #endif /* YYBTYACC */
1203 YYERROR_CALL("yacc stack overflow");
1207 YYERROR_CALL("memory exhausted");
1209 #endif /* YYBTYACC */
1219 if (yyps->save) goto yyvalid;
1220 #endif /* YYBTYACC */
1224 #if defined(YYDESTRUCT_CALL)
1225 if (yychar != YYEOF && yychar != YYEMPTY)
1226 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1227 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1229 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1230 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1234 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1237 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1238 YYDESTRUCT_CALL("cleanup: discarding state",
1239 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1241 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1242 YYDESTRUCT_CALL("cleanup: discarding state",
1243 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1244 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1246 #endif /* defined(YYDESTRUCT_CALL) */
1251 yyFreeState(yyerrctx);
1256 YYParseState *save = yyps;
1263 YYParseState *save = yypath;
1264 yypath = save->save;
1268 #endif /* YYBTYACC */
1269 yyfreestack(&yystack);