1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent of 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,
221 static const YYINT inherit0_ctable[] = { -1,
222 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
229 #define YYMAXTOKEN 261
230 #define YYUNDFTOKEN 270
231 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
233 static const char *const inherit0_name[] = {
235 "$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,
236 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
237 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,"error","GLOBAL","LOCAL","REAL","INTEGER",
242 "NAME","$accept","declaration","class","type","namelist","locnamelist","$$1",
243 "$$2","illegal-symbol",
245 static const char *const inherit0_rule[] = {
246 "$accept : declaration",
247 "declaration : class type namelist",
248 "declaration : type locnamelist",
253 "namelist : namelist NAME",
257 "locnamelist : $$1 $$2 namelist",
269 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
270 YYLTYPE yyloc; /* position returned by actions */
271 YYLTYPE yylloc; /* position from the lexer */
274 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
275 #ifndef YYLLOC_DEFAULT
276 #define YYLLOC_DEFAULT(loc, rhs, n) \
281 (loc).first_line = ((rhs)[-1]).last_line; \
282 (loc).first_column = ((rhs)[-1]).last_column; \
283 (loc).last_line = ((rhs)[-1]).last_line; \
284 (loc).last_column = ((rhs)[-1]).last_column; \
288 (loc).first_line = ((rhs)[ 0 ]).first_line; \
289 (loc).first_column = ((rhs)[ 0 ]).first_column; \
290 (loc).last_line = ((rhs)[n-1]).last_line; \
291 (loc).last_column = ((rhs)[n-1]).last_column; \
294 #endif /* YYLLOC_DEFAULT */
295 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
298 #ifndef YYLVQUEUEGROWTH
299 #define YYLVQUEUEGROWTH 32
301 #endif /* YYBTYACC */
303 /* define the initial stack-sizes */
306 #define YYMAXDEPTH YYSTACKSIZE
309 #define YYSTACKSIZE YYMAXDEPTH
311 #define YYSTACKSIZE 10000
312 #define YYMAXDEPTH 10000
316 #ifndef YYINITSTACKSIZE
317 #define YYINITSTACKSIZE 200
327 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
334 struct YYParseState_s
336 struct YYParseState_s *save; /* Previously saved parser state */
337 YYSTACKDATA yystack; /* saved parser stack */
338 int state; /* saved parser state */
339 int errflag; /* saved error recovery status */
340 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
341 YYINT ctry; /* saved index in yyctable[] for this conflict */
343 typedef struct YYParseState_s YYParseState;
344 #endif /* YYBTYACC */
345 /* variables for the parser stack */
346 static YYSTACKDATA yystack;
349 /* Current parser state */
350 static YYParseState *yyps = 0;
352 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
353 static YYParseState *yypath = 0;
355 /* Base of the lexical value queue */
356 static YYSTYPE *yylvals = 0;
358 /* Current position at lexical value queue */
359 static YYSTYPE *yylvp = 0;
361 /* End position of lexical value queue */
362 static YYSTYPE *yylve = 0;
364 /* The last allocated position at the lexical value queue */
365 static YYSTYPE *yylvlim = 0;
367 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
368 /* Base of the lexical position queue */
369 static YYLTYPE *yylpsns = 0;
371 /* Current position at lexical position queue */
372 static YYLTYPE *yylpp = 0;
374 /* End position of lexical position queue */
375 static YYLTYPE *yylpe = 0;
377 /* The last allocated position at the lexical position queue */
378 static YYLTYPE *yylplim = 0;
381 /* Current position at lexical token queue */
382 static short *yylexp = 0;
384 static short *yylexemes = 0;
385 #endif /* YYBTYACC */
386 #line 46 "inherit0.y"
388 extern int YYLEX_DECL();
389 extern void YYERROR_DECL();
390 #line 391 "inherit0.tab.c"
392 /* For use in generated program */
393 #define yydepth (int)(yystack.s_mark - yystack.s_base)
395 #define yytrial (yyps->save)
396 #endif /* YYBTYACC */
399 #include <stdio.h> /* needed for printf */
402 #include <stdlib.h> /* needed for malloc, etc */
403 #include <string.h> /* needed for memset */
405 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
406 static int yygrowstack(YYSTACKDATA *data)
412 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
416 if ((newsize = data->stacksize) == 0)
417 newsize = YYINITSTACKSIZE;
418 else if (newsize >= YYMAXDEPTH)
420 else if ((newsize *= 2) > YYMAXDEPTH)
421 newsize = YYMAXDEPTH;
423 i = (int) (data->s_mark - data->s_base);
424 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
428 data->s_base = newss;
429 data->s_mark = newss + i;
431 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
435 data->l_base = newvs;
436 data->l_mark = newvs + i;
438 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
439 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
443 data->p_base = newps;
444 data->p_mark = newps + i;
447 data->stacksize = newsize;
448 data->s_last = data->s_base + newsize - 1;
452 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
457 #if YYPURE || defined(YY_NO_LEAKS)
458 static void yyfreestack(YYSTACKDATA *data)
462 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
465 memset(data, 0, sizeof(*data));
468 #define yyfreestack(data) /* nothing */
469 #endif /* YYPURE || defined(YY_NO_LEAKS) */
472 static YYParseState *
473 yyNewState(unsigned size)
475 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
476 if (p == NULL) return NULL;
478 p->yystack.stacksize = size;
481 p->yystack.s_base = NULL;
482 p->yystack.l_base = NULL;
483 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
484 p->yystack.p_base = NULL;
488 p->yystack.s_base = (short *) malloc(size * sizeof(short));
489 if (p->yystack.s_base == NULL) return NULL;
490 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
491 if (p->yystack.l_base == NULL) return NULL;
492 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
493 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
494 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
495 if (p->yystack.p_base == NULL) return NULL;
496 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
503 yyFreeState(YYParseState *p)
505 yyfreestack(&p->yystack);
508 #endif /* YYBTYACC */
510 #define YYABORT goto yyabort
511 #define YYREJECT goto yyabort
512 #define YYACCEPT goto yyaccept
513 #define YYERROR goto yyerrlab
515 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
516 #define YYVALID_NESTED do { if (yyps->save && \
517 yyps->save->save == 0) goto yyvalid; } while(0)
518 #endif /* YYBTYACC */
523 int yym, yyn, yystate, yyresult;
526 YYParseState *yyerrctx = NULL;
527 #endif /* YYBTYACC */
528 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
529 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
534 if ((yys = getenv("YYDEBUG")) != 0)
537 if (yyn >= '0' && yyn <= '9')
541 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
545 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
547 #endif /* YYBTYACC */
554 memset(&yystack, 0, sizeof(yystack));
557 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
558 yystack.s_mark = yystack.s_base;
559 yystack.l_mark = yystack.l_base;
560 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
561 yystack.p_mark = yystack.p_base;
567 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
574 /* we're currently re-reading tokens */
576 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
584 /* in trial mode; save scanner results for future parse attempts */
585 if (yylvp == yylvlim)
586 { /* Enlarge lexical value queue */
587 size_t p = (size_t) (yylvp - yylvals);
588 size_t s = (size_t) (yylvlim - yylvals);
590 s += YYLVQUEUEGROWTH;
591 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
592 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
593 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
594 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
596 yylvp = yylve = yylvals + p;
597 yylvlim = yylvals + s;
598 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
599 yylpp = yylpe = yylpsns + p;
600 yylplim = yylpsns + s;
602 yylexp = yylexemes + p;
604 *yylexp = (short) YYLEX;
607 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
614 /* normal operation, no conflict encountered */
615 #endif /* YYBTYACC */
619 #endif /* YYBTYACC */
620 if (yychar < 0) yychar = YYEOF;
621 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
625 yys = yyname[YYTRANSLATE(yychar)];
626 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
627 YYDEBUGSTR, yydepth, yystate, yychar, yys);
628 #ifdef YYSTYPE_TOSTRING
631 #endif /* YYBTYACC */
632 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
640 /* Do we have a conflict? */
641 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
642 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
651 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
652 YYDEBUGSTR, yydepth, yystate);
654 /* Switch to the next conflict context */
659 if (save->state != yystate) YYABORT;
666 /* Unresolved conflict - start/continue trial parse */
671 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
673 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
675 fputs("Starting trial parse.\n", stderr);
678 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
679 if (save == NULL) goto yyenomem;
680 save->save = yyps->save;
681 save->state = yystate;
682 save->errflag = yyerrflag;
683 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
684 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
685 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
686 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
687 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
688 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
689 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
692 if (yyctable[ctry] == -1)
695 if (yydebug && yychar >= YYEOF)
696 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
701 if (yyps->save == NULL)
703 /* If this is a first conflict in the stack, start saving lexemes */
706 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
707 if (yylexemes == NULL) goto yyenomem;
708 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
709 if (yylvals == NULL) goto yyenomem;
710 yylvlim = yylvals + YYLVQUEUEGROWTH;
711 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
712 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
713 if (yylpsns == NULL) goto yyenomem;
714 yylplim = yylpsns + YYLVQUEUEGROWTH;
719 yylvp = yylve = yylvals;
720 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
721 yylpp = yylpe = yylpsns;
727 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
730 *yylexp = (short) yychar;
738 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
744 save->lexeme = (int) (yylvp - yylvals);
747 if (yytable[yyn] == ctry)
751 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
752 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
757 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
762 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
764 yystate = yyctable[ctry];
765 *++yystack.s_mark = (short) yystate;
766 *++yystack.l_mark = yylval;
767 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
768 *++yystack.p_mark = yylloc;
771 if (yyerrflag > 0) --yyerrflag;
776 yyn = yyctable[ctry];
779 } /* End of code dealing with conflicts */
780 #endif /* YYBTYACC */
781 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
782 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
786 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
787 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
789 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
790 yystate = yytable[yyn];
791 *++yystack.s_mark = yytable[yyn];
792 *++yystack.l_mark = yylval;
793 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
794 *++yystack.p_mark = yylloc;
797 if (yyerrflag > 0) --yyerrflag;
800 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
801 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
806 if (yyerrflag != 0) goto yyinrecovery;
819 YYParseState *save = yyps->save;
822 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
823 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
824 (int)(yylvp - yylvals - yyps->save->lexeme));
826 /* Memorize most forward-looking error state in case it's really an error. */
827 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
829 /* Free old saved error context state */
830 if (yyerrctx) yyFreeState(yyerrctx);
831 /* Create and fill out new saved error context state */
832 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
833 if (yyerrctx == NULL) goto yyenomem;
834 yyerrctx->save = yyps->save;
835 yyerrctx->state = yystate;
836 yyerrctx->errflag = yyerrflag;
837 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
838 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
839 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
840 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
841 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
842 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
843 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
845 yyerrctx->lexeme = (int) (yylvp - yylvals);
847 yylvp = yylvals + save->lexeme;
848 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
849 yylpp = yylpsns + save->lexeme;
851 yylexp = yylexemes + save->lexeme;
853 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
854 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
855 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
856 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
857 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
858 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
859 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
862 yystate = save->state;
863 /* We tried shift, try reduce now */
864 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
865 yyps->save = save->save;
869 /* Nothing left on the stack -- error */
874 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
877 /* Restore state as it was in the most forward-advanced error */
878 yylvp = yylvals + yyerrctx->lexeme;
879 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
880 yylpp = yylpsns + yyerrctx->lexeme;
882 yylexp = yylexemes + yyerrctx->lexeme;
885 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
888 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
889 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
890 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
891 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
892 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
893 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
894 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
896 yystate = yyerrctx->state;
897 yyFreeState(yyerrctx);
902 if (yynewerrflag == 0) goto yyinrecovery;
903 #endif /* YYBTYACC */
905 YYERROR_CALL("syntax error");
906 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
907 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
922 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
923 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
927 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
928 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
930 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
931 yystate = yytable[yyn];
932 *++yystack.s_mark = yytable[yyn];
933 *++yystack.l_mark = yylval;
934 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
935 /* lookahead position is error end position */
936 yyerror_loc_range[1] = yylloc;
937 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
938 *++yystack.p_mark = yyloc;
946 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
947 YYDEBUGSTR, yydepth, *yystack.s_mark);
949 if (yystack.s_mark <= yystack.s_base) goto yyabort;
950 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
951 /* the current TOS position is the error start position */
952 yyerror_loc_range[0] = *yystack.p_mark;
954 #if defined(YYDESTRUCT_CALL)
957 #endif /* YYBTYACC */
958 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
959 YYDESTRUCT_CALL("error: discarding state",
960 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
962 YYDESTRUCT_CALL("error: discarding state",
963 yystos[*yystack.s_mark], yystack.l_mark);
964 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
965 #endif /* defined(YYDESTRUCT_CALL) */
968 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
976 if (yychar == YYEOF) goto yyabort;
980 yys = yyname[YYTRANSLATE(yychar)];
981 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
982 YYDEBUGSTR, yydepth, yystate, yychar, yys);
985 #if defined(YYDESTRUCT_CALL)
988 #endif /* YYBTYACC */
989 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
990 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
992 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
993 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
994 #endif /* defined(YYDESTRUCT_CALL) */
1004 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1005 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1006 #ifdef YYSTYPE_TOSTRING
1009 #endif /* YYBTYACC */
1014 for (i = yym; i > 0; i--)
1016 if (i != yym) fputs(", ", stderr);
1017 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1018 yystack.l_mark[1-i]), stderr);
1023 fputc('\n', stderr);
1027 yyval = yystack.l_mark[1-yym];
1029 memset(&yyval, 0, sizeof yyval);
1030 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1032 /* Perform position reduction */
1033 memset(&yyloc, 0, sizeof(yyloc));
1036 #endif /* YYBTYACC */
1038 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1039 /* just in case YYERROR is invoked within the action, save
1040 the start of the rhs as the error start position */
1041 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1048 #line 20 "inherit0.y"
1049 { yyval = yystack.l_mark[0]; }
1052 #line 22 "inherit0.y"
1053 { yyval = yystack.l_mark[0]; }
1056 #line 25 "inherit0.y"
1060 #line 26 "inherit0.y"
1064 #line 29 "inherit0.y"
1068 #line 30 "inherit0.y"
1072 #line 34 "inherit0.y"
1073 { mksymbol(yystack.l_mark[-2], yystack.l_mark[-3], yystack.l_mark[0]); }
1076 #line 36 "inherit0.y"
1077 { mksymbol(yystack.l_mark[-1], yystack.l_mark[-2], yystack.l_mark[0]); }
1080 #line 40 "inherit0.y"
1084 #line 41 "inherit0.y"
1085 { yyval = yystack.l_mark[-2]; }
1088 #line 43 "inherit0.y"
1089 { yyval = yystack.l_mark[0]; }
1091 #line 1092 "inherit0.tab.c"
1095 yystack.s_mark -= yym;
1096 yystate = *yystack.s_mark;
1097 yystack.l_mark -= yym;
1098 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1099 yystack.p_mark -= yym;
1102 if (yystate == 0 && yym == 0)
1107 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1108 #ifdef YYSTYPE_TOSTRING
1111 #endif /* YYBTYACC */
1112 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1114 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1118 *++yystack.s_mark = YYFINAL;
1119 *++yystack.l_mark = yyval;
1120 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1121 *++yystack.p_mark = yyloc;
1129 /* we're currently re-reading tokens */
1131 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1139 /* in trial mode; save scanner results for future parse attempts */
1140 if (yylvp == yylvlim)
1141 { /* Enlarge lexical value queue */
1142 size_t p = (size_t) (yylvp - yylvals);
1143 size_t s = (size_t) (yylvlim - yylvals);
1145 s += YYLVQUEUEGROWTH;
1146 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1148 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1150 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1151 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1154 yylvp = yylve = yylvals + p;
1155 yylvlim = yylvals + s;
1156 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1157 yylpp = yylpe = yylpsns + p;
1158 yylplim = yylpsns + s;
1160 yylexp = yylexemes + p;
1162 *yylexp = (short) YYLEX;
1165 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1172 /* normal operation, no conflict encountered */
1173 #endif /* YYBTYACC */
1177 #endif /* YYBTYACC */
1178 if (yychar < 0) yychar = YYEOF;
1179 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1183 yys = yyname[YYTRANSLATE(yychar)];
1184 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1185 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1189 if (yychar == YYEOF) goto yyaccept;
1192 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1193 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1194 yystate = yytable[yyn];
1196 yystate = yydgoto[yym];
1200 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1201 #ifdef YYSTYPE_TOSTRING
1204 #endif /* YYBTYACC */
1205 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1207 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1210 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1211 *++yystack.s_mark = (short) yystate;
1212 *++yystack.l_mark = yyval;
1213 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1214 *++yystack.p_mark = yyloc;
1219 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1221 if (yypath) YYABORT;
1224 YYParseState *save = yyps->save;
1225 yyps->save = save->save;
1226 save->save = yypath;
1231 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1232 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1236 yyFreeState(yyerrctx);
1239 yylvp = yylvals + yypath->lexeme;
1240 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1241 yylpp = yylpsns + yypath->lexeme;
1243 yylexp = yylexemes + yypath->lexeme;
1245 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1246 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1247 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1248 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1249 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1250 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1251 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1253 yystate = yypath->state;
1255 #endif /* YYBTYACC */
1258 YYERROR_CALL("yacc stack overflow");
1262 YYERROR_CALL("memory exhausted");
1264 #endif /* YYBTYACC */
1274 if (yyps->save) goto yyvalid;
1275 #endif /* YYBTYACC */
1279 #if defined(YYDESTRUCT_CALL)
1280 if (yychar != YYEOF && yychar != YYEMPTY)
1281 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1282 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1284 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1285 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1289 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1292 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1293 YYDESTRUCT_CALL("cleanup: discarding state",
1294 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1296 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1297 YYDESTRUCT_CALL("cleanup: discarding state",
1298 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1299 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1301 #endif /* defined(YYDESTRUCT_CALL) */
1306 yyFreeState(yyerrctx);
1311 YYParseState *save = yyps;
1318 YYParseState *save = yypath;
1319 yypath = save->save;
1323 #endif /* YYBTYACC */
1324 yyfreestack(&yystack);