1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */
8 #define YYCHECK "yyyymmdd"
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
18 #define YYDEBUGSTR YYPREFIX "debug"
21 #define yyparse err_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,
191 static const YYINT err_syntax10_ctable[] = { -1,
198 #define YYMAXTOKEN 256
199 #define YYUNDFTOKEN 259
200 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
202 static const char *const err_syntax10_name[] = {
204 "$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,
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,
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,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,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,"error","$accept","S",
213 static const char *const err_syntax10_rule[] = {
227 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
228 YYLTYPE yyloc; /* position returned by actions */
229 YYLTYPE yylloc; /* position from the lexer */
232 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
233 #ifndef YYLLOC_DEFAULT
234 #define YYLLOC_DEFAULT(loc, rhs, n) \
239 (loc).first_line = ((rhs)[-1]).last_line; \
240 (loc).first_column = ((rhs)[-1]).last_column; \
241 (loc).last_line = ((rhs)[-1]).last_line; \
242 (loc).last_column = ((rhs)[-1]).last_column; \
246 (loc).first_line = ((rhs)[ 0 ]).first_line; \
247 (loc).first_column = ((rhs)[ 0 ]).first_column; \
248 (loc).last_line = ((rhs)[n-1]).last_line; \
249 (loc).last_column = ((rhs)[n-1]).last_column; \
252 #endif /* YYLLOC_DEFAULT */
253 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
256 #ifndef YYLVQUEUEGROWTH
257 #define YYLVQUEUEGROWTH 32
259 #endif /* YYBTYACC */
261 /* define the initial stack-sizes */
264 #define YYMAXDEPTH YYSTACKSIZE
267 #define YYSTACKSIZE YYMAXDEPTH
269 #define YYSTACKSIZE 10000
270 #define YYMAXDEPTH 10000
274 #ifndef YYINITSTACKSIZE
275 #define YYINITSTACKSIZE 200
285 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
292 struct YYParseState_s
294 struct YYParseState_s *save; /* Previously saved parser state */
295 YYSTACKDATA yystack; /* saved parser stack */
296 int state; /* saved parser state */
297 int errflag; /* saved error recovery status */
298 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
299 YYINT ctry; /* saved index in yyctable[] for this conflict */
301 typedef struct YYParseState_s YYParseState;
302 #endif /* YYBTYACC */
303 /* variables for the parser stack */
304 static YYSTACKDATA yystack;
307 /* Current parser state */
308 static YYParseState *yyps = 0;
310 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
311 static YYParseState *yypath = 0;
313 /* Base of the lexical value queue */
314 static YYSTYPE *yylvals = 0;
316 /* Current position at lexical value queue */
317 static YYSTYPE *yylvp = 0;
319 /* End position of lexical value queue */
320 static YYSTYPE *yylve = 0;
322 /* The last allocated position at the lexical value queue */
323 static YYSTYPE *yylvlim = 0;
325 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
326 /* Base of the lexical position queue */
327 static YYLTYPE *yylpsns = 0;
329 /* Current position at lexical position queue */
330 static YYLTYPE *yylpp = 0;
332 /* End position of lexical position queue */
333 static YYLTYPE *yylpe = 0;
335 /* The last allocated position at the lexical position queue */
336 static YYLTYPE *yylplim = 0;
339 /* Current position at lexical token queue */
340 static short *yylexp = 0;
342 static short *yylexemes = 0;
343 #endif /* YYBTYACC */
344 #line 12 "err_syntax10.y"
351 printf("yyparse() = %d\n", yyparse());
362 yyerror(const char* s)
366 #line 367 "err_syntax10.tab.c"
368 /* For use in generated program */
369 #define yydepth (int)(yystack.s_mark - yystack.s_base)
371 #define yytrial (yyps->save)
372 #endif /* YYBTYACC */
375 #include <stdio.h> /* needed for printf */
378 #include <stdlib.h> /* needed for malloc, etc */
379 #include <string.h> /* needed for memset */
381 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
382 static int yygrowstack(YYSTACKDATA *data)
388 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
392 if ((newsize = data->stacksize) == 0)
393 newsize = YYINITSTACKSIZE;
394 else if (newsize >= YYMAXDEPTH)
396 else if ((newsize *= 2) > YYMAXDEPTH)
397 newsize = YYMAXDEPTH;
399 i = (int) (data->s_mark - data->s_base);
400 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
404 data->s_base = newss;
405 data->s_mark = newss + i;
407 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
411 data->l_base = newvs;
412 data->l_mark = newvs + i;
414 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
415 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
419 data->p_base = newps;
420 data->p_mark = newps + i;
423 data->stacksize = newsize;
424 data->s_last = data->s_base + newsize - 1;
428 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
433 #if YYPURE || defined(YY_NO_LEAKS)
434 static void yyfreestack(YYSTACKDATA *data)
438 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
441 memset(data, 0, sizeof(*data));
444 #define yyfreestack(data) /* nothing */
445 #endif /* YYPURE || defined(YY_NO_LEAKS) */
448 static YYParseState *
449 yyNewState(unsigned size)
451 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
452 if (p == NULL) return NULL;
454 p->yystack.stacksize = size;
457 p->yystack.s_base = NULL;
458 p->yystack.l_base = NULL;
459 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
460 p->yystack.p_base = NULL;
464 p->yystack.s_base = (short *) malloc(size * sizeof(short));
465 if (p->yystack.s_base == NULL) return NULL;
466 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
467 if (p->yystack.l_base == NULL) return NULL;
468 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
469 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
470 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
471 if (p->yystack.p_base == NULL) return NULL;
472 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
479 yyFreeState(YYParseState *p)
481 yyfreestack(&p->yystack);
484 #endif /* YYBTYACC */
486 #define YYABORT goto yyabort
487 #define YYREJECT goto yyabort
488 #define YYACCEPT goto yyaccept
489 #define YYERROR goto yyerrlab
491 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
492 #define YYVALID_NESTED do { if (yyps->save && \
493 yyps->save->save == 0) goto yyvalid; } while(0)
494 #endif /* YYBTYACC */
499 int yym, yyn, yystate, yyresult;
502 YYParseState *yyerrctx = NULL;
503 #endif /* YYBTYACC */
504 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
505 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
510 if ((yys = getenv("YYDEBUG")) != 0)
513 if (yyn >= '0' && yyn <= '9')
517 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
521 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
523 #endif /* YYBTYACC */
530 memset(&yystack, 0, sizeof(yystack));
533 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
534 yystack.s_mark = yystack.s_base;
535 yystack.l_mark = yystack.l_base;
536 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
537 yystack.p_mark = yystack.p_base;
543 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
550 /* we're currently re-reading tokens */
552 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
560 /* in trial mode; save scanner results for future parse attempts */
561 if (yylvp == yylvlim)
562 { /* Enlarge lexical value queue */
563 size_t p = (size_t) (yylvp - yylvals);
564 size_t s = (size_t) (yylvlim - yylvals);
566 s += YYLVQUEUEGROWTH;
567 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
568 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
569 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
570 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
572 yylvp = yylve = yylvals + p;
573 yylvlim = yylvals + s;
574 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
575 yylpp = yylpe = yylpsns + p;
576 yylplim = yylpsns + s;
578 yylexp = yylexemes + p;
580 *yylexp = (short) YYLEX;
583 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
590 /* normal operation, no conflict encountered */
591 #endif /* YYBTYACC */
595 #endif /* YYBTYACC */
596 if (yychar < 0) yychar = YYEOF;
597 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
601 yys = yyname[YYTRANSLATE(yychar)];
602 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
603 YYDEBUGSTR, yydepth, yystate, yychar, yys);
604 #ifdef YYSTYPE_TOSTRING
607 #endif /* YYBTYACC */
608 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
616 /* Do we have a conflict? */
617 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
618 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
627 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
628 YYDEBUGSTR, yydepth, yystate);
630 /* Switch to the next conflict context */
635 if (save->state != yystate) YYABORT;
642 /* Unresolved conflict - start/continue trial parse */
647 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
649 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
651 fputs("Starting trial parse.\n", stderr);
654 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
655 if (save == NULL) goto yyenomem;
656 save->save = yyps->save;
657 save->state = yystate;
658 save->errflag = yyerrflag;
659 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
660 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
661 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
662 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
663 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
664 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
665 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
668 if (yyctable[ctry] == -1)
671 if (yydebug && yychar >= YYEOF)
672 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
677 if (yyps->save == NULL)
679 /* If this is a first conflict in the stack, start saving lexemes */
682 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
683 if (yylexemes == NULL) goto yyenomem;
684 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
685 if (yylvals == NULL) goto yyenomem;
686 yylvlim = yylvals + YYLVQUEUEGROWTH;
687 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
688 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
689 if (yylpsns == NULL) goto yyenomem;
690 yylplim = yylpsns + YYLVQUEUEGROWTH;
695 yylvp = yylve = yylvals;
696 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
697 yylpp = yylpe = yylpsns;
703 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
706 *yylexp = (short) yychar;
714 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
720 save->lexeme = (int) (yylvp - yylvals);
723 if (yytable[yyn] == ctry)
727 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
728 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
733 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
738 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
740 yystate = yyctable[ctry];
741 *++yystack.s_mark = (short) yystate;
742 *++yystack.l_mark = yylval;
743 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
744 *++yystack.p_mark = yylloc;
747 if (yyerrflag > 0) --yyerrflag;
752 yyn = yyctable[ctry];
755 } /* End of code dealing with conflicts */
756 #endif /* YYBTYACC */
757 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
758 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
762 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
763 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
765 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
766 yystate = yytable[yyn];
767 *++yystack.s_mark = yytable[yyn];
768 *++yystack.l_mark = yylval;
769 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
770 *++yystack.p_mark = yylloc;
773 if (yyerrflag > 0) --yyerrflag;
776 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
777 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
782 if (yyerrflag != 0) goto yyinrecovery;
795 YYParseState *save = yyps->save;
798 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
799 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
800 (int)(yylvp - yylvals - yyps->save->lexeme));
802 /* Memorize most forward-looking error state in case it's really an error. */
803 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
805 /* Free old saved error context state */
806 if (yyerrctx) yyFreeState(yyerrctx);
807 /* Create and fill out new saved error context state */
808 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
809 if (yyerrctx == NULL) goto yyenomem;
810 yyerrctx->save = yyps->save;
811 yyerrctx->state = yystate;
812 yyerrctx->errflag = yyerrflag;
813 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
814 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
815 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
816 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
817 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
818 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
819 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
821 yyerrctx->lexeme = (int) (yylvp - yylvals);
823 yylvp = yylvals + save->lexeme;
824 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
825 yylpp = yylpsns + save->lexeme;
827 yylexp = yylexemes + save->lexeme;
829 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
830 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
831 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
832 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
833 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
834 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
835 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
838 yystate = save->state;
839 /* We tried shift, try reduce now */
840 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
841 yyps->save = save->save;
845 /* Nothing left on the stack -- error */
850 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
853 /* Restore state as it was in the most forward-advanced error */
854 yylvp = yylvals + yyerrctx->lexeme;
855 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
856 yylpp = yylpsns + yyerrctx->lexeme;
858 yylexp = yylexemes + yyerrctx->lexeme;
861 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
864 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
865 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
866 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
867 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
868 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
869 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
870 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
872 yystate = yyerrctx->state;
873 yyFreeState(yyerrctx);
878 if (yynewerrflag == 0) goto yyinrecovery;
879 #endif /* YYBTYACC */
881 YYERROR_CALL("syntax error");
882 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
883 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
898 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
899 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
903 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
904 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
906 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
907 yystate = yytable[yyn];
908 *++yystack.s_mark = yytable[yyn];
909 *++yystack.l_mark = yylval;
910 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
911 /* lookahead position is error end position */
912 yyerror_loc_range[1] = yylloc;
913 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
914 *++yystack.p_mark = yyloc;
922 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
923 YYDEBUGSTR, yydepth, *yystack.s_mark);
925 if (yystack.s_mark <= yystack.s_base) goto yyabort;
926 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
927 /* the current TOS position is the error start position */
928 yyerror_loc_range[0] = *yystack.p_mark;
930 #if defined(YYDESTRUCT_CALL)
933 #endif /* YYBTYACC */
934 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
935 YYDESTRUCT_CALL("error: discarding state",
936 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
938 YYDESTRUCT_CALL("error: discarding state",
939 yystos[*yystack.s_mark], yystack.l_mark);
940 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
941 #endif /* defined(YYDESTRUCT_CALL) */
944 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
952 if (yychar == YYEOF) goto yyabort;
956 yys = yyname[YYTRANSLATE(yychar)];
957 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
958 YYDEBUGSTR, yydepth, yystate, yychar, yys);
961 #if defined(YYDESTRUCT_CALL)
964 #endif /* YYBTYACC */
965 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
966 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
968 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
969 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
970 #endif /* defined(YYDESTRUCT_CALL) */
980 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
981 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
982 #ifdef YYSTYPE_TOSTRING
985 #endif /* YYBTYACC */
990 for (i = yym; i > 0; i--)
992 if (i != yym) fputs(", ", stderr);
993 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
994 yystack.l_mark[1-i]), stderr);
1003 yyval = yystack.l_mark[1-yym];
1005 memset(&yyval, 0, sizeof yyval);
1006 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1008 /* Perform position reduction */
1009 memset(&yyloc, 0, sizeof(yyloc));
1012 #endif /* YYBTYACC */
1014 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1015 /* just in case YYERROR is invoked within the action, save
1016 the start of the rhs as the error start position */
1017 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1026 yystack.s_mark -= yym;
1027 yystate = *yystack.s_mark;
1028 yystack.l_mark -= yym;
1029 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1030 yystack.p_mark -= yym;
1033 if (yystate == 0 && yym == 0)
1038 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1039 #ifdef YYSTYPE_TOSTRING
1042 #endif /* YYBTYACC */
1043 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1045 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1049 *++yystack.s_mark = YYFINAL;
1050 *++yystack.l_mark = yyval;
1051 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1052 *++yystack.p_mark = yyloc;
1060 /* we're currently re-reading tokens */
1062 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1070 /* in trial mode; save scanner results for future parse attempts */
1071 if (yylvp == yylvlim)
1072 { /* Enlarge lexical value queue */
1073 size_t p = (size_t) (yylvp - yylvals);
1074 size_t s = (size_t) (yylvlim - yylvals);
1076 s += YYLVQUEUEGROWTH;
1077 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1079 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1081 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1082 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1085 yylvp = yylve = yylvals + p;
1086 yylvlim = yylvals + s;
1087 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1088 yylpp = yylpe = yylpsns + p;
1089 yylplim = yylpsns + s;
1091 yylexp = yylexemes + p;
1093 *yylexp = (short) YYLEX;
1096 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1103 /* normal operation, no conflict encountered */
1104 #endif /* YYBTYACC */
1108 #endif /* YYBTYACC */
1109 if (yychar < 0) yychar = YYEOF;
1110 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1114 yys = yyname[YYTRANSLATE(yychar)];
1115 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1116 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1120 if (yychar == YYEOF) goto yyaccept;
1123 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1124 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1125 yystate = yytable[yyn];
1127 yystate = yydgoto[yym];
1131 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1132 #ifdef YYSTYPE_TOSTRING
1135 #endif /* YYBTYACC */
1136 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1138 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1141 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1142 *++yystack.s_mark = (short) yystate;
1143 *++yystack.l_mark = yyval;
1144 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1145 *++yystack.p_mark = yyloc;
1150 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1152 if (yypath) YYABORT;
1155 YYParseState *save = yyps->save;
1156 yyps->save = save->save;
1157 save->save = yypath;
1162 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1163 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1167 yyFreeState(yyerrctx);
1170 yylvp = yylvals + yypath->lexeme;
1171 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1172 yylpp = yylpsns + yypath->lexeme;
1174 yylexp = yylexemes + yypath->lexeme;
1176 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1177 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1178 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1179 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1180 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1181 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1182 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1184 yystate = yypath->state;
1186 #endif /* YYBTYACC */
1189 YYERROR_CALL("yacc stack overflow");
1193 YYERROR_CALL("memory exhausted");
1195 #endif /* YYBTYACC */
1205 if (yyps->save) goto yyvalid;
1206 #endif /* YYBTYACC */
1210 #if defined(YYDESTRUCT_CALL)
1211 if (yychar != YYEOF && yychar != YYEMPTY)
1212 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1213 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1215 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1216 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1220 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1223 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1224 YYDESTRUCT_CALL("cleanup: discarding state",
1225 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1227 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1228 YYDESTRUCT_CALL("cleanup: discarding state",
1229 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1230 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1232 #endif /* defined(YYDESTRUCT_CALL) */
1237 yyFreeState(yyerrctx);
1242 YYParseState *save = yyps;
1249 YYParseState *save = yypath;
1250 yypath = save->save;
1254 #endif /* YYBTYACC */
1255 yyfreestack(&yystack);