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 inherit1_parse
25 #define yylex inherit1_lex
29 #define yyerror inherit1_error
33 #define yychar inherit1_char
37 #define yyval inherit1_val
41 #define yylval inherit1_lval
45 #define yydebug inherit1_debug
49 #define yynerrs inherit1_nerrs
53 #define yyerrflag inherit1_errflag
54 #endif /* yyerrflag */
57 #define yylhs inherit1_lhs
61 #define yylen inherit1_len
65 #define yydefred inherit1_defred
69 #define yystos inherit1_stos
73 #define yydgoto inherit1_dgoto
77 #define yysindex inherit1_sindex
81 #define yyrindex inherit1_rindex
85 #define yygindex inherit1_gindex
89 #define yytable inherit1_table
93 #define yycheck inherit1_check
97 #define yyname inherit1_name
101 #define yyrule inherit1_rule
107 #define yycindex inherit1_cindex
108 #endif /* yycindex */
111 #define yyctable inherit1_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "inherit1_"
123 typedef enum {cGLOBAL, cLOCAL} class;
124 typedef enum {tREAL, tINTEGER} type;
127 struct symbol { class c; type t; name id; };
128 typedef struct symbol symbol;
130 struct namelist { symbol *s; struct namelist *next; };
131 typedef struct namelist namelist;
133 extern symbol *mksymbol(type t, class c, name id);
136 #define YYLEX_DECL() yylex(void)
137 #define YYERROR_DECL() yyerror(const char *s)
138 extern int YYLEX_DECL();
139 extern void YYERROR_DECL();
142 #undef YYSTYPE_IS_DECLARED
143 #define YYSTYPE_IS_DECLARED 1
145 #ifndef YYSTYPE_IS_DECLARED
146 #define YYSTYPE_IS_DECLARED 1
147 #line 32 "inherit1.y"
155 #endif /* !YYSTYPE_IS_DECLARED */
156 #line 157 "inherit1.tab.c"
158 /* compatibility with bison */
160 /* compatibility with FreeBSD */
161 # ifdef YYPARSE_PARAM_TYPE
162 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
164 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
167 # define YYPARSE_DECL() yyparse(void)
170 /* Parameters sent to lex. */
172 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
173 # define YYLEX yylex(YYLEX_PARAM)
175 # define YYLEX_DECL() yylex(void)
176 # define YYLEX yylex()
179 /* Parameters sent to yyerror. */
181 #define YYERROR_DECL() yyerror(const char *s)
184 #define YYERROR_CALL(msg) yyerror(msg)
187 extern int YYPARSE_DECL();
194 #define YYERRCODE 256
196 static const YYINT inherit1_lhs[] = { -1,
197 0, 0, 3, 3, 4, 4, 1, 1, 5, 6,
200 static const YYINT inherit1_len[] = { 2,
201 3, 2, 1, 1, 1, 1, 2, 1, 0, 0,
204 static const YYINT inherit1_defred[] = { 0,
205 3, 4, 5, 6, 0, 0, 9, 0, 2, 10,
208 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
209 static const YYINT inherit1_stos[] = { 0,
210 257, 258, 259, 260, 263, 266, 267, 267, 265, 268,
211 261, 264, 269, 261, 264,
213 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
214 static const YYINT inherit1_dgoto[] = { 5,
217 static const YYINT inherit1_sindex[] = { -257,
218 0, 0, 0, 0, 0, -255, 0, -254, 0, 0,
219 0, -253, -254, 0, -253,
221 static const YYINT inherit1_rindex[] = { 0,
222 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
226 static const YYINT inherit1_cindex[] = { 0,
227 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
231 static const YYINT inherit1_gindex[] = { 0,
234 #define YYTABLESIZE 11
235 static const YYINT inherit1_table[] = { 1,
236 2, 3, 4, 3, 4, 1, 11, 14, 11, 15,
239 static const YYINT inherit1_check[] = { 257,
240 258, 259, 260, 259, 260, 0, 261, 261, 0, 13,
244 static const YYINT inherit1_ctable[] = { -1,
245 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
252 #define YYMAXTOKEN 261
253 #define YYUNDFTOKEN 270
254 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
256 static const char *const inherit1_name[] = {
258 "$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,
259 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
260 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
261 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
262 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
263 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
264 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
265 "NAME","$accept","declaration","namelist","locnamelist","class","type","$$1",
266 "$$2","illegal-symbol",
268 static const char *const inherit1_rule[] = {
269 "$accept : declaration",
270 "declaration : class type namelist",
271 "declaration : type locnamelist",
276 "namelist : namelist NAME",
280 "locnamelist : $$1 $$2 namelist",
292 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
293 YYLTYPE yyloc; /* position returned by actions */
294 YYLTYPE yylloc; /* position from the lexer */
297 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
298 #ifndef YYLLOC_DEFAULT
299 #define YYLLOC_DEFAULT(loc, rhs, n) \
304 (loc).first_line = ((rhs)[-1]).last_line; \
305 (loc).first_column = ((rhs)[-1]).last_column; \
306 (loc).last_line = ((rhs)[-1]).last_line; \
307 (loc).last_column = ((rhs)[-1]).last_column; \
311 (loc).first_line = ((rhs)[ 0 ]).first_line; \
312 (loc).first_column = ((rhs)[ 0 ]).first_column; \
313 (loc).last_line = ((rhs)[n-1]).last_line; \
314 (loc).last_column = ((rhs)[n-1]).last_column; \
317 #endif /* YYLLOC_DEFAULT */
318 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
321 #ifndef YYLVQUEUEGROWTH
322 #define YYLVQUEUEGROWTH 32
324 #endif /* YYBTYACC */
326 /* define the initial stack-sizes */
329 #define YYMAXDEPTH YYSTACKSIZE
332 #define YYSTACKSIZE YYMAXDEPTH
334 #define YYSTACKSIZE 10000
335 #define YYMAXDEPTH 10000
339 #ifndef YYINITSTACKSIZE
340 #define YYINITSTACKSIZE 200
350 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
357 struct YYParseState_s
359 struct YYParseState_s *save; /* Previously saved parser state */
360 YYSTACKDATA yystack; /* saved parser stack */
361 int state; /* saved parser state */
362 int errflag; /* saved error recovery status */
363 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
364 YYINT ctry; /* saved index in yyctable[] for this conflict */
366 typedef struct YYParseState_s YYParseState;
367 #endif /* YYBTYACC */
368 /* variables for the parser stack */
369 static YYSTACKDATA yystack;
372 /* Current parser state */
373 static YYParseState *yyps = 0;
375 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
376 static YYParseState *yypath = 0;
378 /* Base of the lexical value queue */
379 static YYSTYPE *yylvals = 0;
381 /* Current position at lexical value queue */
382 static YYSTYPE *yylvp = 0;
384 /* End position of lexical value queue */
385 static YYSTYPE *yylve = 0;
387 /* The last allocated position at the lexical value queue */
388 static YYSTYPE *yylvlim = 0;
390 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
391 /* Base of the lexical position queue */
392 static YYLTYPE *yylpsns = 0;
394 /* Current position at lexical position queue */
395 static YYLTYPE *yylpp = 0;
397 /* End position of lexical position queue */
398 static YYLTYPE *yylpe = 0;
400 /* The last allocated position at the lexical position queue */
401 static YYLTYPE *yylplim = 0;
404 /* Current position at lexical token queue */
405 static YYINT *yylexp = 0;
407 static YYINT *yylexemes = 0;
408 #endif /* YYBTYACC */
409 #line 74 "inherit1.y"
411 extern int YYLEX_DECL();
412 extern void YYERROR_DECL();
413 #line 414 "inherit1.tab.c"
415 /* For use in generated program */
416 #define yydepth (int)(yystack.s_mark - yystack.s_base)
418 #define yytrial (yyps->save)
419 #endif /* YYBTYACC */
422 #include <stdio.h> /* needed for printf */
425 #include <stdlib.h> /* needed for malloc, etc */
426 #include <string.h> /* needed for memset */
428 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
429 static int yygrowstack(YYSTACKDATA *data)
435 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
439 if ((newsize = data->stacksize) == 0)
440 newsize = YYINITSTACKSIZE;
441 else if (newsize >= YYMAXDEPTH)
443 else if ((newsize *= 2) > YYMAXDEPTH)
444 newsize = YYMAXDEPTH;
446 i = (int) (data->s_mark - data->s_base);
447 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
451 data->s_base = newss;
452 data->s_mark = newss + i;
454 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
458 data->l_base = newvs;
459 data->l_mark = newvs + i;
461 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
462 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
466 data->p_base = newps;
467 data->p_mark = newps + i;
470 data->stacksize = newsize;
471 data->s_last = data->s_base + newsize - 1;
475 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
480 #if YYPURE || defined(YY_NO_LEAKS)
481 static void yyfreestack(YYSTACKDATA *data)
485 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
488 memset(data, 0, sizeof(*data));
491 #define yyfreestack(data) /* nothing */
492 #endif /* YYPURE || defined(YY_NO_LEAKS) */
495 static YYParseState *
496 yyNewState(unsigned size)
498 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
499 if (p == NULL) return NULL;
501 p->yystack.stacksize = size;
504 p->yystack.s_base = NULL;
505 p->yystack.l_base = NULL;
506 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
507 p->yystack.p_base = NULL;
511 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
512 if (p->yystack.s_base == NULL) return NULL;
513 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
514 if (p->yystack.l_base == NULL) return NULL;
515 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
516 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
517 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
518 if (p->yystack.p_base == NULL) return NULL;
519 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
526 yyFreeState(YYParseState *p)
528 yyfreestack(&p->yystack);
531 #endif /* YYBTYACC */
533 #define YYABORT goto yyabort
534 #define YYREJECT goto yyabort
535 #define YYACCEPT goto yyaccept
536 #define YYERROR goto yyerrlab
538 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
539 #define YYVALID_NESTED do { if (yyps->save && \
540 yyps->save->save == 0) goto yyvalid; } while(0)
541 #endif /* YYBTYACC */
546 int yym, yyn, yystate, yyresult;
549 YYParseState *yyerrctx = NULL;
550 #endif /* YYBTYACC */
551 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
552 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
557 if ((yys = getenv("YYDEBUG")) != 0)
560 if (yyn >= '0' && yyn <= '9')
564 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
568 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
570 #endif /* YYBTYACC */
579 memset(&yystack, 0, sizeof(yystack));
582 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
583 yystack.s_mark = yystack.s_base;
584 yystack.l_mark = yystack.l_base;
585 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
586 yystack.p_mark = yystack.p_base;
592 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
599 /* we're currently re-reading tokens */
601 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
609 /* in trial mode; save scanner results for future parse attempts */
610 if (yylvp == yylvlim)
611 { /* Enlarge lexical value queue */
612 size_t p = (size_t) (yylvp - yylvals);
613 size_t s = (size_t) (yylvlim - yylvals);
615 s += YYLVQUEUEGROWTH;
616 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
617 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
618 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
619 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
621 yylvp = yylve = yylvals + p;
622 yylvlim = yylvals + s;
623 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
624 yylpp = yylpe = yylpsns + p;
625 yylplim = yylpsns + s;
627 yylexp = yylexemes + p;
629 *yylexp = (YYINT) YYLEX;
632 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
639 /* normal operation, no conflict encountered */
640 #endif /* YYBTYACC */
644 #endif /* YYBTYACC */
645 if (yychar < 0) yychar = YYEOF;
649 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
650 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
651 YYDEBUGSTR, yydepth, yystate, yychar, yys);
652 #ifdef YYSTYPE_TOSTRING
655 #endif /* YYBTYACC */
656 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
664 /* Do we have a conflict? */
665 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
666 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
675 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
676 YYDEBUGSTR, yydepth, yystate);
678 /* Switch to the next conflict context */
683 if (save->state != yystate) YYABORT;
690 /* Unresolved conflict - start/continue trial parse */
695 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
697 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
699 fputs("Starting trial parse.\n", stderr);
702 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
703 if (save == NULL) goto yyenomem;
704 save->save = yyps->save;
705 save->state = yystate;
706 save->errflag = yyerrflag;
707 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
708 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
709 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
710 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
711 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
712 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
713 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
716 if (yyctable[ctry] == -1)
719 if (yydebug && yychar >= YYEOF)
720 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
725 if (yyps->save == NULL)
727 /* If this is a first conflict in the stack, start saving lexemes */
730 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
731 if (yylexemes == NULL) goto yyenomem;
732 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
733 if (yylvals == NULL) goto yyenomem;
734 yylvlim = yylvals + YYLVQUEUEGROWTH;
735 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
736 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
737 if (yylpsns == NULL) goto yyenomem;
738 yylplim = yylpsns + YYLVQUEUEGROWTH;
743 yylvp = yylve = yylvals;
744 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
745 yylpp = yylpe = yylpsns;
751 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
754 *yylexp = (YYINT) yychar;
762 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
768 save->lexeme = (int) (yylvp - yylvals);
771 if (yytable[yyn] == ctry)
775 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
776 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
781 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
786 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
788 yystate = yyctable[ctry];
789 *++yystack.s_mark = (YYINT) yystate;
790 *++yystack.l_mark = yylval;
791 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
792 *++yystack.p_mark = yylloc;
795 if (yyerrflag > 0) --yyerrflag;
800 yyn = yyctable[ctry];
803 } /* End of code dealing with conflicts */
804 #endif /* YYBTYACC */
805 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
806 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
810 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
811 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
813 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
814 yystate = yytable[yyn];
815 *++yystack.s_mark = yytable[yyn];
816 *++yystack.l_mark = yylval;
817 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
818 *++yystack.p_mark = yylloc;
821 if (yyerrflag > 0) --yyerrflag;
824 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
825 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
830 if (yyerrflag != 0) goto yyinrecovery;
835 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
838 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
839 * before looking for error recovery */
840 yystack.s_mark -= yym;
841 yystate = *yystack.s_mark;
842 yystack.l_mark -= yym;
843 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
844 yystack.p_mark -= yym;
852 YYParseState *save = yyps->save;
855 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
856 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
857 (int)(yylvp - yylvals - yyps->save->lexeme));
859 /* Memorize most forward-looking error state in case it's really an error. */
860 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
862 /* Free old saved error context state */
863 if (yyerrctx) yyFreeState(yyerrctx);
864 /* Create and fill out new saved error context state */
865 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
866 if (yyerrctx == NULL) goto yyenomem;
867 yyerrctx->save = yyps->save;
868 yyerrctx->state = yystate;
869 yyerrctx->errflag = yyerrflag;
870 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
871 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
872 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
873 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
874 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
875 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
876 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
878 yyerrctx->lexeme = (int) (yylvp - yylvals);
880 yylvp = yylvals + save->lexeme;
881 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
882 yylpp = yylpsns + save->lexeme;
884 yylexp = yylexemes + save->lexeme;
886 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
887 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
888 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
889 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
890 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
891 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
892 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
895 yystate = save->state;
896 /* We tried shift, try reduce now */
897 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
898 yyps->save = save->save;
902 /* Nothing left on the stack -- error */
907 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
910 /* Restore state as it was in the most forward-advanced error */
911 yylvp = yylvals + yyerrctx->lexeme;
912 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
913 yylpp = yylpsns + yyerrctx->lexeme;
915 yylexp = yylexemes + yyerrctx->lexeme;
918 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
921 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
922 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
923 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
924 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
925 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
926 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
927 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
929 yystate = yyerrctx->state;
930 yyFreeState(yyerrctx);
935 if (yynewerrflag == 0) goto yyinrecovery;
936 #endif /* YYBTYACC */
938 YYERROR_CALL("syntax error");
939 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
940 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
944 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
955 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
956 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
960 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
961 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
963 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
964 yystate = yytable[yyn];
965 *++yystack.s_mark = yytable[yyn];
966 *++yystack.l_mark = yylval;
967 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
968 /* lookahead position is error end position */
969 yyerror_loc_range[1] = yylloc;
970 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
971 *++yystack.p_mark = yyloc;
979 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
980 YYDEBUGSTR, yydepth, *yystack.s_mark);
982 if (yystack.s_mark <= yystack.s_base) goto yyabort;
983 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
984 /* the current TOS position is the error start position */
985 yyerror_loc_range[0] = *yystack.p_mark;
987 #if defined(YYDESTRUCT_CALL)
990 #endif /* YYBTYACC */
991 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
992 YYDESTRUCT_CALL("error: discarding state",
993 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
995 YYDESTRUCT_CALL("error: discarding state",
996 yystos[*yystack.s_mark], yystack.l_mark);
997 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
998 #endif /* defined(YYDESTRUCT_CALL) */
1001 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1009 if (yychar == YYEOF) goto yyabort;
1013 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1014 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1015 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1018 #if defined(YYDESTRUCT_CALL)
1021 #endif /* YYBTYACC */
1022 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1023 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1025 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1026 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1027 #endif /* defined(YYDESTRUCT_CALL) */
1037 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1038 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1039 #ifdef YYSTYPE_TOSTRING
1042 #endif /* YYBTYACC */
1047 for (i = yym; i > 0; i--)
1049 if (i != yym) fputs(", ", stderr);
1050 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1051 yystack.l_mark[1-i]), stderr);
1056 fputc('\n', stderr);
1060 yyval = yystack.l_mark[1-yym];
1062 memset(&yyval, 0, sizeof yyval);
1063 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1065 /* Perform position reduction */
1066 memset(&yyloc, 0, sizeof(yyloc));
1069 #endif /* YYBTYACC */
1071 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1072 /* just in case YYERROR is invoked within the action, save
1073 the start of the rhs as the error start position */
1074 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1081 #line 44 "inherit1.y"
1082 { yyval.nlist = yystack.l_mark[0].nlist; }
1085 #line 46 "inherit1.y"
1086 { yyval.nlist = yystack.l_mark[0].nlist; }
1089 #line 49 "inherit1.y"
1090 { yyval.cval = cGLOBAL; }
1093 #line 50 "inherit1.y"
1094 { yyval.cval = cLOCAL; }
1097 #line 53 "inherit1.y"
1098 { yyval.tval = tREAL; }
1101 #line 54 "inherit1.y"
1102 { yyval.tval = tINTEGER; }
1105 #line 58 "inherit1.y"
1106 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-3].cval, yystack.l_mark[0].id);
1107 yyval.nlist->next = yystack.l_mark[-1].nlist;
1111 #line 62 "inherit1.y"
1112 { yyval.nlist->s = mksymbol(yystack.l_mark[-1].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
1113 yyval.nlist->next = NULL;
1117 #line 68 "inherit1.y"
1118 { yyval.cval = cLOCAL; }
1121 #line 69 "inherit1.y"
1122 { yyval.tval = yystack.l_mark[-2].tval; }
1125 #line 71 "inherit1.y"
1126 { yyval.nlist = yystack.l_mark[0].nlist; }
1128 #line 1129 "inherit1.tab.c"
1132 yystack.s_mark -= yym;
1133 yystate = *yystack.s_mark;
1134 yystack.l_mark -= yym;
1135 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1136 yystack.p_mark -= yym;
1139 if (yystate == 0 && yym == 0)
1144 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1145 #ifdef YYSTYPE_TOSTRING
1148 #endif /* YYBTYACC */
1149 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1151 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1155 *++yystack.s_mark = YYFINAL;
1156 *++yystack.l_mark = yyval;
1157 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1158 *++yystack.p_mark = yyloc;
1166 /* we're currently re-reading tokens */
1168 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1176 /* in trial mode; save scanner results for future parse attempts */
1177 if (yylvp == yylvlim)
1178 { /* Enlarge lexical value queue */
1179 size_t p = (size_t) (yylvp - yylvals);
1180 size_t s = (size_t) (yylvlim - yylvals);
1182 s += YYLVQUEUEGROWTH;
1183 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1185 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1187 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1188 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1191 yylvp = yylve = yylvals + p;
1192 yylvlim = yylvals + s;
1193 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1194 yylpp = yylpe = yylpsns + p;
1195 yylplim = yylpsns + s;
1197 yylexp = yylexemes + p;
1199 *yylexp = (YYINT) YYLEX;
1202 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1209 /* normal operation, no conflict encountered */
1210 #endif /* YYBTYACC */
1214 #endif /* YYBTYACC */
1215 if (yychar < 0) yychar = YYEOF;
1219 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1220 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1221 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1225 if (yychar == YYEOF) goto yyaccept;
1228 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1229 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1230 yystate = yytable[yyn];
1232 yystate = yydgoto[yym];
1236 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1237 #ifdef YYSTYPE_TOSTRING
1240 #endif /* YYBTYACC */
1241 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1243 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1246 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1247 *++yystack.s_mark = (YYINT) yystate;
1248 *++yystack.l_mark = yyval;
1249 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1250 *++yystack.p_mark = yyloc;
1255 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1257 if (yypath) YYABORT;
1260 YYParseState *save = yyps->save;
1261 yyps->save = save->save;
1262 save->save = yypath;
1267 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1268 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1272 yyFreeState(yyerrctx);
1275 yylvp = yylvals + yypath->lexeme;
1276 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1277 yylpp = yylpsns + yypath->lexeme;
1279 yylexp = yylexemes + yypath->lexeme;
1281 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1282 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1283 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1284 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1285 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1286 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1287 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1289 yystate = yypath->state;
1291 #endif /* YYBTYACC */
1294 YYERROR_CALL("yacc stack overflow");
1298 YYERROR_CALL("memory exhausted");
1300 #endif /* YYBTYACC */
1310 if (yyps->save) goto yyvalid;
1311 #endif /* YYBTYACC */
1315 #if defined(YYDESTRUCT_CALL)
1316 if (yychar != YYEOF && yychar != YYEMPTY)
1317 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1318 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1320 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1321 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1325 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1328 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1329 YYDESTRUCT_CALL("cleanup: discarding state",
1330 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1332 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1333 YYDESTRUCT_CALL("cleanup: discarding state",
1334 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1335 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1337 #endif /* defined(YYDESTRUCT_CALL) */
1342 yyFreeState(yyerrctx);
1347 YYParseState *save = yyps;
1354 YYParseState *save = yypath;
1355 yypath = save->save;
1359 #endif /* YYBTYACC */
1360 yyfreestack(&yystack);