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();
141 #line 32 "inherit1.y"
143 #undef YYSTYPE_IS_DECLARED
144 #define YYSTYPE_IS_DECLARED 1
146 #ifndef YYSTYPE_IS_DECLARED
147 #define YYSTYPE_IS_DECLARED 1
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 static const YYINT inherit1_stos[] = { 0,
209 257, 258, 259, 260, 263, 266, 267, 267, 265, 268,
210 261, 264, 269, 261, 264,
212 static const YYINT inherit1_dgoto[] = { 5,
215 static const YYINT inherit1_sindex[] = { -257,
216 0, 0, 0, 0, 0, -255, 0, -254, 0, 0,
217 0, -253, -254, 0, -253,
219 static const YYINT inherit1_rindex[] = { 0,
220 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
224 static const YYINT inherit1_cindex[] = { 0,
225 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
229 static const YYINT inherit1_gindex[] = { 0,
232 #define YYTABLESIZE 11
233 static const YYINT inherit1_table[] = { 1,
234 2, 3, 4, 3, 4, 1, 11, 14, 11, 15,
237 static const YYINT inherit1_check[] = { 257,
238 258, 259, 260, 259, 260, 0, 261, 261, 0, 13,
245 #define YYMAXTOKEN 261
246 #define YYUNDFTOKEN 270
247 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
249 static const char *const inherit1_name[] = {
251 "$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,
252 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
253 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
254 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
255 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
256 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
257 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
258 "NAME","$accept","declaration","namelist","locnamelist","class","type","$$1",
259 "$$2","illegal-symbol",
261 static const char *const inherit1_rule[] = {
262 "$accept : declaration",
263 "declaration : class type namelist",
264 "declaration : type locnamelist",
269 "namelist : namelist NAME",
273 "locnamelist : $$1 $$2 namelist",
285 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
286 YYLTYPE yyloc; /* position returned by actions */
287 YYLTYPE yylloc; /* position from the lexer */
290 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
291 #ifndef YYLLOC_DEFAULT
292 #define YYLLOC_DEFAULT(loc, rhs, n) \
297 (loc).first_line = ((rhs)[-1]).last_line; \
298 (loc).first_column = ((rhs)[-1]).last_column; \
299 (loc).last_line = ((rhs)[-1]).last_line; \
300 (loc).last_column = ((rhs)[-1]).last_column; \
304 (loc).first_line = ((rhs)[ 0 ]).first_line; \
305 (loc).first_column = ((rhs)[ 0 ]).first_column; \
306 (loc).last_line = ((rhs)[n-1]).last_line; \
307 (loc).last_column = ((rhs)[n-1]).last_column; \
310 #endif /* YYLLOC_DEFAULT */
311 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
314 #ifndef YYLVQUEUEGROWTH
315 #define YYLVQUEUEGROWTH 32
317 #endif /* YYBTYACC */
319 /* define the initial stack-sizes */
322 #define YYMAXDEPTH YYSTACKSIZE
325 #define YYSTACKSIZE YYMAXDEPTH
327 #define YYSTACKSIZE 10000
328 #define YYMAXDEPTH 10000
332 #ifndef YYINITSTACKSIZE
333 #define YYINITSTACKSIZE 200
343 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
350 struct YYParseState_s
352 struct YYParseState_s *save; /* Previously saved parser state */
353 YYSTACKDATA yystack; /* saved parser stack */
354 int state; /* saved parser state */
355 int errflag; /* saved error recovery status */
356 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
357 YYINT ctry; /* saved index in yyctable[] for this conflict */
359 typedef struct YYParseState_s YYParseState;
360 #endif /* YYBTYACC */
361 /* variables for the parser stack */
362 static YYSTACKDATA yystack;
365 /* Current parser state */
366 static YYParseState *yyps = 0;
368 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
369 static YYParseState *yypath = 0;
371 /* Base of the lexical value queue */
372 static YYSTYPE *yylvals = 0;
374 /* Current position at lexical value queue */
375 static YYSTYPE *yylvp = 0;
377 /* End position of lexical value queue */
378 static YYSTYPE *yylve = 0;
380 /* The last allocated position at the lexical value queue */
381 static YYSTYPE *yylvlim = 0;
383 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
384 /* Base of the lexical position queue */
385 static YYLTYPE *yylpsns = 0;
387 /* Current position at lexical position queue */
388 static YYLTYPE *yylpp = 0;
390 /* End position of lexical position queue */
391 static YYLTYPE *yylpe = 0;
393 /* The last allocated position at the lexical position queue */
394 static YYLTYPE *yylplim = 0;
397 /* Current position at lexical token queue */
398 static short *yylexp = 0;
400 static short *yylexemes = 0;
401 #endif /* YYBTYACC */
402 #line 74 "inherit1.y"
404 extern int YYLEX_DECL();
405 extern void YYERROR_DECL();
406 #line 407 "inherit1.tab.c"
408 /* For use in generated program */
409 #define yydepth (int)(yystack.s_mark - yystack.s_base)
411 #define yytrial (yyps->save)
412 #endif /* YYBTYACC */
415 #include <stdio.h> /* needed for printf */
418 #include <stdlib.h> /* needed for malloc, etc */
419 #include <string.h> /* needed for memset */
421 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
422 static int yygrowstack(YYSTACKDATA *data)
428 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
432 if ((newsize = data->stacksize) == 0)
433 newsize = YYINITSTACKSIZE;
434 else if (newsize >= YYMAXDEPTH)
436 else if ((newsize *= 2) > YYMAXDEPTH)
437 newsize = YYMAXDEPTH;
439 i = (int) (data->s_mark - data->s_base);
440 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
444 data->s_base = newss;
445 data->s_mark = newss + i;
447 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
451 data->l_base = newvs;
452 data->l_mark = newvs + i;
454 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
455 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
459 data->p_base = newps;
460 data->p_mark = newps + i;
463 data->stacksize = newsize;
464 data->s_last = data->s_base + newsize - 1;
468 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
473 #if YYPURE || defined(YY_NO_LEAKS)
474 static void yyfreestack(YYSTACKDATA *data)
478 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
481 memset(data, 0, sizeof(*data));
484 #define yyfreestack(data) /* nothing */
485 #endif /* YYPURE || defined(YY_NO_LEAKS) */
488 static YYParseState *
489 yyNewState(unsigned size)
491 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
492 if (p == NULL) return NULL;
494 p->yystack.stacksize = size;
497 p->yystack.s_base = NULL;
498 p->yystack.l_base = NULL;
499 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
500 p->yystack.p_base = NULL;
504 p->yystack.s_base = (short *) malloc(size * sizeof(short));
505 if (p->yystack.s_base == NULL) return NULL;
506 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
507 if (p->yystack.l_base == NULL) return NULL;
508 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
509 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
510 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
511 if (p->yystack.p_base == NULL) return NULL;
512 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
519 yyFreeState(YYParseState *p)
521 yyfreestack(&p->yystack);
524 #endif /* YYBTYACC */
526 #define YYABORT goto yyabort
527 #define YYREJECT goto yyabort
528 #define YYACCEPT goto yyaccept
529 #define YYERROR goto yyerrlab
531 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
532 #define YYVALID_NESTED do { if (yyps->save && \
533 yyps->save->save == 0) goto yyvalid; } while(0)
534 #endif /* YYBTYACC */
539 int yym, yyn, yystate, yyresult;
542 YYParseState *yyerrctx = NULL;
543 #endif /* YYBTYACC */
544 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
545 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
550 if ((yys = getenv("YYDEBUG")) != 0)
553 if (yyn >= '0' && yyn <= '9')
557 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
561 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
563 #endif /* YYBTYACC */
570 memset(&yystack, 0, sizeof(yystack));
573 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
574 yystack.s_mark = yystack.s_base;
575 yystack.l_mark = yystack.l_base;
576 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
577 yystack.p_mark = yystack.p_base;
583 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
590 /* we're currently re-reading tokens */
592 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
600 /* in trial mode; save scanner results for future parse attempts */
601 if (yylvp == yylvlim)
602 { /* Enlarge lexical value queue */
603 int p = yylvp - yylvals;
604 int s = yylvlim - yylvals;
606 s += YYLVQUEUEGROWTH;
607 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
608 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
609 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
610 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
612 yylvp = yylve = yylvals + p;
613 yylvlim = yylvals + s;
614 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
615 yylpp = yylpe = yylpsns + p;
616 yylplim = yylpsns + s;
618 yylexp = yylexemes + p;
620 *yylexp = (short) YYLEX;
623 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
630 /* normal operation, no conflict encountered */
631 #endif /* YYBTYACC */
635 #endif /* YYBTYACC */
636 if (yychar < 0) yychar = YYEOF;
637 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
641 yys = yyname[YYTRANSLATE(yychar)];
642 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
643 YYDEBUGSTR, yydepth, yystate, yychar, yys);
644 #ifdef YYSTYPE_TOSTRING
647 #endif /* YYBTYACC */
648 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
656 /* Do we have a conflict? */
657 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
658 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
667 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
668 YYDEBUGSTR, yydepth, yystate);
670 /* Switch to the next conflict context */
675 if (save->state != yystate) YYABORT;
682 /* Unresolved conflict - start/continue trial parse */
687 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
689 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
691 fputs("Starting trial parse.\n", stderr);
694 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
695 if (save == NULL) goto yyenomem;
696 save->save = yyps->save;
697 save->state = yystate;
698 save->errflag = yyerrflag;
699 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
700 memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
701 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
702 memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
703 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
704 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
705 memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
708 if (yyctable[ctry] == -1)
711 if (yydebug && yychar >= YYEOF)
712 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
717 if (yyps->save == NULL)
719 /* If this is a first conflict in the stack, start saving lexemes */
722 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
723 if (yylexemes == NULL) goto yyenomem;
724 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
725 if (yylvals == NULL) goto yyenomem;
726 yylvlim = yylvals + YYLVQUEUEGROWTH;
727 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
728 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
729 if (yylpsns == NULL) goto yyenomem;
730 yylplim = yylpsns + YYLVQUEUEGROWTH;
735 yylvp = yylve = yylvals;
736 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
737 yylpp = yylpe = yylpsns;
743 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
746 *yylexp = (short) yychar;
754 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
760 save->lexeme = yylvp - yylvals;
763 if (yytable[yyn] == ctry)
767 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
768 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
773 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
778 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
780 yystate = yyctable[ctry];
781 *++yystack.s_mark = (short) yystate;
782 *++yystack.l_mark = yylval;
783 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
784 *++yystack.p_mark = yylloc;
787 if (yyerrflag > 0) --yyerrflag;
792 yyn = yyctable[ctry];
795 } /* End of code dealing with conflicts */
796 #endif /* YYBTYACC */
797 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
798 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
802 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
803 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
805 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
806 yystate = yytable[yyn];
807 *++yystack.s_mark = yytable[yyn];
808 *++yystack.l_mark = yylval;
809 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
810 *++yystack.p_mark = yylloc;
813 if (yyerrflag > 0) --yyerrflag;
816 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
817 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
822 if (yyerrflag != 0) goto yyinrecovery;
835 YYParseState *save = yyps->save;
838 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
839 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
840 (int)(yylvp - yylvals - yyps->save->lexeme));
842 /* Memorize most forward-looking error state in case it's really an error. */
843 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
845 /* Free old saved error context state */
846 if (yyerrctx) yyFreeState(yyerrctx);
847 /* Create and fill out new saved error context state */
848 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
849 if (yyerrctx == NULL) goto yyenomem;
850 yyerrctx->save = yyps->save;
851 yyerrctx->state = yystate;
852 yyerrctx->errflag = yyerrflag;
853 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
854 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
855 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
856 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
857 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
858 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
859 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
861 yyerrctx->lexeme = yylvp - yylvals;
863 yylvp = yylvals + save->lexeme;
864 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
865 yylpp = yylpsns + save->lexeme;
867 yylexp = yylexemes + save->lexeme;
869 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
870 memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
871 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
872 memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
873 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
874 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
875 memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
878 yystate = save->state;
879 /* We tried shift, try reduce now */
880 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
881 yyps->save = save->save;
885 /* Nothing left on the stack -- error */
890 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
893 /* Restore state as it was in the most forward-advanced error */
894 yylvp = yylvals + yyerrctx->lexeme;
895 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
896 yylpp = yylpsns + yyerrctx->lexeme;
898 yylexp = yylexemes + yyerrctx->lexeme;
901 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
904 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
905 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
906 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
907 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
908 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
909 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
910 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
912 yystate = yyerrctx->state;
913 yyFreeState(yyerrctx);
918 if (yynewerrflag == 0) goto yyinrecovery;
919 #endif /* YYBTYACC */
921 YYERROR_CALL("syntax error");
922 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
923 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
938 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
939 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
943 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
944 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
946 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
947 yystate = yytable[yyn];
948 *++yystack.s_mark = yytable[yyn];
949 *++yystack.l_mark = yylval;
950 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
951 /* lookahead position is error end position */
952 yyerror_loc_range[1] = yylloc;
953 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
954 *++yystack.p_mark = yyloc;
962 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
963 YYDEBUGSTR, yydepth, *yystack.s_mark);
965 if (yystack.s_mark <= yystack.s_base) goto yyabort;
966 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
967 /* the current TOS position is the error start position */
968 yyerror_loc_range[0] = *yystack.p_mark;
970 #if defined(YYDESTRUCT_CALL)
973 #endif /* YYBTYACC */
974 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
975 YYDESTRUCT_CALL("error: discarding state",
976 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
978 YYDESTRUCT_CALL("error: discarding state",
979 yystos[*yystack.s_mark], yystack.l_mark);
980 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
981 #endif /* defined(YYDESTRUCT_CALL) */
984 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
992 if (yychar == YYEOF) goto yyabort;
996 yys = yyname[YYTRANSLATE(yychar)];
997 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
998 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1001 #if defined(YYDESTRUCT_CALL)
1004 #endif /* YYBTYACC */
1005 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1006 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1008 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1009 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1010 #endif /* defined(YYDESTRUCT_CALL) */
1020 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1021 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1022 #ifdef YYSTYPE_TOSTRING
1025 #endif /* YYBTYACC */
1030 for (i = yym; i > 0; i--)
1032 if (i != yym) fputs(", ", stderr);
1033 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1034 yystack.l_mark[1-i]), stderr);
1039 fputc('\n', stderr);
1043 yyval = yystack.l_mark[1-yym];
1045 memset(&yyval, 0, sizeof yyval);
1046 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1048 /* Perform position reduction */
1049 memset(&yyloc, 0, sizeof(yyloc));
1052 #endif /* YYBTYACC */
1054 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1055 /* just in case YYERROR is invoked within the action, save
1056 the start of the rhs as the error start position */
1057 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1064 #line 44 "inherit1.y"
1065 { yyval.nlist = yystack.l_mark[0].nlist; }
1068 #line 46 "inherit1.y"
1069 { yyval.nlist = yystack.l_mark[0].nlist; }
1072 #line 49 "inherit1.y"
1073 { yyval.cval = cGLOBAL; }
1076 #line 50 "inherit1.y"
1077 { yyval.cval = cLOCAL; }
1080 #line 53 "inherit1.y"
1081 { yyval.tval = tREAL; }
1084 #line 54 "inherit1.y"
1085 { yyval.tval = tINTEGER; }
1088 #line 58 "inherit1.y"
1089 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-3].cval, yystack.l_mark[0].id);
1090 yyval.nlist->next = yystack.l_mark[-1].nlist;
1094 #line 62 "inherit1.y"
1095 { yyval.nlist->s = mksymbol(yystack.l_mark[-1].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
1096 yyval.nlist->next = NULL;
1100 #line 68 "inherit1.y"
1101 { yyval.cval = cLOCAL; }
1104 #line 69 "inherit1.y"
1105 { yyval.tval = yystack.l_mark[-2].tval; }
1108 #line 71 "inherit1.y"
1109 { yyval.nlist = yystack.l_mark[0].nlist; }
1111 #line 1112 "inherit1.tab.c"
1115 yystack.s_mark -= yym;
1116 yystate = *yystack.s_mark;
1117 yystack.l_mark -= yym;
1118 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1119 yystack.p_mark -= yym;
1122 if (yystate == 0 && yym == 0)
1127 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1128 #ifdef YYSTYPE_TOSTRING
1131 #endif /* YYBTYACC */
1132 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1134 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1138 *++yystack.s_mark = YYFINAL;
1139 *++yystack.l_mark = yyval;
1140 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1141 *++yystack.p_mark = yyloc;
1149 /* we're currently re-reading tokens */
1151 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1159 /* in trial mode; save scanner results for future parse attempts */
1160 if (yylvp == yylvlim)
1161 { /* Enlarge lexical value queue */
1162 int p = yylvp - yylvals;
1163 int s = yylvlim - yylvals;
1165 s += YYLVQUEUEGROWTH;
1166 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1168 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1170 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1171 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1174 yylvp = yylve = yylvals + p;
1175 yylvlim = yylvals + s;
1176 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1177 yylpp = yylpe = yylpsns + p;
1178 yylplim = yylpsns + s;
1180 yylexp = yylexemes + p;
1182 *yylexp = (short) YYLEX;
1185 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1192 /* normal operation, no conflict encountered */
1193 #endif /* YYBTYACC */
1197 #endif /* YYBTYACC */
1198 if (yychar < 0) yychar = YYEOF;
1199 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1203 yys = yyname[YYTRANSLATE(yychar)];
1204 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1205 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1209 if (yychar == YYEOF) goto yyaccept;
1212 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1213 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1214 yystate = yytable[yyn];
1216 yystate = yydgoto[yym];
1220 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1221 #ifdef YYSTYPE_TOSTRING
1224 #endif /* YYBTYACC */
1225 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1227 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1230 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1231 *++yystack.s_mark = (short) yystate;
1232 *++yystack.l_mark = yyval;
1233 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1234 *++yystack.p_mark = yyloc;
1239 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1241 if (yypath) YYABORT;
1244 YYParseState *save = yyps->save;
1245 yyps->save = save->save;
1246 save->save = yypath;
1251 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1252 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1256 yyFreeState(yyerrctx);
1259 yylvp = yylvals + yypath->lexeme;
1260 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1261 yylpp = yylpsns + yypath->lexeme;
1263 yylexp = yylexemes + yypath->lexeme;
1265 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1266 memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1267 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1268 memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1269 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1270 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1271 memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1273 yystate = yypath->state;
1275 #endif /* YYBTYACC */
1278 YYERROR_CALL("yacc stack overflow");
1282 YYERROR_CALL("memory exhausted");
1284 #endif /* YYBTYACC */
1294 if (yyps->save) goto yyvalid;
1295 #endif /* YYBTYACC */
1299 #if defined(YYDESTRUCT_CALL)
1300 if (yychar != YYEOF && yychar != YYEMPTY)
1301 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1302 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1304 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1305 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1309 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1312 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1313 YYDESTRUCT_CALL("cleanup: discarding state",
1314 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1316 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1317 YYDESTRUCT_CALL("cleanup: discarding state",
1318 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1319 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1321 #endif /* defined(YYDESTRUCT_CALL) */
1326 yyFreeState(yyerrctx);
1331 YYParseState *save = yyps;
1338 YYParseState *save = yypath;
1339 yypath = save->save;
1343 #endif /* YYBTYACC */
1344 yyfreestack(&yystack);