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 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
175 static const YYINT err_syntax12_stos[] = { 0,
178 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
179 static const YYINT err_syntax12_dgoto[] = { 2,
181 static const YYINT err_syntax12_sindex[] = { -256,
184 static const YYINT err_syntax12_rindex[] = { 0,
188 static const YYINT err_syntax12_cindex[] = { 0,
192 static const YYINT err_syntax12_gindex[] = { 0,
194 #define YYTABLESIZE 0
195 static const YYINT err_syntax12_table[] = { 1,
197 static const YYINT err_syntax12_check[] = { 256,
200 static const YYINT err_syntax12_ctable[] = { -1,
207 #define YYMAXTOKEN 456
208 #define YYUNDFTOKEN 459
209 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
211 static const char *const err_syntax12_name[] = {
213 "$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,
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,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,"error",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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
223 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
224 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",
227 static const char *const err_syntax12_rule[] = {
244 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
245 YYLTYPE yyloc; /* position returned by actions */
246 YYLTYPE yylloc; /* position from the lexer */
249 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
250 #ifndef YYLLOC_DEFAULT
251 #define YYLLOC_DEFAULT(loc, rhs, n) \
256 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
257 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
258 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
259 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
263 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
264 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
265 (loc).last_line = YYRHSLOC(rhs, n).last_line; \
266 (loc).last_column = YYRHSLOC(rhs, n).last_column; \
269 #endif /* YYLLOC_DEFAULT */
270 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
273 #ifndef YYLVQUEUEGROWTH
274 #define YYLVQUEUEGROWTH 32
276 #endif /* YYBTYACC */
278 /* define the initial stack-sizes */
281 #define YYMAXDEPTH YYSTACKSIZE
284 #define YYSTACKSIZE YYMAXDEPTH
286 #define YYSTACKSIZE 10000
287 #define YYMAXDEPTH 10000
291 #ifndef YYINITSTACKSIZE
292 #define YYINITSTACKSIZE 200
302 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
309 struct YYParseState_s
311 struct YYParseState_s *save; /* Previously saved parser state */
312 YYSTACKDATA yystack; /* saved parser stack */
313 int state; /* saved parser state */
314 int errflag; /* saved error recovery status */
315 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
316 YYINT ctry; /* saved index in yyctable[] for this conflict */
318 typedef struct YYParseState_s YYParseState;
319 #endif /* YYBTYACC */
320 /* variables for the parser stack */
321 static YYSTACKDATA yystack;
324 /* Current parser state */
325 static YYParseState *yyps = 0;
327 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
328 static YYParseState *yypath = 0;
330 /* Base of the lexical value queue */
331 static YYSTYPE *yylvals = 0;
333 /* Current position at lexical value queue */
334 static YYSTYPE *yylvp = 0;
336 /* End position of lexical value queue */
337 static YYSTYPE *yylve = 0;
339 /* The last allocated position at the lexical value queue */
340 static YYSTYPE *yylvlim = 0;
342 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
343 /* Base of the lexical position queue */
344 static YYLTYPE *yylpsns = 0;
346 /* Current position at lexical position queue */
347 static YYLTYPE *yylpp = 0;
349 /* End position of lexical position queue */
350 static YYLTYPE *yylpe = 0;
352 /* The last allocated position at the lexical position queue */
353 static YYLTYPE *yylplim = 0;
356 /* Current position at lexical token queue */
357 static YYINT *yylexp = 0;
359 static YYINT *yylexemes = 0;
360 #endif /* YYBTYACC */
361 #line 12 "err_syntax12.y"
368 printf("yyparse() = %d\n", yyparse());
379 yyerror(const char* s)
383 #line 384 "err_syntax12.tab.c"
385 /* For use in generated program */
386 #define yydepth (int)(yystack.s_mark - yystack.s_base)
388 #define yytrial (yyps->save)
389 #endif /* YYBTYACC */
392 #include <stdio.h> /* needed for printf */
395 #include <stdlib.h> /* needed for malloc, etc */
396 #include <string.h> /* needed for memset */
398 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
399 static int yygrowstack(YYSTACKDATA *data)
405 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
409 if ((newsize = data->stacksize) == 0)
410 newsize = YYINITSTACKSIZE;
411 else if (newsize >= YYMAXDEPTH)
413 else if ((newsize *= 2) > YYMAXDEPTH)
414 newsize = YYMAXDEPTH;
416 i = (int) (data->s_mark - data->s_base);
417 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
421 data->s_base = newss;
422 data->s_mark = newss + i;
424 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
428 data->l_base = newvs;
429 data->l_mark = newvs + i;
431 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
432 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
436 data->p_base = newps;
437 data->p_mark = newps + i;
440 data->stacksize = newsize;
441 data->s_last = data->s_base + newsize - 1;
445 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
450 #if YYPURE || defined(YY_NO_LEAKS)
451 static void yyfreestack(YYSTACKDATA *data)
455 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
458 memset(data, 0, sizeof(*data));
461 #define yyfreestack(data) /* nothing */
462 #endif /* YYPURE || defined(YY_NO_LEAKS) */
465 static YYParseState *
466 yyNewState(unsigned size)
468 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
469 if (p == NULL) return NULL;
471 p->yystack.stacksize = size;
474 p->yystack.s_base = NULL;
475 p->yystack.l_base = NULL;
476 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
477 p->yystack.p_base = NULL;
481 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
482 if (p->yystack.s_base == NULL) return NULL;
483 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
484 if (p->yystack.l_base == NULL) return NULL;
485 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
486 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
487 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
488 if (p->yystack.p_base == NULL) return NULL;
489 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
496 yyFreeState(YYParseState *p)
498 yyfreestack(&p->yystack);
501 #endif /* YYBTYACC */
503 #define YYABORT goto yyabort
504 #define YYREJECT goto yyabort
505 #define YYACCEPT goto yyaccept
506 #define YYERROR goto yyerrlab
508 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
509 #define YYVALID_NESTED do { if (yyps->save && \
510 yyps->save->save == 0) goto yyvalid; } while(0)
511 #endif /* YYBTYACC */
516 int yym, yyn, yystate, yyresult;
519 YYParseState *yyerrctx = NULL;
520 #endif /* YYBTYACC */
521 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
522 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
527 if ((yys = getenv("YYDEBUG")) != 0)
530 if (yyn >= '0' && yyn <= '9')
534 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
536 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
537 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
541 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
543 #endif /* YYBTYACC */
552 memset(&yystack, 0, sizeof(yystack));
555 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
556 yystack.s_mark = yystack.s_base;
557 yystack.l_mark = yystack.l_base;
558 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
559 yystack.p_mark = yystack.p_base;
565 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
572 /* we're currently re-reading tokens */
574 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
582 /* in trial mode; save scanner results for future parse attempts */
583 if (yylvp == yylvlim)
584 { /* Enlarge lexical value queue */
585 size_t p = (size_t) (yylvp - yylvals);
586 size_t s = (size_t) (yylvlim - yylvals);
588 s += YYLVQUEUEGROWTH;
589 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
590 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
591 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
592 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
594 yylvp = yylve = yylvals + p;
595 yylvlim = yylvals + s;
596 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
597 yylpp = yylpe = yylpsns + p;
598 yylplim = yylpsns + s;
600 yylexp = yylexemes + p;
602 *yylexp = (YYINT) YYLEX;
605 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
612 /* normal operation, no conflict encountered */
613 #endif /* YYBTYACC */
617 #endif /* YYBTYACC */
618 if (yychar < 0) yychar = YYEOF;
622 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
623 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
624 YYDEBUGSTR, yydepth, yystate, yychar, yys);
625 #ifdef YYSTYPE_TOSTRING
628 #endif /* YYBTYACC */
629 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
637 /* Do we have a conflict? */
638 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
639 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
648 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
649 YYDEBUGSTR, yydepth, yystate);
651 /* Switch to the next conflict context */
656 if (save->state != yystate) YYABORT;
663 /* Unresolved conflict - start/continue trial parse */
668 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
670 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
672 fputs("Starting trial parse.\n", stderr);
675 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
676 if (save == NULL) goto yyenomem;
677 save->save = yyps->save;
678 save->state = yystate;
679 save->errflag = yyerrflag;
680 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
681 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
682 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
683 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
684 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
685 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
686 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
689 if (yyctable[ctry] == -1)
692 if (yydebug && yychar >= YYEOF)
693 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
698 if (yyps->save == NULL)
700 /* If this is a first conflict in the stack, start saving lexemes */
703 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
704 if (yylexemes == NULL) goto yyenomem;
705 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
706 if (yylvals == NULL) goto yyenomem;
707 yylvlim = yylvals + YYLVQUEUEGROWTH;
708 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
709 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
710 if (yylpsns == NULL) goto yyenomem;
711 yylplim = yylpsns + YYLVQUEUEGROWTH;
716 yylvp = yylve = yylvals;
717 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
718 yylpp = yylpe = yylpsns;
724 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
727 *yylexp = (YYINT) yychar;
735 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
741 save->lexeme = (int) (yylvp - yylvals);
744 if (yytable[yyn] == ctry)
748 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
749 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
754 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
759 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
761 yystate = yyctable[ctry];
762 *++yystack.s_mark = (YYINT) yystate;
763 *++yystack.l_mark = yylval;
764 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
765 *++yystack.p_mark = yylloc;
768 if (yyerrflag > 0) --yyerrflag;
773 yyn = yyctable[ctry];
776 } /* End of code dealing with conflicts */
777 #endif /* YYBTYACC */
778 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
779 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
783 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
784 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
786 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
787 yystate = yytable[yyn];
788 *++yystack.s_mark = yytable[yyn];
789 *++yystack.l_mark = yylval;
790 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
791 *++yystack.p_mark = yylloc;
794 if (yyerrflag > 0) --yyerrflag;
797 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
798 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
803 if (yyerrflag != 0) goto yyinrecovery;
808 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
811 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
812 * before looking for error recovery */
813 yystack.s_mark -= yym;
814 yystate = *yystack.s_mark;
815 yystack.l_mark -= yym;
816 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
817 yystack.p_mark -= yym;
825 YYParseState *save = yyps->save;
828 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
829 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
830 (int)(yylvp - yylvals - yyps->save->lexeme));
832 /* Memorize most forward-looking error state in case it's really an error. */
833 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
835 /* Free old saved error context state */
836 if (yyerrctx) yyFreeState(yyerrctx);
837 /* Create and fill out new saved error context state */
838 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
839 if (yyerrctx == NULL) goto yyenomem;
840 yyerrctx->save = yyps->save;
841 yyerrctx->state = yystate;
842 yyerrctx->errflag = yyerrflag;
843 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
844 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
845 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
846 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
847 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
848 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
849 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
851 yyerrctx->lexeme = (int) (yylvp - yylvals);
853 yylvp = yylvals + save->lexeme;
854 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
855 yylpp = yylpsns + save->lexeme;
857 yylexp = yylexemes + save->lexeme;
859 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
860 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
861 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
862 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
863 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
864 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
865 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
868 yystate = save->state;
869 /* We tried shift, try reduce now */
870 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
871 yyps->save = save->save;
875 /* Nothing left on the stack -- error */
880 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
883 /* Restore state as it was in the most forward-advanced error */
884 yylvp = yylvals + yyerrctx->lexeme;
885 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
886 yylpp = yylpsns + yyerrctx->lexeme;
888 yylexp = yylexemes + yyerrctx->lexeme;
891 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
894 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
895 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
896 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
897 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
898 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
899 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
900 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
902 yystate = yyerrctx->state;
903 yyFreeState(yyerrctx);
908 if (yynewerrflag == 0) goto yyinrecovery;
909 #endif /* YYBTYACC */
911 YYERROR_CALL("syntax error");
912 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
913 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
917 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
928 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
929 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
933 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
934 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
936 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
937 yystate = yytable[yyn];
938 *++yystack.s_mark = yytable[yyn];
939 *++yystack.l_mark = yylval;
940 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
941 /* lookahead position is error end position */
942 yyerror_loc_range[2] = yylloc;
943 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
944 *++yystack.p_mark = yyloc;
952 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
953 YYDEBUGSTR, yydepth, *yystack.s_mark);
955 if (yystack.s_mark <= yystack.s_base) goto yyabort;
956 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
957 /* the current TOS position is the error start position */
958 yyerror_loc_range[1] = *yystack.p_mark;
960 #if defined(YYDESTRUCT_CALL)
963 #endif /* YYBTYACC */
964 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
965 YYDESTRUCT_CALL("error: discarding state",
966 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
968 YYDESTRUCT_CALL("error: discarding state",
969 yystos[*yystack.s_mark], yystack.l_mark);
970 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
971 #endif /* defined(YYDESTRUCT_CALL) */
974 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
982 if (yychar == YYEOF) goto yyabort;
986 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
987 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
988 YYDEBUGSTR, yydepth, yystate, yychar, yys);
991 #if defined(YYDESTRUCT_CALL)
994 #endif /* YYBTYACC */
995 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
996 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
998 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
999 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1000 #endif /* defined(YYDESTRUCT_CALL) */
1010 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1011 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1012 #ifdef YYSTYPE_TOSTRING
1015 #endif /* YYBTYACC */
1020 for (i = yym; i > 0; i--)
1022 if (i != yym) fputs(", ", stderr);
1023 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1024 yystack.l_mark[1-i]), stderr);
1029 fputc('\n', stderr);
1033 yyval = yystack.l_mark[1-yym];
1035 memset(&yyval, 0, sizeof yyval);
1036 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1038 /* Perform position reduction */
1039 memset(&yyloc, 0, sizeof(yyloc));
1042 #endif /* YYBTYACC */
1044 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
1045 /* just in case YYERROR is invoked within the action, save
1046 the start of the rhs as the error start position */
1047 yyerror_loc_range[1] = yystack.p_mark[1-yym];
1056 yystack.s_mark -= yym;
1057 yystate = *yystack.s_mark;
1058 yystack.l_mark -= yym;
1059 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1060 yystack.p_mark -= yym;
1063 if (yystate == 0 && yym == 0)
1068 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1069 #ifdef YYSTYPE_TOSTRING
1072 #endif /* YYBTYACC */
1073 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1075 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1079 *++yystack.s_mark = YYFINAL;
1080 *++yystack.l_mark = yyval;
1081 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1082 *++yystack.p_mark = yyloc;
1090 /* we're currently re-reading tokens */
1092 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1100 /* in trial mode; save scanner results for future parse attempts */
1101 if (yylvp == yylvlim)
1102 { /* Enlarge lexical value queue */
1103 size_t p = (size_t) (yylvp - yylvals);
1104 size_t s = (size_t) (yylvlim - yylvals);
1106 s += YYLVQUEUEGROWTH;
1107 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1109 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1111 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1112 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1115 yylvp = yylve = yylvals + p;
1116 yylvlim = yylvals + s;
1117 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1118 yylpp = yylpe = yylpsns + p;
1119 yylplim = yylpsns + s;
1121 yylexp = yylexemes + p;
1123 *yylexp = (YYINT) YYLEX;
1126 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1133 /* normal operation, no conflict encountered */
1134 #endif /* YYBTYACC */
1138 #endif /* YYBTYACC */
1139 if (yychar < 0) yychar = YYEOF;
1143 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1144 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1145 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1149 if (yychar == YYEOF) goto yyaccept;
1152 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1153 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1154 yystate = yytable[yyn];
1156 yystate = yydgoto[yym];
1160 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1161 #ifdef YYSTYPE_TOSTRING
1164 #endif /* YYBTYACC */
1165 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1167 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1170 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1171 *++yystack.s_mark = (YYINT) yystate;
1172 *++yystack.l_mark = yyval;
1173 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1174 *++yystack.p_mark = yyloc;
1179 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1181 if (yypath) YYABORT;
1184 YYParseState *save = yyps->save;
1185 yyps->save = save->save;
1186 save->save = yypath;
1191 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1192 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1196 yyFreeState(yyerrctx);
1199 yylvp = yylvals + yypath->lexeme;
1200 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1201 yylpp = yylpsns + yypath->lexeme;
1203 yylexp = yylexemes + yypath->lexeme;
1205 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1206 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1207 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1208 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1209 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1210 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1211 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1213 yystate = yypath->state;
1215 #endif /* YYBTYACC */
1218 YYERROR_CALL("yacc stack overflow");
1222 YYERROR_CALL("memory exhausted");
1224 #endif /* YYBTYACC */
1234 if (yyps->save) goto yyvalid;
1235 #endif /* YYBTYACC */
1239 #if defined(YYDESTRUCT_CALL)
1240 if (yychar != YYEOF && yychar != YYEMPTY)
1241 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1242 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1244 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1245 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1249 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1252 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1253 YYDESTRUCT_CALL("cleanup: discarding state",
1254 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1256 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1257 YYDESTRUCT_CALL("cleanup: discarding state",
1258 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1259 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1261 #endif /* defined(YYDESTRUCT_CALL) */
1266 yyFreeState(yyerrctx);
1271 YYParseState *save = yyps;
1278 YYParseState *save = yypath;
1279 yypath = save->save;
1283 #endif /* YYBTYACC */
1284 yyfreestack(&yystack);