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",
322 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
323 YYLTYPE yyloc; /* position returned by actions */
324 YYLTYPE yylloc; /* position from the lexer */
327 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
328 #ifndef YYLLOC_DEFAULT
329 #define YYLLOC_DEFAULT(loc, rhs, n) \
334 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
335 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
336 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
337 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
341 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
342 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
343 (loc).last_line = YYRHSLOC(rhs, n).last_line; \
344 (loc).last_column = YYRHSLOC(rhs, n).last_column; \
347 #endif /* YYLLOC_DEFAULT */
348 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
351 #ifndef YYLVQUEUEGROWTH
352 #define YYLVQUEUEGROWTH 32
354 #endif /* YYBTYACC */
356 /* define the initial stack-sizes */
359 #define YYMAXDEPTH YYSTACKSIZE
362 #define YYSTACKSIZE YYMAXDEPTH
364 #define YYSTACKSIZE 10000
365 #define YYMAXDEPTH 10000
369 #ifndef YYINITSTACKSIZE
370 #define YYINITSTACKSIZE 200
380 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
387 struct YYParseState_s
389 struct YYParseState_s *save; /* Previously saved parser state */
390 YYSTACKDATA yystack; /* saved parser stack */
391 int state; /* saved parser state */
392 int errflag; /* saved error recovery status */
393 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
394 YYINT ctry; /* saved index in yyctable[] for this conflict */
396 typedef struct YYParseState_s YYParseState;
397 #endif /* YYBTYACC */
398 /* variables for the parser stack */
399 static YYSTACKDATA yystack;
402 /* Current parser state */
403 static YYParseState *yyps = 0;
405 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
406 static YYParseState *yypath = 0;
408 /* Base of the lexical value queue */
409 static YYSTYPE *yylvals = 0;
411 /* Current position at lexical value queue */
412 static YYSTYPE *yylvp = 0;
414 /* End position of lexical value queue */
415 static YYSTYPE *yylve = 0;
417 /* The last allocated position at the lexical value queue */
418 static YYSTYPE *yylvlim = 0;
420 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
421 /* Base of the lexical position queue */
422 static YYLTYPE *yylpsns = 0;
424 /* Current position at lexical position queue */
425 static YYLTYPE *yylpp = 0;
427 /* End position of lexical position queue */
428 static YYLTYPE *yylpe = 0;
430 /* The last allocated position at the lexical position queue */
431 static YYLTYPE *yylplim = 0;
434 /* Current position at lexical token queue */
435 static YYINT *yylexp = 0;
437 static YYINT *yylexemes = 0;
438 #endif /* YYBTYACC */
439 #line 80 "err_inherit4.y"
441 extern int YYLEX_DECL();
442 extern void YYERROR_DECL();
443 #line 444 "err_inherit4.tab.c"
445 /* Release memory associated with symbol. */
446 #if ! defined YYDESTRUCT_IS_DECLARED
453 #line 28 "err_inherit4.y"
456 #line 457 "err_inherit4.tab.c"
458 #line 28 "err_inherit4.y"
461 #line 462 "err_inherit4.tab.c"
463 #line 28 "err_inherit4.y"
466 #line 467 "err_inherit4.tab.c"
469 #define YYDESTRUCT_IS_DECLARED 1
472 /* For use in generated program */
473 #define yydepth (int)(yystack.s_mark - yystack.s_base)
475 #define yytrial (yyps->save)
476 #endif /* YYBTYACC */
479 #include <stdio.h> /* needed for printf */
482 #include <stdlib.h> /* needed for malloc, etc */
483 #include <string.h> /* needed for memset */
485 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
486 static int yygrowstack(YYSTACKDATA *data)
492 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
496 if ((newsize = data->stacksize) == 0)
497 newsize = YYINITSTACKSIZE;
498 else if (newsize >= YYMAXDEPTH)
500 else if ((newsize *= 2) > YYMAXDEPTH)
501 newsize = YYMAXDEPTH;
503 i = (int) (data->s_mark - data->s_base);
504 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
508 data->s_base = newss;
509 data->s_mark = newss + i;
511 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
515 data->l_base = newvs;
516 data->l_mark = newvs + i;
518 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
519 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
523 data->p_base = newps;
524 data->p_mark = newps + i;
527 data->stacksize = newsize;
528 data->s_last = data->s_base + newsize - 1;
532 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
537 #if YYPURE || defined(YY_NO_LEAKS)
538 static void yyfreestack(YYSTACKDATA *data)
542 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
545 memset(data, 0, sizeof(*data));
548 #define yyfreestack(data) /* nothing */
549 #endif /* YYPURE || defined(YY_NO_LEAKS) */
552 static YYParseState *
553 yyNewState(unsigned size)
555 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
556 if (p == NULL) return NULL;
558 p->yystack.stacksize = size;
561 p->yystack.s_base = NULL;
562 p->yystack.l_base = NULL;
563 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
564 p->yystack.p_base = NULL;
568 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
569 if (p->yystack.s_base == NULL) return NULL;
570 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
571 if (p->yystack.l_base == NULL) return NULL;
572 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
573 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
574 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
575 if (p->yystack.p_base == NULL) return NULL;
576 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
583 yyFreeState(YYParseState *p)
585 yyfreestack(&p->yystack);
588 #endif /* YYBTYACC */
590 #define YYABORT goto yyabort
591 #define YYREJECT goto yyabort
592 #define YYACCEPT goto yyaccept
593 #define YYERROR goto yyerrlab
595 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
596 #define YYVALID_NESTED do { if (yyps->save && \
597 yyps->save->save == 0) goto yyvalid; } while(0)
598 #endif /* YYBTYACC */
603 int yym, yyn, yystate, yyresult;
606 YYParseState *yyerrctx = NULL;
607 #endif /* YYBTYACC */
608 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
609 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
614 if ((yys = getenv("YYDEBUG")) != 0)
617 if (yyn >= '0' && yyn <= '9')
621 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
623 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
624 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
628 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
630 #endif /* YYBTYACC */
639 memset(&yystack, 0, sizeof(yystack));
642 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
643 yystack.s_mark = yystack.s_base;
644 yystack.l_mark = yystack.l_base;
645 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
646 yystack.p_mark = yystack.p_base;
652 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
659 /* we're currently re-reading tokens */
661 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
669 /* in trial mode; save scanner results for future parse attempts */
670 if (yylvp == yylvlim)
671 { /* Enlarge lexical value queue */
672 size_t p = (size_t) (yylvp - yylvals);
673 size_t s = (size_t) (yylvlim - yylvals);
675 s += YYLVQUEUEGROWTH;
676 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
677 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
678 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
679 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
681 yylvp = yylve = yylvals + p;
682 yylvlim = yylvals + s;
683 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
684 yylpp = yylpe = yylpsns + p;
685 yylplim = yylpsns + s;
687 yylexp = yylexemes + p;
689 *yylexp = (YYINT) YYLEX;
692 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
699 /* normal operation, no conflict encountered */
700 #endif /* YYBTYACC */
704 #endif /* YYBTYACC */
705 if (yychar < 0) yychar = YYEOF;
709 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
710 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
711 YYDEBUGSTR, yydepth, yystate, yychar, yys);
712 #ifdef YYSTYPE_TOSTRING
715 #endif /* YYBTYACC */
716 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
724 /* Do we have a conflict? */
725 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
726 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
735 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
736 YYDEBUGSTR, yydepth, yystate);
738 /* Switch to the next conflict context */
743 if (save->state != yystate) YYABORT;
750 /* Unresolved conflict - start/continue trial parse */
755 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
757 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
759 fputs("Starting trial parse.\n", stderr);
762 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
763 if (save == NULL) goto yyenomem;
764 save->save = yyps->save;
765 save->state = yystate;
766 save->errflag = yyerrflag;
767 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
768 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
769 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
770 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
771 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
772 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
773 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
776 if (yyctable[ctry] == -1)
779 if (yydebug && yychar >= YYEOF)
780 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
785 if (yyps->save == NULL)
787 /* If this is a first conflict in the stack, start saving lexemes */
790 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
791 if (yylexemes == NULL) goto yyenomem;
792 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
793 if (yylvals == NULL) goto yyenomem;
794 yylvlim = yylvals + YYLVQUEUEGROWTH;
795 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
796 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
797 if (yylpsns == NULL) goto yyenomem;
798 yylplim = yylpsns + YYLVQUEUEGROWTH;
803 yylvp = yylve = yylvals;
804 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
805 yylpp = yylpe = yylpsns;
811 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
814 *yylexp = (YYINT) yychar;
822 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
828 save->lexeme = (int) (yylvp - yylvals);
831 if (yytable[yyn] == ctry)
835 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
836 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
841 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
846 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
848 yystate = yyctable[ctry];
849 *++yystack.s_mark = (YYINT) yystate;
850 *++yystack.l_mark = yylval;
851 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
852 *++yystack.p_mark = yylloc;
855 if (yyerrflag > 0) --yyerrflag;
860 yyn = yyctable[ctry];
863 } /* End of code dealing with conflicts */
864 #endif /* YYBTYACC */
865 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
866 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
870 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
871 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
873 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
874 yystate = yytable[yyn];
875 *++yystack.s_mark = yytable[yyn];
876 *++yystack.l_mark = yylval;
877 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
878 *++yystack.p_mark = yylloc;
881 if (yyerrflag > 0) --yyerrflag;
884 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
885 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
890 if (yyerrflag != 0) goto yyinrecovery;
895 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
898 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
899 * before looking for error recovery */
900 yystack.s_mark -= yym;
901 yystate = *yystack.s_mark;
902 yystack.l_mark -= yym;
903 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
904 yystack.p_mark -= yym;
912 YYParseState *save = yyps->save;
915 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
916 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
917 (int)(yylvp - yylvals - yyps->save->lexeme));
919 /* Memorize most forward-looking error state in case it's really an error. */
920 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
922 /* Free old saved error context state */
923 if (yyerrctx) yyFreeState(yyerrctx);
924 /* Create and fill out new saved error context state */
925 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
926 if (yyerrctx == NULL) goto yyenomem;
927 yyerrctx->save = yyps->save;
928 yyerrctx->state = yystate;
929 yyerrctx->errflag = yyerrflag;
930 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
931 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
932 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
933 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
934 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
935 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
936 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
938 yyerrctx->lexeme = (int) (yylvp - yylvals);
940 yylvp = yylvals + save->lexeme;
941 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
942 yylpp = yylpsns + save->lexeme;
944 yylexp = yylexemes + save->lexeme;
946 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
947 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
948 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
949 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
950 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
951 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
952 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
955 yystate = save->state;
956 /* We tried shift, try reduce now */
957 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
958 yyps->save = save->save;
962 /* Nothing left on the stack -- error */
967 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
970 /* Restore state as it was in the most forward-advanced error */
971 yylvp = yylvals + yyerrctx->lexeme;
972 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
973 yylpp = yylpsns + yyerrctx->lexeme;
975 yylexp = yylexemes + yyerrctx->lexeme;
978 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
981 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
982 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
983 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
984 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
985 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
986 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
987 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
989 yystate = yyerrctx->state;
990 yyFreeState(yyerrctx);
995 if (yynewerrflag == 0) goto yyinrecovery;
996 #endif /* YYBTYACC */
998 YYERROR_CALL("syntax error");
999 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1000 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
1004 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1015 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1016 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1020 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1021 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1023 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1024 yystate = yytable[yyn];
1025 *++yystack.s_mark = yytable[yyn];
1026 *++yystack.l_mark = yylval;
1027 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1028 /* lookahead position is error end position */
1029 yyerror_loc_range[2] = yylloc;
1030 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1031 *++yystack.p_mark = yyloc;
1039 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1040 YYDEBUGSTR, yydepth, *yystack.s_mark);
1042 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1043 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1044 /* the current TOS position is the error start position */
1045 yyerror_loc_range[1] = *yystack.p_mark;
1047 #if defined(YYDESTRUCT_CALL)
1050 #endif /* YYBTYACC */
1051 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1052 YYDESTRUCT_CALL("error: discarding state",
1053 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1055 YYDESTRUCT_CALL("error: discarding state",
1056 yystos[*yystack.s_mark], yystack.l_mark);
1057 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1058 #endif /* defined(YYDESTRUCT_CALL) */
1061 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1069 if (yychar == YYEOF) goto yyabort;
1073 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1074 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1075 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1078 #if defined(YYDESTRUCT_CALL)
1081 #endif /* YYBTYACC */
1082 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1083 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1085 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1086 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1087 #endif /* defined(YYDESTRUCT_CALL) */
1097 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1098 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1099 #ifdef YYSTYPE_TOSTRING
1102 #endif /* YYBTYACC */
1107 for (i = yym; i > 0; i--)
1109 if (i != yym) fputs(", ", stderr);
1110 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1111 yystack.l_mark[1-i]), stderr);
1116 fputc('\n', stderr);
1120 yyval = yystack.l_mark[1-yym];
1122 memset(&yyval, 0, sizeof yyval);
1123 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1125 /* Perform position reduction */
1126 memset(&yyloc, 0, sizeof(yyloc));
1129 #endif /* YYBTYACC */
1131 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
1132 /* just in case YYERROR is invoked within the action, save
1133 the start of the rhs as the error start position */
1134 yyerror_loc_range[1] = yystack.p_mark[1-yym];
1141 #line 52 "err_inherit4.y"
1142 yyval.cval = yystack.l_mark[-1].cval;
1145 #line 52 "err_inherit4.y"
1146 yyval.tval = yystack.l_mark[-1].tval;
1149 #line 53 "err_inherit4.y"
1150 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[0]; }
1153 #line 55 "err_inherit4.y"
1154 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[-3]; }
1157 #line 58 "err_inherit4.y"
1158 { yyval.cval = cGLOBAL; }
1161 #line 59 "err_inherit4.y"
1162 { yyval.cval = cLOCAL; }
1165 #line 62 "err_inherit4.y"
1166 { yyval.tval = tREAL; }
1169 #line 63 "err_inherit4.y"
1170 { yyval.tval = tINTEGER; }
1173 #line 67 "err_inherit4.y"
1174 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-3].cval, yystack.l_mark[0].id);
1175 yyval.nlist->next = yystack.l_mark[-1].nlist;
1179 #line 71 "err_inherit4.y"
1180 { yyval.nlist->s = mksymbol(yystack.l_mark[-1].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
1181 yyval.nlist->next = NULL;
1185 #line 77 "err_inherit4.y"
1186 { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[1]; }
1188 #line 1189 "err_inherit4.tab.c"
1192 yystack.s_mark -= yym;
1193 yystate = *yystack.s_mark;
1194 yystack.l_mark -= yym;
1195 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1196 yystack.p_mark -= yym;
1199 if (yystate == 0 && yym == 0)
1204 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1205 #ifdef YYSTYPE_TOSTRING
1208 #endif /* YYBTYACC */
1209 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1211 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1215 *++yystack.s_mark = YYFINAL;
1216 *++yystack.l_mark = yyval;
1217 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1218 *++yystack.p_mark = yyloc;
1226 /* we're currently re-reading tokens */
1228 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1236 /* in trial mode; save scanner results for future parse attempts */
1237 if (yylvp == yylvlim)
1238 { /* Enlarge lexical value queue */
1239 size_t p = (size_t) (yylvp - yylvals);
1240 size_t s = (size_t) (yylvlim - yylvals);
1242 s += YYLVQUEUEGROWTH;
1243 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1245 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1247 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1248 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1251 yylvp = yylve = yylvals + p;
1252 yylvlim = yylvals + s;
1253 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1254 yylpp = yylpe = yylpsns + p;
1255 yylplim = yylpsns + s;
1257 yylexp = yylexemes + p;
1259 *yylexp = (YYINT) YYLEX;
1262 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1269 /* normal operation, no conflict encountered */
1270 #endif /* YYBTYACC */
1274 #endif /* YYBTYACC */
1275 if (yychar < 0) yychar = YYEOF;
1279 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1280 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1281 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1285 if (yychar == YYEOF) goto yyaccept;
1288 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1289 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1290 yystate = yytable[yyn];
1292 yystate = yydgoto[yym];
1296 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1297 #ifdef YYSTYPE_TOSTRING
1300 #endif /* YYBTYACC */
1301 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1303 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1306 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1307 *++yystack.s_mark = (YYINT) yystate;
1308 *++yystack.l_mark = yyval;
1309 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1310 *++yystack.p_mark = yyloc;
1315 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1317 if (yypath) YYABORT;
1320 YYParseState *save = yyps->save;
1321 yyps->save = save->save;
1322 save->save = yypath;
1327 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1328 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1332 yyFreeState(yyerrctx);
1335 yylvp = yylvals + yypath->lexeme;
1336 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1337 yylpp = yylpsns + yypath->lexeme;
1339 yylexp = yylexemes + yypath->lexeme;
1341 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1342 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1343 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1344 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1345 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1346 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1347 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1349 yystate = yypath->state;
1351 #endif /* YYBTYACC */
1354 YYERROR_CALL("yacc stack overflow");
1358 YYERROR_CALL("memory exhausted");
1360 #endif /* YYBTYACC */
1370 if (yyps->save) goto yyvalid;
1371 #endif /* YYBTYACC */
1375 #if defined(YYDESTRUCT_CALL)
1376 if (yychar != YYEOF && yychar != YYEMPTY)
1377 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1378 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1380 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1381 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1385 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1388 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1389 YYDESTRUCT_CALL("cleanup: discarding state",
1390 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1392 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1393 YYDESTRUCT_CALL("cleanup: discarding state",
1394 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1395 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1397 #endif /* defined(YYDESTRUCT_CALL) */
1402 yyFreeState(yyerrctx);
1407 YYParseState *save = yyps;
1414 YYParseState *save = yypath;
1415 yypath = save->save;
1419 #endif /* YYBTYACC */
1420 yyfreestack(&yystack);