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 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,
200 #define YYMAXTOKEN 256
201 #define YYUNDFTOKEN 259
202 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
204 static const char *const err_syntax11_name[] = {
206 "$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,
207 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
208 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
209 0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
210 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,"error","$accept","S",
215 static const char *const err_syntax11_rule[] = {
229 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
230 YYLTYPE yyloc; /* position returned by actions */
231 YYLTYPE yylloc; /* position from the lexer */
234 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
235 #ifndef YYLLOC_DEFAULT
236 #define YYLLOC_DEFAULT(loc, rhs, n) \
241 (loc).first_line = ((rhs)[-1]).last_line; \
242 (loc).first_column = ((rhs)[-1]).last_column; \
243 (loc).last_line = ((rhs)[-1]).last_line; \
244 (loc).last_column = ((rhs)[-1]).last_column; \
248 (loc).first_line = ((rhs)[ 0 ]).first_line; \
249 (loc).first_column = ((rhs)[ 0 ]).first_column; \
250 (loc).last_line = ((rhs)[n-1]).last_line; \
251 (loc).last_column = ((rhs)[n-1]).last_column; \
254 #endif /* YYLLOC_DEFAULT */
255 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
258 #ifndef YYLVQUEUEGROWTH
259 #define YYLVQUEUEGROWTH 32
261 #endif /* YYBTYACC */
263 /* define the initial stack-sizes */
266 #define YYMAXDEPTH YYSTACKSIZE
269 #define YYSTACKSIZE YYMAXDEPTH
271 #define YYSTACKSIZE 10000
272 #define YYMAXDEPTH 10000
276 #ifndef YYINITSTACKSIZE
277 #define YYINITSTACKSIZE 200
287 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
294 struct YYParseState_s
296 struct YYParseState_s *save; /* Previously saved parser state */
297 YYSTACKDATA yystack; /* saved parser stack */
298 int state; /* saved parser state */
299 int errflag; /* saved error recovery status */
300 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
301 YYINT ctry; /* saved index in yyctable[] for this conflict */
303 typedef struct YYParseState_s YYParseState;
304 #endif /* YYBTYACC */
305 /* variables for the parser stack */
306 static YYSTACKDATA yystack;
309 /* Current parser state */
310 static YYParseState *yyps = 0;
312 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
313 static YYParseState *yypath = 0;
315 /* Base of the lexical value queue */
316 static YYSTYPE *yylvals = 0;
318 /* Current position at lexical value queue */
319 static YYSTYPE *yylvp = 0;
321 /* End position of lexical value queue */
322 static YYSTYPE *yylve = 0;
324 /* The last allocated position at the lexical value queue */
325 static YYSTYPE *yylvlim = 0;
327 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
328 /* Base of the lexical position queue */
329 static YYLTYPE *yylpsns = 0;
331 /* Current position at lexical position queue */
332 static YYLTYPE *yylpp = 0;
334 /* End position of lexical position queue */
335 static YYLTYPE *yylpe = 0;
337 /* The last allocated position at the lexical position queue */
338 static YYLTYPE *yylplim = 0;
341 /* Current position at lexical token queue */
342 static short *yylexp = 0;
344 static short *yylexemes = 0;
345 #endif /* YYBTYACC */
346 #line 12 "err_syntax11.y"
353 printf("yyparse() = %d\n", yyparse());
364 yyerror(const char* s)
368 #line 369 "err_syntax11.tab.c"
370 /* For use in generated program */
371 #define yydepth (int)(yystack.s_mark - yystack.s_base)
373 #define yytrial (yyps->save)
374 #endif /* YYBTYACC */
377 #include <stdio.h> /* needed for printf */
380 #include <stdlib.h> /* needed for malloc, etc */
381 #include <string.h> /* needed for memset */
383 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
384 static int yygrowstack(YYSTACKDATA *data)
390 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
394 if ((newsize = data->stacksize) == 0)
395 newsize = YYINITSTACKSIZE;
396 else if (newsize >= YYMAXDEPTH)
398 else if ((newsize *= 2) > YYMAXDEPTH)
399 newsize = YYMAXDEPTH;
401 i = (int) (data->s_mark - data->s_base);
402 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
406 data->s_base = newss;
407 data->s_mark = newss + i;
409 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
413 data->l_base = newvs;
414 data->l_mark = newvs + i;
416 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
417 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
421 data->p_base = newps;
422 data->p_mark = newps + i;
425 data->stacksize = newsize;
426 data->s_last = data->s_base + newsize - 1;
430 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
435 #if YYPURE || defined(YY_NO_LEAKS)
436 static void yyfreestack(YYSTACKDATA *data)
440 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
443 memset(data, 0, sizeof(*data));
446 #define yyfreestack(data) /* nothing */
447 #endif /* YYPURE || defined(YY_NO_LEAKS) */
450 static YYParseState *
451 yyNewState(unsigned size)
453 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
454 if (p == NULL) return NULL;
456 p->yystack.stacksize = size;
459 p->yystack.s_base = NULL;
460 p->yystack.l_base = NULL;
461 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
462 p->yystack.p_base = NULL;
466 p->yystack.s_base = (short *) malloc(size * sizeof(short));
467 if (p->yystack.s_base == NULL) return NULL;
468 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
469 if (p->yystack.l_base == NULL) return NULL;
470 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
471 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
472 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
473 if (p->yystack.p_base == NULL) return NULL;
474 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
481 yyFreeState(YYParseState *p)
483 yyfreestack(&p->yystack);
486 #endif /* YYBTYACC */
488 #define YYABORT goto yyabort
489 #define YYREJECT goto yyabort
490 #define YYACCEPT goto yyaccept
491 #define YYERROR goto yyerrlab
493 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
494 #define YYVALID_NESTED do { if (yyps->save && \
495 yyps->save->save == 0) goto yyvalid; } while(0)
496 #endif /* YYBTYACC */
501 int yym, yyn, yystate, yyresult;
504 YYParseState *yyerrctx = NULL;
505 #endif /* YYBTYACC */
506 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
507 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
512 if ((yys = getenv("YYDEBUG")) != 0)
515 if (yyn >= '0' && yyn <= '9')
519 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
523 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
525 #endif /* YYBTYACC */
532 memset(&yystack, 0, sizeof(yystack));
535 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
536 yystack.s_mark = yystack.s_base;
537 yystack.l_mark = yystack.l_base;
538 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
539 yystack.p_mark = yystack.p_base;
545 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
552 /* we're currently re-reading tokens */
554 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
562 /* in trial mode; save scanner results for future parse attempts */
563 if (yylvp == yylvlim)
564 { /* Enlarge lexical value queue */
565 int p = yylvp - yylvals;
566 int s = yylvlim - yylvals;
568 s += YYLVQUEUEGROWTH;
569 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
570 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
571 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
572 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
574 yylvp = yylve = yylvals + p;
575 yylvlim = yylvals + s;
576 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
577 yylpp = yylpe = yylpsns + p;
578 yylplim = yylpsns + s;
580 yylexp = yylexemes + p;
582 *yylexp = (short) YYLEX;
585 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
592 /* normal operation, no conflict encountered */
593 #endif /* YYBTYACC */
597 #endif /* YYBTYACC */
598 if (yychar < 0) yychar = YYEOF;
599 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
603 yys = yyname[YYTRANSLATE(yychar)];
604 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
605 YYDEBUGSTR, yydepth, yystate, yychar, yys);
606 #ifdef YYSTYPE_TOSTRING
609 #endif /* YYBTYACC */
610 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
618 /* Do we have a conflict? */
619 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
620 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
629 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
630 YYDEBUGSTR, yydepth, yystate);
632 /* Switch to the next conflict context */
637 if (save->state != yystate) YYABORT;
644 /* Unresolved conflict - start/continue trial parse */
649 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
651 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
653 fputs("Starting trial parse.\n", stderr);
656 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
657 if (save == NULL) goto yyenomem;
658 save->save = yyps->save;
659 save->state = yystate;
660 save->errflag = yyerrflag;
661 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
662 memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
663 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
664 memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
665 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
666 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
667 memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
670 if (yyctable[ctry] == -1)
673 if (yydebug && yychar >= YYEOF)
674 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
679 if (yyps->save == NULL)
681 /* If this is a first conflict in the stack, start saving lexemes */
684 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
685 if (yylexemes == NULL) goto yyenomem;
686 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
687 if (yylvals == NULL) goto yyenomem;
688 yylvlim = yylvals + YYLVQUEUEGROWTH;
689 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
690 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
691 if (yylpsns == NULL) goto yyenomem;
692 yylplim = yylpsns + YYLVQUEUEGROWTH;
697 yylvp = yylve = yylvals;
698 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
699 yylpp = yylpe = yylpsns;
705 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
708 *yylexp = (short) yychar;
716 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
722 save->lexeme = yylvp - yylvals;
725 if (yytable[yyn] == ctry)
729 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
730 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
735 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
740 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
742 yystate = yyctable[ctry];
743 *++yystack.s_mark = (short) yystate;
744 *++yystack.l_mark = yylval;
745 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
746 *++yystack.p_mark = yylloc;
749 if (yyerrflag > 0) --yyerrflag;
754 yyn = yyctable[ctry];
757 } /* End of code dealing with conflicts */
758 #endif /* YYBTYACC */
759 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
760 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
764 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
765 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
767 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
768 yystate = yytable[yyn];
769 *++yystack.s_mark = yytable[yyn];
770 *++yystack.l_mark = yylval;
771 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
772 *++yystack.p_mark = yylloc;
775 if (yyerrflag > 0) --yyerrflag;
778 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
779 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
784 if (yyerrflag != 0) goto yyinrecovery;
797 YYParseState *save = yyps->save;
800 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
801 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
802 (int)(yylvp - yylvals - yyps->save->lexeme));
804 /* Memorize most forward-looking error state in case it's really an error. */
805 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
807 /* Free old saved error context state */
808 if (yyerrctx) yyFreeState(yyerrctx);
809 /* Create and fill out new saved error context state */
810 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
811 if (yyerrctx == NULL) goto yyenomem;
812 yyerrctx->save = yyps->save;
813 yyerrctx->state = yystate;
814 yyerrctx->errflag = yyerrflag;
815 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
816 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
817 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
818 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
819 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
820 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
821 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
823 yyerrctx->lexeme = yylvp - yylvals;
825 yylvp = yylvals + save->lexeme;
826 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
827 yylpp = yylpsns + save->lexeme;
829 yylexp = yylexemes + save->lexeme;
831 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
832 memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
833 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
834 memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
835 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
836 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
837 memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
840 yystate = save->state;
841 /* We tried shift, try reduce now */
842 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
843 yyps->save = save->save;
847 /* Nothing left on the stack -- error */
852 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
855 /* Restore state as it was in the most forward-advanced error */
856 yylvp = yylvals + yyerrctx->lexeme;
857 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
858 yylpp = yylpsns + yyerrctx->lexeme;
860 yylexp = yylexemes + yyerrctx->lexeme;
863 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
866 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
867 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
868 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
869 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
870 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
871 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
872 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
874 yystate = yyerrctx->state;
875 yyFreeState(yyerrctx);
880 if (yynewerrflag == 0) goto yyinrecovery;
881 #endif /* YYBTYACC */
883 YYERROR_CALL("syntax error");
884 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
885 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
900 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
901 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
905 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
906 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
908 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
909 yystate = yytable[yyn];
910 *++yystack.s_mark = yytable[yyn];
911 *++yystack.l_mark = yylval;
912 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
913 /* lookahead position is error end position */
914 yyerror_loc_range[1] = yylloc;
915 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
916 *++yystack.p_mark = yyloc;
924 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
925 YYDEBUGSTR, yydepth, *yystack.s_mark);
927 if (yystack.s_mark <= yystack.s_base) goto yyabort;
928 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
929 /* the current TOS position is the error start position */
930 yyerror_loc_range[0] = *yystack.p_mark;
932 #if defined(YYDESTRUCT_CALL)
935 #endif /* YYBTYACC */
936 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
937 YYDESTRUCT_CALL("error: discarding state",
938 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
940 YYDESTRUCT_CALL("error: discarding state",
941 yystos[*yystack.s_mark], yystack.l_mark);
942 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
943 #endif /* defined(YYDESTRUCT_CALL) */
946 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
954 if (yychar == YYEOF) goto yyabort;
958 yys = yyname[YYTRANSLATE(yychar)];
959 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
960 YYDEBUGSTR, yydepth, yystate, yychar, yys);
963 #if defined(YYDESTRUCT_CALL)
966 #endif /* YYBTYACC */
967 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
968 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
970 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
971 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
972 #endif /* defined(YYDESTRUCT_CALL) */
982 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
983 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
984 #ifdef YYSTYPE_TOSTRING
987 #endif /* YYBTYACC */
992 for (i = yym; i > 0; i--)
994 if (i != yym) fputs(", ", stderr);
995 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
996 yystack.l_mark[1-i]), stderr);
1001 fputc('\n', stderr);
1005 yyval = yystack.l_mark[1-yym];
1007 memset(&yyval, 0, sizeof yyval);
1008 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1010 /* Perform position reduction */
1011 memset(&yyloc, 0, sizeof(yyloc));
1014 #endif /* YYBTYACC */
1016 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1017 /* just in case YYERROR is invoked within the action, save
1018 the start of the rhs as the error start position */
1019 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1028 yystack.s_mark -= yym;
1029 yystate = *yystack.s_mark;
1030 yystack.l_mark -= yym;
1031 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1032 yystack.p_mark -= yym;
1035 if (yystate == 0 && yym == 0)
1040 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1041 #ifdef YYSTYPE_TOSTRING
1044 #endif /* YYBTYACC */
1045 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1047 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1051 *++yystack.s_mark = YYFINAL;
1052 *++yystack.l_mark = yyval;
1053 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1054 *++yystack.p_mark = yyloc;
1062 /* we're currently re-reading tokens */
1064 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1072 /* in trial mode; save scanner results for future parse attempts */
1073 if (yylvp == yylvlim)
1074 { /* Enlarge lexical value queue */
1075 int p = yylvp - yylvals;
1076 int s = yylvlim - yylvals;
1078 s += YYLVQUEUEGROWTH;
1079 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1081 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1083 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1084 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1087 yylvp = yylve = yylvals + p;
1088 yylvlim = yylvals + s;
1089 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1090 yylpp = yylpe = yylpsns + p;
1091 yylplim = yylpsns + s;
1093 yylexp = yylexemes + p;
1095 *yylexp = (short) YYLEX;
1098 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1105 /* normal operation, no conflict encountered */
1106 #endif /* YYBTYACC */
1110 #endif /* YYBTYACC */
1111 if (yychar < 0) yychar = YYEOF;
1112 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1116 yys = yyname[YYTRANSLATE(yychar)];
1117 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1118 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1122 if (yychar == YYEOF) goto yyaccept;
1125 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1126 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1127 yystate = yytable[yyn];
1129 yystate = yydgoto[yym];
1133 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1134 #ifdef YYSTYPE_TOSTRING
1137 #endif /* YYBTYACC */
1138 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1140 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1143 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1144 *++yystack.s_mark = (short) yystate;
1145 *++yystack.l_mark = yyval;
1146 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1147 *++yystack.p_mark = yyloc;
1152 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1154 if (yypath) YYABORT;
1157 YYParseState *save = yyps->save;
1158 yyps->save = save->save;
1159 save->save = yypath;
1164 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1165 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1169 yyFreeState(yyerrctx);
1172 yylvp = yylvals + yypath->lexeme;
1173 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1174 yylpp = yylpsns + yypath->lexeme;
1176 yylexp = yylexemes + yypath->lexeme;
1178 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1179 memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1180 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1181 memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1182 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1183 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1184 memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1186 yystate = yypath->state;
1188 #endif /* YYBTYACC */
1191 YYERROR_CALL("yacc stack overflow");
1195 YYERROR_CALL("memory exhausted");
1197 #endif /* YYBTYACC */
1207 if (yyps->save) goto yyvalid;
1208 #endif /* YYBTYACC */
1212 #if defined(YYDESTRUCT_CALL)
1213 if (yychar != YYEOF && yychar != YYEMPTY)
1214 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1215 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1217 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1218 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1222 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1225 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1226 YYDESTRUCT_CALL("cleanup: discarding state",
1227 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1229 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1230 YYDESTRUCT_CALL("cleanup: discarding state",
1231 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1232 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1234 #endif /* defined(YYDESTRUCT_CALL) */
1239 yyFreeState(yyerrctx);
1244 YYParseState *save = yyps;
1251 YYParseState *save = yypath;
1252 yypath = save->save;
1256 #endif /* YYBTYACC */
1257 yyfreestack(&yystack);