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_inherit4_parse
25 #define yylex err_inherit4_lex
29 #define yyerror err_inherit4_error
33 #define yychar err_inherit4_char
37 #define yyval err_inherit4_val
41 #define yylval err_inherit4_lval
45 #define yydebug err_inherit4_debug
49 #define yynerrs err_inherit4_nerrs
53 #define yyerrflag err_inherit4_errflag
54 #endif /* yyerrflag */
57 #define yylhs err_inherit4_lhs
61 #define yylen err_inherit4_len
65 #define yydefred err_inherit4_defred
69 #define yystos err_inherit4_stos
73 #define yydgoto err_inherit4_dgoto
77 #define yysindex err_inherit4_sindex
81 #define yyrindex err_inherit4_rindex
85 #define yygindex err_inherit4_gindex
89 #define yytable err_inherit4_table
93 #define yycheck err_inherit4_check
97 #define yyname err_inherit4_name
101 #define yyrule err_inherit4_rule
105 #define yyloc err_inherit4_loc
109 #define yylloc err_inherit4_lloc
115 #define yycindex err_inherit4_cindex
116 #endif /* yycindex */
119 #define yyctable err_inherit4_ctable
120 #endif /* yyctable */
122 #endif /* YYBTYACC */
124 #define YYPREFIX "err_inherit4_"
128 #line 3 "err_inherit4.y"
131 typedef enum {cGLOBAL, cLOCAL} class;
132 typedef enum {tREAL, tINTEGER} type;
135 struct symbol { class c; type t; name id; };
136 typedef struct symbol symbol;
138 struct namelist { symbol *s; struct namelist *next; };
139 typedef struct namelist namelist;
141 extern symbol *mksymbol(type t, class c, name id);
144 #define YYLEX_DECL() yylex(void)
145 #define YYERROR_DECL() yyerror(const char *s)
148 #undef YYSTYPE_IS_DECLARED
149 #define YYSTYPE_IS_DECLARED 1
151 #ifndef YYSTYPE_IS_DECLARED
152 #define YYSTYPE_IS_DECLARED 1
153 #line 41 "err_inherit4.y"
161 #endif /* !YYSTYPE_IS_DECLARED */
162 #line 163 "err_inherit4.tab.c"
164 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
165 /* Default: YYLTYPE is the text position type. */
166 typedef struct YYLTYPE
173 #define YYLTYPE_IS_DECLARED 1
176 /* compatibility with bison */
178 /* compatibility with FreeBSD */
179 # ifdef YYPARSE_PARAM_TYPE
180 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
182 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
185 # define YYPARSE_DECL() yyparse(void)
188 /* Parameters sent to lex. */
190 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
191 # define YYLEX yylex(YYLEX_PARAM)
193 # define YYLEX_DECL() yylex(void)
194 # define YYLEX yylex()
197 /* Parameters sent to yyerror. */
199 #define YYERROR_DECL() yyerror(YYLTYPE loc, const char *s)
202 #define YYERROR_CALL(msg) yyerror(yylloc, msg)
205 #ifndef YYDESTRUCT_DECL
206 #define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, YYLTYPE *loc)
208 #ifndef YYDESTRUCT_CALL
209 #define YYDESTRUCT_CALL(msg, psymb, val, loc) yydestruct(msg, psymb, val, loc)
212 extern int YYPARSE_DECL();
219 #define YYERRCODE 256
221 static const YYINT err_inherit4_lhs[] = { -1,
222 5, 6, 0, 0, 3, 3, 4, 4, 1, 1,
225 static const YYINT err_inherit4_len[] = { 2,
226 0, 0, 5, 2, 1, 1, 1, 1, 2, 1,
229 static const YYINT err_inherit4_defred[] = { 0,
230 5, 6, 7, 8, 0, 0, 0, 1, 10, 0,
233 static const YYINT err_inherit4_stos[] = { 0,
234 257, 258, 259, 260, 263, 266, 267, 267, 261, 264,
235 265, 268, 261, 269, 264,
237 static const YYINT err_inherit4_dgoto[] = { 5,
238 10, 11, 6, 7, 12, 14,
240 static const YYINT err_inherit4_sindex[] = { -257,
241 0, 0, 0, 0, 0, -255, -254, 0, 0, -253,
244 static const YYINT err_inherit4_rindex[] = { 0,
245 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,
249 static const YYINT err_inherit4_cindex[] = { 0,
250 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
254 static const YYINT err_inherit4_gindex[] = { 0,
257 #define YYTABLESIZE 11
258 static const YYINT err_inherit4_table[] = { 1,
259 2, 3, 4, 3, 4, 11, 9, 13, 3, 15,
262 static const YYINT err_inherit4_check[] = { 257,
263 258, 259, 260, 259, 260, 0, 261, 261, 0, 14,
267 static const YYINT err_inherit4_ctable[] = { -1,
268 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
275 #define YYMAXTOKEN 261
276 #define YYUNDFTOKEN 270
277 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
279 static const char *const err_inherit4_name[] = {
281 "$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,
282 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
283 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
284 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
285 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
286 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
287 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
288 "NAME","$accept","declaration","namelist","locnamelist","class","type","$$1",
289 "$$2","illegal-symbol",
291 static const char *const err_inherit4_rule[] = {
292 "$accept : declaration",
295 "declaration : class type $$1 $$2 namelist",
296 "declaration : type locnamelist",
301 "namelist : namelist NAME",
303 "locnamelist : namelist",
315 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
316 YYLTYPE yyloc; /* position returned by actions */
317 YYLTYPE yylloc; /* position from the lexer */
320 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
321 #ifndef YYLLOC_DEFAULT
322 #define YYLLOC_DEFAULT(loc, rhs, n) \
327 (loc).first_line = ((rhs)[-1]).last_line; \
328 (loc).first_column = ((rhs)[-1]).last_column; \
329 (loc).last_line = ((rhs)[-1]).last_line; \
330 (loc).last_column = ((rhs)[-1]).last_column; \
334 (loc).first_line = ((rhs)[ 0 ]).first_line; \
335 (loc).first_column = ((rhs)[ 0 ]).first_column; \
336 (loc).last_line = ((rhs)[n-1]).last_line; \
337 (loc).last_column = ((rhs)[n-1]).last_column; \
340 #endif /* YYLLOC_DEFAULT */
341 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
344 #ifndef YYLVQUEUEGROWTH
345 #define YYLVQUEUEGROWTH 32
347 #endif /* YYBTYACC */
349 /* define the initial stack-sizes */
352 #define YYMAXDEPTH YYSTACKSIZE
355 #define YYSTACKSIZE YYMAXDEPTH
357 #define YYSTACKSIZE 10000
358 #define YYMAXDEPTH 10000
362 #ifndef YYINITSTACKSIZE
363 #define YYINITSTACKSIZE 200
373 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
380 struct YYParseState_s
382 struct YYParseState_s *save; /* Previously saved parser state */
383 YYSTACKDATA yystack; /* saved parser stack */
384 int state; /* saved parser state */
385 int errflag; /* saved error recovery status */
386 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
387 YYINT ctry; /* saved index in yyctable[] for this conflict */
389 typedef struct YYParseState_s YYParseState;
390 #endif /* YYBTYACC */
391 /* variables for the parser stack */
392 static YYSTACKDATA yystack;
395 /* Current parser state */
396 static YYParseState *yyps = 0;
398 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
399 static YYParseState *yypath = 0;
401 /* Base of the lexical value queue */
402 static YYSTYPE *yylvals = 0;
404 /* Current position at lexical value queue */
405 static YYSTYPE *yylvp = 0;
407 /* End position of lexical value queue */
408 static YYSTYPE *yylve = 0;
410 /* The last allocated position at the lexical value queue */
411 static YYSTYPE *yylvlim = 0;
413 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
414 /* Base of the lexical position queue */
415 static YYLTYPE *yylpsns = 0;
417 /* Current position at lexical position queue */
418 static YYLTYPE *yylpp = 0;
420 /* End position of lexical position queue */
421 static YYLTYPE *yylpe = 0;
423 /* The last allocated position at the lexical position queue */
424 static YYLTYPE *yylplim = 0;
427 /* Current position at lexical token queue */
428 static short *yylexp = 0;
430 static short *yylexemes = 0;
431 #endif /* YYBTYACC */
432 #line 80 "err_inherit4.y"
434 extern int YYLEX_DECL();
435 extern void YYERROR_DECL();
436 #line 437 "err_inherit4.tab.c"
438 /* Release memory associated with symbol. */
439 #if ! defined YYDESTRUCT_IS_DECLARED
446 #line 28 "err_inherit4.y"
449 #line 450 "err_inherit4.tab.c"
451 #line 28 "err_inherit4.y"
454 #line 455 "err_inherit4.tab.c"
456 #line 28 "err_inherit4.y"
459 #line 460 "err_inherit4.tab.c"
462 #define YYDESTRUCT_IS_DECLARED 1
465 /* For use in generated program */
466 #define yydepth (int)(yystack.s_mark - yystack.s_base)
468 #define yytrial (yyps->save)
469 #endif /* YYBTYACC */
472 #include <stdio.h> /* needed for printf */
475 #include <stdlib.h> /* needed for malloc, etc */
476 #include <string.h> /* needed for memset */
478 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
479 static int yygrowstack(YYSTACKDATA *data)
485 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
489 if ((newsize = data->stacksize) == 0)
490 newsize = YYINITSTACKSIZE;
491 else if (newsize >= YYMAXDEPTH)
493 else if ((newsize *= 2) > YYMAXDEPTH)
494 newsize = YYMAXDEPTH;
496 i = (int) (data->s_mark - data->s_base);
497 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
501 data->s_base = newss;
502 data->s_mark = newss + i;
504 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
508 data->l_base = newvs;
509 data->l_mark = newvs + i;
511 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
512 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
516 data->p_base = newps;
517 data->p_mark = newps + i;
520 data->stacksize = newsize;
521 data->s_last = data->s_base + newsize - 1;
525 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
530 #if YYPURE || defined(YY_NO_LEAKS)
531 static void yyfreestack(YYSTACKDATA *data)
535 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
538 memset(data, 0, sizeof(*data));
541 #define yyfreestack(data) /* nothing */
542 #endif /* YYPURE || defined(YY_NO_LEAKS) */
545 static YYParseState *
546 yyNewState(unsigned size)
548 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
549 if (p == NULL) return NULL;
551 p->yystack.stacksize = size;
554 p->yystack.s_base = NULL;
555 p->yystack.l_base = NULL;
556 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
557 p->yystack.p_base = NULL;
561 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
562 if (p->yystack.s_base == NULL) return NULL;
563 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
564 if (p->yystack.l_base == NULL) return NULL;
565 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
566 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
567 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
568 if (p->yystack.p_base == NULL) return NULL;
569 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
576 yyFreeState(YYParseState *p)
578 yyfreestack(&p->yystack);
581 #endif /* YYBTYACC */
583 #define YYABORT goto yyabort
584 #define YYREJECT goto yyabort
585 #define YYACCEPT goto yyaccept
586 #define YYERROR goto yyerrlab
588 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
589 #define YYVALID_NESTED do { if (yyps->save && \
590 yyps->save->save == 0) goto yyvalid; } while(0)
591 #endif /* YYBTYACC */
596 int yym, yyn, yystate, yyresult;
599 YYParseState *yyerrctx = NULL;
600 #endif /* YYBTYACC */
601 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
602 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
607 if ((yys = getenv("YYDEBUG")) != 0)
610 if (yyn >= '0' && yyn <= '9')
614 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
618 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
620 #endif /* YYBTYACC */
629 memset(&yystack, 0, sizeof(yystack));
632 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
633 yystack.s_mark = yystack.s_base;
634 yystack.l_mark = yystack.l_base;
635 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
636 yystack.p_mark = yystack.p_base;
642 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
649 /* we're currently re-reading tokens */
651 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
659 /* in trial mode; save scanner results for future parse attempts */
660 if (yylvp == yylvlim)
661 { /* Enlarge lexical value queue */
662 size_t p = (size_t) (yylvp - yylvals);
663 size_t s = (size_t) (yylvlim - yylvals);
665 s += YYLVQUEUEGROWTH;
666 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
667 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
668 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
669 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
671 yylvp = yylve = yylvals + p;
672 yylvlim = yylvals + s;
673 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
674 yylpp = yylpe = yylpsns + p;
675 yylplim = yylpsns + s;
677 yylexp = yylexemes + p;
679 *yylexp = (short) YYLEX;
682 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
689 /* normal operation, no conflict encountered */
690 #endif /* YYBTYACC */
694 #endif /* YYBTYACC */
695 if (yychar < 0) yychar = YYEOF;
699 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
700 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
701 YYDEBUGSTR, yydepth, yystate, yychar, yys);
702 #ifdef YYSTYPE_TOSTRING
705 #endif /* YYBTYACC */
706 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
714 /* Do we have a conflict? */
715 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
716 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
725 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
726 YYDEBUGSTR, yydepth, yystate);
728 /* Switch to the next conflict context */
733 if (save->state != yystate) YYABORT;
740 /* Unresolved conflict - start/continue trial parse */
745 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
747 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
749 fputs("Starting trial parse.\n", stderr);
752 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
753 if (save == NULL) goto yyenomem;
754 save->save = yyps->save;
755 save->state = yystate;
756 save->errflag = yyerrflag;
757 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
758 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
759 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
760 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
761 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
762 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
763 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
766 if (yyctable[ctry] == -1)
769 if (yydebug && yychar >= YYEOF)
770 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
775 if (yyps->save == NULL)
777 /* If this is a first conflict in the stack, start saving lexemes */
780 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
781 if (yylexemes == NULL) goto yyenomem;
782 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
783 if (yylvals == NULL) goto yyenomem;
784 yylvlim = yylvals + YYLVQUEUEGROWTH;
785 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
786 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
787 if (yylpsns == NULL) goto yyenomem;
788 yylplim = yylpsns + YYLVQUEUEGROWTH;
793 yylvp = yylve = yylvals;
794 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
795 yylpp = yylpe = yylpsns;
801 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
804 *yylexp = (short) yychar;
812 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
818 save->lexeme = (int) (yylvp - yylvals);
821 if (yytable[yyn] == ctry)
825 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
826 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
831 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
836 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
838 yystate = yyctable[ctry];
839 *++yystack.s_mark = (YYINT) yystate;
840 *++yystack.l_mark = yylval;
841 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
842 *++yystack.p_mark = yylloc;
845 if (yyerrflag > 0) --yyerrflag;
850 yyn = yyctable[ctry];
853 } /* End of code dealing with conflicts */
854 #endif /* YYBTYACC */
855 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
856 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
860 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
861 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
863 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
864 yystate = yytable[yyn];
865 *++yystack.s_mark = yytable[yyn];
866 *++yystack.l_mark = yylval;
867 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
868 *++yystack.p_mark = yylloc;
871 if (yyerrflag > 0) --yyerrflag;
874 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
875 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
880 if (yyerrflag != 0) goto yyinrecovery;
885 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
888 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
889 * before looking for error recovery */
890 yystack.s_mark -= yym;
891 yystate = *yystack.s_mark;
892 yystack.l_mark -= yym;
893 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
894 yystack.p_mark -= yym;
902 YYParseState *save = yyps->save;
905 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
906 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
907 (int)(yylvp - yylvals - yyps->save->lexeme));
909 /* Memorize most forward-looking error state in case it's really an error. */
910 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
912 /* Free old saved error context state */
913 if (yyerrctx) yyFreeState(yyerrctx);
914 /* Create and fill out new saved error context state */
915 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
916 if (yyerrctx == NULL) goto yyenomem;
917 yyerrctx->save = yyps->save;
918 yyerrctx->state = yystate;
919 yyerrctx->errflag = yyerrflag;
920 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
921 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
922 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
923 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
924 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
925 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
926 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
928 yyerrctx->lexeme = (int) (yylvp - yylvals);
930 yylvp = yylvals + save->lexeme;
931 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
932 yylpp = yylpsns + save->lexeme;
934 yylexp = yylexemes + save->lexeme;
936 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
937 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
938 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
939 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
940 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
941 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
942 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
945 yystate = save->state;
946 /* We tried shift, try reduce now */
947 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
948 yyps->save = save->save;
952 /* Nothing left on the stack -- error */
957 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
960 /* Restore state as it was in the most forward-advanced error */
961 yylvp = yylvals + yyerrctx->lexeme;
962 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
963 yylpp = yylpsns + yyerrctx->lexeme;
965 yylexp = yylexemes + yyerrctx->lexeme;
968 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
971 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
972 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
973 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
974 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
975 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
976 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
977 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
979 yystate = yyerrctx->state;
980 yyFreeState(yyerrctx);
985 if (yynewerrflag == 0) goto yyinrecovery;
986 #endif /* YYBTYACC */
988 YYERROR_CALL("syntax error");
989 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
990 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
994 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1005 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1006 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1010 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1011 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1013 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1014 yystate = yytable[yyn];
1015 *++yystack.s_mark = yytable[yyn];
1016 *++yystack.l_mark = yylval;
1017 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1018 /* lookahead position is error end position */
1019 yyerror_loc_range[1] = yylloc;
1020 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1021 *++yystack.p_mark = yyloc;
1029 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1030 YYDEBUGSTR, yydepth, *yystack.s_mark);
1032 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1033 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1034 /* the current TOS position is the error start position */
1035 yyerror_loc_range[0] = *yystack.p_mark;
1037 #if defined(YYDESTRUCT_CALL)
1040 #endif /* YYBTYACC */
1041 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1042 YYDESTRUCT_CALL("error: discarding state",
1043 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1045 YYDESTRUCT_CALL("error: discarding state",
1046 yystos[*yystack.s_mark], yystack.l_mark);
1047 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1048 #endif /* defined(YYDESTRUCT_CALL) */
1051 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1059 if (yychar == YYEOF) goto yyabort;
1063 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1064 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1065 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1068 #if defined(YYDESTRUCT_CALL)
1071 #endif /* YYBTYACC */
1072 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1073 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1075 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1076 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1077 #endif /* defined(YYDESTRUCT_CALL) */
1087 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1088 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1089 #ifdef YYSTYPE_TOSTRING
1092 #endif /* YYBTYACC */
1097 for (i = yym; i > 0; i--)
1099 if (i != yym) fputs(", ", stderr);
1100 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1101 yystack.l_mark[1-i]), stderr);
1106 fputc('\n', stderr);
1110 yyval = yystack.l_mark[1-yym];
1112 memset(&yyval, 0, sizeof yyval);
1113 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1115 /* Perform position reduction */
1116 memset(&yyloc, 0, sizeof(yyloc));
1119 #endif /* YYBTYACC */
1121 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1122 /* just in case YYERROR is invoked within the action, save
1123 the start of the rhs as the error start position */
1124 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1131 #line 52 "err_inherit4.y"
1132 yyval.cval = yystack.l_mark[-1].cval;
1135 #line 52 "err_inherit4.y"
1136 yyval.tval = yystack.l_mark[-1].tval;
1139 #line 53 "err_inherit4.y"
1140 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[0]; }
1143 #line 55 "err_inherit4.y"
1144 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[-3]; }
1147 #line 58 "err_inherit4.y"
1148 { yyval.cval = cGLOBAL; }
1151 #line 59 "err_inherit4.y"
1152 { yyval.cval = cLOCAL; }
1155 #line 62 "err_inherit4.y"
1156 { yyval.tval = tREAL; }
1159 #line 63 "err_inherit4.y"
1160 { yyval.tval = tINTEGER; }
1163 #line 67 "err_inherit4.y"
1164 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-3].cval, yystack.l_mark[0].id);
1165 yyval.nlist->next = yystack.l_mark[-1].nlist;
1169 #line 71 "err_inherit4.y"
1170 { yyval.nlist->s = mksymbol(yystack.l_mark[-1].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
1171 yyval.nlist->next = NULL;
1175 #line 77 "err_inherit4.y"
1176 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[1]; }
1178 #line 1179 "err_inherit4.tab.c"
1182 yystack.s_mark -= yym;
1183 yystate = *yystack.s_mark;
1184 yystack.l_mark -= yym;
1185 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1186 yystack.p_mark -= yym;
1189 if (yystate == 0 && yym == 0)
1194 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1195 #ifdef YYSTYPE_TOSTRING
1198 #endif /* YYBTYACC */
1199 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1201 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1205 *++yystack.s_mark = YYFINAL;
1206 *++yystack.l_mark = yyval;
1207 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1208 *++yystack.p_mark = yyloc;
1216 /* we're currently re-reading tokens */
1218 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1226 /* in trial mode; save scanner results for future parse attempts */
1227 if (yylvp == yylvlim)
1228 { /* Enlarge lexical value queue */
1229 size_t p = (size_t) (yylvp - yylvals);
1230 size_t s = (size_t) (yylvlim - yylvals);
1232 s += YYLVQUEUEGROWTH;
1233 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1235 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1237 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1238 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1241 yylvp = yylve = yylvals + p;
1242 yylvlim = yylvals + s;
1243 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1244 yylpp = yylpe = yylpsns + p;
1245 yylplim = yylpsns + s;
1247 yylexp = yylexemes + p;
1249 *yylexp = (short) YYLEX;
1252 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1259 /* normal operation, no conflict encountered */
1260 #endif /* YYBTYACC */
1264 #endif /* YYBTYACC */
1265 if (yychar < 0) yychar = YYEOF;
1269 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1270 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1271 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1275 if (yychar == YYEOF) goto yyaccept;
1278 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1279 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1280 yystate = yytable[yyn];
1282 yystate = yydgoto[yym];
1286 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1287 #ifdef YYSTYPE_TOSTRING
1290 #endif /* YYBTYACC */
1291 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1293 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1296 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1297 *++yystack.s_mark = (YYINT) yystate;
1298 *++yystack.l_mark = yyval;
1299 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1300 *++yystack.p_mark = yyloc;
1305 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1307 if (yypath) YYABORT;
1310 YYParseState *save = yyps->save;
1311 yyps->save = save->save;
1312 save->save = yypath;
1317 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1318 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1322 yyFreeState(yyerrctx);
1325 yylvp = yylvals + yypath->lexeme;
1326 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1327 yylpp = yylpsns + yypath->lexeme;
1329 yylexp = yylexemes + yypath->lexeme;
1331 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1332 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1333 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1334 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1335 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1336 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1337 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1339 yystate = yypath->state;
1341 #endif /* YYBTYACC */
1344 YYERROR_CALL("yacc stack overflow");
1348 YYERROR_CALL("memory exhausted");
1350 #endif /* YYBTYACC */
1360 if (yyps->save) goto yyvalid;
1361 #endif /* YYBTYACC */
1365 #if defined(YYDESTRUCT_CALL)
1366 if (yychar != YYEOF && yychar != YYEMPTY)
1367 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1368 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1370 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1371 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1375 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1378 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1379 YYDESTRUCT_CALL("cleanup: discarding state",
1380 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1382 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1383 YYDESTRUCT_CALL("cleanup: discarding state",
1384 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1385 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1387 #endif /* defined(YYDESTRUCT_CALL) */
1392 yyFreeState(yyerrctx);
1397 YYParseState *save = yyps;
1404 YYParseState *save = yypath;
1405 yypath = save->save;
1409 #endif /* YYBTYACC */
1410 yyfreestack(&yystack);