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 err_inherit4_parse
25 #define yylex err_inherit4_lex
29 #define yyerror err_inherit4_error
33 #define yychar err_inherit4_char
37 #define yyval err_inherit4_val
41 #define yylval err_inherit4_lval
45 #define yydebug err_inherit4_debug
49 #define yynerrs err_inherit4_nerrs
53 #define yyerrflag err_inherit4_errflag
54 #endif /* yyerrflag */
57 #define yylhs err_inherit4_lhs
61 #define yylen err_inherit4_len
65 #define yydefred err_inherit4_defred
69 #define yystos err_inherit4_stos
73 #define yydgoto err_inherit4_dgoto
77 #define yysindex err_inherit4_sindex
81 #define yyrindex err_inherit4_rindex
85 #define yygindex err_inherit4_gindex
89 #define yytable err_inherit4_table
93 #define yycheck err_inherit4_check
97 #define yyname err_inherit4_name
101 #define yyrule err_inherit4_rule
105 #define yyloc err_inherit4_loc
109 #define yylloc err_inherit4_lloc
115 #define yycindex err_inherit4_cindex
116 #endif /* yycindex */
119 #define yyctable err_inherit4_ctable
120 #endif /* yyctable */
122 #endif /* YYBTYACC */
124 #define YYPREFIX "err_inherit4_"
128 #line 3 "err_inherit4.y"
131 typedef enum {cGLOBAL, cLOCAL} class;
132 typedef enum {tREAL, tINTEGER} type;
135 struct symbol { class c; type t; name id; };
136 typedef struct symbol symbol;
138 struct namelist { symbol *s; struct namelist *next; };
139 typedef struct namelist namelist;
141 extern symbol *mksymbol(type t, class c, name id);
144 #define YYLEX_DECL() yylex(void)
145 #define YYERROR_DECL() yyerror(const char *s)
148 #undef YYSTYPE_IS_DECLARED
149 #define YYSTYPE_IS_DECLARED 1
151 #ifndef YYSTYPE_IS_DECLARED
152 #define YYSTYPE_IS_DECLARED 1
153 #line 41 "err_inherit4.y"
161 #endif /* !YYSTYPE_IS_DECLARED */
162 #line 163 "err_inherit4.tab.c"
164 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
165 /* Default: YYLTYPE is the text position type. */
166 typedef struct YYLTYPE
174 #define YYLTYPE_IS_DECLARED 1
176 #define YYRHSLOC(rhs, k) ((rhs)[k])
178 /* compatibility with bison */
180 /* compatibility with FreeBSD */
181 # ifdef YYPARSE_PARAM_TYPE
182 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
184 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
187 # define YYPARSE_DECL() yyparse(void)
190 /* Parameters sent to lex. */
192 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
193 # define YYLEX yylex(YYLEX_PARAM)
195 # define YYLEX_DECL() yylex(void)
196 # define YYLEX yylex()
199 /* Parameters sent to yyerror. */
201 #define YYERROR_DECL() yyerror(YYLTYPE *loc, const char *s)
204 #define YYERROR_CALL(msg) yyerror(&yylloc, msg)
207 #ifndef YYDESTRUCT_DECL
208 #define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, YYLTYPE *loc)
210 #ifndef YYDESTRUCT_CALL
211 #define YYDESTRUCT_CALL(msg, psymb, val, loc) yydestruct(msg, psymb, val, loc)
214 extern int YYPARSE_DECL();
221 #define YYERRCODE 256
223 static const YYINT err_inherit4_lhs[] = { -1,
224 5, 6, 0, 0, 3, 3, 4, 4, 1, 1,
227 static const YYINT err_inherit4_len[] = { 2,
228 0, 0, 5, 2, 1, 1, 1, 1, 2, 1,
231 static const YYINT err_inherit4_defred[] = { 0,
232 5, 6, 7, 8, 0, 0, 0, 1, 10, 0,
235 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
236 static const YYINT err_inherit4_stos[] = { 0,
237 257, 258, 259, 260, 263, 266, 267, 267, 261, 264,
238 265, 268, 261, 269, 264,
240 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
241 static const YYINT err_inherit4_dgoto[] = { 5,
242 10, 11, 6, 7, 12, 14,
244 static const YYINT err_inherit4_sindex[] = { -257,
245 0, 0, 0, 0, 0, -255, -254, 0, 0, -253,
248 static const YYINT err_inherit4_rindex[] = { 0,
249 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,
253 static const YYINT err_inherit4_cindex[] = { 0,
254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
258 static const YYINT err_inherit4_gindex[] = { 0,
261 #define YYTABLESIZE 11
262 static const YYINT err_inherit4_table[] = { 1,
263 2, 3, 4, 3, 4, 11, 9, 13, 3, 15,
266 static const YYINT err_inherit4_check[] = { 257,
267 258, 259, 260, 259, 260, 0, 261, 261, 0, 14,
271 static const YYINT err_inherit4_ctable[] = { -1,
272 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
279 #define YYMAXTOKEN 261
280 #define YYUNDFTOKEN 270
281 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
283 static const char *const err_inherit4_name[] = {
285 "$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,
286 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
287 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
288 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
289 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
290 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
291 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
292 "NAME","$accept","declaration","namelist","locnamelist","class","type","$$1",
293 "$$2","illegal-symbol",
295 static const char *const err_inherit4_rule[] = {
296 "$accept : declaration",
299 "declaration : class type $$1 $$2 namelist",
300 "declaration : type locnamelist",
305 "namelist : namelist NAME",
307 "locnamelist : namelist",
319 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
320 YYLTYPE yyloc; /* position returned by actions */
321 YYLTYPE yylloc; /* position from the lexer */
324 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
325 #ifndef YYLLOC_DEFAULT
326 #define YYLLOC_DEFAULT(loc, rhs, n) \
331 (loc).first_line = ((rhs)[-1]).last_line; \
332 (loc).first_column = ((rhs)[-1]).last_column; \
333 (loc).last_line = ((rhs)[-1]).last_line; \
334 (loc).last_column = ((rhs)[-1]).last_column; \
338 (loc).first_line = ((rhs)[ 0 ]).first_line; \
339 (loc).first_column = ((rhs)[ 0 ]).first_column; \
340 (loc).last_line = ((rhs)[n-1]).last_line; \
341 (loc).last_column = ((rhs)[n-1]).last_column; \
344 #endif /* YYLLOC_DEFAULT */
345 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
348 #ifndef YYLVQUEUEGROWTH
349 #define YYLVQUEUEGROWTH 32
351 #endif /* YYBTYACC */
353 /* define the initial stack-sizes */
356 #define YYMAXDEPTH YYSTACKSIZE
359 #define YYSTACKSIZE YYMAXDEPTH
361 #define YYSTACKSIZE 10000
362 #define YYMAXDEPTH 10000
366 #ifndef YYINITSTACKSIZE
367 #define YYINITSTACKSIZE 200
377 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
384 struct YYParseState_s
386 struct YYParseState_s *save; /* Previously saved parser state */
387 YYSTACKDATA yystack; /* saved parser stack */
388 int state; /* saved parser state */
389 int errflag; /* saved error recovery status */
390 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
391 YYINT ctry; /* saved index in yyctable[] for this conflict */
393 typedef struct YYParseState_s YYParseState;
394 #endif /* YYBTYACC */
395 /* variables for the parser stack */
396 static YYSTACKDATA yystack;
399 /* Current parser state */
400 static YYParseState *yyps = 0;
402 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
403 static YYParseState *yypath = 0;
405 /* Base of the lexical value queue */
406 static YYSTYPE *yylvals = 0;
408 /* Current position at lexical value queue */
409 static YYSTYPE *yylvp = 0;
411 /* End position of lexical value queue */
412 static YYSTYPE *yylve = 0;
414 /* The last allocated position at the lexical value queue */
415 static YYSTYPE *yylvlim = 0;
417 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
418 /* Base of the lexical position queue */
419 static YYLTYPE *yylpsns = 0;
421 /* Current position at lexical position queue */
422 static YYLTYPE *yylpp = 0;
424 /* End position of lexical position queue */
425 static YYLTYPE *yylpe = 0;
427 /* The last allocated position at the lexical position queue */
428 static YYLTYPE *yylplim = 0;
431 /* Current position at lexical token queue */
432 static YYINT *yylexp = 0;
434 static YYINT *yylexemes = 0;
435 #endif /* YYBTYACC */
436 #line 80 "err_inherit4.y"
438 extern int YYLEX_DECL();
439 extern void YYERROR_DECL();
440 #line 441 "err_inherit4.tab.c"
442 /* Release memory associated with symbol. */
443 #if ! defined YYDESTRUCT_IS_DECLARED
450 #line 28 "err_inherit4.y"
453 #line 454 "err_inherit4.tab.c"
455 #line 28 "err_inherit4.y"
458 #line 459 "err_inherit4.tab.c"
460 #line 28 "err_inherit4.y"
463 #line 464 "err_inherit4.tab.c"
466 #define YYDESTRUCT_IS_DECLARED 1
469 /* For use in generated program */
470 #define yydepth (int)(yystack.s_mark - yystack.s_base)
472 #define yytrial (yyps->save)
473 #endif /* YYBTYACC */
476 #include <stdio.h> /* needed for printf */
479 #include <stdlib.h> /* needed for malloc, etc */
480 #include <string.h> /* needed for memset */
482 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
483 static int yygrowstack(YYSTACKDATA *data)
489 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
493 if ((newsize = data->stacksize) == 0)
494 newsize = YYINITSTACKSIZE;
495 else if (newsize >= YYMAXDEPTH)
497 else if ((newsize *= 2) > YYMAXDEPTH)
498 newsize = YYMAXDEPTH;
500 i = (int) (data->s_mark - data->s_base);
501 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
505 data->s_base = newss;
506 data->s_mark = newss + i;
508 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
512 data->l_base = newvs;
513 data->l_mark = newvs + i;
515 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
516 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
520 data->p_base = newps;
521 data->p_mark = newps + i;
524 data->stacksize = newsize;
525 data->s_last = data->s_base + newsize - 1;
529 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
534 #if YYPURE || defined(YY_NO_LEAKS)
535 static void yyfreestack(YYSTACKDATA *data)
539 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
542 memset(data, 0, sizeof(*data));
545 #define yyfreestack(data) /* nothing */
546 #endif /* YYPURE || defined(YY_NO_LEAKS) */
549 static YYParseState *
550 yyNewState(unsigned size)
552 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
553 if (p == NULL) return NULL;
555 p->yystack.stacksize = size;
558 p->yystack.s_base = NULL;
559 p->yystack.l_base = NULL;
560 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
561 p->yystack.p_base = NULL;
565 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
566 if (p->yystack.s_base == NULL) return NULL;
567 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
568 if (p->yystack.l_base == NULL) return NULL;
569 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
570 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
571 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
572 if (p->yystack.p_base == NULL) return NULL;
573 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
580 yyFreeState(YYParseState *p)
582 yyfreestack(&p->yystack);
585 #endif /* YYBTYACC */
587 #define YYABORT goto yyabort
588 #define YYREJECT goto yyabort
589 #define YYACCEPT goto yyaccept
590 #define YYERROR goto yyerrlab
592 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
593 #define YYVALID_NESTED do { if (yyps->save && \
594 yyps->save->save == 0) goto yyvalid; } while(0)
595 #endif /* YYBTYACC */
600 int yym, yyn, yystate, yyresult;
603 YYParseState *yyerrctx = NULL;
604 #endif /* YYBTYACC */
605 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
606 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
611 if ((yys = getenv("YYDEBUG")) != 0)
614 if (yyn >= '0' && yyn <= '9')
618 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
620 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
621 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
625 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
627 #endif /* YYBTYACC */
636 memset(&yystack, 0, sizeof(yystack));
639 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
640 yystack.s_mark = yystack.s_base;
641 yystack.l_mark = yystack.l_base;
642 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
643 yystack.p_mark = yystack.p_base;
649 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
656 /* we're currently re-reading tokens */
658 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
666 /* in trial mode; save scanner results for future parse attempts */
667 if (yylvp == yylvlim)
668 { /* Enlarge lexical value queue */
669 size_t p = (size_t) (yylvp - yylvals);
670 size_t s = (size_t) (yylvlim - yylvals);
672 s += YYLVQUEUEGROWTH;
673 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
674 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
675 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
676 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
678 yylvp = yylve = yylvals + p;
679 yylvlim = yylvals + s;
680 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
681 yylpp = yylpe = yylpsns + p;
682 yylplim = yylpsns + s;
684 yylexp = yylexemes + p;
686 *yylexp = (YYINT) YYLEX;
689 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
696 /* normal operation, no conflict encountered */
697 #endif /* YYBTYACC */
701 #endif /* YYBTYACC */
702 if (yychar < 0) yychar = YYEOF;
706 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
707 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
708 YYDEBUGSTR, yydepth, yystate, yychar, yys);
709 #ifdef YYSTYPE_TOSTRING
712 #endif /* YYBTYACC */
713 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
721 /* Do we have a conflict? */
722 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
723 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
732 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
733 YYDEBUGSTR, yydepth, yystate);
735 /* Switch to the next conflict context */
740 if (save->state != yystate) YYABORT;
747 /* Unresolved conflict - start/continue trial parse */
752 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
754 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
756 fputs("Starting trial parse.\n", stderr);
759 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
760 if (save == NULL) goto yyenomem;
761 save->save = yyps->save;
762 save->state = yystate;
763 save->errflag = yyerrflag;
764 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
765 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
766 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
767 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
768 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
769 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
770 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
773 if (yyctable[ctry] == -1)
776 if (yydebug && yychar >= YYEOF)
777 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
782 if (yyps->save == NULL)
784 /* If this is a first conflict in the stack, start saving lexemes */
787 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
788 if (yylexemes == NULL) goto yyenomem;
789 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
790 if (yylvals == NULL) goto yyenomem;
791 yylvlim = yylvals + YYLVQUEUEGROWTH;
792 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
793 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
794 if (yylpsns == NULL) goto yyenomem;
795 yylplim = yylpsns + YYLVQUEUEGROWTH;
800 yylvp = yylve = yylvals;
801 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
802 yylpp = yylpe = yylpsns;
808 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
811 *yylexp = (YYINT) yychar;
819 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
825 save->lexeme = (int) (yylvp - yylvals);
828 if (yytable[yyn] == ctry)
832 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
833 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
838 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
843 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
845 yystate = yyctable[ctry];
846 *++yystack.s_mark = (YYINT) yystate;
847 *++yystack.l_mark = yylval;
848 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
849 *++yystack.p_mark = yylloc;
852 if (yyerrflag > 0) --yyerrflag;
857 yyn = yyctable[ctry];
860 } /* End of code dealing with conflicts */
861 #endif /* YYBTYACC */
862 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
863 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
867 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
868 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
870 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
871 yystate = yytable[yyn];
872 *++yystack.s_mark = yytable[yyn];
873 *++yystack.l_mark = yylval;
874 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
875 *++yystack.p_mark = yylloc;
878 if (yyerrflag > 0) --yyerrflag;
881 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
882 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
887 if (yyerrflag != 0) goto yyinrecovery;
892 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
895 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
896 * before looking for error recovery */
897 yystack.s_mark -= yym;
898 yystate = *yystack.s_mark;
899 yystack.l_mark -= yym;
900 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
901 yystack.p_mark -= yym;
909 YYParseState *save = yyps->save;
912 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
913 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
914 (int)(yylvp - yylvals - yyps->save->lexeme));
916 /* Memorize most forward-looking error state in case it's really an error. */
917 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
919 /* Free old saved error context state */
920 if (yyerrctx) yyFreeState(yyerrctx);
921 /* Create and fill out new saved error context state */
922 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
923 if (yyerrctx == NULL) goto yyenomem;
924 yyerrctx->save = yyps->save;
925 yyerrctx->state = yystate;
926 yyerrctx->errflag = yyerrflag;
927 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
928 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
929 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
930 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
931 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
932 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
933 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
935 yyerrctx->lexeme = (int) (yylvp - yylvals);
937 yylvp = yylvals + save->lexeme;
938 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
939 yylpp = yylpsns + save->lexeme;
941 yylexp = yylexemes + save->lexeme;
943 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
944 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
945 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
946 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
947 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
948 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
949 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
952 yystate = save->state;
953 /* We tried shift, try reduce now */
954 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
955 yyps->save = save->save;
959 /* Nothing left on the stack -- error */
964 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
967 /* Restore state as it was in the most forward-advanced error */
968 yylvp = yylvals + yyerrctx->lexeme;
969 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
970 yylpp = yylpsns + yyerrctx->lexeme;
972 yylexp = yylexemes + yyerrctx->lexeme;
975 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
978 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
979 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
980 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
981 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
982 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
983 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
984 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
986 yystate = yyerrctx->state;
987 yyFreeState(yyerrctx);
992 if (yynewerrflag == 0) goto yyinrecovery;
993 #endif /* YYBTYACC */
995 YYERROR_CALL("syntax error");
996 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
997 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1001 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1012 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1013 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1017 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1018 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1020 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1021 yystate = yytable[yyn];
1022 *++yystack.s_mark = yytable[yyn];
1023 *++yystack.l_mark = yylval;
1024 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1025 /* lookahead position is error end position */
1026 yyerror_loc_range[1] = yylloc;
1027 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1028 *++yystack.p_mark = yyloc;
1036 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1037 YYDEBUGSTR, yydepth, *yystack.s_mark);
1039 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1040 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1041 /* the current TOS position is the error start position */
1042 yyerror_loc_range[0] = *yystack.p_mark;
1044 #if defined(YYDESTRUCT_CALL)
1047 #endif /* YYBTYACC */
1048 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1049 YYDESTRUCT_CALL("error: discarding state",
1050 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1052 YYDESTRUCT_CALL("error: discarding state",
1053 yystos[*yystack.s_mark], yystack.l_mark);
1054 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1055 #endif /* defined(YYDESTRUCT_CALL) */
1058 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1066 if (yychar == YYEOF) goto yyabort;
1070 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1071 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1072 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1075 #if defined(YYDESTRUCT_CALL)
1078 #endif /* YYBTYACC */
1079 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1080 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1082 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1083 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1084 #endif /* defined(YYDESTRUCT_CALL) */
1094 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1095 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1096 #ifdef YYSTYPE_TOSTRING
1099 #endif /* YYBTYACC */
1104 for (i = yym; i > 0; i--)
1106 if (i != yym) fputs(", ", stderr);
1107 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1108 yystack.l_mark[1-i]), stderr);
1113 fputc('\n', stderr);
1117 yyval = yystack.l_mark[1-yym];
1119 memset(&yyval, 0, sizeof yyval);
1120 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1122 /* Perform position reduction */
1123 memset(&yyloc, 0, sizeof(yyloc));
1126 #endif /* YYBTYACC */
1128 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1129 /* just in case YYERROR is invoked within the action, save
1130 the start of the rhs as the error start position */
1131 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1138 #line 52 "err_inherit4.y"
1139 yyval.cval = yystack.l_mark[-1].cval;
1142 #line 52 "err_inherit4.y"
1143 yyval.tval = yystack.l_mark[-1].tval;
1146 #line 53 "err_inherit4.y"
1147 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[0]; }
1150 #line 55 "err_inherit4.y"
1151 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[-3]; }
1154 #line 58 "err_inherit4.y"
1155 { yyval.cval = cGLOBAL; }
1158 #line 59 "err_inherit4.y"
1159 { yyval.cval = cLOCAL; }
1162 #line 62 "err_inherit4.y"
1163 { yyval.tval = tREAL; }
1166 #line 63 "err_inherit4.y"
1167 { yyval.tval = tINTEGER; }
1170 #line 67 "err_inherit4.y"
1171 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-3].cval, yystack.l_mark[0].id);
1172 yyval.nlist->next = yystack.l_mark[-1].nlist;
1176 #line 71 "err_inherit4.y"
1177 { yyval.nlist->s = mksymbol(yystack.l_mark[-1].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
1178 yyval.nlist->next = NULL;
1182 #line 77 "err_inherit4.y"
1183 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[1]; }
1185 #line 1186 "err_inherit4.tab.c"
1189 yystack.s_mark -= yym;
1190 yystate = *yystack.s_mark;
1191 yystack.l_mark -= yym;
1192 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1193 yystack.p_mark -= yym;
1196 if (yystate == 0 && yym == 0)
1201 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1202 #ifdef YYSTYPE_TOSTRING
1205 #endif /* YYBTYACC */
1206 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1208 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1212 *++yystack.s_mark = YYFINAL;
1213 *++yystack.l_mark = yyval;
1214 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1215 *++yystack.p_mark = yyloc;
1223 /* we're currently re-reading tokens */
1225 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1233 /* in trial mode; save scanner results for future parse attempts */
1234 if (yylvp == yylvlim)
1235 { /* Enlarge lexical value queue */
1236 size_t p = (size_t) (yylvp - yylvals);
1237 size_t s = (size_t) (yylvlim - yylvals);
1239 s += YYLVQUEUEGROWTH;
1240 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1242 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1244 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1245 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1248 yylvp = yylve = yylvals + p;
1249 yylvlim = yylvals + s;
1250 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1251 yylpp = yylpe = yylpsns + p;
1252 yylplim = yylpsns + s;
1254 yylexp = yylexemes + p;
1256 *yylexp = (YYINT) YYLEX;
1259 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1266 /* normal operation, no conflict encountered */
1267 #endif /* YYBTYACC */
1271 #endif /* YYBTYACC */
1272 if (yychar < 0) yychar = YYEOF;
1276 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1277 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1278 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1282 if (yychar == YYEOF) goto yyaccept;
1285 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1286 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1287 yystate = yytable[yyn];
1289 yystate = yydgoto[yym];
1293 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1294 #ifdef YYSTYPE_TOSTRING
1297 #endif /* YYBTYACC */
1298 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1300 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1303 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1304 *++yystack.s_mark = (YYINT) yystate;
1305 *++yystack.l_mark = yyval;
1306 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1307 *++yystack.p_mark = yyloc;
1312 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1314 if (yypath) YYABORT;
1317 YYParseState *save = yyps->save;
1318 yyps->save = save->save;
1319 save->save = yypath;
1324 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1325 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1329 yyFreeState(yyerrctx);
1332 yylvp = yylvals + yypath->lexeme;
1333 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1334 yylpp = yylpsns + yypath->lexeme;
1336 yylexp = yylexemes + yypath->lexeme;
1338 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1339 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1340 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1341 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1342 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1343 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1344 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1346 yystate = yypath->state;
1348 #endif /* YYBTYACC */
1351 YYERROR_CALL("yacc stack overflow");
1355 YYERROR_CALL("memory exhausted");
1357 #endif /* YYBTYACC */
1367 if (yyps->save) goto yyvalid;
1368 #endif /* YYBTYACC */
1372 #if defined(YYDESTRUCT_CALL)
1373 if (yychar != YYEOF && yychar != YYEMPTY)
1374 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1375 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1377 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1378 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1382 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1385 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1386 YYDESTRUCT_CALL("cleanup: discarding state",
1387 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1389 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1390 YYDESTRUCT_CALL("cleanup: discarding state",
1391 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1392 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1394 #endif /* defined(YYDESTRUCT_CALL) */
1399 yyFreeState(yyerrctx);
1404 YYParseState *save = yyps;
1411 YYParseState *save = yypath;
1412 yypath = save->save;
1416 #endif /* YYBTYACC */
1417 yyfreestack(&yystack);