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_syntax11_parse
25 #define yylex err_syntax11_lex
29 #define yyerror err_syntax11_error
33 #define yychar err_syntax11_char
37 #define yyval err_syntax11_val
41 #define yylval err_syntax11_lval
45 #define yydebug err_syntax11_debug
49 #define yynerrs err_syntax11_nerrs
53 #define yyerrflag err_syntax11_errflag
54 #endif /* yyerrflag */
57 #define yylhs err_syntax11_lhs
61 #define yylen err_syntax11_len
65 #define yydefred err_syntax11_defred
69 #define yystos err_syntax11_stos
73 #define yydgoto err_syntax11_dgoto
77 #define yysindex err_syntax11_sindex
81 #define yyrindex err_syntax11_rindex
85 #define yygindex err_syntax11_gindex
89 #define yytable err_syntax11_table
93 #define yycheck err_syntax11_check
97 #define yyname err_syntax11_name
101 #define yyrule err_syntax11_rule
107 #define yycindex err_syntax11_cindex
108 #endif /* yycindex */
111 #define yyctable err_syntax11_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "err_syntax11_"
120 #line 2 "err_syntax11.y"
122 static void yyerror(const char *);
123 #line 124 "err_syntax11.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_syntax11_lhs[] = { -1,
167 static const YYINT err_syntax11_len[] = { 2,
170 static const YYINT err_syntax11_defred[] = { 0,
173 static const YYINT err_syntax11_stos[] = { 0,
176 static const YYINT err_syntax11_dgoto[] = { 2,
178 static const YYINT err_syntax11_sindex[] = { -256,
181 static const YYINT err_syntax11_rindex[] = { 0,
185 static const YYINT err_syntax11_cindex[] = { 0,
189 static const YYINT err_syntax11_gindex[] = { 0,
191 #define YYTABLESIZE 0
192 static const YYINT err_syntax11_table[] = { 1,
194 static const YYINT err_syntax11_check[] = { 256,
197 static const YYINT err_syntax11_ctable[] = { -1,
204 #define YYMAXTOKEN 256
205 #define YYUNDFTOKEN 259
206 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
208 static const char *const err_syntax11_name[] = {
210 "$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,
211 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
212 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
213 0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
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,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,"error","$accept","S",
219 static const char *const err_syntax11_rule[] = {
233 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
234 YYLTYPE yyloc; /* position returned by actions */
235 YYLTYPE yylloc; /* position from the lexer */
238 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
239 #ifndef YYLLOC_DEFAULT
240 #define YYLLOC_DEFAULT(loc, rhs, n) \
245 (loc).first_line = ((rhs)[-1]).last_line; \
246 (loc).first_column = ((rhs)[-1]).last_column; \
247 (loc).last_line = ((rhs)[-1]).last_line; \
248 (loc).last_column = ((rhs)[-1]).last_column; \
252 (loc).first_line = ((rhs)[ 0 ]).first_line; \
253 (loc).first_column = ((rhs)[ 0 ]).first_column; \
254 (loc).last_line = ((rhs)[n-1]).last_line; \
255 (loc).last_column = ((rhs)[n-1]).last_column; \
258 #endif /* YYLLOC_DEFAULT */
259 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
262 #ifndef YYLVQUEUEGROWTH
263 #define YYLVQUEUEGROWTH 32
265 #endif /* YYBTYACC */
267 /* define the initial stack-sizes */
270 #define YYMAXDEPTH YYSTACKSIZE
273 #define YYSTACKSIZE YYMAXDEPTH
275 #define YYSTACKSIZE 10000
276 #define YYMAXDEPTH 10000
280 #ifndef YYINITSTACKSIZE
281 #define YYINITSTACKSIZE 200
291 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
298 struct YYParseState_s
300 struct YYParseState_s *save; /* Previously saved parser state */
301 YYSTACKDATA yystack; /* saved parser stack */
302 int state; /* saved parser state */
303 int errflag; /* saved error recovery status */
304 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
305 YYINT ctry; /* saved index in yyctable[] for this conflict */
307 typedef struct YYParseState_s YYParseState;
308 #endif /* YYBTYACC */
309 /* variables for the parser stack */
310 static YYSTACKDATA yystack;
313 /* Current parser state */
314 static YYParseState *yyps = 0;
316 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
317 static YYParseState *yypath = 0;
319 /* Base of the lexical value queue */
320 static YYSTYPE *yylvals = 0;
322 /* Current position at lexical value queue */
323 static YYSTYPE *yylvp = 0;
325 /* End position of lexical value queue */
326 static YYSTYPE *yylve = 0;
328 /* The last allocated position at the lexical value queue */
329 static YYSTYPE *yylvlim = 0;
331 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
332 /* Base of the lexical position queue */
333 static YYLTYPE *yylpsns = 0;
335 /* Current position at lexical position queue */
336 static YYLTYPE *yylpp = 0;
338 /* End position of lexical position queue */
339 static YYLTYPE *yylpe = 0;
341 /* The last allocated position at the lexical position queue */
342 static YYLTYPE *yylplim = 0;
345 /* Current position at lexical token queue */
346 static short *yylexp = 0;
348 static short *yylexemes = 0;
349 #endif /* YYBTYACC */
350 #line 12 "err_syntax11.y"
357 printf("yyparse() = %d\n", yyparse());
368 yyerror(const char* s)
372 #line 373 "err_syntax11.tab.c"
374 /* For use in generated program */
375 #define yydepth (int)(yystack.s_mark - yystack.s_base)
377 #define yytrial (yyps->save)
378 #endif /* YYBTYACC */
381 #include <stdio.h> /* needed for printf */
384 #include <stdlib.h> /* needed for malloc, etc */
385 #include <string.h> /* needed for memset */
387 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
388 static int yygrowstack(YYSTACKDATA *data)
394 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
398 if ((newsize = data->stacksize) == 0)
399 newsize = YYINITSTACKSIZE;
400 else if (newsize >= YYMAXDEPTH)
402 else if ((newsize *= 2) > YYMAXDEPTH)
403 newsize = YYMAXDEPTH;
405 i = (int) (data->s_mark - data->s_base);
406 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
410 data->s_base = newss;
411 data->s_mark = newss + i;
413 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
417 data->l_base = newvs;
418 data->l_mark = newvs + i;
420 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
421 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
425 data->p_base = newps;
426 data->p_mark = newps + i;
429 data->stacksize = newsize;
430 data->s_last = data->s_base + newsize - 1;
434 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
439 #if YYPURE || defined(YY_NO_LEAKS)
440 static void yyfreestack(YYSTACKDATA *data)
444 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
447 memset(data, 0, sizeof(*data));
450 #define yyfreestack(data) /* nothing */
451 #endif /* YYPURE || defined(YY_NO_LEAKS) */
454 static YYParseState *
455 yyNewState(unsigned size)
457 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
458 if (p == NULL) return NULL;
460 p->yystack.stacksize = size;
463 p->yystack.s_base = NULL;
464 p->yystack.l_base = NULL;
465 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
466 p->yystack.p_base = NULL;
470 p->yystack.s_base = (short *) malloc(size * sizeof(short));
471 if (p->yystack.s_base == NULL) return NULL;
472 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
473 if (p->yystack.l_base == NULL) return NULL;
474 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
475 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
476 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
477 if (p->yystack.p_base == NULL) return NULL;
478 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
485 yyFreeState(YYParseState *p)
487 yyfreestack(&p->yystack);
490 #endif /* YYBTYACC */
492 #define YYABORT goto yyabort
493 #define YYREJECT goto yyabort
494 #define YYACCEPT goto yyaccept
495 #define YYERROR goto yyerrlab
497 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
498 #define YYVALID_NESTED do { if (yyps->save && \
499 yyps->save->save == 0) goto yyvalid; } while(0)
500 #endif /* YYBTYACC */
505 int yym, yyn, yystate, yyresult;
508 YYParseState *yyerrctx = NULL;
509 #endif /* YYBTYACC */
510 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
511 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
516 if ((yys = getenv("YYDEBUG")) != 0)
519 if (yyn >= '0' && yyn <= '9')
523 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
527 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
529 #endif /* YYBTYACC */
536 memset(&yystack, 0, sizeof(yystack));
539 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
540 yystack.s_mark = yystack.s_base;
541 yystack.l_mark = yystack.l_base;
542 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
543 yystack.p_mark = yystack.p_base;
549 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
556 /* we're currently re-reading tokens */
558 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
566 /* in trial mode; save scanner results for future parse attempts */
567 if (yylvp == yylvlim)
568 { /* Enlarge lexical value queue */
569 size_t p = (size_t) (yylvp - yylvals);
570 size_t s = (size_t) (yylvlim - yylvals);
572 s += YYLVQUEUEGROWTH;
573 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
574 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
575 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
576 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
578 yylvp = yylve = yylvals + p;
579 yylvlim = yylvals + s;
580 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
581 yylpp = yylpe = yylpsns + p;
582 yylplim = yylpsns + s;
584 yylexp = yylexemes + p;
586 *yylexp = (short) YYLEX;
589 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
596 /* normal operation, no conflict encountered */
597 #endif /* YYBTYACC */
601 #endif /* YYBTYACC */
602 if (yychar < 0) yychar = YYEOF;
603 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
607 yys = yyname[YYTRANSLATE(yychar)];
608 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
609 YYDEBUGSTR, yydepth, yystate, yychar, yys);
610 #ifdef YYSTYPE_TOSTRING
613 #endif /* YYBTYACC */
614 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
622 /* Do we have a conflict? */
623 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
624 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
633 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
634 YYDEBUGSTR, yydepth, yystate);
636 /* Switch to the next conflict context */
641 if (save->state != yystate) YYABORT;
648 /* Unresolved conflict - start/continue trial parse */
653 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
655 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
657 fputs("Starting trial parse.\n", stderr);
660 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
661 if (save == NULL) goto yyenomem;
662 save->save = yyps->save;
663 save->state = yystate;
664 save->errflag = yyerrflag;
665 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
666 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
667 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
668 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
669 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
670 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
671 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
674 if (yyctable[ctry] == -1)
677 if (yydebug && yychar >= YYEOF)
678 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
683 if (yyps->save == NULL)
685 /* If this is a first conflict in the stack, start saving lexemes */
688 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
689 if (yylexemes == NULL) goto yyenomem;
690 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
691 if (yylvals == NULL) goto yyenomem;
692 yylvlim = yylvals + YYLVQUEUEGROWTH;
693 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
694 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
695 if (yylpsns == NULL) goto yyenomem;
696 yylplim = yylpsns + YYLVQUEUEGROWTH;
701 yylvp = yylve = yylvals;
702 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
703 yylpp = yylpe = yylpsns;
709 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
712 *yylexp = (short) yychar;
720 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
726 save->lexeme = (int) (yylvp - yylvals);
729 if (yytable[yyn] == ctry)
733 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
734 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
739 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
744 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
746 yystate = yyctable[ctry];
747 *++yystack.s_mark = (short) yystate;
748 *++yystack.l_mark = yylval;
749 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
750 *++yystack.p_mark = yylloc;
753 if (yyerrflag > 0) --yyerrflag;
758 yyn = yyctable[ctry];
761 } /* End of code dealing with conflicts */
762 #endif /* YYBTYACC */
763 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
764 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
768 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
769 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
771 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
772 yystate = yytable[yyn];
773 *++yystack.s_mark = yytable[yyn];
774 *++yystack.l_mark = yylval;
775 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
776 *++yystack.p_mark = yylloc;
779 if (yyerrflag > 0) --yyerrflag;
782 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
783 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
788 if (yyerrflag != 0) goto yyinrecovery;
801 YYParseState *save = yyps->save;
804 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
805 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
806 (int)(yylvp - yylvals - yyps->save->lexeme));
808 /* Memorize most forward-looking error state in case it's really an error. */
809 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
811 /* Free old saved error context state */
812 if (yyerrctx) yyFreeState(yyerrctx);
813 /* Create and fill out new saved error context state */
814 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
815 if (yyerrctx == NULL) goto yyenomem;
816 yyerrctx->save = yyps->save;
817 yyerrctx->state = yystate;
818 yyerrctx->errflag = yyerrflag;
819 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
820 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
821 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
822 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
823 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
824 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
825 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
827 yyerrctx->lexeme = (int) (yylvp - yylvals);
829 yylvp = yylvals + save->lexeme;
830 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
831 yylpp = yylpsns + save->lexeme;
833 yylexp = yylexemes + save->lexeme;
835 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
836 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
837 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
838 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
839 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
840 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
841 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
844 yystate = save->state;
845 /* We tried shift, try reduce now */
846 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
847 yyps->save = save->save;
851 /* Nothing left on the stack -- error */
856 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
859 /* Restore state as it was in the most forward-advanced error */
860 yylvp = yylvals + yyerrctx->lexeme;
861 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
862 yylpp = yylpsns + yyerrctx->lexeme;
864 yylexp = yylexemes + yyerrctx->lexeme;
867 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
870 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
871 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
872 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
873 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
874 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
875 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
876 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
878 yystate = yyerrctx->state;
879 yyFreeState(yyerrctx);
884 if (yynewerrflag == 0) goto yyinrecovery;
885 #endif /* YYBTYACC */
887 YYERROR_CALL("syntax error");
888 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
889 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
904 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
905 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
909 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
910 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
912 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
913 yystate = yytable[yyn];
914 *++yystack.s_mark = yytable[yyn];
915 *++yystack.l_mark = yylval;
916 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
917 /* lookahead position is error end position */
918 yyerror_loc_range[1] = yylloc;
919 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
920 *++yystack.p_mark = yyloc;
928 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
929 YYDEBUGSTR, yydepth, *yystack.s_mark);
931 if (yystack.s_mark <= yystack.s_base) goto yyabort;
932 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
933 /* the current TOS position is the error start position */
934 yyerror_loc_range[0] = *yystack.p_mark;
936 #if defined(YYDESTRUCT_CALL)
939 #endif /* YYBTYACC */
940 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
941 YYDESTRUCT_CALL("error: discarding state",
942 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
944 YYDESTRUCT_CALL("error: discarding state",
945 yystos[*yystack.s_mark], yystack.l_mark);
946 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
947 #endif /* defined(YYDESTRUCT_CALL) */
950 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
958 if (yychar == YYEOF) goto yyabort;
962 yys = yyname[YYTRANSLATE(yychar)];
963 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
964 YYDEBUGSTR, yydepth, yystate, yychar, yys);
967 #if defined(YYDESTRUCT_CALL)
970 #endif /* YYBTYACC */
971 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
972 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
974 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
975 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
976 #endif /* defined(YYDESTRUCT_CALL) */
986 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
987 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
988 #ifdef YYSTYPE_TOSTRING
991 #endif /* YYBTYACC */
996 for (i = yym; i > 0; i--)
998 if (i != yym) fputs(", ", stderr);
999 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1000 yystack.l_mark[1-i]), stderr);
1005 fputc('\n', stderr);
1009 yyval = yystack.l_mark[1-yym];
1011 memset(&yyval, 0, sizeof yyval);
1012 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1014 /* Perform position reduction */
1015 memset(&yyloc, 0, sizeof(yyloc));
1018 #endif /* YYBTYACC */
1020 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1021 /* just in case YYERROR is invoked within the action, save
1022 the start of the rhs as the error start position */
1023 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1032 yystack.s_mark -= yym;
1033 yystate = *yystack.s_mark;
1034 yystack.l_mark -= yym;
1035 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1036 yystack.p_mark -= yym;
1039 if (yystate == 0 && yym == 0)
1044 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1045 #ifdef YYSTYPE_TOSTRING
1048 #endif /* YYBTYACC */
1049 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1051 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1055 *++yystack.s_mark = YYFINAL;
1056 *++yystack.l_mark = yyval;
1057 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1058 *++yystack.p_mark = yyloc;
1066 /* we're currently re-reading tokens */
1068 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1076 /* in trial mode; save scanner results for future parse attempts */
1077 if (yylvp == yylvlim)
1078 { /* Enlarge lexical value queue */
1079 size_t p = (size_t) (yylvp - yylvals);
1080 size_t s = (size_t) (yylvlim - yylvals);
1082 s += YYLVQUEUEGROWTH;
1083 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1085 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1087 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1088 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1091 yylvp = yylve = yylvals + p;
1092 yylvlim = yylvals + s;
1093 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1094 yylpp = yylpe = yylpsns + p;
1095 yylplim = yylpsns + s;
1097 yylexp = yylexemes + p;
1099 *yylexp = (short) YYLEX;
1102 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1109 /* normal operation, no conflict encountered */
1110 #endif /* YYBTYACC */
1114 #endif /* YYBTYACC */
1115 if (yychar < 0) yychar = YYEOF;
1116 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1120 yys = yyname[YYTRANSLATE(yychar)];
1121 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1122 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1126 if (yychar == YYEOF) goto yyaccept;
1129 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1130 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1131 yystate = yytable[yyn];
1133 yystate = yydgoto[yym];
1137 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1138 #ifdef YYSTYPE_TOSTRING
1141 #endif /* YYBTYACC */
1142 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1144 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1147 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1148 *++yystack.s_mark = (short) yystate;
1149 *++yystack.l_mark = yyval;
1150 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1151 *++yystack.p_mark = yyloc;
1156 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1158 if (yypath) YYABORT;
1161 YYParseState *save = yyps->save;
1162 yyps->save = save->save;
1163 save->save = yypath;
1168 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1169 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1173 yyFreeState(yyerrctx);
1176 yylvp = yylvals + yypath->lexeme;
1177 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1178 yylpp = yylpsns + yypath->lexeme;
1180 yylexp = yylexemes + yypath->lexeme;
1182 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1183 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1184 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1185 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1186 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1187 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1188 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1190 yystate = yypath->state;
1192 #endif /* YYBTYACC */
1195 YYERROR_CALL("yacc stack overflow");
1199 YYERROR_CALL("memory exhausted");
1201 #endif /* YYBTYACC */
1211 if (yyps->save) goto yyvalid;
1212 #endif /* YYBTYACC */
1216 #if defined(YYDESTRUCT_CALL)
1217 if (yychar != YYEOF && yychar != YYEMPTY)
1218 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1219 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1221 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1222 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1226 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1229 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1230 YYDESTRUCT_CALL("cleanup: discarding state",
1231 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1233 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1234 YYDESTRUCT_CALL("cleanup: discarding state",
1235 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1236 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1238 #endif /* defined(YYDESTRUCT_CALL) */
1243 yyFreeState(yyerrctx);
1248 YYParseState *save = yyps;
1255 YYParseState *save = yypath;
1256 yypath = save->save;
1260 #endif /* YYBTYACC */
1261 yyfreestack(&yystack);