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_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,
201 #define YYMAXTOKEN 456
202 #define YYUNDFTOKEN 459
203 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
205 static const char *const err_syntax12_name[] = {
207 "$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,
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,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,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,"error",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,0,0,0,0,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,"text","$accept","S",
221 static const char *const err_syntax12_rule[] = {
235 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
236 YYLTYPE yyloc; /* position returned by actions */
237 YYLTYPE yylloc; /* position from the lexer */
240 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
241 #ifndef YYLLOC_DEFAULT
242 #define YYLLOC_DEFAULT(loc, rhs, n) \
247 (loc).first_line = ((rhs)[-1]).last_line; \
248 (loc).first_column = ((rhs)[-1]).last_column; \
249 (loc).last_line = ((rhs)[-1]).last_line; \
250 (loc).last_column = ((rhs)[-1]).last_column; \
254 (loc).first_line = ((rhs)[ 0 ]).first_line; \
255 (loc).first_column = ((rhs)[ 0 ]).first_column; \
256 (loc).last_line = ((rhs)[n-1]).last_line; \
257 (loc).last_column = ((rhs)[n-1]).last_column; \
260 #endif /* YYLLOC_DEFAULT */
261 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
264 #ifndef YYLVQUEUEGROWTH
265 #define YYLVQUEUEGROWTH 32
267 #endif /* YYBTYACC */
269 /* define the initial stack-sizes */
272 #define YYMAXDEPTH YYSTACKSIZE
275 #define YYSTACKSIZE YYMAXDEPTH
277 #define YYSTACKSIZE 10000
278 #define YYMAXDEPTH 10000
282 #ifndef YYINITSTACKSIZE
283 #define YYINITSTACKSIZE 200
293 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
300 struct YYParseState_s
302 struct YYParseState_s *save; /* Previously saved parser state */
303 YYSTACKDATA yystack; /* saved parser stack */
304 int state; /* saved parser state */
305 int errflag; /* saved error recovery status */
306 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
307 YYINT ctry; /* saved index in yyctable[] for this conflict */
309 typedef struct YYParseState_s YYParseState;
310 #endif /* YYBTYACC */
311 /* variables for the parser stack */
312 static YYSTACKDATA yystack;
315 /* Current parser state */
316 static YYParseState *yyps = 0;
318 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
319 static YYParseState *yypath = 0;
321 /* Base of the lexical value queue */
322 static YYSTYPE *yylvals = 0;
324 /* Current position at lexical value queue */
325 static YYSTYPE *yylvp = 0;
327 /* End position of lexical value queue */
328 static YYSTYPE *yylve = 0;
330 /* The last allocated position at the lexical value queue */
331 static YYSTYPE *yylvlim = 0;
333 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
334 /* Base of the lexical position queue */
335 static YYLTYPE *yylpsns = 0;
337 /* Current position at lexical position queue */
338 static YYLTYPE *yylpp = 0;
340 /* End position of lexical position queue */
341 static YYLTYPE *yylpe = 0;
343 /* The last allocated position at the lexical position queue */
344 static YYLTYPE *yylplim = 0;
347 /* Current position at lexical token queue */
348 static short *yylexp = 0;
350 static short *yylexemes = 0;
351 #endif /* YYBTYACC */
352 #line 12 "err_syntax12.y"
359 printf("yyparse() = %d\n", yyparse());
370 yyerror(const char* s)
374 #line 375 "err_syntax12.tab.c"
376 /* For use in generated program */
377 #define yydepth (int)(yystack.s_mark - yystack.s_base)
379 #define yytrial (yyps->save)
380 #endif /* YYBTYACC */
383 #include <stdio.h> /* needed for printf */
386 #include <stdlib.h> /* needed for malloc, etc */
387 #include <string.h> /* needed for memset */
389 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
390 static int yygrowstack(YYSTACKDATA *data)
396 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
400 if ((newsize = data->stacksize) == 0)
401 newsize = YYINITSTACKSIZE;
402 else if (newsize >= YYMAXDEPTH)
404 else if ((newsize *= 2) > YYMAXDEPTH)
405 newsize = YYMAXDEPTH;
407 i = (int) (data->s_mark - data->s_base);
408 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
412 data->s_base = newss;
413 data->s_mark = newss + i;
415 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
419 data->l_base = newvs;
420 data->l_mark = newvs + i;
422 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
423 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
427 data->p_base = newps;
428 data->p_mark = newps + i;
431 data->stacksize = newsize;
432 data->s_last = data->s_base + newsize - 1;
436 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
441 #if YYPURE || defined(YY_NO_LEAKS)
442 static void yyfreestack(YYSTACKDATA *data)
446 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
449 memset(data, 0, sizeof(*data));
452 #define yyfreestack(data) /* nothing */
453 #endif /* YYPURE || defined(YY_NO_LEAKS) */
456 static YYParseState *
457 yyNewState(unsigned size)
459 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
460 if (p == NULL) return NULL;
462 p->yystack.stacksize = size;
465 p->yystack.s_base = NULL;
466 p->yystack.l_base = NULL;
467 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
468 p->yystack.p_base = NULL;
472 p->yystack.s_base = (short *) malloc(size * sizeof(short));
473 if (p->yystack.s_base == NULL) return NULL;
474 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
475 if (p->yystack.l_base == NULL) return NULL;
476 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
477 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
478 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
479 if (p->yystack.p_base == NULL) return NULL;
480 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
487 yyFreeState(YYParseState *p)
489 yyfreestack(&p->yystack);
492 #endif /* YYBTYACC */
494 #define YYABORT goto yyabort
495 #define YYREJECT goto yyabort
496 #define YYACCEPT goto yyaccept
497 #define YYERROR goto yyerrlab
499 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
500 #define YYVALID_NESTED do { if (yyps->save && \
501 yyps->save->save == 0) goto yyvalid; } while(0)
502 #endif /* YYBTYACC */
507 int yym, yyn, yystate, yyresult;
510 YYParseState *yyerrctx = NULL;
511 #endif /* YYBTYACC */
512 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
513 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
518 if ((yys = getenv("YYDEBUG")) != 0)
521 if (yyn >= '0' && yyn <= '9')
525 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
529 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
531 #endif /* YYBTYACC */
538 memset(&yystack, 0, sizeof(yystack));
541 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
542 yystack.s_mark = yystack.s_base;
543 yystack.l_mark = yystack.l_base;
544 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
545 yystack.p_mark = yystack.p_base;
551 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
558 /* we're currently re-reading tokens */
560 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
568 /* in trial mode; save scanner results for future parse attempts */
569 if (yylvp == yylvlim)
570 { /* Enlarge lexical value queue */
571 int p = yylvp - yylvals;
572 int s = yylvlim - yylvals;
574 s += YYLVQUEUEGROWTH;
575 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
576 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
577 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
578 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
580 yylvp = yylve = yylvals + p;
581 yylvlim = yylvals + s;
582 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
583 yylpp = yylpe = yylpsns + p;
584 yylplim = yylpsns + s;
586 yylexp = yylexemes + p;
588 *yylexp = (short) YYLEX;
591 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
598 /* normal operation, no conflict encountered */
599 #endif /* YYBTYACC */
603 #endif /* YYBTYACC */
604 if (yychar < 0) yychar = YYEOF;
605 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
609 yys = yyname[YYTRANSLATE(yychar)];
610 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
611 YYDEBUGSTR, yydepth, yystate, yychar, yys);
612 #ifdef YYSTYPE_TOSTRING
615 #endif /* YYBTYACC */
616 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
624 /* Do we have a conflict? */
625 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
626 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
635 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
636 YYDEBUGSTR, yydepth, yystate);
638 /* Switch to the next conflict context */
643 if (save->state != yystate) YYABORT;
650 /* Unresolved conflict - start/continue trial parse */
655 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
657 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
659 fputs("Starting trial parse.\n", stderr);
662 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
663 if (save == NULL) goto yyenomem;
664 save->save = yyps->save;
665 save->state = yystate;
666 save->errflag = yyerrflag;
667 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
668 memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
669 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
670 memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
671 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
672 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
673 memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
676 if (yyctable[ctry] == -1)
679 if (yydebug && yychar >= YYEOF)
680 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
685 if (yyps->save == NULL)
687 /* If this is a first conflict in the stack, start saving lexemes */
690 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
691 if (yylexemes == NULL) goto yyenomem;
692 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
693 if (yylvals == NULL) goto yyenomem;
694 yylvlim = yylvals + YYLVQUEUEGROWTH;
695 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
696 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
697 if (yylpsns == NULL) goto yyenomem;
698 yylplim = yylpsns + YYLVQUEUEGROWTH;
703 yylvp = yylve = yylvals;
704 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
705 yylpp = yylpe = yylpsns;
711 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
714 *yylexp = (short) yychar;
722 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
728 save->lexeme = yylvp - yylvals;
731 if (yytable[yyn] == ctry)
735 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
736 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
741 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
746 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
748 yystate = yyctable[ctry];
749 *++yystack.s_mark = (short) yystate;
750 *++yystack.l_mark = yylval;
751 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
752 *++yystack.p_mark = yylloc;
755 if (yyerrflag > 0) --yyerrflag;
760 yyn = yyctable[ctry];
763 } /* End of code dealing with conflicts */
764 #endif /* YYBTYACC */
765 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
766 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
770 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
771 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
773 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
774 yystate = yytable[yyn];
775 *++yystack.s_mark = yytable[yyn];
776 *++yystack.l_mark = yylval;
777 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
778 *++yystack.p_mark = yylloc;
781 if (yyerrflag > 0) --yyerrflag;
784 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
785 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
790 if (yyerrflag != 0) goto yyinrecovery;
803 YYParseState *save = yyps->save;
806 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
807 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
808 (int)(yylvp - yylvals - yyps->save->lexeme));
810 /* Memorize most forward-looking error state in case it's really an error. */
811 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
813 /* Free old saved error context state */
814 if (yyerrctx) yyFreeState(yyerrctx);
815 /* Create and fill out new saved error context state */
816 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
817 if (yyerrctx == NULL) goto yyenomem;
818 yyerrctx->save = yyps->save;
819 yyerrctx->state = yystate;
820 yyerrctx->errflag = yyerrflag;
821 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
822 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
823 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
824 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
825 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
826 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
827 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
829 yyerrctx->lexeme = yylvp - yylvals;
831 yylvp = yylvals + save->lexeme;
832 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
833 yylpp = yylpsns + save->lexeme;
835 yylexp = yylexemes + save->lexeme;
837 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
838 memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
839 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
840 memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
841 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
842 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
843 memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
846 yystate = save->state;
847 /* We tried shift, try reduce now */
848 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
849 yyps->save = save->save;
853 /* Nothing left on the stack -- error */
858 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
861 /* Restore state as it was in the most forward-advanced error */
862 yylvp = yylvals + yyerrctx->lexeme;
863 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
864 yylpp = yylpsns + yyerrctx->lexeme;
866 yylexp = yylexemes + yyerrctx->lexeme;
869 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
872 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
873 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
874 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
875 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
876 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
877 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
878 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
880 yystate = yyerrctx->state;
881 yyFreeState(yyerrctx);
886 if (yynewerrflag == 0) goto yyinrecovery;
887 #endif /* YYBTYACC */
889 YYERROR_CALL("syntax error");
890 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
891 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
906 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
907 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
911 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
912 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
914 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
915 yystate = yytable[yyn];
916 *++yystack.s_mark = yytable[yyn];
917 *++yystack.l_mark = yylval;
918 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
919 /* lookahead position is error end position */
920 yyerror_loc_range[1] = yylloc;
921 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
922 *++yystack.p_mark = yyloc;
930 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
931 YYDEBUGSTR, yydepth, *yystack.s_mark);
933 if (yystack.s_mark <= yystack.s_base) goto yyabort;
934 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
935 /* the current TOS position is the error start position */
936 yyerror_loc_range[0] = *yystack.p_mark;
938 #if defined(YYDESTRUCT_CALL)
941 #endif /* YYBTYACC */
942 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
943 YYDESTRUCT_CALL("error: discarding state",
944 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
946 YYDESTRUCT_CALL("error: discarding state",
947 yystos[*yystack.s_mark], yystack.l_mark);
948 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
949 #endif /* defined(YYDESTRUCT_CALL) */
952 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
960 if (yychar == YYEOF) goto yyabort;
964 yys = yyname[YYTRANSLATE(yychar)];
965 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
966 YYDEBUGSTR, yydepth, yystate, yychar, yys);
969 #if defined(YYDESTRUCT_CALL)
972 #endif /* YYBTYACC */
973 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
974 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
976 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
977 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
978 #endif /* defined(YYDESTRUCT_CALL) */
988 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
989 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
990 #ifdef YYSTYPE_TOSTRING
993 #endif /* YYBTYACC */
998 for (i = yym; i > 0; i--)
1000 if (i != yym) fputs(", ", stderr);
1001 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1002 yystack.l_mark[1-i]), stderr);
1007 fputc('\n', stderr);
1011 yyval = yystack.l_mark[1-yym];
1013 memset(&yyval, 0, sizeof yyval);
1014 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1016 /* Perform position reduction */
1017 memset(&yyloc, 0, sizeof(yyloc));
1020 #endif /* YYBTYACC */
1022 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1023 /* just in case YYERROR is invoked within the action, save
1024 the start of the rhs as the error start position */
1025 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1034 yystack.s_mark -= yym;
1035 yystate = *yystack.s_mark;
1036 yystack.l_mark -= yym;
1037 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1038 yystack.p_mark -= yym;
1041 if (yystate == 0 && yym == 0)
1046 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1047 #ifdef YYSTYPE_TOSTRING
1050 #endif /* YYBTYACC */
1051 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1053 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1057 *++yystack.s_mark = YYFINAL;
1058 *++yystack.l_mark = yyval;
1059 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1060 *++yystack.p_mark = yyloc;
1068 /* we're currently re-reading tokens */
1070 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1078 /* in trial mode; save scanner results for future parse attempts */
1079 if (yylvp == yylvlim)
1080 { /* Enlarge lexical value queue */
1081 int p = yylvp - yylvals;
1082 int s = yylvlim - yylvals;
1084 s += YYLVQUEUEGROWTH;
1085 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1087 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1089 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1090 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1093 yylvp = yylve = yylvals + p;
1094 yylvlim = yylvals + s;
1095 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1096 yylpp = yylpe = yylpsns + p;
1097 yylplim = yylpsns + s;
1099 yylexp = yylexemes + p;
1101 *yylexp = (short) YYLEX;
1104 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1111 /* normal operation, no conflict encountered */
1112 #endif /* YYBTYACC */
1116 #endif /* YYBTYACC */
1117 if (yychar < 0) yychar = YYEOF;
1118 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1122 yys = yyname[YYTRANSLATE(yychar)];
1123 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1124 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1128 if (yychar == YYEOF) goto yyaccept;
1131 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1132 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1133 yystate = yytable[yyn];
1135 yystate = yydgoto[yym];
1139 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1140 #ifdef YYSTYPE_TOSTRING
1143 #endif /* YYBTYACC */
1144 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1146 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1149 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1150 *++yystack.s_mark = (short) yystate;
1151 *++yystack.l_mark = yyval;
1152 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1153 *++yystack.p_mark = yyloc;
1158 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1160 if (yypath) YYABORT;
1163 YYParseState *save = yyps->save;
1164 yyps->save = save->save;
1165 save->save = yypath;
1170 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1171 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1175 yyFreeState(yyerrctx);
1178 yylvp = yylvals + yypath->lexeme;
1179 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1180 yylpp = yylpsns + yypath->lexeme;
1182 yylexp = yylexemes + yypath->lexeme;
1184 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1185 memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1186 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1187 memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1188 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1189 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1190 memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1192 yystate = yypath->state;
1194 #endif /* YYBTYACC */
1197 YYERROR_CALL("yacc stack overflow");
1201 YYERROR_CALL("memory exhausted");
1203 #endif /* YYBTYACC */
1213 if (yyps->save) goto yyvalid;
1214 #endif /* YYBTYACC */
1218 #if defined(YYDESTRUCT_CALL)
1219 if (yychar != YYEOF && yychar != YYEMPTY)
1220 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1221 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1223 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1224 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1228 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1231 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1232 YYDESTRUCT_CALL("cleanup: discarding state",
1233 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1235 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1236 YYDESTRUCT_CALL("cleanup: discarding state",
1237 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1238 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1240 #endif /* defined(YYDESTRUCT_CALL) */
1245 yyFreeState(yyerrctx);
1250 YYParseState *save = yyps;
1257 YYParseState *save = yypath;
1258 yypath = save->save;
1262 #endif /* YYBTYACC */
1263 yyfreestack(&yystack);