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_syntax12_parse
25 #define yylex err_syntax12_lex
29 #define yyerror err_syntax12_error
33 #define yychar err_syntax12_char
37 #define yyval err_syntax12_val
41 #define yylval err_syntax12_lval
45 #define yydebug err_syntax12_debug
49 #define yynerrs err_syntax12_nerrs
53 #define yyerrflag err_syntax12_errflag
54 #endif /* yyerrflag */
57 #define yylhs err_syntax12_lhs
61 #define yylen err_syntax12_len
65 #define yydefred err_syntax12_defred
69 #define yystos err_syntax12_stos
73 #define yydgoto err_syntax12_dgoto
77 #define yysindex err_syntax12_sindex
81 #define yyrindex err_syntax12_rindex
85 #define yygindex err_syntax12_gindex
89 #define yytable err_syntax12_table
93 #define yycheck err_syntax12_check
97 #define yyname err_syntax12_name
101 #define yyrule err_syntax12_rule
107 #define yycindex err_syntax12_cindex
108 #endif /* yycindex */
111 #define yyctable err_syntax12_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "err_syntax12_"
120 #line 2 "err_syntax12.y"
122 static void yyerror(const char *);
123 #line 124 "err_syntax12.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();
163 #define YYERRCODE 256
165 static const YYINT err_syntax12_lhs[] = { -1,
168 static const YYINT err_syntax12_len[] = { 2,
171 static const YYINT err_syntax12_defred[] = { 0,
174 static const YYINT err_syntax12_stos[] = { 0,
177 static const YYINT err_syntax12_dgoto[] = { 2,
179 static const YYINT err_syntax12_sindex[] = { -256,
182 static const YYINT err_syntax12_rindex[] = { 0,
186 static const YYINT err_syntax12_cindex[] = { 0,
190 static const YYINT err_syntax12_gindex[] = { 0,
192 #define YYTABLESIZE 0
193 static const YYINT err_syntax12_table[] = { 1,
195 static const YYINT err_syntax12_check[] = { 256,
198 static const YYINT err_syntax12_ctable[] = { -1,
205 #define YYMAXTOKEN 456
206 #define YYUNDFTOKEN 459
207 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
209 static const char *const err_syntax12_name[] = {
211 "$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,
212 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
213 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
214 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
215 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
216 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
217 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
218 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
219 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
220 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
221 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
222 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"text","$accept","S",
225 static const char *const err_syntax12_rule[] = {
239 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
240 YYLTYPE yyloc; /* position returned by actions */
241 YYLTYPE yylloc; /* position from the lexer */
244 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
245 #ifndef YYLLOC_DEFAULT
246 #define YYLLOC_DEFAULT(loc, rhs, n) \
251 (loc).first_line = ((rhs)[-1]).last_line; \
252 (loc).first_column = ((rhs)[-1]).last_column; \
253 (loc).last_line = ((rhs)[-1]).last_line; \
254 (loc).last_column = ((rhs)[-1]).last_column; \
258 (loc).first_line = ((rhs)[ 0 ]).first_line; \
259 (loc).first_column = ((rhs)[ 0 ]).first_column; \
260 (loc).last_line = ((rhs)[n-1]).last_line; \
261 (loc).last_column = ((rhs)[n-1]).last_column; \
264 #endif /* YYLLOC_DEFAULT */
265 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
268 #ifndef YYLVQUEUEGROWTH
269 #define YYLVQUEUEGROWTH 32
271 #endif /* YYBTYACC */
273 /* define the initial stack-sizes */
276 #define YYMAXDEPTH YYSTACKSIZE
279 #define YYSTACKSIZE YYMAXDEPTH
281 #define YYSTACKSIZE 10000
282 #define YYMAXDEPTH 10000
286 #ifndef YYINITSTACKSIZE
287 #define YYINITSTACKSIZE 200
297 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
304 struct YYParseState_s
306 struct YYParseState_s *save; /* Previously saved parser state */
307 YYSTACKDATA yystack; /* saved parser stack */
308 int state; /* saved parser state */
309 int errflag; /* saved error recovery status */
310 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
311 YYINT ctry; /* saved index in yyctable[] for this conflict */
313 typedef struct YYParseState_s YYParseState;
314 #endif /* YYBTYACC */
315 /* variables for the parser stack */
316 static YYSTACKDATA yystack;
319 /* Current parser state */
320 static YYParseState *yyps = 0;
322 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
323 static YYParseState *yypath = 0;
325 /* Base of the lexical value queue */
326 static YYSTYPE *yylvals = 0;
328 /* Current position at lexical value queue */
329 static YYSTYPE *yylvp = 0;
331 /* End position of lexical value queue */
332 static YYSTYPE *yylve = 0;
334 /* The last allocated position at the lexical value queue */
335 static YYSTYPE *yylvlim = 0;
337 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
338 /* Base of the lexical position queue */
339 static YYLTYPE *yylpsns = 0;
341 /* Current position at lexical position queue */
342 static YYLTYPE *yylpp = 0;
344 /* End position of lexical position queue */
345 static YYLTYPE *yylpe = 0;
347 /* The last allocated position at the lexical position queue */
348 static YYLTYPE *yylplim = 0;
351 /* Current position at lexical token queue */
352 static short *yylexp = 0;
354 static short *yylexemes = 0;
355 #endif /* YYBTYACC */
356 #line 12 "err_syntax12.y"
363 printf("yyparse() = %d\n", yyparse());
374 yyerror(const char* s)
378 #line 379 "err_syntax12.tab.c"
380 /* For use in generated program */
381 #define yydepth (int)(yystack.s_mark - yystack.s_base)
383 #define yytrial (yyps->save)
384 #endif /* YYBTYACC */
387 #include <stdio.h> /* needed for printf */
390 #include <stdlib.h> /* needed for malloc, etc */
391 #include <string.h> /* needed for memset */
393 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
394 static int yygrowstack(YYSTACKDATA *data)
400 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
404 if ((newsize = data->stacksize) == 0)
405 newsize = YYINITSTACKSIZE;
406 else if (newsize >= YYMAXDEPTH)
408 else if ((newsize *= 2) > YYMAXDEPTH)
409 newsize = YYMAXDEPTH;
411 i = (int) (data->s_mark - data->s_base);
412 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
416 data->s_base = newss;
417 data->s_mark = newss + i;
419 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
423 data->l_base = newvs;
424 data->l_mark = newvs + i;
426 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
427 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
431 data->p_base = newps;
432 data->p_mark = newps + i;
435 data->stacksize = newsize;
436 data->s_last = data->s_base + newsize - 1;
440 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
445 #if YYPURE || defined(YY_NO_LEAKS)
446 static void yyfreestack(YYSTACKDATA *data)
450 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
453 memset(data, 0, sizeof(*data));
456 #define yyfreestack(data) /* nothing */
457 #endif /* YYPURE || defined(YY_NO_LEAKS) */
460 static YYParseState *
461 yyNewState(unsigned size)
463 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
464 if (p == NULL) return NULL;
466 p->yystack.stacksize = size;
469 p->yystack.s_base = NULL;
470 p->yystack.l_base = NULL;
471 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
472 p->yystack.p_base = NULL;
476 p->yystack.s_base = (short *) malloc(size * sizeof(short));
477 if (p->yystack.s_base == NULL) return NULL;
478 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
479 if (p->yystack.l_base == NULL) return NULL;
480 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
481 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
482 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
483 if (p->yystack.p_base == NULL) return NULL;
484 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
491 yyFreeState(YYParseState *p)
493 yyfreestack(&p->yystack);
496 #endif /* YYBTYACC */
498 #define YYABORT goto yyabort
499 #define YYREJECT goto yyabort
500 #define YYACCEPT goto yyaccept
501 #define YYERROR goto yyerrlab
503 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
504 #define YYVALID_NESTED do { if (yyps->save && \
505 yyps->save->save == 0) goto yyvalid; } while(0)
506 #endif /* YYBTYACC */
511 int yym, yyn, yystate, yyresult;
514 YYParseState *yyerrctx = NULL;
515 #endif /* YYBTYACC */
516 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
517 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
522 if ((yys = getenv("YYDEBUG")) != 0)
525 if (yyn >= '0' && yyn <= '9')
529 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
533 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
535 #endif /* YYBTYACC */
542 memset(&yystack, 0, sizeof(yystack));
545 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
546 yystack.s_mark = yystack.s_base;
547 yystack.l_mark = yystack.l_base;
548 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
549 yystack.p_mark = yystack.p_base;
555 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
562 /* we're currently re-reading tokens */
564 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
572 /* in trial mode; save scanner results for future parse attempts */
573 if (yylvp == yylvlim)
574 { /* Enlarge lexical value queue */
575 size_t p = (size_t) (yylvp - yylvals);
576 size_t s = (size_t) (yylvlim - yylvals);
578 s += YYLVQUEUEGROWTH;
579 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
580 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
581 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
582 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
584 yylvp = yylve = yylvals + p;
585 yylvlim = yylvals + s;
586 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
587 yylpp = yylpe = yylpsns + p;
588 yylplim = yylpsns + s;
590 yylexp = yylexemes + p;
592 *yylexp = (short) YYLEX;
595 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
602 /* normal operation, no conflict encountered */
603 #endif /* YYBTYACC */
607 #endif /* YYBTYACC */
608 if (yychar < 0) yychar = YYEOF;
609 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
613 yys = yyname[YYTRANSLATE(yychar)];
614 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
615 YYDEBUGSTR, yydepth, yystate, yychar, yys);
616 #ifdef YYSTYPE_TOSTRING
619 #endif /* YYBTYACC */
620 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
628 /* Do we have a conflict? */
629 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
630 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
639 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
640 YYDEBUGSTR, yydepth, yystate);
642 /* Switch to the next conflict context */
647 if (save->state != yystate) YYABORT;
654 /* Unresolved conflict - start/continue trial parse */
659 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
661 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
663 fputs("Starting trial parse.\n", stderr);
666 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
667 if (save == NULL) goto yyenomem;
668 save->save = yyps->save;
669 save->state = yystate;
670 save->errflag = yyerrflag;
671 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
672 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
673 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
674 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
675 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
676 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
677 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
680 if (yyctable[ctry] == -1)
683 if (yydebug && yychar >= YYEOF)
684 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
689 if (yyps->save == NULL)
691 /* If this is a first conflict in the stack, start saving lexemes */
694 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
695 if (yylexemes == NULL) goto yyenomem;
696 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
697 if (yylvals == NULL) goto yyenomem;
698 yylvlim = yylvals + YYLVQUEUEGROWTH;
699 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
700 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
701 if (yylpsns == NULL) goto yyenomem;
702 yylplim = yylpsns + YYLVQUEUEGROWTH;
707 yylvp = yylve = yylvals;
708 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
709 yylpp = yylpe = yylpsns;
715 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
718 *yylexp = (short) yychar;
726 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
732 save->lexeme = (int) (yylvp - yylvals);
735 if (yytable[yyn] == ctry)
739 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
740 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
745 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
750 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
752 yystate = yyctable[ctry];
753 *++yystack.s_mark = (short) yystate;
754 *++yystack.l_mark = yylval;
755 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
756 *++yystack.p_mark = yylloc;
759 if (yyerrflag > 0) --yyerrflag;
764 yyn = yyctable[ctry];
767 } /* End of code dealing with conflicts */
768 #endif /* YYBTYACC */
769 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
770 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
774 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
775 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
777 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
778 yystate = yytable[yyn];
779 *++yystack.s_mark = yytable[yyn];
780 *++yystack.l_mark = yylval;
781 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
782 *++yystack.p_mark = yylloc;
785 if (yyerrflag > 0) --yyerrflag;
788 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
789 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
794 if (yyerrflag != 0) goto yyinrecovery;
807 YYParseState *save = yyps->save;
810 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
811 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
812 (int)(yylvp - yylvals - yyps->save->lexeme));
814 /* Memorize most forward-looking error state in case it's really an error. */
815 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
817 /* Free old saved error context state */
818 if (yyerrctx) yyFreeState(yyerrctx);
819 /* Create and fill out new saved error context state */
820 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
821 if (yyerrctx == NULL) goto yyenomem;
822 yyerrctx->save = yyps->save;
823 yyerrctx->state = yystate;
824 yyerrctx->errflag = yyerrflag;
825 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
826 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
827 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
828 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
829 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
830 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
831 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
833 yyerrctx->lexeme = (int) (yylvp - yylvals);
835 yylvp = yylvals + save->lexeme;
836 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
837 yylpp = yylpsns + save->lexeme;
839 yylexp = yylexemes + save->lexeme;
841 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
842 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
843 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
844 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
845 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
846 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
847 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
850 yystate = save->state;
851 /* We tried shift, try reduce now */
852 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
853 yyps->save = save->save;
857 /* Nothing left on the stack -- error */
862 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
865 /* Restore state as it was in the most forward-advanced error */
866 yylvp = yylvals + yyerrctx->lexeme;
867 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
868 yylpp = yylpsns + yyerrctx->lexeme;
870 yylexp = yylexemes + yyerrctx->lexeme;
873 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
876 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
877 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
878 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
879 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
880 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
881 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
882 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
884 yystate = yyerrctx->state;
885 yyFreeState(yyerrctx);
890 if (yynewerrflag == 0) goto yyinrecovery;
891 #endif /* YYBTYACC */
893 YYERROR_CALL("syntax error");
894 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
895 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
910 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
911 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
915 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
916 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
918 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
919 yystate = yytable[yyn];
920 *++yystack.s_mark = yytable[yyn];
921 *++yystack.l_mark = yylval;
922 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
923 /* lookahead position is error end position */
924 yyerror_loc_range[1] = yylloc;
925 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
926 *++yystack.p_mark = yyloc;
934 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
935 YYDEBUGSTR, yydepth, *yystack.s_mark);
937 if (yystack.s_mark <= yystack.s_base) goto yyabort;
938 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
939 /* the current TOS position is the error start position */
940 yyerror_loc_range[0] = *yystack.p_mark;
942 #if defined(YYDESTRUCT_CALL)
945 #endif /* YYBTYACC */
946 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
947 YYDESTRUCT_CALL("error: discarding state",
948 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
950 YYDESTRUCT_CALL("error: discarding state",
951 yystos[*yystack.s_mark], yystack.l_mark);
952 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
953 #endif /* defined(YYDESTRUCT_CALL) */
956 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
964 if (yychar == YYEOF) goto yyabort;
968 yys = yyname[YYTRANSLATE(yychar)];
969 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
970 YYDEBUGSTR, yydepth, yystate, yychar, yys);
973 #if defined(YYDESTRUCT_CALL)
976 #endif /* YYBTYACC */
977 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
978 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
980 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
981 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
982 #endif /* defined(YYDESTRUCT_CALL) */
992 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
993 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
994 #ifdef YYSTYPE_TOSTRING
997 #endif /* YYBTYACC */
1002 for (i = yym; i > 0; i--)
1004 if (i != yym) fputs(", ", stderr);
1005 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1006 yystack.l_mark[1-i]), stderr);
1011 fputc('\n', stderr);
1015 yyval = yystack.l_mark[1-yym];
1017 memset(&yyval, 0, sizeof yyval);
1018 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1020 /* Perform position reduction */
1021 memset(&yyloc, 0, sizeof(yyloc));
1024 #endif /* YYBTYACC */
1026 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1027 /* just in case YYERROR is invoked within the action, save
1028 the start of the rhs as the error start position */
1029 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1038 yystack.s_mark -= yym;
1039 yystate = *yystack.s_mark;
1040 yystack.l_mark -= yym;
1041 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1042 yystack.p_mark -= yym;
1045 if (yystate == 0 && yym == 0)
1050 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1051 #ifdef YYSTYPE_TOSTRING
1054 #endif /* YYBTYACC */
1055 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1057 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1061 *++yystack.s_mark = YYFINAL;
1062 *++yystack.l_mark = yyval;
1063 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1064 *++yystack.p_mark = yyloc;
1072 /* we're currently re-reading tokens */
1074 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1082 /* in trial mode; save scanner results for future parse attempts */
1083 if (yylvp == yylvlim)
1084 { /* Enlarge lexical value queue */
1085 size_t p = (size_t) (yylvp - yylvals);
1086 size_t s = (size_t) (yylvlim - yylvals);
1088 s += YYLVQUEUEGROWTH;
1089 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1091 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1093 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1094 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1097 yylvp = yylve = yylvals + p;
1098 yylvlim = yylvals + s;
1099 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1100 yylpp = yylpe = yylpsns + p;
1101 yylplim = yylpsns + s;
1103 yylexp = yylexemes + p;
1105 *yylexp = (short) YYLEX;
1108 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1115 /* normal operation, no conflict encountered */
1116 #endif /* YYBTYACC */
1120 #endif /* YYBTYACC */
1121 if (yychar < 0) yychar = YYEOF;
1122 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1126 yys = yyname[YYTRANSLATE(yychar)];
1127 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1128 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1132 if (yychar == YYEOF) goto yyaccept;
1135 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1136 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1137 yystate = yytable[yyn];
1139 yystate = yydgoto[yym];
1143 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1144 #ifdef YYSTYPE_TOSTRING
1147 #endif /* YYBTYACC */
1148 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1150 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1153 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1154 *++yystack.s_mark = (short) yystate;
1155 *++yystack.l_mark = yyval;
1156 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1157 *++yystack.p_mark = yyloc;
1162 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1164 if (yypath) YYABORT;
1167 YYParseState *save = yyps->save;
1168 yyps->save = save->save;
1169 save->save = yypath;
1174 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1175 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1179 yyFreeState(yyerrctx);
1182 yylvp = yylvals + yypath->lexeme;
1183 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1184 yylpp = yylpsns + yypath->lexeme;
1186 yylexp = yylexemes + yypath->lexeme;
1188 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1189 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1190 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1191 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1192 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1193 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1194 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1196 yystate = yypath->state;
1198 #endif /* YYBTYACC */
1201 YYERROR_CALL("yacc stack overflow");
1205 YYERROR_CALL("memory exhausted");
1207 #endif /* YYBTYACC */
1217 if (yyps->save) goto yyvalid;
1218 #endif /* YYBTYACC */
1222 #if defined(YYDESTRUCT_CALL)
1223 if (yychar != YYEOF && yychar != YYEMPTY)
1224 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1225 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1227 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1228 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1232 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1235 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1236 YYDESTRUCT_CALL("cleanup: discarding state",
1237 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1239 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1240 YYDESTRUCT_CALL("cleanup: discarding state",
1241 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1242 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1244 #endif /* defined(YYDESTRUCT_CALL) */
1249 yyFreeState(yyerrctx);
1254 YYParseState *save = yyps;
1261 YYParseState *save = yypath;
1262 yypath = save->save;
1266 #endif /* YYBTYACC */
1267 yyfreestack(&yystack);