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_syntax10_parse
25 #define yylex err_syntax10_lex
29 #define yyerror err_syntax10_error
33 #define yychar err_syntax10_char
37 #define yyval err_syntax10_val
41 #define yylval err_syntax10_lval
45 #define yydebug err_syntax10_debug
49 #define yynerrs err_syntax10_nerrs
53 #define yyerrflag err_syntax10_errflag
54 #endif /* yyerrflag */
57 #define yylhs err_syntax10_lhs
61 #define yylen err_syntax10_len
65 #define yydefred err_syntax10_defred
69 #define yystos err_syntax10_stos
73 #define yydgoto err_syntax10_dgoto
77 #define yysindex err_syntax10_sindex
81 #define yyrindex err_syntax10_rindex
85 #define yygindex err_syntax10_gindex
89 #define yytable err_syntax10_table
93 #define yycheck err_syntax10_check
97 #define yyname err_syntax10_name
101 #define yyrule err_syntax10_rule
107 #define yycindex err_syntax10_cindex
108 #endif /* yycindex */
111 #define yyctable err_syntax10_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "err_syntax10_"
120 #line 2 "err_syntax10.y"
122 static void yyerror(const char *);
123 #line 124 "err_syntax10.tab.c"
125 /* compatibility with bison */
127 /* compatibility with FreeBSD */
128 # ifdef YYPARSE_PARAM_TYPE
129 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
131 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
134 # define YYPARSE_DECL() yyparse(void)
137 /* Parameters sent to lex. */
139 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
140 # define YYLEX yylex(YYLEX_PARAM)
142 # define YYLEX_DECL() yylex(void)
143 # define YYLEX yylex()
146 /* Parameters sent to yyerror. */
148 #define YYERROR_DECL() yyerror(const char *s)
151 #define YYERROR_CALL(msg) yyerror(msg)
154 extern int YYPARSE_DECL();
156 #define YYERRCODE 256
158 static const YYINT err_syntax10_lhs[] = { -1,
161 static const YYINT err_syntax10_len[] = { 2,
164 static const YYINT err_syntax10_defred[] = { 0,
167 static const YYINT err_syntax10_stos[] = { 0,
170 static const YYINT err_syntax10_dgoto[] = { 2,
172 static const YYINT err_syntax10_sindex[] = { -256,
175 static const YYINT err_syntax10_rindex[] = { 0,
179 static const YYINT err_syntax10_cindex[] = { 0,
183 static const YYINT err_syntax10_gindex[] = { 0,
185 #define YYTABLESIZE 0
186 static const YYINT err_syntax10_table[] = { 1,
188 static const YYINT err_syntax10_check[] = { 256,
194 #define YYMAXTOKEN 256
195 #define YYUNDFTOKEN 259
196 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
198 static const char *const err_syntax10_name[] = {
200 "$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,
201 0,"'&'",0,"'('",0,"'*'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
202 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
203 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
204 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
205 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
206 0,0,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","S",
209 static const char *const err_syntax10_rule[] = {
223 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
224 YYLTYPE yyloc; /* position returned by actions */
225 YYLTYPE yylloc; /* position from the lexer */
228 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
229 #ifndef YYLLOC_DEFAULT
230 #define YYLLOC_DEFAULT(loc, rhs, n) \
235 (loc).first_line = ((rhs)[-1]).last_line; \
236 (loc).first_column = ((rhs)[-1]).last_column; \
237 (loc).last_line = ((rhs)[-1]).last_line; \
238 (loc).last_column = ((rhs)[-1]).last_column; \
242 (loc).first_line = ((rhs)[ 0 ]).first_line; \
243 (loc).first_column = ((rhs)[ 0 ]).first_column; \
244 (loc).last_line = ((rhs)[n-1]).last_line; \
245 (loc).last_column = ((rhs)[n-1]).last_column; \
248 #endif /* YYLLOC_DEFAULT */
249 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
252 #ifndef YYLVQUEUEGROWTH
253 #define YYLVQUEUEGROWTH 32
255 #endif /* YYBTYACC */
257 /* define the initial stack-sizes */
260 #define YYMAXDEPTH YYSTACKSIZE
263 #define YYSTACKSIZE YYMAXDEPTH
265 #define YYSTACKSIZE 10000
266 #define YYMAXDEPTH 10000
270 #ifndef YYINITSTACKSIZE
271 #define YYINITSTACKSIZE 200
281 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
288 struct YYParseState_s
290 struct YYParseState_s *save; /* Previously saved parser state */
291 YYSTACKDATA yystack; /* saved parser stack */
292 int state; /* saved parser state */
293 int errflag; /* saved error recovery status */
294 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
295 YYINT ctry; /* saved index in yyctable[] for this conflict */
297 typedef struct YYParseState_s YYParseState;
298 #endif /* YYBTYACC */
299 /* variables for the parser stack */
300 static YYSTACKDATA yystack;
303 /* Current parser state */
304 static YYParseState *yyps = 0;
306 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
307 static YYParseState *yypath = 0;
309 /* Base of the lexical value queue */
310 static YYSTYPE *yylvals = 0;
312 /* Current position at lexical value queue */
313 static YYSTYPE *yylvp = 0;
315 /* End position of lexical value queue */
316 static YYSTYPE *yylve = 0;
318 /* The last allocated position at the lexical value queue */
319 static YYSTYPE *yylvlim = 0;
321 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
322 /* Base of the lexical position queue */
323 static YYLTYPE *yylpsns = 0;
325 /* Current position at lexical position queue */
326 static YYLTYPE *yylpp = 0;
328 /* End position of lexical position queue */
329 static YYLTYPE *yylpe = 0;
331 /* The last allocated position at the lexical position queue */
332 static YYLTYPE *yylplim = 0;
335 /* Current position at lexical token queue */
336 static short *yylexp = 0;
338 static short *yylexemes = 0;
339 #endif /* YYBTYACC */
340 #line 12 "err_syntax10.y"
347 printf("yyparse() = %d\n", yyparse());
358 yyerror(const char* s)
362 #line 363 "err_syntax10.tab.c"
364 /* For use in generated program */
365 #define yydepth (int)(yystack.s_mark - yystack.s_base)
367 #define yytrial (yyps->save)
368 #endif /* YYBTYACC */
371 #include <stdio.h> /* needed for printf */
374 #include <stdlib.h> /* needed for malloc, etc */
375 #include <string.h> /* needed for memset */
377 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
378 static int yygrowstack(YYSTACKDATA *data)
384 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
388 if ((newsize = data->stacksize) == 0)
389 newsize = YYINITSTACKSIZE;
390 else if (newsize >= YYMAXDEPTH)
392 else if ((newsize *= 2) > YYMAXDEPTH)
393 newsize = YYMAXDEPTH;
395 i = (int) (data->s_mark - data->s_base);
396 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
400 data->s_base = newss;
401 data->s_mark = newss + i;
403 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
407 data->l_base = newvs;
408 data->l_mark = newvs + i;
410 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
411 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
415 data->p_base = newps;
416 data->p_mark = newps + i;
419 data->stacksize = newsize;
420 data->s_last = data->s_base + newsize - 1;
424 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
429 #if YYPURE || defined(YY_NO_LEAKS)
430 static void yyfreestack(YYSTACKDATA *data)
434 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
437 memset(data, 0, sizeof(*data));
440 #define yyfreestack(data) /* nothing */
441 #endif /* YYPURE || defined(YY_NO_LEAKS) */
444 static YYParseState *
445 yyNewState(unsigned size)
447 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
448 if (p == NULL) return NULL;
450 p->yystack.stacksize = size;
453 p->yystack.s_base = NULL;
454 p->yystack.l_base = NULL;
455 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
456 p->yystack.p_base = NULL;
460 p->yystack.s_base = (short *) malloc(size * sizeof(short));
461 if (p->yystack.s_base == NULL) return NULL;
462 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
463 if (p->yystack.l_base == NULL) return NULL;
464 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
465 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
466 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
467 if (p->yystack.p_base == NULL) return NULL;
468 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
475 yyFreeState(YYParseState *p)
477 yyfreestack(&p->yystack);
480 #endif /* YYBTYACC */
482 #define YYABORT goto yyabort
483 #define YYREJECT goto yyabort
484 #define YYACCEPT goto yyaccept
485 #define YYERROR goto yyerrlab
487 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
488 #define YYVALID_NESTED do { if (yyps->save && \
489 yyps->save->save == 0) goto yyvalid; } while(0)
490 #endif /* YYBTYACC */
495 int yym, yyn, yystate, yyresult;
498 YYParseState *yyerrctx = NULL;
499 #endif /* YYBTYACC */
500 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
501 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
506 if ((yys = getenv("YYDEBUG")) != 0)
509 if (yyn >= '0' && yyn <= '9')
513 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
517 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
519 #endif /* YYBTYACC */
526 memset(&yystack, 0, sizeof(yystack));
529 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
530 yystack.s_mark = yystack.s_base;
531 yystack.l_mark = yystack.l_base;
532 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
533 yystack.p_mark = yystack.p_base;
539 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
546 /* we're currently re-reading tokens */
548 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
556 /* in trial mode; save scanner results for future parse attempts */
557 if (yylvp == yylvlim)
558 { /* Enlarge lexical value queue */
559 int p = yylvp - yylvals;
560 int s = yylvlim - yylvals;
562 s += YYLVQUEUEGROWTH;
563 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
564 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
565 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
566 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
568 yylvp = yylve = yylvals + p;
569 yylvlim = yylvals + s;
570 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
571 yylpp = yylpe = yylpsns + p;
572 yylplim = yylpsns + s;
574 yylexp = yylexemes + p;
576 *yylexp = (short) YYLEX;
579 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
586 /* normal operation, no conflict encountered */
587 #endif /* YYBTYACC */
591 #endif /* YYBTYACC */
592 if (yychar < 0) yychar = YYEOF;
593 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
597 yys = yyname[YYTRANSLATE(yychar)];
598 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
599 YYDEBUGSTR, yydepth, yystate, yychar, yys);
600 #ifdef YYSTYPE_TOSTRING
603 #endif /* YYBTYACC */
604 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
612 /* Do we have a conflict? */
613 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
614 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
623 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
624 YYDEBUGSTR, yydepth, yystate);
626 /* Switch to the next conflict context */
631 if (save->state != yystate) YYABORT;
638 /* Unresolved conflict - start/continue trial parse */
643 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
645 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
647 fputs("Starting trial parse.\n", stderr);
650 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
651 if (save == NULL) goto yyenomem;
652 save->save = yyps->save;
653 save->state = yystate;
654 save->errflag = yyerrflag;
655 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
656 memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
657 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
658 memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
659 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
660 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
661 memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
664 if (yyctable[ctry] == -1)
667 if (yydebug && yychar >= YYEOF)
668 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
673 if (yyps->save == NULL)
675 /* If this is a first conflict in the stack, start saving lexemes */
678 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
679 if (yylexemes == NULL) goto yyenomem;
680 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
681 if (yylvals == NULL) goto yyenomem;
682 yylvlim = yylvals + YYLVQUEUEGROWTH;
683 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
684 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
685 if (yylpsns == NULL) goto yyenomem;
686 yylplim = yylpsns + YYLVQUEUEGROWTH;
691 yylvp = yylve = yylvals;
692 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
693 yylpp = yylpe = yylpsns;
699 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
702 *yylexp = (short) yychar;
710 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
716 save->lexeme = yylvp - yylvals;
719 if (yytable[yyn] == ctry)
723 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
724 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
729 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
734 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
736 yystate = yyctable[ctry];
737 *++yystack.s_mark = (short) yystate;
738 *++yystack.l_mark = yylval;
739 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
740 *++yystack.p_mark = yylloc;
743 if (yyerrflag > 0) --yyerrflag;
748 yyn = yyctable[ctry];
751 } /* End of code dealing with conflicts */
752 #endif /* YYBTYACC */
753 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
754 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
758 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
759 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
761 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
762 yystate = yytable[yyn];
763 *++yystack.s_mark = yytable[yyn];
764 *++yystack.l_mark = yylval;
765 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
766 *++yystack.p_mark = yylloc;
769 if (yyerrflag > 0) --yyerrflag;
772 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
773 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
778 if (yyerrflag != 0) goto yyinrecovery;
791 YYParseState *save = yyps->save;
794 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
795 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
796 (int)(yylvp - yylvals - yyps->save->lexeme));
798 /* Memorize most forward-looking error state in case it's really an error. */
799 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
801 /* Free old saved error context state */
802 if (yyerrctx) yyFreeState(yyerrctx);
803 /* Create and fill out new saved error context state */
804 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
805 if (yyerrctx == NULL) goto yyenomem;
806 yyerrctx->save = yyps->save;
807 yyerrctx->state = yystate;
808 yyerrctx->errflag = yyerrflag;
809 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
810 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
811 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
812 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
813 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
814 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
815 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
817 yyerrctx->lexeme = yylvp - yylvals;
819 yylvp = yylvals + save->lexeme;
820 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
821 yylpp = yylpsns + save->lexeme;
823 yylexp = yylexemes + save->lexeme;
825 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
826 memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
827 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
828 memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
829 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
830 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
831 memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
834 yystate = save->state;
835 /* We tried shift, try reduce now */
836 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
837 yyps->save = save->save;
841 /* Nothing left on the stack -- error */
846 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
849 /* Restore state as it was in the most forward-advanced error */
850 yylvp = yylvals + yyerrctx->lexeme;
851 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
852 yylpp = yylpsns + yyerrctx->lexeme;
854 yylexp = yylexemes + yyerrctx->lexeme;
857 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
860 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
861 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
862 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
863 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
864 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
865 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
866 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
868 yystate = yyerrctx->state;
869 yyFreeState(yyerrctx);
874 if (yynewerrflag == 0) goto yyinrecovery;
875 #endif /* YYBTYACC */
877 YYERROR_CALL("syntax error");
878 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
879 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
894 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
895 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
899 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
900 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
902 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
903 yystate = yytable[yyn];
904 *++yystack.s_mark = yytable[yyn];
905 *++yystack.l_mark = yylval;
906 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
907 /* lookahead position is error end position */
908 yyerror_loc_range[1] = yylloc;
909 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
910 *++yystack.p_mark = yyloc;
918 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
919 YYDEBUGSTR, yydepth, *yystack.s_mark);
921 if (yystack.s_mark <= yystack.s_base) goto yyabort;
922 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
923 /* the current TOS position is the error start position */
924 yyerror_loc_range[0] = *yystack.p_mark;
926 #if defined(YYDESTRUCT_CALL)
929 #endif /* YYBTYACC */
930 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
931 YYDESTRUCT_CALL("error: discarding state",
932 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
934 YYDESTRUCT_CALL("error: discarding state",
935 yystos[*yystack.s_mark], yystack.l_mark);
936 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
937 #endif /* defined(YYDESTRUCT_CALL) */
940 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
948 if (yychar == YYEOF) goto yyabort;
952 yys = yyname[YYTRANSLATE(yychar)];
953 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
954 YYDEBUGSTR, yydepth, yystate, yychar, yys);
957 #if defined(YYDESTRUCT_CALL)
960 #endif /* YYBTYACC */
961 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
962 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
964 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
965 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
966 #endif /* defined(YYDESTRUCT_CALL) */
976 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
977 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
978 #ifdef YYSTYPE_TOSTRING
981 #endif /* YYBTYACC */
986 for (i = yym; i > 0; i--)
988 if (i != yym) fputs(", ", stderr);
989 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
990 yystack.l_mark[1-i]), stderr);
999 yyval = yystack.l_mark[1-yym];
1001 memset(&yyval, 0, sizeof yyval);
1002 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1004 /* Perform position reduction */
1005 memset(&yyloc, 0, sizeof(yyloc));
1008 #endif /* YYBTYACC */
1010 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1011 /* just in case YYERROR is invoked within the action, save
1012 the start of the rhs as the error start position */
1013 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1022 yystack.s_mark -= yym;
1023 yystate = *yystack.s_mark;
1024 yystack.l_mark -= yym;
1025 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1026 yystack.p_mark -= yym;
1029 if (yystate == 0 && yym == 0)
1034 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1035 #ifdef YYSTYPE_TOSTRING
1038 #endif /* YYBTYACC */
1039 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1041 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1045 *++yystack.s_mark = YYFINAL;
1046 *++yystack.l_mark = yyval;
1047 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1048 *++yystack.p_mark = yyloc;
1056 /* we're currently re-reading tokens */
1058 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1066 /* in trial mode; save scanner results for future parse attempts */
1067 if (yylvp == yylvlim)
1068 { /* Enlarge lexical value queue */
1069 int p = yylvp - yylvals;
1070 int s = yylvlim - yylvals;
1072 s += YYLVQUEUEGROWTH;
1073 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1075 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1077 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1078 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1081 yylvp = yylve = yylvals + p;
1082 yylvlim = yylvals + s;
1083 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1084 yylpp = yylpe = yylpsns + p;
1085 yylplim = yylpsns + s;
1087 yylexp = yylexemes + p;
1089 *yylexp = (short) YYLEX;
1092 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1099 /* normal operation, no conflict encountered */
1100 #endif /* YYBTYACC */
1104 #endif /* YYBTYACC */
1105 if (yychar < 0) yychar = YYEOF;
1106 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1110 yys = yyname[YYTRANSLATE(yychar)];
1111 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1112 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1116 if (yychar == YYEOF) goto yyaccept;
1119 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1120 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1121 yystate = yytable[yyn];
1123 yystate = yydgoto[yym];
1127 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1128 #ifdef YYSTYPE_TOSTRING
1131 #endif /* YYBTYACC */
1132 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1134 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1137 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1138 *++yystack.s_mark = (short) yystate;
1139 *++yystack.l_mark = yyval;
1140 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1141 *++yystack.p_mark = yyloc;
1146 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1148 if (yypath) YYABORT;
1151 YYParseState *save = yyps->save;
1152 yyps->save = save->save;
1153 save->save = yypath;
1158 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1159 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1163 yyFreeState(yyerrctx);
1166 yylvp = yylvals + yypath->lexeme;
1167 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1168 yylpp = yylpsns + yypath->lexeme;
1170 yylexp = yylexemes + yypath->lexeme;
1172 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1173 memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1174 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1175 memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1176 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1177 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1178 memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1180 yystate = yypath->state;
1182 #endif /* YYBTYACC */
1185 YYERROR_CALL("yacc stack overflow");
1189 YYERROR_CALL("memory exhausted");
1191 #endif /* YYBTYACC */
1201 if (yyps->save) goto yyvalid;
1202 #endif /* YYBTYACC */
1206 #if defined(YYDESTRUCT_CALL)
1207 if (yychar != YYEOF && yychar != YYEMPTY)
1208 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1209 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1211 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1212 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1216 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1219 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1220 YYDESTRUCT_CALL("cleanup: discarding state",
1221 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1223 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1224 YYDESTRUCT_CALL("cleanup: discarding state",
1225 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1226 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1228 #endif /* defined(YYDESTRUCT_CALL) */
1233 yyFreeState(yyerrctx);
1238 YYParseState *save = yyps;
1245 YYParseState *save = yypath;
1246 yypath = save->save;
1250 #endif /* YYBTYACC */
1251 yyfreestack(&yystack);