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_inherit3_parse
25 #define yylex err_inherit3_lex
29 #define yyerror err_inherit3_error
33 #define yychar err_inherit3_char
37 #define yyval err_inherit3_val
41 #define yylval err_inherit3_lval
45 #define yydebug err_inherit3_debug
49 #define yynerrs err_inherit3_nerrs
53 #define yyerrflag err_inherit3_errflag
54 #endif /* yyerrflag */
57 #define yylhs err_inherit3_lhs
61 #define yylen err_inherit3_len
65 #define yydefred err_inherit3_defred
69 #define yystos err_inherit3_stos
73 #define yydgoto err_inherit3_dgoto
77 #define yysindex err_inherit3_sindex
81 #define yyrindex err_inherit3_rindex
85 #define yygindex err_inherit3_gindex
89 #define yytable err_inherit3_table
93 #define yycheck err_inherit3_check
97 #define yyname err_inherit3_name
101 #define yyrule err_inherit3_rule
107 #define yycindex err_inherit3_cindex
108 #endif /* yycindex */
111 #define yyctable err_inherit3_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "err_inherit3_"
120 #line 2 "err_inherit3.y"
123 typedef enum {cGLOBAL, cLOCAL} class;
124 typedef enum {tREAL, tINTEGER} type;
127 struct symbol { class c; type t; name id; };
128 typedef struct symbol symbol;
130 struct namelist { symbol *s; struct namelist *next; };
131 typedef struct namelist namelist;
133 extern symbol *mksymbol(type t, class c, name id);
136 #define YYLEX_DECL() yylex(void)
137 #define YYERROR_DECL() yyerror(const char *s)
140 #undef YYSTYPE_IS_DECLARED
141 #define YYSTYPE_IS_DECLARED 1
143 #ifndef YYSTYPE_IS_DECLARED
144 #define YYSTYPE_IS_DECLARED 1
145 #line 39 "err_inherit3.y"
153 #endif /* !YYSTYPE_IS_DECLARED */
154 #line 155 "err_inherit3.tab.c"
156 /* compatibility with bison */
158 /* compatibility with FreeBSD */
159 # ifdef YYPARSE_PARAM_TYPE
160 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
162 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
165 # define YYPARSE_DECL() yyparse(void)
168 /* Parameters sent to lex. */
170 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
171 # define YYLEX yylex(YYLEX_PARAM)
173 # define YYLEX_DECL() yylex(void)
174 # define YYLEX yylex()
177 /* Parameters sent to yyerror. */
179 #define YYERROR_DECL() yyerror(const char *s)
182 #define YYERROR_CALL(msg) yyerror(msg)
185 #ifndef YYDESTRUCT_DECL
186 #define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val)
188 #ifndef YYDESTRUCT_CALL
189 #define YYDESTRUCT_CALL(msg, psymb, val) yydestruct(msg, psymb, val)
192 extern int YYPARSE_DECL();
199 #define YYERRCODE 256
201 static const YYINT err_inherit3_lhs[] = { -1,
202 5, 6, 0, 0, 3, 3, 4, 4, 7, 1,
205 static const YYINT err_inherit3_len[] = { 2,
206 0, 0, 5, 2, 1, 1, 1, 1, 0, 3,
209 static const YYINT err_inherit3_defred[] = { 0,
210 5, 6, 7, 8, 0, 0, 12, 1, 4, 2,
211 2, 0, 0, 11, 13, 0, 3, 0, 10,
213 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
214 static const YYINT err_inherit3_stos[] = { 0,
215 257, 258, 259, 260, 263, 266, 267, 267, 265, 271,
216 268, 269, 269, 261, 264, 270, 264, 264, 261,
218 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
219 static const YYINT err_inherit3_dgoto[] = { 5,
220 15, 9, 6, 7, 11, 12, 16, 10,
222 static const YYINT err_inherit3_sindex[] = { -257,
223 0, 0, 0, 0, 0, -254, 0, 0, 0, 0,
224 0, -253, -253, 0, 0, -253, 0, -252, 0,
226 static const YYINT err_inherit3_rindex[] = { 0,
227 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
228 0, 0, 0, 0, 0, 0, 0, 0, 0,
231 static const YYINT err_inherit3_cindex[] = { 0,
232 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
233 0, 0, 0, 0, 0, 0, 0, 0, 0,
236 static const YYINT err_inherit3_gindex[] = { 0,
237 -9, 0, 0, 4, 0, 1, 0, 0,
239 #define YYTABLESIZE 12
240 static const YYINT err_inherit3_table[] = { 1,
241 2, 3, 4, 17, 3, 4, 18, 14, 19, 8,
244 static const YYINT err_inherit3_check[] = { 257,
245 258, 259, 260, 13, 259, 260, 16, 261, 261, 6,
249 static const YYINT err_inherit3_ctable[] = { -1,
250 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
258 #define YYMAXTOKEN 261
259 #define YYUNDFTOKEN 272
260 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
262 static const char *const err_inherit3_name[] = {
264 "$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,
265 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
266 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
267 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
268 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
269 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
270 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
271 "NAME","$accept","declaration","namelist","locnamelist","class","type","$$1",
272 "$$2","$$3","$$4","illegal-symbol",
274 static const char *const err_inherit3_rule[] = {
275 "$accept : declaration",
278 "declaration : class type $$1 $$2 namelist",
279 "declaration : type locnamelist",
285 "namelist : $$3 namelist NAME",
288 "locnamelist : $$4 $$2 namelist",
303 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
304 YYLTYPE yyloc; /* position returned by actions */
305 YYLTYPE yylloc; /* position from the lexer */
308 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
309 #ifndef YYLLOC_DEFAULT
310 #define YYLLOC_DEFAULT(loc, rhs, n) \
315 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
316 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
317 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
318 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
322 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
323 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
324 (loc).last_line = YYRHSLOC(rhs, n).last_line; \
325 (loc).last_column = YYRHSLOC(rhs, n).last_column; \
328 #endif /* YYLLOC_DEFAULT */
329 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
332 #ifndef YYLVQUEUEGROWTH
333 #define YYLVQUEUEGROWTH 32
335 #endif /* YYBTYACC */
337 /* define the initial stack-sizes */
340 #define YYMAXDEPTH YYSTACKSIZE
343 #define YYSTACKSIZE YYMAXDEPTH
345 #define YYSTACKSIZE 10000
346 #define YYMAXDEPTH 10000
350 #ifndef YYINITSTACKSIZE
351 #define YYINITSTACKSIZE 200
361 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
368 struct YYParseState_s
370 struct YYParseState_s *save; /* Previously saved parser state */
371 YYSTACKDATA yystack; /* saved parser stack */
372 int state; /* saved parser state */
373 int errflag; /* saved error recovery status */
374 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
375 YYINT ctry; /* saved index in yyctable[] for this conflict */
377 typedef struct YYParseState_s YYParseState;
378 #endif /* YYBTYACC */
379 /* variables for the parser stack */
380 static YYSTACKDATA yystack;
383 /* Current parser state */
384 static YYParseState *yyps = 0;
386 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
387 static YYParseState *yypath = 0;
389 /* Base of the lexical value queue */
390 static YYSTYPE *yylvals = 0;
392 /* Current position at lexical value queue */
393 static YYSTYPE *yylvp = 0;
395 /* End position of lexical value queue */
396 static YYSTYPE *yylve = 0;
398 /* The last allocated position at the lexical value queue */
399 static YYSTYPE *yylvlim = 0;
401 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
402 /* Base of the lexical position queue */
403 static YYLTYPE *yylpsns = 0;
405 /* Current position at lexical position queue */
406 static YYLTYPE *yylpp = 0;
408 /* End position of lexical position queue */
409 static YYLTYPE *yylpe = 0;
411 /* The last allocated position at the lexical position queue */
412 static YYLTYPE *yylplim = 0;
415 /* Current position at lexical token queue */
416 static YYINT *yylexp = 0;
418 static YYINT *yylexemes = 0;
419 #endif /* YYBTYACC */
420 #line 78 "err_inherit3.y"
422 extern int YYLEX_DECL();
423 extern void YYERROR_DECL();
424 #line 425 "err_inherit3.tab.c"
426 /* Release memory associated with symbol. */
427 #if ! defined YYDESTRUCT_IS_DECLARED
434 #line 30 "err_inherit3.y"
436 namelist *p = (*val).nlist;
440 free(pp->s); free(pp);
444 #line 445 "err_inherit3.tab.c"
446 #line 30 "err_inherit3.y"
448 namelist *p = (*val).nlist;
452 free(pp->s); free(pp);
456 #line 457 "err_inherit3.tab.c"
458 #line 30 "err_inherit3.y"
460 namelist *p = (*val).nlist;
464 free(pp->s); free(pp);
468 #line 469 "err_inherit3.tab.c"
471 #define YYDESTRUCT_IS_DECLARED 1
474 /* For use in generated program */
475 #define yydepth (int)(yystack.s_mark - yystack.s_base)
477 #define yytrial (yyps->save)
478 #endif /* YYBTYACC */
481 #include <stdio.h> /* needed for printf */
484 #include <stdlib.h> /* needed for malloc, etc */
485 #include <string.h> /* needed for memset */
487 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
488 static int yygrowstack(YYSTACKDATA *data)
494 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
498 if ((newsize = data->stacksize) == 0)
499 newsize = YYINITSTACKSIZE;
500 else if (newsize >= YYMAXDEPTH)
502 else if ((newsize *= 2) > YYMAXDEPTH)
503 newsize = YYMAXDEPTH;
505 i = (int) (data->s_mark - data->s_base);
506 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
510 data->s_base = newss;
511 data->s_mark = newss + i;
513 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
517 data->l_base = newvs;
518 data->l_mark = newvs + i;
520 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
521 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
525 data->p_base = newps;
526 data->p_mark = newps + i;
529 data->stacksize = newsize;
530 data->s_last = data->s_base + newsize - 1;
534 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
539 #if YYPURE || defined(YY_NO_LEAKS)
540 static void yyfreestack(YYSTACKDATA *data)
544 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
547 memset(data, 0, sizeof(*data));
550 #define yyfreestack(data) /* nothing */
551 #endif /* YYPURE || defined(YY_NO_LEAKS) */
554 static YYParseState *
555 yyNewState(unsigned size)
557 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
558 if (p == NULL) return NULL;
560 p->yystack.stacksize = size;
563 p->yystack.s_base = NULL;
564 p->yystack.l_base = NULL;
565 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
566 p->yystack.p_base = NULL;
570 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
571 if (p->yystack.s_base == NULL) return NULL;
572 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
573 if (p->yystack.l_base == NULL) return NULL;
574 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
575 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
576 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
577 if (p->yystack.p_base == NULL) return NULL;
578 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
585 yyFreeState(YYParseState *p)
587 yyfreestack(&p->yystack);
590 #endif /* YYBTYACC */
592 #define YYABORT goto yyabort
593 #define YYREJECT goto yyabort
594 #define YYACCEPT goto yyaccept
595 #define YYERROR goto yyerrlab
597 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
598 #define YYVALID_NESTED do { if (yyps->save && \
599 yyps->save->save == 0) goto yyvalid; } while(0)
600 #endif /* YYBTYACC */
605 int yym, yyn, yystate, yyresult;
608 YYParseState *yyerrctx = NULL;
609 #endif /* YYBTYACC */
610 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
611 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
616 if ((yys = getenv("YYDEBUG")) != 0)
619 if (yyn >= '0' && yyn <= '9')
623 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
625 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
626 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
630 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
632 #endif /* YYBTYACC */
641 memset(&yystack, 0, sizeof(yystack));
644 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
645 yystack.s_mark = yystack.s_base;
646 yystack.l_mark = yystack.l_base;
647 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
648 yystack.p_mark = yystack.p_base;
654 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
661 /* we're currently re-reading tokens */
663 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
671 /* in trial mode; save scanner results for future parse attempts */
672 if (yylvp == yylvlim)
673 { /* Enlarge lexical value queue */
674 size_t p = (size_t) (yylvp - yylvals);
675 size_t s = (size_t) (yylvlim - yylvals);
677 s += YYLVQUEUEGROWTH;
678 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
679 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
680 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
681 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
683 yylvp = yylve = yylvals + p;
684 yylvlim = yylvals + s;
685 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
686 yylpp = yylpe = yylpsns + p;
687 yylplim = yylpsns + s;
689 yylexp = yylexemes + p;
691 *yylexp = (YYINT) YYLEX;
694 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
701 /* normal operation, no conflict encountered */
702 #endif /* YYBTYACC */
706 #endif /* YYBTYACC */
707 if (yychar < 0) yychar = YYEOF;
711 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
712 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
713 YYDEBUGSTR, yydepth, yystate, yychar, yys);
714 #ifdef YYSTYPE_TOSTRING
717 #endif /* YYBTYACC */
718 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
726 /* Do we have a conflict? */
727 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
728 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
737 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
738 YYDEBUGSTR, yydepth, yystate);
740 /* Switch to the next conflict context */
745 if (save->state != yystate) YYABORT;
752 /* Unresolved conflict - start/continue trial parse */
757 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
759 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
761 fputs("Starting trial parse.\n", stderr);
764 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
765 if (save == NULL) goto yyenomem;
766 save->save = yyps->save;
767 save->state = yystate;
768 save->errflag = yyerrflag;
769 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
770 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
771 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
772 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
773 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
774 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
775 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
778 if (yyctable[ctry] == -1)
781 if (yydebug && yychar >= YYEOF)
782 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
787 if (yyps->save == NULL)
789 /* If this is a first conflict in the stack, start saving lexemes */
792 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
793 if (yylexemes == NULL) goto yyenomem;
794 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
795 if (yylvals == NULL) goto yyenomem;
796 yylvlim = yylvals + YYLVQUEUEGROWTH;
797 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
798 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
799 if (yylpsns == NULL) goto yyenomem;
800 yylplim = yylpsns + YYLVQUEUEGROWTH;
805 yylvp = yylve = yylvals;
806 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
807 yylpp = yylpe = yylpsns;
813 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
816 *yylexp = (YYINT) yychar;
824 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
830 save->lexeme = (int) (yylvp - yylvals);
833 if (yytable[yyn] == ctry)
837 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
838 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
843 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
848 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
850 yystate = yyctable[ctry];
851 *++yystack.s_mark = (YYINT) yystate;
852 *++yystack.l_mark = yylval;
853 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
854 *++yystack.p_mark = yylloc;
857 if (yyerrflag > 0) --yyerrflag;
862 yyn = yyctable[ctry];
865 } /* End of code dealing with conflicts */
866 #endif /* YYBTYACC */
867 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
868 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
872 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
873 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
875 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
876 yystate = yytable[yyn];
877 *++yystack.s_mark = yytable[yyn];
878 *++yystack.l_mark = yylval;
879 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
880 *++yystack.p_mark = yylloc;
883 if (yyerrflag > 0) --yyerrflag;
886 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
887 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
892 if (yyerrflag != 0) goto yyinrecovery;
897 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
900 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
901 * before looking for error recovery */
902 yystack.s_mark -= yym;
903 yystate = *yystack.s_mark;
904 yystack.l_mark -= yym;
905 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
906 yystack.p_mark -= yym;
914 YYParseState *save = yyps->save;
917 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
918 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
919 (int)(yylvp - yylvals - yyps->save->lexeme));
921 /* Memorize most forward-looking error state in case it's really an error. */
922 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
924 /* Free old saved error context state */
925 if (yyerrctx) yyFreeState(yyerrctx);
926 /* Create and fill out new saved error context state */
927 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
928 if (yyerrctx == NULL) goto yyenomem;
929 yyerrctx->save = yyps->save;
930 yyerrctx->state = yystate;
931 yyerrctx->errflag = yyerrflag;
932 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
933 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
934 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
935 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
936 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
937 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
938 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
940 yyerrctx->lexeme = (int) (yylvp - yylvals);
942 yylvp = yylvals + save->lexeme;
943 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
944 yylpp = yylpsns + save->lexeme;
946 yylexp = yylexemes + save->lexeme;
948 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
949 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
950 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
951 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
952 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
953 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
954 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
957 yystate = save->state;
958 /* We tried shift, try reduce now */
959 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
960 yyps->save = save->save;
964 /* Nothing left on the stack -- error */
969 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
972 /* Restore state as it was in the most forward-advanced error */
973 yylvp = yylvals + yyerrctx->lexeme;
974 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
975 yylpp = yylpsns + yyerrctx->lexeme;
977 yylexp = yylexemes + yyerrctx->lexeme;
980 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
983 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
984 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
985 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
986 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
987 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
988 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
989 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
991 yystate = yyerrctx->state;
992 yyFreeState(yyerrctx);
997 if (yynewerrflag == 0) goto yyinrecovery;
998 #endif /* YYBTYACC */
1000 YYERROR_CALL("syntax error");
1001 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1002 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
1006 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1017 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1018 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1022 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1023 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1025 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1026 yystate = yytable[yyn];
1027 *++yystack.s_mark = yytable[yyn];
1028 *++yystack.l_mark = yylval;
1029 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1030 /* lookahead position is error end position */
1031 yyerror_loc_range[2] = yylloc;
1032 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1033 *++yystack.p_mark = yyloc;
1041 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1042 YYDEBUGSTR, yydepth, *yystack.s_mark);
1044 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1045 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1046 /* the current TOS position is the error start position */
1047 yyerror_loc_range[1] = *yystack.p_mark;
1049 #if defined(YYDESTRUCT_CALL)
1052 #endif /* YYBTYACC */
1053 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1054 YYDESTRUCT_CALL("error: discarding state",
1055 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1057 YYDESTRUCT_CALL("error: discarding state",
1058 yystos[*yystack.s_mark], yystack.l_mark);
1059 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1060 #endif /* defined(YYDESTRUCT_CALL) */
1063 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1071 if (yychar == YYEOF) goto yyabort;
1075 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1076 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1077 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1080 #if defined(YYDESTRUCT_CALL)
1083 #endif /* YYBTYACC */
1084 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1085 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1087 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1088 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1089 #endif /* defined(YYDESTRUCT_CALL) */
1099 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1100 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1101 #ifdef YYSTYPE_TOSTRING
1104 #endif /* YYBTYACC */
1109 for (i = yym; i > 0; i--)
1111 if (i != yym) fputs(", ", stderr);
1112 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1113 yystack.l_mark[1-i]), stderr);
1118 fputc('\n', stderr);
1122 yyval = yystack.l_mark[1-yym];
1124 memset(&yyval, 0, sizeof yyval);
1125 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1127 /* Perform position reduction */
1128 memset(&yyloc, 0, sizeof(yyloc));
1131 #endif /* YYBTYACC */
1133 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
1134 /* just in case YYERROR is invoked within the action, save
1135 the start of the rhs as the error start position */
1136 yyerror_loc_range[1] = yystack.p_mark[1-yym];
1143 #line 50 "err_inherit3.y"
1144 yyval.cval = yystack.l_mark[-1].cval;
1147 #line 50 "err_inherit3.y"
1148 yyval.tval = yystack.l_mark[-1].tval;
1151 #line 51 "err_inherit3.y"
1152 { yyval.nlist = yystack.l_mark[0].nlist; }
1155 #line 53 "err_inherit3.y"
1156 { yyval.nlist = yystack.l_mark[0].nlist; }
1159 #line 56 "err_inherit3.y"
1160 { yyval.cval = cGLOBAL; }
1163 #line 57 "err_inherit3.y"
1164 { yyval.cval = cLOCAL; }
1167 #line 60 "err_inherit3.y"
1168 { yyval.tval = tREAL; }
1171 #line 61 "err_inherit3.y"
1172 { yyval.tval = tINTEGER; }
1175 #line 64 "err_inherit3.y"
1176 yyval.cval = yystack.l_mark[-2];
1179 #line 65 "err_inherit3.y"
1180 { yyval.nlist->s = mksymbol(yystack.l_mark[-5].tval, yystack.l_mark[-5].cval, yystack.l_mark[0].id);
1181 yyval.nlist->next = yystack.l_mark[-1].nlist;
1185 #line 69 "err_inherit3.y"
1186 { yyval.nlist->s = mksymbol(yystack.l_mark[-3], yystack.l_mark[-3], yystack.l_mark[0].id);
1187 yyval.nlist->next = NULL;
1191 #line 74 "err_inherit3.y"
1192 yyval.cval = cLOCAL;
1195 #line 75 "err_inherit3.y"
1196 { yyval.nlist = yystack.l_mark[0].nlist; }
1198 #line 1199 "err_inherit3.tab.c"
1202 yystack.s_mark -= yym;
1203 yystate = *yystack.s_mark;
1204 yystack.l_mark -= yym;
1205 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1206 yystack.p_mark -= yym;
1209 if (yystate == 0 && yym == 0)
1214 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1215 #ifdef YYSTYPE_TOSTRING
1218 #endif /* YYBTYACC */
1219 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1221 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1225 *++yystack.s_mark = YYFINAL;
1226 *++yystack.l_mark = yyval;
1227 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1228 *++yystack.p_mark = yyloc;
1236 /* we're currently re-reading tokens */
1238 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1246 /* in trial mode; save scanner results for future parse attempts */
1247 if (yylvp == yylvlim)
1248 { /* Enlarge lexical value queue */
1249 size_t p = (size_t) (yylvp - yylvals);
1250 size_t s = (size_t) (yylvlim - yylvals);
1252 s += YYLVQUEUEGROWTH;
1253 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1255 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1257 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1258 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1261 yylvp = yylve = yylvals + p;
1262 yylvlim = yylvals + s;
1263 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1264 yylpp = yylpe = yylpsns + p;
1265 yylplim = yylpsns + s;
1267 yylexp = yylexemes + p;
1269 *yylexp = (YYINT) YYLEX;
1272 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1279 /* normal operation, no conflict encountered */
1280 #endif /* YYBTYACC */
1284 #endif /* YYBTYACC */
1285 if (yychar < 0) yychar = YYEOF;
1289 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1290 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1291 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1295 if (yychar == YYEOF) goto yyaccept;
1298 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1299 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1300 yystate = yytable[yyn];
1302 yystate = yydgoto[yym];
1306 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1307 #ifdef YYSTYPE_TOSTRING
1310 #endif /* YYBTYACC */
1311 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1313 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1316 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1317 *++yystack.s_mark = (YYINT) yystate;
1318 *++yystack.l_mark = yyval;
1319 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1320 *++yystack.p_mark = yyloc;
1325 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1327 if (yypath) YYABORT;
1330 YYParseState *save = yyps->save;
1331 yyps->save = save->save;
1332 save->save = yypath;
1337 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1338 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1342 yyFreeState(yyerrctx);
1345 yylvp = yylvals + yypath->lexeme;
1346 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1347 yylpp = yylpsns + yypath->lexeme;
1349 yylexp = yylexemes + yypath->lexeme;
1351 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1352 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1353 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1354 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1355 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1356 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1357 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1359 yystate = yypath->state;
1361 #endif /* YYBTYACC */
1364 YYERROR_CALL("yacc stack overflow");
1368 YYERROR_CALL("memory exhausted");
1370 #endif /* YYBTYACC */
1380 if (yyps->save) goto yyvalid;
1381 #endif /* YYBTYACC */
1385 #if defined(YYDESTRUCT_CALL)
1386 if (yychar != YYEOF && yychar != YYEMPTY)
1387 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1388 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1390 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1391 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1395 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1398 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1399 YYDESTRUCT_CALL("cleanup: discarding state",
1400 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1402 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1403 YYDESTRUCT_CALL("cleanup: discarding state",
1404 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1405 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1407 #endif /* defined(YYDESTRUCT_CALL) */
1412 yyFreeState(yyerrctx);
1417 YYParseState *save = yyps;
1424 YYParseState *save = yypath;
1425 yypath = save->save;
1429 #endif /* YYBTYACC */
1430 yyfreestack(&yystack);