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);
566 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
567 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
571 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
573 #endif /* YYBTYACC */
582 memset(&yystack, 0, sizeof(yystack));
585 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
586 yystack.s_mark = yystack.s_base;
587 yystack.l_mark = yystack.l_base;
588 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
589 yystack.p_mark = yystack.p_base;
595 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
602 /* we're currently re-reading tokens */
604 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
612 /* in trial mode; save scanner results for future parse attempts */
613 if (yylvp == yylvlim)
614 { /* Enlarge lexical value queue */
615 size_t p = (size_t) (yylvp - yylvals);
616 size_t s = (size_t) (yylvlim - yylvals);
618 s += YYLVQUEUEGROWTH;
619 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
620 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
621 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
622 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
624 yylvp = yylve = yylvals + p;
625 yylvlim = yylvals + s;
626 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
627 yylpp = yylpe = yylpsns + p;
628 yylplim = yylpsns + s;
630 yylexp = yylexemes + p;
632 *yylexp = (YYINT) YYLEX;
635 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
642 /* normal operation, no conflict encountered */
643 #endif /* YYBTYACC */
647 #endif /* YYBTYACC */
648 if (yychar < 0) yychar = YYEOF;
652 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
653 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
654 YYDEBUGSTR, yydepth, yystate, yychar, yys);
655 #ifdef YYSTYPE_TOSTRING
658 #endif /* YYBTYACC */
659 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
667 /* Do we have a conflict? */
668 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
669 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
678 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
679 YYDEBUGSTR, yydepth, yystate);
681 /* Switch to the next conflict context */
686 if (save->state != yystate) YYABORT;
693 /* Unresolved conflict - start/continue trial parse */
698 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
700 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
702 fputs("Starting trial parse.\n", stderr);
705 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
706 if (save == NULL) goto yyenomem;
707 save->save = yyps->save;
708 save->state = yystate;
709 save->errflag = yyerrflag;
710 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
711 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
712 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
713 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
714 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
715 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
716 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
719 if (yyctable[ctry] == -1)
722 if (yydebug && yychar >= YYEOF)
723 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
728 if (yyps->save == NULL)
730 /* If this is a first conflict in the stack, start saving lexemes */
733 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
734 if (yylexemes == NULL) goto yyenomem;
735 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
736 if (yylvals == NULL) goto yyenomem;
737 yylvlim = yylvals + YYLVQUEUEGROWTH;
738 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
739 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
740 if (yylpsns == NULL) goto yyenomem;
741 yylplim = yylpsns + YYLVQUEUEGROWTH;
746 yylvp = yylve = yylvals;
747 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
748 yylpp = yylpe = yylpsns;
754 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
757 *yylexp = (YYINT) yychar;
765 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
771 save->lexeme = (int) (yylvp - yylvals);
774 if (yytable[yyn] == ctry)
778 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
779 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
784 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
789 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
791 yystate = yyctable[ctry];
792 *++yystack.s_mark = (YYINT) yystate;
793 *++yystack.l_mark = yylval;
794 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
795 *++yystack.p_mark = yylloc;
798 if (yyerrflag > 0) --yyerrflag;
803 yyn = yyctable[ctry];
806 } /* End of code dealing with conflicts */
807 #endif /* YYBTYACC */
808 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
809 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
813 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
814 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
816 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
817 yystate = yytable[yyn];
818 *++yystack.s_mark = yytable[yyn];
819 *++yystack.l_mark = yylval;
820 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
821 *++yystack.p_mark = yylloc;
824 if (yyerrflag > 0) --yyerrflag;
827 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
828 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
833 if (yyerrflag != 0) goto yyinrecovery;
838 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
841 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
842 * before looking for error recovery */
843 yystack.s_mark -= yym;
844 yystate = *yystack.s_mark;
845 yystack.l_mark -= yym;
846 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
847 yystack.p_mark -= yym;
855 YYParseState *save = yyps->save;
858 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
859 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
860 (int)(yylvp - yylvals - yyps->save->lexeme));
862 /* Memorize most forward-looking error state in case it's really an error. */
863 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
865 /* Free old saved error context state */
866 if (yyerrctx) yyFreeState(yyerrctx);
867 /* Create and fill out new saved error context state */
868 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
869 if (yyerrctx == NULL) goto yyenomem;
870 yyerrctx->save = yyps->save;
871 yyerrctx->state = yystate;
872 yyerrctx->errflag = yyerrflag;
873 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
874 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
875 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
876 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
877 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
878 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
879 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
881 yyerrctx->lexeme = (int) (yylvp - yylvals);
883 yylvp = yylvals + save->lexeme;
884 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
885 yylpp = yylpsns + save->lexeme;
887 yylexp = yylexemes + save->lexeme;
889 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
890 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
891 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
892 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
893 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
894 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
895 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
898 yystate = save->state;
899 /* We tried shift, try reduce now */
900 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
901 yyps->save = save->save;
905 /* Nothing left on the stack -- error */
910 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
913 /* Restore state as it was in the most forward-advanced error */
914 yylvp = yylvals + yyerrctx->lexeme;
915 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
916 yylpp = yylpsns + yyerrctx->lexeme;
918 yylexp = yylexemes + yyerrctx->lexeme;
921 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
924 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
925 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
926 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
927 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
928 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
929 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
930 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
932 yystate = yyerrctx->state;
933 yyFreeState(yyerrctx);
938 if (yynewerrflag == 0) goto yyinrecovery;
939 #endif /* YYBTYACC */
941 YYERROR_CALL("syntax error");
942 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
943 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
947 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
958 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
959 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
963 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
964 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
966 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
967 yystate = yytable[yyn];
968 *++yystack.s_mark = yytable[yyn];
969 *++yystack.l_mark = yylval;
970 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
971 /* lookahead position is error end position */
972 yyerror_loc_range[1] = yylloc;
973 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
974 *++yystack.p_mark = yyloc;
982 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
983 YYDEBUGSTR, yydepth, *yystack.s_mark);
985 if (yystack.s_mark <= yystack.s_base) goto yyabort;
986 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
987 /* the current TOS position is the error start position */
988 yyerror_loc_range[0] = *yystack.p_mark;
990 #if defined(YYDESTRUCT_CALL)
993 #endif /* YYBTYACC */
994 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
995 YYDESTRUCT_CALL("error: discarding state",
996 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
998 YYDESTRUCT_CALL("error: discarding state",
999 yystos[*yystack.s_mark], yystack.l_mark);
1000 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1001 #endif /* defined(YYDESTRUCT_CALL) */
1004 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1012 if (yychar == YYEOF) goto yyabort;
1016 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1017 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1018 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1021 #if defined(YYDESTRUCT_CALL)
1024 #endif /* YYBTYACC */
1025 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1026 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1028 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1029 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1030 #endif /* defined(YYDESTRUCT_CALL) */
1040 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1041 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1042 #ifdef YYSTYPE_TOSTRING
1045 #endif /* YYBTYACC */
1050 for (i = yym; i > 0; i--)
1052 if (i != yym) fputs(", ", stderr);
1053 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1054 yystack.l_mark[1-i]), stderr);
1059 fputc('\n', stderr);
1063 yyval = yystack.l_mark[1-yym];
1065 memset(&yyval, 0, sizeof yyval);
1066 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1068 /* Perform position reduction */
1069 memset(&yyloc, 0, sizeof(yyloc));
1072 #endif /* YYBTYACC */
1074 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1075 /* just in case YYERROR is invoked within the action, save
1076 the start of the rhs as the error start position */
1077 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1084 #line 44 "inherit1.y"
1085 { yyval.nlist = yystack.l_mark[0].nlist; }
1088 #line 46 "inherit1.y"
1089 { yyval.nlist = yystack.l_mark[0].nlist; }
1092 #line 49 "inherit1.y"
1093 { yyval.cval = cGLOBAL; }
1096 #line 50 "inherit1.y"
1097 { yyval.cval = cLOCAL; }
1100 #line 53 "inherit1.y"
1101 { yyval.tval = tREAL; }
1104 #line 54 "inherit1.y"
1105 { yyval.tval = tINTEGER; }
1108 #line 58 "inherit1.y"
1109 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-3].cval, yystack.l_mark[0].id);
1110 yyval.nlist->next = yystack.l_mark[-1].nlist;
1114 #line 62 "inherit1.y"
1115 { yyval.nlist->s = mksymbol(yystack.l_mark[-1].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
1116 yyval.nlist->next = NULL;
1120 #line 68 "inherit1.y"
1121 { yyval.cval = cLOCAL; }
1124 #line 69 "inherit1.y"
1125 { yyval.tval = yystack.l_mark[-2].tval; }
1128 #line 71 "inherit1.y"
1129 { yyval.nlist = yystack.l_mark[0].nlist; }
1131 #line 1132 "inherit1.tab.c"
1135 yystack.s_mark -= yym;
1136 yystate = *yystack.s_mark;
1137 yystack.l_mark -= yym;
1138 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1139 yystack.p_mark -= yym;
1142 if (yystate == 0 && yym == 0)
1147 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1148 #ifdef YYSTYPE_TOSTRING
1151 #endif /* YYBTYACC */
1152 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1154 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1158 *++yystack.s_mark = YYFINAL;
1159 *++yystack.l_mark = yyval;
1160 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1161 *++yystack.p_mark = yyloc;
1169 /* we're currently re-reading tokens */
1171 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1179 /* in trial mode; save scanner results for future parse attempts */
1180 if (yylvp == yylvlim)
1181 { /* Enlarge lexical value queue */
1182 size_t p = (size_t) (yylvp - yylvals);
1183 size_t s = (size_t) (yylvlim - yylvals);
1185 s += YYLVQUEUEGROWTH;
1186 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1188 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1190 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1191 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1194 yylvp = yylve = yylvals + p;
1195 yylvlim = yylvals + s;
1196 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1197 yylpp = yylpe = yylpsns + p;
1198 yylplim = yylpsns + s;
1200 yylexp = yylexemes + p;
1202 *yylexp = (YYINT) YYLEX;
1205 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1212 /* normal operation, no conflict encountered */
1213 #endif /* YYBTYACC */
1217 #endif /* YYBTYACC */
1218 if (yychar < 0) yychar = YYEOF;
1222 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1223 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1224 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1228 if (yychar == YYEOF) goto yyaccept;
1231 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1232 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1233 yystate = yytable[yyn];
1235 yystate = yydgoto[yym];
1239 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1240 #ifdef YYSTYPE_TOSTRING
1243 #endif /* YYBTYACC */
1244 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1246 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1249 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1250 *++yystack.s_mark = (YYINT) yystate;
1251 *++yystack.l_mark = yyval;
1252 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1253 *++yystack.p_mark = yyloc;
1258 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1260 if (yypath) YYABORT;
1263 YYParseState *save = yyps->save;
1264 yyps->save = save->save;
1265 save->save = yypath;
1270 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1271 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1275 yyFreeState(yyerrctx);
1278 yylvp = yylvals + yypath->lexeme;
1279 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1280 yylpp = yylpsns + yypath->lexeme;
1282 yylexp = yylexemes + yypath->lexeme;
1284 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1285 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1286 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1287 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1288 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1289 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1290 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1292 yystate = yypath->state;
1294 #endif /* YYBTYACC */
1297 YYERROR_CALL("yacc stack overflow");
1301 YYERROR_CALL("memory exhausted");
1303 #endif /* YYBTYACC */
1313 if (yyps->save) goto yyvalid;
1314 #endif /* YYBTYACC */
1318 #if defined(YYDESTRUCT_CALL)
1319 if (yychar != YYEOF && yychar != YYEMPTY)
1320 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1321 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1323 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1324 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1328 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1331 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1332 YYDESTRUCT_CALL("cleanup: discarding state",
1333 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1335 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1336 YYDESTRUCT_CALL("cleanup: discarding state",
1337 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1338 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1340 #endif /* defined(YYDESTRUCT_CALL) */
1345 yyFreeState(yyerrctx);
1350 YYParseState *save = yyps;
1357 YYParseState *save = yypath;
1358 yypath = save->save;
1362 #endif /* YYBTYACC */
1363 yyfreestack(&yystack);