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);
545 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
546 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
550 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
552 #endif /* YYBTYACC */
561 memset(&yystack, 0, sizeof(yystack));
564 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
565 yystack.s_mark = yystack.s_base;
566 yystack.l_mark = yystack.l_base;
567 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
568 yystack.p_mark = yystack.p_base;
574 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
581 /* we're currently re-reading tokens */
583 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
591 /* in trial mode; save scanner results for future parse attempts */
592 if (yylvp == yylvlim)
593 { /* Enlarge lexical value queue */
594 size_t p = (size_t) (yylvp - yylvals);
595 size_t s = (size_t) (yylvlim - yylvals);
597 s += YYLVQUEUEGROWTH;
598 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
599 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
600 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
601 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
603 yylvp = yylve = yylvals + p;
604 yylvlim = yylvals + s;
605 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
606 yylpp = yylpe = yylpsns + p;
607 yylplim = yylpsns + s;
609 yylexp = yylexemes + p;
611 *yylexp = (YYINT) YYLEX;
614 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
621 /* normal operation, no conflict encountered */
622 #endif /* YYBTYACC */
626 #endif /* YYBTYACC */
627 if (yychar < 0) yychar = YYEOF;
631 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
632 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
633 YYDEBUGSTR, yydepth, yystate, yychar, yys);
634 #ifdef YYSTYPE_TOSTRING
637 #endif /* YYBTYACC */
638 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
646 /* Do we have a conflict? */
647 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
648 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
657 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
658 YYDEBUGSTR, yydepth, yystate);
660 /* Switch to the next conflict context */
665 if (save->state != yystate) YYABORT;
672 /* Unresolved conflict - start/continue trial parse */
677 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
679 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
681 fputs("Starting trial parse.\n", stderr);
684 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
685 if (save == NULL) goto yyenomem;
686 save->save = yyps->save;
687 save->state = yystate;
688 save->errflag = yyerrflag;
689 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
690 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
691 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
692 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
693 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
694 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
695 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
698 if (yyctable[ctry] == -1)
701 if (yydebug && yychar >= YYEOF)
702 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
707 if (yyps->save == NULL)
709 /* If this is a first conflict in the stack, start saving lexemes */
712 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
713 if (yylexemes == NULL) goto yyenomem;
714 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
715 if (yylvals == NULL) goto yyenomem;
716 yylvlim = yylvals + YYLVQUEUEGROWTH;
717 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
718 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
719 if (yylpsns == NULL) goto yyenomem;
720 yylplim = yylpsns + YYLVQUEUEGROWTH;
725 yylvp = yylve = yylvals;
726 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
727 yylpp = yylpe = yylpsns;
733 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
736 *yylexp = (YYINT) yychar;
744 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
750 save->lexeme = (int) (yylvp - yylvals);
753 if (yytable[yyn] == ctry)
757 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
758 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
763 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
768 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
770 yystate = yyctable[ctry];
771 *++yystack.s_mark = (YYINT) yystate;
772 *++yystack.l_mark = yylval;
773 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
774 *++yystack.p_mark = yylloc;
777 if (yyerrflag > 0) --yyerrflag;
782 yyn = yyctable[ctry];
785 } /* End of code dealing with conflicts */
786 #endif /* YYBTYACC */
787 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
788 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
792 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
793 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
795 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
796 yystate = yytable[yyn];
797 *++yystack.s_mark = yytable[yyn];
798 *++yystack.l_mark = yylval;
799 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
800 *++yystack.p_mark = yylloc;
803 if (yyerrflag > 0) --yyerrflag;
806 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
807 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
812 if (yyerrflag != 0) goto yyinrecovery;
817 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
820 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
821 * before looking for error recovery */
822 yystack.s_mark -= yym;
823 yystate = *yystack.s_mark;
824 yystack.l_mark -= yym;
825 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
826 yystack.p_mark -= yym;
834 YYParseState *save = yyps->save;
837 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
838 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
839 (int)(yylvp - yylvals - yyps->save->lexeme));
841 /* Memorize most forward-looking error state in case it's really an error. */
842 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
844 /* Free old saved error context state */
845 if (yyerrctx) yyFreeState(yyerrctx);
846 /* Create and fill out new saved error context state */
847 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
848 if (yyerrctx == NULL) goto yyenomem;
849 yyerrctx->save = yyps->save;
850 yyerrctx->state = yystate;
851 yyerrctx->errflag = yyerrflag;
852 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
853 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
854 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
855 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
856 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
857 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
858 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
860 yyerrctx->lexeme = (int) (yylvp - yylvals);
862 yylvp = yylvals + save->lexeme;
863 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
864 yylpp = yylpsns + save->lexeme;
866 yylexp = yylexemes + save->lexeme;
868 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
869 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
870 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
871 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
872 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
873 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
874 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
877 yystate = save->state;
878 /* We tried shift, try reduce now */
879 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
880 yyps->save = save->save;
884 /* Nothing left on the stack -- error */
889 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
892 /* Restore state as it was in the most forward-advanced error */
893 yylvp = yylvals + yyerrctx->lexeme;
894 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
895 yylpp = yylpsns + yyerrctx->lexeme;
897 yylexp = yylexemes + yyerrctx->lexeme;
900 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
903 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
904 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
905 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
906 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
907 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
908 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
909 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
911 yystate = yyerrctx->state;
912 yyFreeState(yyerrctx);
917 if (yynewerrflag == 0) goto yyinrecovery;
918 #endif /* YYBTYACC */
920 YYERROR_CALL("syntax error");
921 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
922 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
926 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
937 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
938 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
942 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
943 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
945 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
946 yystate = yytable[yyn];
947 *++yystack.s_mark = yytable[yyn];
948 *++yystack.l_mark = yylval;
949 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
950 /* lookahead position is error end position */
951 yyerror_loc_range[1] = yylloc;
952 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
953 *++yystack.p_mark = yyloc;
961 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
962 YYDEBUGSTR, yydepth, *yystack.s_mark);
964 if (yystack.s_mark <= yystack.s_base) goto yyabort;
965 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
966 /* the current TOS position is the error start position */
967 yyerror_loc_range[0] = *yystack.p_mark;
969 #if defined(YYDESTRUCT_CALL)
972 #endif /* YYBTYACC */
973 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
974 YYDESTRUCT_CALL("error: discarding state",
975 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
977 YYDESTRUCT_CALL("error: discarding state",
978 yystos[*yystack.s_mark], yystack.l_mark);
979 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
980 #endif /* defined(YYDESTRUCT_CALL) */
983 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
991 if (yychar == YYEOF) goto yyabort;
995 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
996 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
997 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1000 #if defined(YYDESTRUCT_CALL)
1003 #endif /* YYBTYACC */
1004 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1005 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1007 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1008 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1009 #endif /* defined(YYDESTRUCT_CALL) */
1019 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1020 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1021 #ifdef YYSTYPE_TOSTRING
1024 #endif /* YYBTYACC */
1029 for (i = yym; i > 0; i--)
1031 if (i != yym) fputs(", ", stderr);
1032 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1033 yystack.l_mark[1-i]), stderr);
1038 fputc('\n', stderr);
1042 yyval = yystack.l_mark[1-yym];
1044 memset(&yyval, 0, sizeof yyval);
1045 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1047 /* Perform position reduction */
1048 memset(&yyloc, 0, sizeof(yyloc));
1051 #endif /* YYBTYACC */
1053 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1054 /* just in case YYERROR is invoked within the action, save
1055 the start of the rhs as the error start position */
1056 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1063 #line 20 "inherit0.y"
1064 { yyval = yystack.l_mark[0]; }
1067 #line 22 "inherit0.y"
1068 { yyval = yystack.l_mark[0]; }
1071 #line 25 "inherit0.y"
1075 #line 26 "inherit0.y"
1079 #line 29 "inherit0.y"
1083 #line 30 "inherit0.y"
1087 #line 34 "inherit0.y"
1088 { mksymbol(yystack.l_mark[-2], yystack.l_mark[-3], yystack.l_mark[0]); }
1091 #line 36 "inherit0.y"
1092 { mksymbol(yystack.l_mark[-1], yystack.l_mark[-2], yystack.l_mark[0]); }
1095 #line 40 "inherit0.y"
1099 #line 41 "inherit0.y"
1100 { yyval = yystack.l_mark[-2]; }
1103 #line 43 "inherit0.y"
1104 { yyval = yystack.l_mark[0]; }
1106 #line 1107 "inherit0.tab.c"
1110 yystack.s_mark -= yym;
1111 yystate = *yystack.s_mark;
1112 yystack.l_mark -= yym;
1113 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1114 yystack.p_mark -= yym;
1117 if (yystate == 0 && yym == 0)
1122 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1123 #ifdef YYSTYPE_TOSTRING
1126 #endif /* YYBTYACC */
1127 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1129 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1133 *++yystack.s_mark = YYFINAL;
1134 *++yystack.l_mark = yyval;
1135 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1136 *++yystack.p_mark = yyloc;
1144 /* we're currently re-reading tokens */
1146 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1154 /* in trial mode; save scanner results for future parse attempts */
1155 if (yylvp == yylvlim)
1156 { /* Enlarge lexical value queue */
1157 size_t p = (size_t) (yylvp - yylvals);
1158 size_t s = (size_t) (yylvlim - yylvals);
1160 s += YYLVQUEUEGROWTH;
1161 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1163 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1165 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1166 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1169 yylvp = yylve = yylvals + p;
1170 yylvlim = yylvals + s;
1171 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1172 yylpp = yylpe = yylpsns + p;
1173 yylplim = yylpsns + s;
1175 yylexp = yylexemes + p;
1177 *yylexp = (YYINT) YYLEX;
1180 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1187 /* normal operation, no conflict encountered */
1188 #endif /* YYBTYACC */
1192 #endif /* YYBTYACC */
1193 if (yychar < 0) yychar = YYEOF;
1197 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1198 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1199 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1203 if (yychar == YYEOF) goto yyaccept;
1206 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1207 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1208 yystate = yytable[yyn];
1210 yystate = yydgoto[yym];
1214 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1215 #ifdef YYSTYPE_TOSTRING
1218 #endif /* YYBTYACC */
1219 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1221 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1224 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1225 *++yystack.s_mark = (YYINT) yystate;
1226 *++yystack.l_mark = yyval;
1227 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1228 *++yystack.p_mark = yyloc;
1233 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1235 if (yypath) YYABORT;
1238 YYParseState *save = yyps->save;
1239 yyps->save = save->save;
1240 save->save = yypath;
1245 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1246 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1250 yyFreeState(yyerrctx);
1253 yylvp = yylvals + yypath->lexeme;
1254 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1255 yylpp = yylpsns + yypath->lexeme;
1257 yylexp = yylexemes + yypath->lexeme;
1259 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1260 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1261 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1262 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1263 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1264 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1265 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1267 yystate = yypath->state;
1269 #endif /* YYBTYACC */
1272 YYERROR_CALL("yacc stack overflow");
1276 YYERROR_CALL("memory exhausted");
1278 #endif /* YYBTYACC */
1288 if (yyps->save) goto yyvalid;
1289 #endif /* YYBTYACC */
1293 #if defined(YYDESTRUCT_CALL)
1294 if (yychar != YYEOF && yychar != YYEMPTY)
1295 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1296 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1298 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1299 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1303 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1306 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1307 YYDESTRUCT_CALL("cleanup: discarding state",
1308 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1310 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1311 YYDESTRUCT_CALL("cleanup: discarding state",
1312 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1313 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1315 #endif /* defined(YYDESTRUCT_CALL) */
1320 yyFreeState(yyerrctx);
1325 YYParseState *save = yyps;
1332 YYParseState *save = yypath;
1333 yypath = save->save;
1337 #endif /* YYBTYACC */
1338 yyfreestack(&yystack);