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 error_parse
25 #define yylex error_lex
29 #define yyerror error_error
33 #define yychar error_char
37 #define yyval error_val
41 #define yylval error_lval
45 #define yydebug error_debug
49 #define yynerrs error_nerrs
53 #define yyerrflag error_errflag
54 #endif /* yyerrflag */
57 #define yylhs error_lhs
61 #define yylen error_len
65 #define yydefred error_defred
69 #define yystos error_stos
73 #define yydgoto error_dgoto
77 #define yysindex error_sindex
81 #define yyrindex error_rindex
85 #define yygindex error_gindex
89 #define yytable error_table
93 #define yycheck error_check
97 #define yyname error_name
101 #define yyrule error_rule
107 #define yycindex error_cindex
108 #endif /* yycindex */
111 #define yyctable error_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "error_"
120 #line 2 "code_error.y"
124 static void yyerror(const char *);
127 #line 128 "code_error.code.c"
129 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
130 /* Default: YYSTYPE is the semantic value type. */
132 # define YYSTYPE_IS_DECLARED 1
135 /* compatibility with bison */
137 /* compatibility with FreeBSD */
138 # ifdef YYPARSE_PARAM_TYPE
139 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
141 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
144 # define YYPARSE_DECL() yyparse(void)
147 /* Parameters sent to lex. */
149 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
150 # define YYLEX yylex(YYLEX_PARAM)
152 # define YYLEX_DECL() yylex(void)
153 # define YYLEX yylex()
156 /* Parameters sent to yyerror. */
158 #define YYERROR_DECL() yyerror(const char *s)
161 #define YYERROR_CALL(msg) yyerror(msg)
164 #define YYERRCODE 256
165 #define YYTABLESIZE 0
170 #define YYMAXTOKEN 256
171 #define YYUNDFTOKEN 259
172 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
174 extern int YYPARSE_DECL();
176 extern const YYINT yylhs[];
177 extern const YYINT yylen[];
178 extern const YYINT yydefred[];
179 extern const YYINT yystos[];
180 extern const YYINT yydgoto[];
181 extern const YYINT yysindex[];
182 extern const YYINT yyrindex[];
184 extern const YYINT yycindex[];
185 #endif /* YYBTYACC */
186 extern const YYINT yygindex[];
187 extern const YYINT yytable[];
188 extern const YYINT yycheck[];
190 extern const YYINT yyctable[];
191 #endif /* YYBTYACC */
194 extern const char *const yyname[];
195 extern const char *const yyrule[];
205 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
206 YYLTYPE yyloc; /* position returned by actions */
207 YYLTYPE yylloc; /* position from the lexer */
210 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
211 #ifndef YYLLOC_DEFAULT
212 #define YYLLOC_DEFAULT(loc, rhs, n) \
217 (loc).first_line = ((rhs)[-1]).last_line; \
218 (loc).first_column = ((rhs)[-1]).last_column; \
219 (loc).last_line = ((rhs)[-1]).last_line; \
220 (loc).last_column = ((rhs)[-1]).last_column; \
224 (loc).first_line = ((rhs)[ 0 ]).first_line; \
225 (loc).first_column = ((rhs)[ 0 ]).first_column; \
226 (loc).last_line = ((rhs)[n-1]).last_line; \
227 (loc).last_column = ((rhs)[n-1]).last_column; \
230 #endif /* YYLLOC_DEFAULT */
231 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
234 #ifndef YYLVQUEUEGROWTH
235 #define YYLVQUEUEGROWTH 32
237 #endif /* YYBTYACC */
239 /* define the initial stack-sizes */
242 #define YYMAXDEPTH YYSTACKSIZE
245 #define YYSTACKSIZE YYMAXDEPTH
247 #define YYSTACKSIZE 10000
248 #define YYMAXDEPTH 10000
252 #ifndef YYINITSTACKSIZE
253 #define YYINITSTACKSIZE 200
263 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
270 struct YYParseState_s
272 struct YYParseState_s *save; /* Previously saved parser state */
273 YYSTACKDATA yystack; /* saved parser stack */
274 int state; /* saved parser state */
275 int errflag; /* saved error recovery status */
276 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
277 YYINT ctry; /* saved index in yyctable[] for this conflict */
279 typedef struct YYParseState_s YYParseState;
280 #endif /* YYBTYACC */
281 /* variables for the parser stack */
282 static YYSTACKDATA yystack;
285 /* Current parser state */
286 static YYParseState *yyps = 0;
288 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
289 static YYParseState *yypath = 0;
291 /* Base of the lexical value queue */
292 static YYSTYPE *yylvals = 0;
294 /* Current position at lexical value queue */
295 static YYSTYPE *yylvp = 0;
297 /* End position of lexical value queue */
298 static YYSTYPE *yylve = 0;
300 /* The last allocated position at the lexical value queue */
301 static YYSTYPE *yylvlim = 0;
303 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
304 /* Base of the lexical position queue */
305 static YYLTYPE *yylpsns = 0;
307 /* Current position at lexical position queue */
308 static YYLTYPE *yylpp = 0;
310 /* End position of lexical position queue */
311 static YYLTYPE *yylpe = 0;
313 /* The last allocated position at the lexical position queue */
314 static YYLTYPE *yylplim = 0;
317 /* Current position at lexical token queue */
318 static short *yylexp = 0;
320 static short *yylexemes = 0;
321 #endif /* YYBTYACC */
322 #line 12 "code_error.y"
327 extern int YYLEX_DECL();
333 printf("yyparse() = %d\n", yyparse());
344 yyerror(const char* s)
348 #line 349 "code_error.code.c"
350 /* For use in generated program */
351 #define yydepth (int)(yystack.s_mark - yystack.s_base)
353 #define yytrial (yyps->save)
354 #endif /* YYBTYACC */
357 #include <stdio.h> /* needed for printf */
360 #include <stdlib.h> /* needed for malloc, etc */
361 #include <string.h> /* needed for memset */
363 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
364 static int yygrowstack(YYSTACKDATA *data)
370 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
374 if ((newsize = data->stacksize) == 0)
375 newsize = YYINITSTACKSIZE;
376 else if (newsize >= YYMAXDEPTH)
378 else if ((newsize *= 2) > YYMAXDEPTH)
379 newsize = YYMAXDEPTH;
381 i = (int) (data->s_mark - data->s_base);
382 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
386 data->s_base = newss;
387 data->s_mark = newss + i;
389 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
393 data->l_base = newvs;
394 data->l_mark = newvs + i;
396 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
397 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
401 data->p_base = newps;
402 data->p_mark = newps + i;
405 data->stacksize = newsize;
406 data->s_last = data->s_base + newsize - 1;
410 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
415 #if YYPURE || defined(YY_NO_LEAKS)
416 static void yyfreestack(YYSTACKDATA *data)
420 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
423 memset(data, 0, sizeof(*data));
426 #define yyfreestack(data) /* nothing */
427 #endif /* YYPURE || defined(YY_NO_LEAKS) */
430 static YYParseState *
431 yyNewState(unsigned size)
433 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
434 if (p == NULL) return NULL;
436 p->yystack.stacksize = size;
439 p->yystack.s_base = NULL;
440 p->yystack.l_base = NULL;
441 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
442 p->yystack.p_base = NULL;
446 p->yystack.s_base = (short *) malloc(size * sizeof(short));
447 if (p->yystack.s_base == NULL) return NULL;
448 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
449 if (p->yystack.l_base == NULL) return NULL;
450 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
451 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
452 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
453 if (p->yystack.p_base == NULL) return NULL;
454 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
461 yyFreeState(YYParseState *p)
463 yyfreestack(&p->yystack);
466 #endif /* YYBTYACC */
468 #define YYABORT goto yyabort
469 #define YYREJECT goto yyabort
470 #define YYACCEPT goto yyaccept
471 #define YYERROR goto yyerrlab
473 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
474 #define YYVALID_NESTED do { if (yyps->save && \
475 yyps->save->save == 0) goto yyvalid; } while(0)
476 #endif /* YYBTYACC */
481 int yym, yyn, yystate, yyresult;
484 YYParseState *yyerrctx = NULL;
485 #endif /* YYBTYACC */
486 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
487 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
492 if ((yys = getenv("YYDEBUG")) != 0)
495 if (yyn >= '0' && yyn <= '9')
499 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
503 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
505 #endif /* YYBTYACC */
512 memset(&yystack, 0, sizeof(yystack));
515 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
516 yystack.s_mark = yystack.s_base;
517 yystack.l_mark = yystack.l_base;
518 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
519 yystack.p_mark = yystack.p_base;
525 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
532 /* we're currently re-reading tokens */
534 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
542 /* in trial mode; save scanner results for future parse attempts */
543 if (yylvp == yylvlim)
544 { /* Enlarge lexical value queue */
545 size_t p = (size_t) (yylvp - yylvals);
546 size_t s = (size_t) (yylvlim - yylvals);
548 s += YYLVQUEUEGROWTH;
549 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
550 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
551 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
552 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
554 yylvp = yylve = yylvals + p;
555 yylvlim = yylvals + s;
556 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
557 yylpp = yylpe = yylpsns + p;
558 yylplim = yylpsns + s;
560 yylexp = yylexemes + p;
562 *yylexp = (short) YYLEX;
565 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
572 /* normal operation, no conflict encountered */
573 #endif /* YYBTYACC */
577 #endif /* YYBTYACC */
578 if (yychar < 0) yychar = YYEOF;
579 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
583 yys = yyname[YYTRANSLATE(yychar)];
584 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
585 YYDEBUGSTR, yydepth, yystate, yychar, yys);
586 #ifdef YYSTYPE_TOSTRING
589 #endif /* YYBTYACC */
590 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
598 /* Do we have a conflict? */
599 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
600 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
609 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
610 YYDEBUGSTR, yydepth, yystate);
612 /* Switch to the next conflict context */
617 if (save->state != yystate) YYABORT;
624 /* Unresolved conflict - start/continue trial parse */
629 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
631 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
633 fputs("Starting trial parse.\n", stderr);
636 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
637 if (save == NULL) goto yyenomem;
638 save->save = yyps->save;
639 save->state = yystate;
640 save->errflag = yyerrflag;
641 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
642 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
643 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
644 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
645 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
646 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
647 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
650 if (yyctable[ctry] == -1)
653 if (yydebug && yychar >= YYEOF)
654 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
659 if (yyps->save == NULL)
661 /* If this is a first conflict in the stack, start saving lexemes */
664 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
665 if (yylexemes == NULL) goto yyenomem;
666 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
667 if (yylvals == NULL) goto yyenomem;
668 yylvlim = yylvals + YYLVQUEUEGROWTH;
669 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
670 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
671 if (yylpsns == NULL) goto yyenomem;
672 yylplim = yylpsns + YYLVQUEUEGROWTH;
677 yylvp = yylve = yylvals;
678 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
679 yylpp = yylpe = yylpsns;
685 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
688 *yylexp = (short) yychar;
696 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
702 save->lexeme = (int) (yylvp - yylvals);
705 if (yytable[yyn] == ctry)
709 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
710 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
715 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
720 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
722 yystate = yyctable[ctry];
723 *++yystack.s_mark = (short) yystate;
724 *++yystack.l_mark = yylval;
725 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
726 *++yystack.p_mark = yylloc;
729 if (yyerrflag > 0) --yyerrflag;
734 yyn = yyctable[ctry];
737 } /* End of code dealing with conflicts */
738 #endif /* YYBTYACC */
739 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
740 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
744 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
745 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
747 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
748 yystate = yytable[yyn];
749 *++yystack.s_mark = yytable[yyn];
750 *++yystack.l_mark = yylval;
751 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
752 *++yystack.p_mark = yylloc;
755 if (yyerrflag > 0) --yyerrflag;
758 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
759 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
764 if (yyerrflag != 0) goto yyinrecovery;
777 YYParseState *save = yyps->save;
780 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
781 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
782 (int)(yylvp - yylvals - yyps->save->lexeme));
784 /* Memorize most forward-looking error state in case it's really an error. */
785 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
787 /* Free old saved error context state */
788 if (yyerrctx) yyFreeState(yyerrctx);
789 /* Create and fill out new saved error context state */
790 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
791 if (yyerrctx == NULL) goto yyenomem;
792 yyerrctx->save = yyps->save;
793 yyerrctx->state = yystate;
794 yyerrctx->errflag = yyerrflag;
795 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
796 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
797 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
798 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
799 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
800 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
801 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
803 yyerrctx->lexeme = (int) (yylvp - yylvals);
805 yylvp = yylvals + save->lexeme;
806 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
807 yylpp = yylpsns + save->lexeme;
809 yylexp = yylexemes + save->lexeme;
811 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
812 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
813 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
814 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
815 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
816 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
817 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
820 yystate = save->state;
821 /* We tried shift, try reduce now */
822 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
823 yyps->save = save->save;
827 /* Nothing left on the stack -- error */
832 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
835 /* Restore state as it was in the most forward-advanced error */
836 yylvp = yylvals + yyerrctx->lexeme;
837 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
838 yylpp = yylpsns + yyerrctx->lexeme;
840 yylexp = yylexemes + yyerrctx->lexeme;
843 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
846 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
847 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
848 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
849 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
850 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
851 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
852 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
854 yystate = yyerrctx->state;
855 yyFreeState(yyerrctx);
860 if (yynewerrflag == 0) goto yyinrecovery;
861 #endif /* YYBTYACC */
863 YYERROR_CALL("syntax error");
864 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
865 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
880 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
881 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
885 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
886 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
888 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
889 yystate = yytable[yyn];
890 *++yystack.s_mark = yytable[yyn];
891 *++yystack.l_mark = yylval;
892 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
893 /* lookahead position is error end position */
894 yyerror_loc_range[1] = yylloc;
895 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
896 *++yystack.p_mark = yyloc;
904 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
905 YYDEBUGSTR, yydepth, *yystack.s_mark);
907 if (yystack.s_mark <= yystack.s_base) goto yyabort;
908 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
909 /* the current TOS position is the error start position */
910 yyerror_loc_range[0] = *yystack.p_mark;
912 #if defined(YYDESTRUCT_CALL)
915 #endif /* YYBTYACC */
916 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
917 YYDESTRUCT_CALL("error: discarding state",
918 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
920 YYDESTRUCT_CALL("error: discarding state",
921 yystos[*yystack.s_mark], yystack.l_mark);
922 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
923 #endif /* defined(YYDESTRUCT_CALL) */
926 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
934 if (yychar == YYEOF) goto yyabort;
938 yys = yyname[YYTRANSLATE(yychar)];
939 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
940 YYDEBUGSTR, yydepth, yystate, yychar, yys);
943 #if defined(YYDESTRUCT_CALL)
946 #endif /* YYBTYACC */
947 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
948 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
950 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
951 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
952 #endif /* defined(YYDESTRUCT_CALL) */
962 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
963 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
964 #ifdef YYSTYPE_TOSTRING
967 #endif /* YYBTYACC */
972 for (i = yym; i > 0; i--)
974 if (i != yym) fputs(", ", stderr);
975 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
976 yystack.l_mark[1-i]), stderr);
985 yyval = yystack.l_mark[1-yym];
987 memset(&yyval, 0, sizeof yyval);
988 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
990 /* Perform position reduction */
991 memset(&yyloc, 0, sizeof(yyloc));
994 #endif /* YYBTYACC */
996 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
997 /* just in case YYERROR is invoked within the action, save
998 the start of the rhs as the error start position */
999 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1008 yystack.s_mark -= yym;
1009 yystate = *yystack.s_mark;
1010 yystack.l_mark -= yym;
1011 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1012 yystack.p_mark -= yym;
1015 if (yystate == 0 && yym == 0)
1020 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1021 #ifdef YYSTYPE_TOSTRING
1024 #endif /* YYBTYACC */
1025 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1027 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1031 *++yystack.s_mark = YYFINAL;
1032 *++yystack.l_mark = yyval;
1033 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1034 *++yystack.p_mark = yyloc;
1042 /* we're currently re-reading tokens */
1044 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1052 /* in trial mode; save scanner results for future parse attempts */
1053 if (yylvp == yylvlim)
1054 { /* Enlarge lexical value queue */
1055 size_t p = (size_t) (yylvp - yylvals);
1056 size_t s = (size_t) (yylvlim - yylvals);
1058 s += YYLVQUEUEGROWTH;
1059 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1061 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1063 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1064 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1067 yylvp = yylve = yylvals + p;
1068 yylvlim = yylvals + s;
1069 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1070 yylpp = yylpe = yylpsns + p;
1071 yylplim = yylpsns + s;
1073 yylexp = yylexemes + p;
1075 *yylexp = (short) YYLEX;
1078 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1085 /* normal operation, no conflict encountered */
1086 #endif /* YYBTYACC */
1090 #endif /* YYBTYACC */
1091 if (yychar < 0) yychar = YYEOF;
1092 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1096 yys = yyname[YYTRANSLATE(yychar)];
1097 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1098 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1102 if (yychar == YYEOF) goto yyaccept;
1105 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1106 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1107 yystate = yytable[yyn];
1109 yystate = yydgoto[yym];
1113 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1114 #ifdef YYSTYPE_TOSTRING
1117 #endif /* YYBTYACC */
1118 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1120 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1123 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1124 *++yystack.s_mark = (short) yystate;
1125 *++yystack.l_mark = yyval;
1126 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1127 *++yystack.p_mark = yyloc;
1132 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1134 if (yypath) YYABORT;
1137 YYParseState *save = yyps->save;
1138 yyps->save = save->save;
1139 save->save = yypath;
1144 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1145 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1149 yyFreeState(yyerrctx);
1152 yylvp = yylvals + yypath->lexeme;
1153 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1154 yylpp = yylpsns + yypath->lexeme;
1156 yylexp = yylexemes + yypath->lexeme;
1158 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1159 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1160 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1161 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1162 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1163 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1164 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1166 yystate = yypath->state;
1168 #endif /* YYBTYACC */
1171 YYERROR_CALL("yacc stack overflow");
1175 YYERROR_CALL("memory exhausted");
1177 #endif /* YYBTYACC */
1187 if (yyps->save) goto yyvalid;
1188 #endif /* YYBTYACC */
1192 #if defined(YYDESTRUCT_CALL)
1193 if (yychar != YYEOF && yychar != YYEMPTY)
1194 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1195 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1197 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1198 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1202 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1205 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1206 YYDESTRUCT_CALL("cleanup: discarding state",
1207 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1209 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1210 YYDESTRUCT_CALL("cleanup: discarding state",
1211 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1212 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1214 #endif /* defined(YYDESTRUCT_CALL) */
1219 yyFreeState(yyerrctx);
1224 YYParseState *save = yyps;
1231 YYParseState *save = yypath;
1232 yypath = save->save;
1236 #endif /* YYBTYACC */
1237 yyfreestack(&yystack);