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 inherit0_parse
25 #define yylex inherit0_lex
29 #define yyerror inherit0_error
33 #define yychar inherit0_char
37 #define yyval inherit0_val
41 #define yylval inherit0_lval
45 #define yydebug inherit0_debug
49 #define yynerrs inherit0_nerrs
53 #define yyerrflag inherit0_errflag
54 #endif /* yyerrflag */
57 #define yylhs inherit0_lhs
61 #define yylen inherit0_len
65 #define yydefred inherit0_defred
69 #define yystos inherit0_stos
73 #define yydgoto inherit0_dgoto
77 #define yysindex inherit0_sindex
81 #define yyrindex inherit0_rindex
85 #define yygindex inherit0_gindex
89 #define yytable inherit0_table
93 #define yycheck inherit0_check
97 #define yyname inherit0_name
101 #define yyrule inherit0_rule
107 #define yycindex inherit0_cindex
108 #endif /* yycindex */
111 #define yyctable inherit0_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "inherit0_"
121 extern void mksymbol(int t, int c, int id);
124 #define YYLEX_DECL() yylex(void)
125 #define YYERROR_DECL() yyerror(const char *s)
126 extern int YYLEX_DECL();
127 extern void YYERROR_DECL();
129 #line 130 "inherit0.tab.c"
131 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
132 /* Default: YYSTYPE is the semantic value type. */
134 # define YYSTYPE_IS_DECLARED 1
137 /* compatibility with bison */
139 /* compatibility with FreeBSD */
140 # ifdef YYPARSE_PARAM_TYPE
141 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
143 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
146 # define YYPARSE_DECL() yyparse(void)
149 /* Parameters sent to lex. */
151 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
152 # define YYLEX yylex(YYLEX_PARAM)
154 # define YYLEX_DECL() yylex(void)
155 # define YYLEX yylex()
158 /* Parameters sent to yyerror. */
160 #define YYERROR_DECL() yyerror(const char *s)
163 #define YYERROR_CALL(msg) yyerror(msg)
166 extern int YYPARSE_DECL();
173 #define YYERRCODE 256
175 static const YYINT inherit0_lhs[] = { -1,
176 0, 0, 1, 1, 2, 2, 3, 3, 5, 6,
179 static const YYINT inherit0_len[] = { 2,
180 3, 2, 1, 1, 1, 1, 2, 1, 0, 0,
183 static const YYINT inherit0_defred[] = { 0,
184 3, 4, 5, 6, 0, 0, 9, 0, 2, 10,
187 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
188 static const YYINT inherit0_stos[] = { 0,
189 257, 258, 259, 260, 263, 264, 265, 265, 267, 268,
190 261, 266, 269, 261, 266,
192 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
193 static const YYINT inherit0_dgoto[] = { 5,
196 static const YYINT inherit0_sindex[] = { -257,
197 0, 0, 0, 0, 0, -255, 0, -254, 0, 0,
198 0, -253, -254, 0, -253,
200 static const YYINT inherit0_rindex[] = { 0,
201 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
205 static const YYINT inherit0_cindex[] = { 0,
206 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
210 static const YYINT inherit0_gindex[] = { 0,
213 #define YYTABLESIZE 11
214 static const YYINT inherit0_table[] = { 1,
215 2, 3, 4, 3, 4, 1, 11, 14, 11, 8,
218 static const YYINT inherit0_check[] = { 257,
219 258, 259, 260, 259, 260, 0, 261, 261, 0, 6,
223 static const YYINT inherit0_ctable[] = { -1,
224 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
231 #define YYMAXTOKEN 261
232 #define YYUNDFTOKEN 270
233 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
235 static const char *const inherit0_name[] = {
237 "$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,
238 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
239 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
240 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
241 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
242 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
243 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
244 "NAME","$accept","declaration","class","type","namelist","locnamelist","$$1",
245 "$$2","illegal-symbol",
247 static const char *const inherit0_rule[] = {
248 "$accept : declaration",
249 "declaration : class type namelist",
250 "declaration : type locnamelist",
255 "namelist : namelist NAME",
259 "locnamelist : $$1 $$2 namelist",
271 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
272 YYLTYPE yyloc; /* position returned by actions */
273 YYLTYPE yylloc; /* position from the lexer */
276 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
277 #ifndef YYLLOC_DEFAULT
278 #define YYLLOC_DEFAULT(loc, rhs, n) \
283 (loc).first_line = ((rhs)[-1]).last_line; \
284 (loc).first_column = ((rhs)[-1]).last_column; \
285 (loc).last_line = ((rhs)[-1]).last_line; \
286 (loc).last_column = ((rhs)[-1]).last_column; \
290 (loc).first_line = ((rhs)[ 0 ]).first_line; \
291 (loc).first_column = ((rhs)[ 0 ]).first_column; \
292 (loc).last_line = ((rhs)[n-1]).last_line; \
293 (loc).last_column = ((rhs)[n-1]).last_column; \
296 #endif /* YYLLOC_DEFAULT */
297 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
300 #ifndef YYLVQUEUEGROWTH
301 #define YYLVQUEUEGROWTH 32
303 #endif /* YYBTYACC */
305 /* define the initial stack-sizes */
308 #define YYMAXDEPTH YYSTACKSIZE
311 #define YYSTACKSIZE YYMAXDEPTH
313 #define YYSTACKSIZE 10000
314 #define YYMAXDEPTH 10000
318 #ifndef YYINITSTACKSIZE
319 #define YYINITSTACKSIZE 200
329 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
336 struct YYParseState_s
338 struct YYParseState_s *save; /* Previously saved parser state */
339 YYSTACKDATA yystack; /* saved parser stack */
340 int state; /* saved parser state */
341 int errflag; /* saved error recovery status */
342 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
343 YYINT ctry; /* saved index in yyctable[] for this conflict */
345 typedef struct YYParseState_s YYParseState;
346 #endif /* YYBTYACC */
347 /* variables for the parser stack */
348 static YYSTACKDATA yystack;
351 /* Current parser state */
352 static YYParseState *yyps = 0;
354 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
355 static YYParseState *yypath = 0;
357 /* Base of the lexical value queue */
358 static YYSTYPE *yylvals = 0;
360 /* Current position at lexical value queue */
361 static YYSTYPE *yylvp = 0;
363 /* End position of lexical value queue */
364 static YYSTYPE *yylve = 0;
366 /* The last allocated position at the lexical value queue */
367 static YYSTYPE *yylvlim = 0;
369 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
370 /* Base of the lexical position queue */
371 static YYLTYPE *yylpsns = 0;
373 /* Current position at lexical position queue */
374 static YYLTYPE *yylpp = 0;
376 /* End position of lexical position queue */
377 static YYLTYPE *yylpe = 0;
379 /* The last allocated position at the lexical position queue */
380 static YYLTYPE *yylplim = 0;
383 /* Current position at lexical token queue */
384 static YYINT *yylexp = 0;
386 static YYINT *yylexemes = 0;
387 #endif /* YYBTYACC */
388 #line 46 "inherit0.y"
390 extern int YYLEX_DECL();
391 extern void YYERROR_DECL();
392 #line 393 "inherit0.tab.c"
394 /* For use in generated program */
395 #define yydepth (int)(yystack.s_mark - yystack.s_base)
397 #define yytrial (yyps->save)
398 #endif /* YYBTYACC */
401 #include <stdio.h> /* needed for printf */
404 #include <stdlib.h> /* needed for malloc, etc */
405 #include <string.h> /* needed for memset */
407 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
408 static int yygrowstack(YYSTACKDATA *data)
414 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
418 if ((newsize = data->stacksize) == 0)
419 newsize = YYINITSTACKSIZE;
420 else if (newsize >= YYMAXDEPTH)
422 else if ((newsize *= 2) > YYMAXDEPTH)
423 newsize = YYMAXDEPTH;
425 i = (int) (data->s_mark - data->s_base);
426 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
430 data->s_base = newss;
431 data->s_mark = newss + i;
433 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
437 data->l_base = newvs;
438 data->l_mark = newvs + i;
440 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
441 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
445 data->p_base = newps;
446 data->p_mark = newps + i;
449 data->stacksize = newsize;
450 data->s_last = data->s_base + newsize - 1;
454 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
459 #if YYPURE || defined(YY_NO_LEAKS)
460 static void yyfreestack(YYSTACKDATA *data)
464 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
467 memset(data, 0, sizeof(*data));
470 #define yyfreestack(data) /* nothing */
471 #endif /* YYPURE || defined(YY_NO_LEAKS) */
474 static YYParseState *
475 yyNewState(unsigned size)
477 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
478 if (p == NULL) return NULL;
480 p->yystack.stacksize = size;
483 p->yystack.s_base = NULL;
484 p->yystack.l_base = NULL;
485 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
486 p->yystack.p_base = NULL;
490 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
491 if (p->yystack.s_base == NULL) return NULL;
492 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
493 if (p->yystack.l_base == NULL) return NULL;
494 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
495 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
496 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
497 if (p->yystack.p_base == NULL) return NULL;
498 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
505 yyFreeState(YYParseState *p)
507 yyfreestack(&p->yystack);
510 #endif /* YYBTYACC */
512 #define YYABORT goto yyabort
513 #define YYREJECT goto yyabort
514 #define YYACCEPT goto yyaccept
515 #define YYERROR goto yyerrlab
517 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
518 #define YYVALID_NESTED do { if (yyps->save && \
519 yyps->save->save == 0) goto yyvalid; } while(0)
520 #endif /* YYBTYACC */
525 int yym, yyn, yystate, yyresult;
528 YYParseState *yyerrctx = NULL;
529 #endif /* YYBTYACC */
530 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
531 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
536 if ((yys = getenv("YYDEBUG")) != 0)
539 if (yyn >= '0' && yyn <= '9')
543 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
547 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
549 #endif /* YYBTYACC */
558 memset(&yystack, 0, sizeof(yystack));
561 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
562 yystack.s_mark = yystack.s_base;
563 yystack.l_mark = yystack.l_base;
564 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
565 yystack.p_mark = yystack.p_base;
571 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
578 /* we're currently re-reading tokens */
580 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
588 /* in trial mode; save scanner results for future parse attempts */
589 if (yylvp == yylvlim)
590 { /* Enlarge lexical value queue */
591 size_t p = (size_t) (yylvp - yylvals);
592 size_t s = (size_t) (yylvlim - yylvals);
594 s += YYLVQUEUEGROWTH;
595 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
596 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
597 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
598 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
600 yylvp = yylve = yylvals + p;
601 yylvlim = yylvals + s;
602 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
603 yylpp = yylpe = yylpsns + p;
604 yylplim = yylpsns + s;
606 yylexp = yylexemes + p;
608 *yylexp = (YYINT) YYLEX;
611 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
618 /* normal operation, no conflict encountered */
619 #endif /* YYBTYACC */
623 #endif /* YYBTYACC */
624 if (yychar < 0) yychar = YYEOF;
628 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
629 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
630 YYDEBUGSTR, yydepth, yystate, yychar, yys);
631 #ifdef YYSTYPE_TOSTRING
634 #endif /* YYBTYACC */
635 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
643 /* Do we have a conflict? */
644 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
645 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
654 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
655 YYDEBUGSTR, yydepth, yystate);
657 /* Switch to the next conflict context */
662 if (save->state != yystate) YYABORT;
669 /* Unresolved conflict - start/continue trial parse */
674 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
676 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
678 fputs("Starting trial parse.\n", stderr);
681 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
682 if (save == NULL) goto yyenomem;
683 save->save = yyps->save;
684 save->state = yystate;
685 save->errflag = yyerrflag;
686 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
687 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
688 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
689 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
690 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
691 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
692 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
695 if (yyctable[ctry] == -1)
698 if (yydebug && yychar >= YYEOF)
699 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
704 if (yyps->save == NULL)
706 /* If this is a first conflict in the stack, start saving lexemes */
709 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
710 if (yylexemes == NULL) goto yyenomem;
711 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
712 if (yylvals == NULL) goto yyenomem;
713 yylvlim = yylvals + YYLVQUEUEGROWTH;
714 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
715 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
716 if (yylpsns == NULL) goto yyenomem;
717 yylplim = yylpsns + YYLVQUEUEGROWTH;
722 yylvp = yylve = yylvals;
723 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
724 yylpp = yylpe = yylpsns;
730 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
733 *yylexp = (YYINT) yychar;
741 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
747 save->lexeme = (int) (yylvp - yylvals);
750 if (yytable[yyn] == ctry)
754 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
755 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
760 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
765 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
767 yystate = yyctable[ctry];
768 *++yystack.s_mark = (YYINT) yystate;
769 *++yystack.l_mark = yylval;
770 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
771 *++yystack.p_mark = yylloc;
774 if (yyerrflag > 0) --yyerrflag;
779 yyn = yyctable[ctry];
782 } /* End of code dealing with conflicts */
783 #endif /* YYBTYACC */
784 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
785 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
789 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
790 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
792 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
793 yystate = yytable[yyn];
794 *++yystack.s_mark = yytable[yyn];
795 *++yystack.l_mark = yylval;
796 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
797 *++yystack.p_mark = yylloc;
800 if (yyerrflag > 0) --yyerrflag;
803 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
804 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
809 if (yyerrflag != 0) goto yyinrecovery;
814 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
817 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
818 * before looking for error recovery */
819 yystack.s_mark -= yym;
820 yystate = *yystack.s_mark;
821 yystack.l_mark -= yym;
822 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
823 yystack.p_mark -= yym;
831 YYParseState *save = yyps->save;
834 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
835 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
836 (int)(yylvp - yylvals - yyps->save->lexeme));
838 /* Memorize most forward-looking error state in case it's really an error. */
839 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
841 /* Free old saved error context state */
842 if (yyerrctx) yyFreeState(yyerrctx);
843 /* Create and fill out new saved error context state */
844 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
845 if (yyerrctx == NULL) goto yyenomem;
846 yyerrctx->save = yyps->save;
847 yyerrctx->state = yystate;
848 yyerrctx->errflag = yyerrflag;
849 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
850 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
851 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
852 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
853 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
854 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
855 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
857 yyerrctx->lexeme = (int) (yylvp - yylvals);
859 yylvp = yylvals + save->lexeme;
860 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
861 yylpp = yylpsns + save->lexeme;
863 yylexp = yylexemes + save->lexeme;
865 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
866 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
867 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
868 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
869 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
870 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
871 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
874 yystate = save->state;
875 /* We tried shift, try reduce now */
876 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
877 yyps->save = save->save;
881 /* Nothing left on the stack -- error */
886 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
889 /* Restore state as it was in the most forward-advanced error */
890 yylvp = yylvals + yyerrctx->lexeme;
891 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
892 yylpp = yylpsns + yyerrctx->lexeme;
894 yylexp = yylexemes + yyerrctx->lexeme;
897 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
900 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
901 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
902 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
903 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
904 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
905 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
906 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
908 yystate = yyerrctx->state;
909 yyFreeState(yyerrctx);
914 if (yynewerrflag == 0) goto yyinrecovery;
915 #endif /* YYBTYACC */
917 YYERROR_CALL("syntax error");
918 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
919 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
923 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
934 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
935 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
939 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
940 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
942 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
943 yystate = yytable[yyn];
944 *++yystack.s_mark = yytable[yyn];
945 *++yystack.l_mark = yylval;
946 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
947 /* lookahead position is error end position */
948 yyerror_loc_range[1] = yylloc;
949 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
950 *++yystack.p_mark = yyloc;
958 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
959 YYDEBUGSTR, yydepth, *yystack.s_mark);
961 if (yystack.s_mark <= yystack.s_base) goto yyabort;
962 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
963 /* the current TOS position is the error start position */
964 yyerror_loc_range[0] = *yystack.p_mark;
966 #if defined(YYDESTRUCT_CALL)
969 #endif /* YYBTYACC */
970 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
971 YYDESTRUCT_CALL("error: discarding state",
972 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
974 YYDESTRUCT_CALL("error: discarding state",
975 yystos[*yystack.s_mark], yystack.l_mark);
976 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
977 #endif /* defined(YYDESTRUCT_CALL) */
980 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
988 if (yychar == YYEOF) goto yyabort;
992 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
993 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
994 YYDEBUGSTR, yydepth, yystate, yychar, yys);
997 #if defined(YYDESTRUCT_CALL)
1000 #endif /* YYBTYACC */
1001 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1002 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1004 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1005 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1006 #endif /* defined(YYDESTRUCT_CALL) */
1016 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1017 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1018 #ifdef YYSTYPE_TOSTRING
1021 #endif /* YYBTYACC */
1026 for (i = yym; i > 0; i--)
1028 if (i != yym) fputs(", ", stderr);
1029 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1030 yystack.l_mark[1-i]), stderr);
1035 fputc('\n', stderr);
1039 yyval = yystack.l_mark[1-yym];
1041 memset(&yyval, 0, sizeof yyval);
1042 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1044 /* Perform position reduction */
1045 memset(&yyloc, 0, sizeof(yyloc));
1048 #endif /* YYBTYACC */
1050 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1051 /* just in case YYERROR is invoked within the action, save
1052 the start of the rhs as the error start position */
1053 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1060 #line 20 "inherit0.y"
1061 { yyval = yystack.l_mark[0]; }
1064 #line 22 "inherit0.y"
1065 { yyval = yystack.l_mark[0]; }
1068 #line 25 "inherit0.y"
1072 #line 26 "inherit0.y"
1076 #line 29 "inherit0.y"
1080 #line 30 "inherit0.y"
1084 #line 34 "inherit0.y"
1085 { mksymbol(yystack.l_mark[-2], yystack.l_mark[-3], yystack.l_mark[0]); }
1088 #line 36 "inherit0.y"
1089 { mksymbol(yystack.l_mark[-1], yystack.l_mark[-2], yystack.l_mark[0]); }
1092 #line 40 "inherit0.y"
1096 #line 41 "inherit0.y"
1097 { yyval = yystack.l_mark[-2]; }
1100 #line 43 "inherit0.y"
1101 { yyval = yystack.l_mark[0]; }
1103 #line 1104 "inherit0.tab.c"
1107 yystack.s_mark -= yym;
1108 yystate = *yystack.s_mark;
1109 yystack.l_mark -= yym;
1110 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1111 yystack.p_mark -= yym;
1114 if (yystate == 0 && yym == 0)
1119 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1120 #ifdef YYSTYPE_TOSTRING
1123 #endif /* YYBTYACC */
1124 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1126 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1130 *++yystack.s_mark = YYFINAL;
1131 *++yystack.l_mark = yyval;
1132 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1133 *++yystack.p_mark = yyloc;
1141 /* we're currently re-reading tokens */
1143 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1151 /* in trial mode; save scanner results for future parse attempts */
1152 if (yylvp == yylvlim)
1153 { /* Enlarge lexical value queue */
1154 size_t p = (size_t) (yylvp - yylvals);
1155 size_t s = (size_t) (yylvlim - yylvals);
1157 s += YYLVQUEUEGROWTH;
1158 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1160 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1162 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1163 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1166 yylvp = yylve = yylvals + p;
1167 yylvlim = yylvals + s;
1168 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1169 yylpp = yylpe = yylpsns + p;
1170 yylplim = yylpsns + s;
1172 yylexp = yylexemes + p;
1174 *yylexp = (YYINT) YYLEX;
1177 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1184 /* normal operation, no conflict encountered */
1185 #endif /* YYBTYACC */
1189 #endif /* YYBTYACC */
1190 if (yychar < 0) yychar = YYEOF;
1194 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1195 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1196 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1200 if (yychar == YYEOF) goto yyaccept;
1203 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1204 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1205 yystate = yytable[yyn];
1207 yystate = yydgoto[yym];
1211 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1212 #ifdef YYSTYPE_TOSTRING
1215 #endif /* YYBTYACC */
1216 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1218 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1221 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1222 *++yystack.s_mark = (YYINT) yystate;
1223 *++yystack.l_mark = yyval;
1224 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1225 *++yystack.p_mark = yyloc;
1230 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1232 if (yypath) YYABORT;
1235 YYParseState *save = yyps->save;
1236 yyps->save = save->save;
1237 save->save = yypath;
1242 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1243 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1247 yyFreeState(yyerrctx);
1250 yylvp = yylvals + yypath->lexeme;
1251 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1252 yylpp = yylpsns + yypath->lexeme;
1254 yylexp = yylexemes + yypath->lexeme;
1256 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1257 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1258 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1259 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1260 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1261 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1262 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1264 yystate = yypath->state;
1266 #endif /* YYBTYACC */
1269 YYERROR_CALL("yacc stack overflow");
1273 YYERROR_CALL("memory exhausted");
1275 #endif /* YYBTYACC */
1285 if (yyps->save) goto yyvalid;
1286 #endif /* YYBTYACC */
1290 #if defined(YYDESTRUCT_CALL)
1291 if (yychar != YYEOF && yychar != YYEMPTY)
1292 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1293 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1295 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1296 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1300 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1303 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1304 YYDESTRUCT_CALL("cleanup: discarding state",
1305 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1307 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1308 YYDESTRUCT_CALL("cleanup: discarding state",
1309 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1310 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1312 #endif /* defined(YYDESTRUCT_CALL) */
1317 yyFreeState(yyerrctx);
1322 YYParseState *save = yyps;
1329 YYParseState *save = yypath;
1330 yypath = save->save;
1334 #endif /* YYBTYACC */
1335 yyfreestack(&yystack);