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 static const YYINT inherit0_stos[] = { 0,
188 257, 258, 259, 260, 263, 264, 265, 265, 267, 268,
189 261, 266, 269, 261, 266,
191 static const YYINT inherit0_dgoto[] = { 5,
194 static const YYINT inherit0_sindex[] = { -257,
195 0, 0, 0, 0, 0, -255, 0, -254, 0, 0,
196 0, -253, -254, 0, -253,
198 static const YYINT inherit0_rindex[] = { 0,
199 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
203 static const YYINT inherit0_cindex[] = { 0,
204 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
208 static const YYINT inherit0_gindex[] = { 0,
211 #define YYTABLESIZE 11
212 static const YYINT inherit0_table[] = { 1,
213 2, 3, 4, 3, 4, 1, 11, 14, 11, 8,
216 static const YYINT inherit0_check[] = { 257,
217 258, 259, 260, 259, 260, 0, 261, 261, 0, 6,
224 #define YYMAXTOKEN 261
225 #define YYUNDFTOKEN 270
226 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
228 static const char *const inherit0_name[] = {
230 "$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,
231 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
232 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
233 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
234 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
235 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
236 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
237 "NAME","$accept","declaration","class","type","namelist","locnamelist","$$1",
238 "$$2","illegal-symbol",
240 static const char *const inherit0_rule[] = {
241 "$accept : declaration",
242 "declaration : class type namelist",
243 "declaration : type locnamelist",
248 "namelist : namelist NAME",
252 "locnamelist : $$1 $$2 namelist",
264 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
265 YYLTYPE yyloc; /* position returned by actions */
266 YYLTYPE yylloc; /* position from the lexer */
269 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
270 #ifndef YYLLOC_DEFAULT
271 #define YYLLOC_DEFAULT(loc, rhs, n) \
276 (loc).first_line = ((rhs)[-1]).last_line; \
277 (loc).first_column = ((rhs)[-1]).last_column; \
278 (loc).last_line = ((rhs)[-1]).last_line; \
279 (loc).last_column = ((rhs)[-1]).last_column; \
283 (loc).first_line = ((rhs)[ 0 ]).first_line; \
284 (loc).first_column = ((rhs)[ 0 ]).first_column; \
285 (loc).last_line = ((rhs)[n-1]).last_line; \
286 (loc).last_column = ((rhs)[n-1]).last_column; \
289 #endif /* YYLLOC_DEFAULT */
290 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
293 #ifndef YYLVQUEUEGROWTH
294 #define YYLVQUEUEGROWTH 32
296 #endif /* YYBTYACC */
298 /* define the initial stack-sizes */
301 #define YYMAXDEPTH YYSTACKSIZE
304 #define YYSTACKSIZE YYMAXDEPTH
306 #define YYSTACKSIZE 10000
307 #define YYMAXDEPTH 10000
311 #ifndef YYINITSTACKSIZE
312 #define YYINITSTACKSIZE 200
322 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
329 struct YYParseState_s
331 struct YYParseState_s *save; /* Previously saved parser state */
332 YYSTACKDATA yystack; /* saved parser stack */
333 int state; /* saved parser state */
334 int errflag; /* saved error recovery status */
335 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
336 YYINT ctry; /* saved index in yyctable[] for this conflict */
338 typedef struct YYParseState_s YYParseState;
339 #endif /* YYBTYACC */
340 /* variables for the parser stack */
341 static YYSTACKDATA yystack;
344 /* Current parser state */
345 static YYParseState *yyps = 0;
347 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
348 static YYParseState *yypath = 0;
350 /* Base of the lexical value queue */
351 static YYSTYPE *yylvals = 0;
353 /* Current position at lexical value queue */
354 static YYSTYPE *yylvp = 0;
356 /* End position of lexical value queue */
357 static YYSTYPE *yylve = 0;
359 /* The last allocated position at the lexical value queue */
360 static YYSTYPE *yylvlim = 0;
362 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
363 /* Base of the lexical position queue */
364 static YYLTYPE *yylpsns = 0;
366 /* Current position at lexical position queue */
367 static YYLTYPE *yylpp = 0;
369 /* End position of lexical position queue */
370 static YYLTYPE *yylpe = 0;
372 /* The last allocated position at the lexical position queue */
373 static YYLTYPE *yylplim = 0;
376 /* Current position at lexical token queue */
377 static short *yylexp = 0;
379 static short *yylexemes = 0;
380 #endif /* YYBTYACC */
381 #line 46 "inherit0.y"
383 extern int YYLEX_DECL();
384 extern void YYERROR_DECL();
385 #line 386 "inherit0.tab.c"
387 /* For use in generated program */
388 #define yydepth (int)(yystack.s_mark - yystack.s_base)
390 #define yytrial (yyps->save)
391 #endif /* YYBTYACC */
394 #include <stdio.h> /* needed for printf */
397 #include <stdlib.h> /* needed for malloc, etc */
398 #include <string.h> /* needed for memset */
400 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
401 static int yygrowstack(YYSTACKDATA *data)
407 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
411 if ((newsize = data->stacksize) == 0)
412 newsize = YYINITSTACKSIZE;
413 else if (newsize >= YYMAXDEPTH)
415 else if ((newsize *= 2) > YYMAXDEPTH)
416 newsize = YYMAXDEPTH;
418 i = (int) (data->s_mark - data->s_base);
419 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
423 data->s_base = newss;
424 data->s_mark = newss + i;
426 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
430 data->l_base = newvs;
431 data->l_mark = newvs + i;
433 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
434 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
438 data->p_base = newps;
439 data->p_mark = newps + i;
442 data->stacksize = newsize;
443 data->s_last = data->s_base + newsize - 1;
447 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
452 #if YYPURE || defined(YY_NO_LEAKS)
453 static void yyfreestack(YYSTACKDATA *data)
457 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
460 memset(data, 0, sizeof(*data));
463 #define yyfreestack(data) /* nothing */
464 #endif /* YYPURE || defined(YY_NO_LEAKS) */
467 static YYParseState *
468 yyNewState(unsigned size)
470 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
471 if (p == NULL) return NULL;
473 p->yystack.stacksize = size;
476 p->yystack.s_base = NULL;
477 p->yystack.l_base = NULL;
478 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
479 p->yystack.p_base = NULL;
483 p->yystack.s_base = (short *) malloc(size * sizeof(short));
484 if (p->yystack.s_base == NULL) return NULL;
485 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
486 if (p->yystack.l_base == NULL) return NULL;
487 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
488 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
489 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
490 if (p->yystack.p_base == NULL) return NULL;
491 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
498 yyFreeState(YYParseState *p)
500 yyfreestack(&p->yystack);
503 #endif /* YYBTYACC */
505 #define YYABORT goto yyabort
506 #define YYREJECT goto yyabort
507 #define YYACCEPT goto yyaccept
508 #define YYERROR goto yyerrlab
510 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
511 #define YYVALID_NESTED do { if (yyps->save && \
512 yyps->save->save == 0) goto yyvalid; } while(0)
513 #endif /* YYBTYACC */
518 int yym, yyn, yystate, yyresult;
521 YYParseState *yyerrctx = NULL;
522 #endif /* YYBTYACC */
523 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
524 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
529 if ((yys = getenv("YYDEBUG")) != 0)
532 if (yyn >= '0' && yyn <= '9')
536 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
540 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
542 #endif /* YYBTYACC */
549 memset(&yystack, 0, sizeof(yystack));
552 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
553 yystack.s_mark = yystack.s_base;
554 yystack.l_mark = yystack.l_base;
555 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
556 yystack.p_mark = yystack.p_base;
562 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
569 /* we're currently re-reading tokens */
571 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
579 /* in trial mode; save scanner results for future parse attempts */
580 if (yylvp == yylvlim)
581 { /* Enlarge lexical value queue */
582 int p = yylvp - yylvals;
583 int s = yylvlim - yylvals;
585 s += YYLVQUEUEGROWTH;
586 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
587 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
588 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
589 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
591 yylvp = yylve = yylvals + p;
592 yylvlim = yylvals + s;
593 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
594 yylpp = yylpe = yylpsns + p;
595 yylplim = yylpsns + s;
597 yylexp = yylexemes + p;
599 *yylexp = (short) YYLEX;
602 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
609 /* normal operation, no conflict encountered */
610 #endif /* YYBTYACC */
614 #endif /* YYBTYACC */
615 if (yychar < 0) yychar = YYEOF;
616 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
620 yys = yyname[YYTRANSLATE(yychar)];
621 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
622 YYDEBUGSTR, yydepth, yystate, yychar, yys);
623 #ifdef YYSTYPE_TOSTRING
626 #endif /* YYBTYACC */
627 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
635 /* Do we have a conflict? */
636 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
637 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
646 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
647 YYDEBUGSTR, yydepth, yystate);
649 /* Switch to the next conflict context */
654 if (save->state != yystate) YYABORT;
661 /* Unresolved conflict - start/continue trial parse */
666 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
668 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
670 fputs("Starting trial parse.\n", stderr);
673 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
674 if (save == NULL) goto yyenomem;
675 save->save = yyps->save;
676 save->state = yystate;
677 save->errflag = yyerrflag;
678 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
679 memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
680 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
681 memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
682 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
683 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
684 memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
687 if (yyctable[ctry] == -1)
690 if (yydebug && yychar >= YYEOF)
691 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
696 if (yyps->save == NULL)
698 /* If this is a first conflict in the stack, start saving lexemes */
701 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
702 if (yylexemes == NULL) goto yyenomem;
703 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
704 if (yylvals == NULL) goto yyenomem;
705 yylvlim = yylvals + YYLVQUEUEGROWTH;
706 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
707 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
708 if (yylpsns == NULL) goto yyenomem;
709 yylplim = yylpsns + YYLVQUEUEGROWTH;
714 yylvp = yylve = yylvals;
715 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
716 yylpp = yylpe = yylpsns;
722 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
725 *yylexp = (short) yychar;
733 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
739 save->lexeme = yylvp - yylvals;
742 if (yytable[yyn] == ctry)
746 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
747 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
752 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
757 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
759 yystate = yyctable[ctry];
760 *++yystack.s_mark = (short) yystate;
761 *++yystack.l_mark = yylval;
762 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
763 *++yystack.p_mark = yylloc;
766 if (yyerrflag > 0) --yyerrflag;
771 yyn = yyctable[ctry];
774 } /* End of code dealing with conflicts */
775 #endif /* YYBTYACC */
776 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
777 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
781 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
782 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
784 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
785 yystate = yytable[yyn];
786 *++yystack.s_mark = yytable[yyn];
787 *++yystack.l_mark = yylval;
788 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
789 *++yystack.p_mark = yylloc;
792 if (yyerrflag > 0) --yyerrflag;
795 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
796 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
801 if (yyerrflag != 0) goto yyinrecovery;
814 YYParseState *save = yyps->save;
817 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
818 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
819 (int)(yylvp - yylvals - yyps->save->lexeme));
821 /* Memorize most forward-looking error state in case it's really an error. */
822 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
824 /* Free old saved error context state */
825 if (yyerrctx) yyFreeState(yyerrctx);
826 /* Create and fill out new saved error context state */
827 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
828 if (yyerrctx == NULL) goto yyenomem;
829 yyerrctx->save = yyps->save;
830 yyerrctx->state = yystate;
831 yyerrctx->errflag = yyerrflag;
832 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
833 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
834 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
835 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
836 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
837 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
838 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
840 yyerrctx->lexeme = yylvp - yylvals;
842 yylvp = yylvals + save->lexeme;
843 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
844 yylpp = yylpsns + save->lexeme;
846 yylexp = yylexemes + save->lexeme;
848 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
849 memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
850 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
851 memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
852 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
853 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
854 memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
857 yystate = save->state;
858 /* We tried shift, try reduce now */
859 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
860 yyps->save = save->save;
864 /* Nothing left on the stack -- error */
869 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
872 /* Restore state as it was in the most forward-advanced error */
873 yylvp = yylvals + yyerrctx->lexeme;
874 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
875 yylpp = yylpsns + yyerrctx->lexeme;
877 yylexp = yylexemes + yyerrctx->lexeme;
880 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
883 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
884 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
885 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
886 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
887 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
888 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
889 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
891 yystate = yyerrctx->state;
892 yyFreeState(yyerrctx);
897 if (yynewerrflag == 0) goto yyinrecovery;
898 #endif /* YYBTYACC */
900 YYERROR_CALL("syntax error");
901 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
902 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
917 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
918 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
922 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
923 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
925 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
926 yystate = yytable[yyn];
927 *++yystack.s_mark = yytable[yyn];
928 *++yystack.l_mark = yylval;
929 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
930 /* lookahead position is error end position */
931 yyerror_loc_range[1] = yylloc;
932 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
933 *++yystack.p_mark = yyloc;
941 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
942 YYDEBUGSTR, yydepth, *yystack.s_mark);
944 if (yystack.s_mark <= yystack.s_base) goto yyabort;
945 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
946 /* the current TOS position is the error start position */
947 yyerror_loc_range[0] = *yystack.p_mark;
949 #if defined(YYDESTRUCT_CALL)
952 #endif /* YYBTYACC */
953 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
954 YYDESTRUCT_CALL("error: discarding state",
955 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
957 YYDESTRUCT_CALL("error: discarding state",
958 yystos[*yystack.s_mark], yystack.l_mark);
959 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
960 #endif /* defined(YYDESTRUCT_CALL) */
963 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
971 if (yychar == YYEOF) goto yyabort;
975 yys = yyname[YYTRANSLATE(yychar)];
976 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
977 YYDEBUGSTR, yydepth, yystate, yychar, yys);
980 #if defined(YYDESTRUCT_CALL)
983 #endif /* YYBTYACC */
984 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
985 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
987 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
988 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
989 #endif /* defined(YYDESTRUCT_CALL) */
999 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1000 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1001 #ifdef YYSTYPE_TOSTRING
1004 #endif /* YYBTYACC */
1009 for (i = yym; i > 0; i--)
1011 if (i != yym) fputs(", ", stderr);
1012 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1013 yystack.l_mark[1-i]), stderr);
1018 fputc('\n', stderr);
1022 yyval = yystack.l_mark[1-yym];
1024 memset(&yyval, 0, sizeof yyval);
1025 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1027 /* Perform position reduction */
1028 memset(&yyloc, 0, sizeof(yyloc));
1031 #endif /* YYBTYACC */
1033 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1034 /* just in case YYERROR is invoked within the action, save
1035 the start of the rhs as the error start position */
1036 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1043 #line 20 "inherit0.y"
1044 { yyval = yystack.l_mark[0]; }
1047 #line 22 "inherit0.y"
1048 { yyval = yystack.l_mark[0]; }
1051 #line 25 "inherit0.y"
1055 #line 26 "inherit0.y"
1059 #line 29 "inherit0.y"
1063 #line 30 "inherit0.y"
1067 #line 34 "inherit0.y"
1068 { mksymbol(yystack.l_mark[-2], yystack.l_mark[-3], yystack.l_mark[0]); }
1071 #line 36 "inherit0.y"
1072 { mksymbol(yystack.l_mark[-1], yystack.l_mark[-2], yystack.l_mark[0]); }
1075 #line 40 "inherit0.y"
1079 #line 41 "inherit0.y"
1080 { yyval = yystack.l_mark[-2]; }
1083 #line 43 "inherit0.y"
1084 { yyval = yystack.l_mark[0]; }
1086 #line 1087 "inherit0.tab.c"
1090 yystack.s_mark -= yym;
1091 yystate = *yystack.s_mark;
1092 yystack.l_mark -= yym;
1093 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1094 yystack.p_mark -= yym;
1097 if (yystate == 0 && yym == 0)
1102 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1103 #ifdef YYSTYPE_TOSTRING
1106 #endif /* YYBTYACC */
1107 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1109 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1113 *++yystack.s_mark = YYFINAL;
1114 *++yystack.l_mark = yyval;
1115 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1116 *++yystack.p_mark = yyloc;
1124 /* we're currently re-reading tokens */
1126 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1134 /* in trial mode; save scanner results for future parse attempts */
1135 if (yylvp == yylvlim)
1136 { /* Enlarge lexical value queue */
1137 int p = yylvp - yylvals;
1138 int s = yylvlim - yylvals;
1140 s += YYLVQUEUEGROWTH;
1141 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1143 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1145 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1146 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1149 yylvp = yylve = yylvals + p;
1150 yylvlim = yylvals + s;
1151 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1152 yylpp = yylpe = yylpsns + p;
1153 yylplim = yylpsns + s;
1155 yylexp = yylexemes + p;
1157 *yylexp = (short) YYLEX;
1160 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1167 /* normal operation, no conflict encountered */
1168 #endif /* YYBTYACC */
1172 #endif /* YYBTYACC */
1173 if (yychar < 0) yychar = YYEOF;
1174 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1178 yys = yyname[YYTRANSLATE(yychar)];
1179 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1180 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1184 if (yychar == YYEOF) goto yyaccept;
1187 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1188 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1189 yystate = yytable[yyn];
1191 yystate = yydgoto[yym];
1195 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1196 #ifdef YYSTYPE_TOSTRING
1199 #endif /* YYBTYACC */
1200 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1202 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1205 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1206 *++yystack.s_mark = (short) yystate;
1207 *++yystack.l_mark = yyval;
1208 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1209 *++yystack.p_mark = yyloc;
1214 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1216 if (yypath) YYABORT;
1219 YYParseState *save = yyps->save;
1220 yyps->save = save->save;
1221 save->save = yypath;
1226 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1227 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1231 yyFreeState(yyerrctx);
1234 yylvp = yylvals + yypath->lexeme;
1235 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1236 yylpp = yylpsns + yypath->lexeme;
1238 yylexp = yylexemes + yypath->lexeme;
1240 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1241 memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1242 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1243 memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1244 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1245 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1246 memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1248 yystate = yypath->state;
1250 #endif /* YYBTYACC */
1253 YYERROR_CALL("yacc stack overflow");
1257 YYERROR_CALL("memory exhausted");
1259 #endif /* YYBTYACC */
1269 if (yyps->save) goto yyvalid;
1270 #endif /* YYBTYACC */
1274 #if defined(YYDESTRUCT_CALL)
1275 if (yychar != YYEOF && yychar != YYEMPTY)
1276 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1277 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1279 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1280 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1284 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1287 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1288 YYDESTRUCT_CALL("cleanup: discarding state",
1289 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1291 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1292 YYDESTRUCT_CALL("cleanup: discarding state",
1293 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1294 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1296 #endif /* defined(YYDESTRUCT_CALL) */
1301 yyFreeState(yyerrctx);
1306 YYParseState *save = yyps;
1313 YYParseState *save = yypath;
1314 yypath = save->save;
1318 #endif /* YYBTYACC */
1319 yyfreestack(&yystack);