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_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 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
174 static const YYINT err_syntax11_stos[] = { 0,
177 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
178 static const YYINT err_syntax11_dgoto[] = { 2,
180 static const YYINT err_syntax11_sindex[] = { -256,
183 static const YYINT err_syntax11_rindex[] = { 0,
187 static const YYINT err_syntax11_cindex[] = { 0,
191 static const YYINT err_syntax11_gindex[] = { 0,
193 #define YYTABLESIZE 0
194 static const YYINT err_syntax11_table[] = { 1,
196 static const YYINT err_syntax11_check[] = { 256,
199 static const YYINT err_syntax11_ctable[] = { -1,
206 #define YYMAXTOKEN 256
207 #define YYUNDFTOKEN 259
208 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
210 static const char *const err_syntax11_name[] = {
212 "$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,
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,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,
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,"error","$accept","S",
221 static const char *const err_syntax11_rule[] = {
235 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
236 YYLTYPE yyloc; /* position returned by actions */
237 YYLTYPE yylloc; /* position from the lexer */
240 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
241 #ifndef YYLLOC_DEFAULT
242 #define YYLLOC_DEFAULT(loc, rhs, n) \
247 (loc).first_line = ((rhs)[-1]).last_line; \
248 (loc).first_column = ((rhs)[-1]).last_column; \
249 (loc).last_line = ((rhs)[-1]).last_line; \
250 (loc).last_column = ((rhs)[-1]).last_column; \
254 (loc).first_line = ((rhs)[ 0 ]).first_line; \
255 (loc).first_column = ((rhs)[ 0 ]).first_column; \
256 (loc).last_line = ((rhs)[n-1]).last_line; \
257 (loc).last_column = ((rhs)[n-1]).last_column; \
260 #endif /* YYLLOC_DEFAULT */
261 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
264 #ifndef YYLVQUEUEGROWTH
265 #define YYLVQUEUEGROWTH 32
267 #endif /* YYBTYACC */
269 /* define the initial stack-sizes */
272 #define YYMAXDEPTH YYSTACKSIZE
275 #define YYSTACKSIZE YYMAXDEPTH
277 #define YYSTACKSIZE 10000
278 #define YYMAXDEPTH 10000
282 #ifndef YYINITSTACKSIZE
283 #define YYINITSTACKSIZE 200
293 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
300 struct YYParseState_s
302 struct YYParseState_s *save; /* Previously saved parser state */
303 YYSTACKDATA yystack; /* saved parser stack */
304 int state; /* saved parser state */
305 int errflag; /* saved error recovery status */
306 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
307 YYINT ctry; /* saved index in yyctable[] for this conflict */
309 typedef struct YYParseState_s YYParseState;
310 #endif /* YYBTYACC */
311 /* variables for the parser stack */
312 static YYSTACKDATA yystack;
315 /* Current parser state */
316 static YYParseState *yyps = 0;
318 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
319 static YYParseState *yypath = 0;
321 /* Base of the lexical value queue */
322 static YYSTYPE *yylvals = 0;
324 /* Current position at lexical value queue */
325 static YYSTYPE *yylvp = 0;
327 /* End position of lexical value queue */
328 static YYSTYPE *yylve = 0;
330 /* The last allocated position at the lexical value queue */
331 static YYSTYPE *yylvlim = 0;
333 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
334 /* Base of the lexical position queue */
335 static YYLTYPE *yylpsns = 0;
337 /* Current position at lexical position queue */
338 static YYLTYPE *yylpp = 0;
340 /* End position of lexical position queue */
341 static YYLTYPE *yylpe = 0;
343 /* The last allocated position at the lexical position queue */
344 static YYLTYPE *yylplim = 0;
347 /* Current position at lexical token queue */
348 static YYINT *yylexp = 0;
350 static YYINT *yylexemes = 0;
351 #endif /* YYBTYACC */
352 #line 12 "err_syntax11.y"
359 printf("yyparse() = %d\n", yyparse());
370 yyerror(const char* s)
374 #line 375 "err_syntax11.tab.c"
376 /* For use in generated program */
377 #define yydepth (int)(yystack.s_mark - yystack.s_base)
379 #define yytrial (yyps->save)
380 #endif /* YYBTYACC */
383 #include <stdio.h> /* needed for printf */
386 #include <stdlib.h> /* needed for malloc, etc */
387 #include <string.h> /* needed for memset */
389 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
390 static int yygrowstack(YYSTACKDATA *data)
396 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
400 if ((newsize = data->stacksize) == 0)
401 newsize = YYINITSTACKSIZE;
402 else if (newsize >= YYMAXDEPTH)
404 else if ((newsize *= 2) > YYMAXDEPTH)
405 newsize = YYMAXDEPTH;
407 i = (int) (data->s_mark - data->s_base);
408 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
412 data->s_base = newss;
413 data->s_mark = newss + i;
415 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
419 data->l_base = newvs;
420 data->l_mark = newvs + i;
422 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
423 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
427 data->p_base = newps;
428 data->p_mark = newps + i;
431 data->stacksize = newsize;
432 data->s_last = data->s_base + newsize - 1;
436 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
441 #if YYPURE || defined(YY_NO_LEAKS)
442 static void yyfreestack(YYSTACKDATA *data)
446 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
449 memset(data, 0, sizeof(*data));
452 #define yyfreestack(data) /* nothing */
453 #endif /* YYPURE || defined(YY_NO_LEAKS) */
456 static YYParseState *
457 yyNewState(unsigned size)
459 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
460 if (p == NULL) return NULL;
462 p->yystack.stacksize = size;
465 p->yystack.s_base = NULL;
466 p->yystack.l_base = NULL;
467 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
468 p->yystack.p_base = NULL;
472 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
473 if (p->yystack.s_base == NULL) return NULL;
474 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
475 if (p->yystack.l_base == NULL) return NULL;
476 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
477 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
478 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
479 if (p->yystack.p_base == NULL) return NULL;
480 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
487 yyFreeState(YYParseState *p)
489 yyfreestack(&p->yystack);
492 #endif /* YYBTYACC */
494 #define YYABORT goto yyabort
495 #define YYREJECT goto yyabort
496 #define YYACCEPT goto yyaccept
497 #define YYERROR goto yyerrlab
499 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
500 #define YYVALID_NESTED do { if (yyps->save && \
501 yyps->save->save == 0) goto yyvalid; } while(0)
502 #endif /* YYBTYACC */
507 int yym, yyn, yystate, yyresult;
510 YYParseState *yyerrctx = NULL;
511 #endif /* YYBTYACC */
512 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
513 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
518 if ((yys = getenv("YYDEBUG")) != 0)
521 if (yyn >= '0' && yyn <= '9')
525 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
527 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
528 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
532 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
534 #endif /* YYBTYACC */
543 memset(&yystack, 0, sizeof(yystack));
546 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
547 yystack.s_mark = yystack.s_base;
548 yystack.l_mark = yystack.l_base;
549 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
550 yystack.p_mark = yystack.p_base;
556 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
563 /* we're currently re-reading tokens */
565 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
573 /* in trial mode; save scanner results for future parse attempts */
574 if (yylvp == yylvlim)
575 { /* Enlarge lexical value queue */
576 size_t p = (size_t) (yylvp - yylvals);
577 size_t s = (size_t) (yylvlim - yylvals);
579 s += YYLVQUEUEGROWTH;
580 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
581 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
582 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
583 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
585 yylvp = yylve = yylvals + p;
586 yylvlim = yylvals + s;
587 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
588 yylpp = yylpe = yylpsns + p;
589 yylplim = yylpsns + s;
591 yylexp = yylexemes + p;
593 *yylexp = (YYINT) YYLEX;
596 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
603 /* normal operation, no conflict encountered */
604 #endif /* YYBTYACC */
608 #endif /* YYBTYACC */
609 if (yychar < 0) yychar = YYEOF;
613 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
614 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
615 YYDEBUGSTR, yydepth, yystate, yychar, yys);
616 #ifdef YYSTYPE_TOSTRING
619 #endif /* YYBTYACC */
620 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
628 /* Do we have a conflict? */
629 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
630 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
639 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
640 YYDEBUGSTR, yydepth, yystate);
642 /* Switch to the next conflict context */
647 if (save->state != yystate) YYABORT;
654 /* Unresolved conflict - start/continue trial parse */
659 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
661 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
663 fputs("Starting trial parse.\n", stderr);
666 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
667 if (save == NULL) goto yyenomem;
668 save->save = yyps->save;
669 save->state = yystate;
670 save->errflag = yyerrflag;
671 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
672 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
673 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
674 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
675 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
676 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
677 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
680 if (yyctable[ctry] == -1)
683 if (yydebug && yychar >= YYEOF)
684 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
689 if (yyps->save == NULL)
691 /* If this is a first conflict in the stack, start saving lexemes */
694 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
695 if (yylexemes == NULL) goto yyenomem;
696 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
697 if (yylvals == NULL) goto yyenomem;
698 yylvlim = yylvals + YYLVQUEUEGROWTH;
699 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
700 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
701 if (yylpsns == NULL) goto yyenomem;
702 yylplim = yylpsns + YYLVQUEUEGROWTH;
707 yylvp = yylve = yylvals;
708 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
709 yylpp = yylpe = yylpsns;
715 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
718 *yylexp = (YYINT) yychar;
726 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
732 save->lexeme = (int) (yylvp - yylvals);
735 if (yytable[yyn] == ctry)
739 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
740 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
745 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
750 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
752 yystate = yyctable[ctry];
753 *++yystack.s_mark = (YYINT) yystate;
754 *++yystack.l_mark = yylval;
755 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
756 *++yystack.p_mark = yylloc;
759 if (yyerrflag > 0) --yyerrflag;
764 yyn = yyctable[ctry];
767 } /* End of code dealing with conflicts */
768 #endif /* YYBTYACC */
769 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
770 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
774 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
775 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
777 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
778 yystate = yytable[yyn];
779 *++yystack.s_mark = yytable[yyn];
780 *++yystack.l_mark = yylval;
781 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
782 *++yystack.p_mark = yylloc;
785 if (yyerrflag > 0) --yyerrflag;
788 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
789 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
794 if (yyerrflag != 0) goto yyinrecovery;
799 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
802 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
803 * before looking for error recovery */
804 yystack.s_mark -= yym;
805 yystate = *yystack.s_mark;
806 yystack.l_mark -= yym;
807 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
808 yystack.p_mark -= yym;
816 YYParseState *save = yyps->save;
819 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
820 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
821 (int)(yylvp - yylvals - yyps->save->lexeme));
823 /* Memorize most forward-looking error state in case it's really an error. */
824 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
826 /* Free old saved error context state */
827 if (yyerrctx) yyFreeState(yyerrctx);
828 /* Create and fill out new saved error context state */
829 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
830 if (yyerrctx == NULL) goto yyenomem;
831 yyerrctx->save = yyps->save;
832 yyerrctx->state = yystate;
833 yyerrctx->errflag = yyerrflag;
834 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
835 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
836 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
837 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
838 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
839 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
840 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
842 yyerrctx->lexeme = (int) (yylvp - yylvals);
844 yylvp = yylvals + save->lexeme;
845 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
846 yylpp = yylpsns + save->lexeme;
848 yylexp = yylexemes + save->lexeme;
850 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
851 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
852 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
853 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
854 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
855 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
856 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
859 yystate = save->state;
860 /* We tried shift, try reduce now */
861 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
862 yyps->save = save->save;
866 /* Nothing left on the stack -- error */
871 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
874 /* Restore state as it was in the most forward-advanced error */
875 yylvp = yylvals + yyerrctx->lexeme;
876 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
877 yylpp = yylpsns + yyerrctx->lexeme;
879 yylexp = yylexemes + yyerrctx->lexeme;
882 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
885 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
886 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
887 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
888 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
889 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
890 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
891 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
893 yystate = yyerrctx->state;
894 yyFreeState(yyerrctx);
899 if (yynewerrflag == 0) goto yyinrecovery;
900 #endif /* YYBTYACC */
902 YYERROR_CALL("syntax error");
903 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
904 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
908 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
919 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
920 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
924 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
925 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
927 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
928 yystate = yytable[yyn];
929 *++yystack.s_mark = yytable[yyn];
930 *++yystack.l_mark = yylval;
931 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
932 /* lookahead position is error end position */
933 yyerror_loc_range[1] = yylloc;
934 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
935 *++yystack.p_mark = yyloc;
943 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
944 YYDEBUGSTR, yydepth, *yystack.s_mark);
946 if (yystack.s_mark <= yystack.s_base) goto yyabort;
947 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
948 /* the current TOS position is the error start position */
949 yyerror_loc_range[0] = *yystack.p_mark;
951 #if defined(YYDESTRUCT_CALL)
954 #endif /* YYBTYACC */
955 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
956 YYDESTRUCT_CALL("error: discarding state",
957 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
959 YYDESTRUCT_CALL("error: discarding state",
960 yystos[*yystack.s_mark], yystack.l_mark);
961 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
962 #endif /* defined(YYDESTRUCT_CALL) */
965 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
973 if (yychar == YYEOF) goto yyabort;
977 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
978 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
979 YYDEBUGSTR, yydepth, yystate, yychar, yys);
982 #if defined(YYDESTRUCT_CALL)
985 #endif /* YYBTYACC */
986 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
987 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
989 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
990 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
991 #endif /* defined(YYDESTRUCT_CALL) */
1001 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1002 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1003 #ifdef YYSTYPE_TOSTRING
1006 #endif /* YYBTYACC */
1011 for (i = yym; i > 0; i--)
1013 if (i != yym) fputs(", ", stderr);
1014 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1015 yystack.l_mark[1-i]), stderr);
1020 fputc('\n', stderr);
1024 yyval = yystack.l_mark[1-yym];
1026 memset(&yyval, 0, sizeof yyval);
1027 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1029 /* Perform position reduction */
1030 memset(&yyloc, 0, sizeof(yyloc));
1033 #endif /* YYBTYACC */
1035 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1036 /* just in case YYERROR is invoked within the action, save
1037 the start of the rhs as the error start position */
1038 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1047 yystack.s_mark -= yym;
1048 yystate = *yystack.s_mark;
1049 yystack.l_mark -= yym;
1050 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1051 yystack.p_mark -= yym;
1054 if (yystate == 0 && yym == 0)
1059 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1060 #ifdef YYSTYPE_TOSTRING
1063 #endif /* YYBTYACC */
1064 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1066 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1070 *++yystack.s_mark = YYFINAL;
1071 *++yystack.l_mark = yyval;
1072 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1073 *++yystack.p_mark = yyloc;
1081 /* we're currently re-reading tokens */
1083 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1091 /* in trial mode; save scanner results for future parse attempts */
1092 if (yylvp == yylvlim)
1093 { /* Enlarge lexical value queue */
1094 size_t p = (size_t) (yylvp - yylvals);
1095 size_t s = (size_t) (yylvlim - yylvals);
1097 s += YYLVQUEUEGROWTH;
1098 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1100 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1102 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1103 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1106 yylvp = yylve = yylvals + p;
1107 yylvlim = yylvals + s;
1108 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1109 yylpp = yylpe = yylpsns + p;
1110 yylplim = yylpsns + s;
1112 yylexp = yylexemes + p;
1114 *yylexp = (YYINT) YYLEX;
1117 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1124 /* normal operation, no conflict encountered */
1125 #endif /* YYBTYACC */
1129 #endif /* YYBTYACC */
1130 if (yychar < 0) yychar = YYEOF;
1134 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1135 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1136 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1140 if (yychar == YYEOF) goto yyaccept;
1143 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1144 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1145 yystate = yytable[yyn];
1147 yystate = yydgoto[yym];
1151 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1152 #ifdef YYSTYPE_TOSTRING
1155 #endif /* YYBTYACC */
1156 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1158 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1161 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1162 *++yystack.s_mark = (YYINT) yystate;
1163 *++yystack.l_mark = yyval;
1164 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1165 *++yystack.p_mark = yyloc;
1170 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1172 if (yypath) YYABORT;
1175 YYParseState *save = yyps->save;
1176 yyps->save = save->save;
1177 save->save = yypath;
1182 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1183 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1187 yyFreeState(yyerrctx);
1190 yylvp = yylvals + yypath->lexeme;
1191 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1192 yylpp = yylpsns + yypath->lexeme;
1194 yylexp = yylexemes + yypath->lexeme;
1196 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1197 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1198 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1199 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1200 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1201 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1202 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1204 yystate = yypath->state;
1206 #endif /* YYBTYACC */
1209 YYERROR_CALL("yacc stack overflow");
1213 YYERROR_CALL("memory exhausted");
1215 #endif /* YYBTYACC */
1225 if (yyps->save) goto yyvalid;
1226 #endif /* YYBTYACC */
1230 #if defined(YYDESTRUCT_CALL)
1231 if (yychar != YYEOF && yychar != YYEMPTY)
1232 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1233 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1235 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1236 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1240 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1243 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1244 YYDESTRUCT_CALL("cleanup: discarding state",
1245 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1247 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1248 YYDESTRUCT_CALL("cleanup: discarding state",
1249 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1250 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1252 #endif /* defined(YYDESTRUCT_CALL) */
1257 yyFreeState(yyerrctx);
1262 YYParseState *save = yyps;
1269 YYParseState *save = yypath;
1270 yypath = save->save;
1274 #endif /* YYBTYACC */
1275 yyfreestack(&yystack);