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 (yytrial ? YYPREFIX "debug(trial)" : YYPREFIX "debug")
21 #define yyparse destroy3_parse
25 #define yylex destroy3_lex
29 #define yyerror destroy3_error
33 #define yychar destroy3_char
37 #define yyval destroy3_val
41 #define yylval destroy3_lval
45 #define yydebug destroy3_debug
49 #define yynerrs destroy3_nerrs
53 #define yyerrflag destroy3_errflag
54 #endif /* yyerrflag */
57 #define yylhs destroy3_lhs
61 #define yylen destroy3_len
65 #define yydefred destroy3_defred
69 #define yystos destroy3_stos
73 #define yydgoto destroy3_dgoto
77 #define yysindex destroy3_sindex
81 #define yyrindex destroy3_rindex
85 #define yygindex destroy3_gindex
89 #define yytable destroy3_table
93 #define yycheck destroy3_check
97 #define yyname destroy3_name
101 #define yyrule destroy3_rule
107 #define yycindex destroy3_cindex
108 #endif /* yycindex */
111 #define yyctable destroy3_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "destroy3_"
120 #line 7 "btyacc_destroy3.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 struct parser_param {
138 extern symbol *mksymbol(type t, class c, name id);
141 #define YYLEX_DECL() yylex(void)
142 #define YYERROR_DECL() yyerror(const char *s)
145 #undef YYSTYPE_IS_DECLARED
146 #define YYSTYPE_IS_DECLARED 1
148 #ifndef YYSTYPE_IS_DECLARED
149 #define YYSTYPE_IS_DECLARED 1
150 #line 53 "btyacc_destroy3.y"
158 #endif /* !YYSTYPE_IS_DECLARED */
159 #line 160 "btyacc_destroy3.tab.c"
161 /* compatibility with bison */
163 /* compatibility with FreeBSD */
164 # ifdef YYPARSE_PARAM_TYPE
165 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
167 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
170 # define YYPARSE_DECL() yyparse(struct parser_param *param, int flag)
173 /* Parameters sent to lex. */
175 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
176 # define YYLEX yylex(YYLEX_PARAM)
178 # define YYLEX_DECL() yylex(void)
179 # define YYLEX yylex()
182 /* Parameters sent to yyerror. */
184 #define YYERROR_DECL() yyerror(struct parser_param *param, int flag, const char *s)
187 #define YYERROR_CALL(msg) yyerror(param, flag, msg)
190 #ifndef YYDESTRUCT_DECL
191 #define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, struct parser_param *param, int flag)
193 #ifndef YYDESTRUCT_CALL
194 #define YYDESTRUCT_CALL(msg, psymb, val) yydestruct(msg, psymb, val, param, flag)
197 extern int YYPARSE_DECL();
204 #define YYERRCODE 256
206 static const YYINT destroy3_lhs[] = { -1,
207 0, 0, 2, 2, 3, 3, 4, 4, 1,
209 static const YYINT destroy3_len[] = { 2,
210 8, 5, 1, 1, 1, 1, 2, 1, 6,
212 static const YYINT destroy3_defred[] = { 0,
213 3, 4, 5, 6, 0, 0, 0, 0, 8, 0,
214 0, 0, 0, 7, 0, 0, 0, 0, 0, 2,
217 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
218 static const YYINT destroy3_stos[] = { 0,
219 257, 258, 259, 260, 263, 265, 266, 266, 261, 264,
220 267, 267, 40, 261, 40, 40, 265, 258, 265, 41,
221 44, 44, 266, 266, 41, 41,
223 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
224 static const YYINT destroy3_dgoto[] = { 5,
227 static const YYINT destroy3_sindex[] = { -254,
228 0, 0, 0, 0, 0, -251, -248, -248, 0, -26,
229 -40, -39, -246, 0, -243, -246, -25, -24, -23, 0,
230 -251, -251, -22, -19, 0, 0,
232 static const YYINT destroy3_rindex[] = { 0,
233 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
234 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
238 static const YYINT destroy3_cindex[] = { 0,
239 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
240 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
244 static const YYINT destroy3_gindex[] = { 0,
247 #define YYTABLESIZE 222
248 static const YYINT destroy3_table[] = { 15,
249 16, 8, 1, 2, 3, 4, 17, 3, 4, 19,
250 1, 2, 9, 13, 18, 20, 23, 24, 25, 21,
251 22, 26, 12, 0, 0, 0, 0, 0, 0, 0,
252 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
255 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
257 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
258 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
260 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
261 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
263 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
264 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
265 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
266 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
267 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
268 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
269 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
273 static const YYINT destroy3_check[] = { 40,
274 40, 6, 257, 258, 259, 260, 13, 259, 260, 16,
275 257, 258, 261, 40, 258, 41, 21, 22, 41, 44,
276 44, 41, 8, -1, -1, -1, -1, -1, -1, -1,
277 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
278 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
279 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
280 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
281 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
282 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
283 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
284 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
285 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
286 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
287 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
288 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
289 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
290 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
291 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
292 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
293 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
294 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
295 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
299 static const YYINT destroy3_ctable[] = { -1,
300 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
301 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
302 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
303 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
304 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
305 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
306 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
307 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
308 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
309 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
310 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
311 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
312 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
313 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
314 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
315 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
316 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
317 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
318 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
319 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
320 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
321 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
329 #define YYMAXTOKEN 261
330 #define YYUNDFTOKEN 268
331 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
333 static const char *const destroy3_name[] = {
335 "$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,
336 0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
337 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
338 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
339 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
340 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
341 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL",
342 "REAL","INTEGER","NAME","$accept","declaration","locnamelist","class","type",
343 "namelist","illegal-symbol",
345 static const char *const destroy3_rule[] = {
346 "$accept : declaration",
347 "declaration : class type namelist '(' class ',' type ')'",
348 "declaration : type locnamelist '(' class ')'",
353 "namelist : namelist NAME",
355 "locnamelist : namelist '(' LOCAL ',' type ')'",
367 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
368 YYLTYPE yyloc; /* position returned by actions */
369 YYLTYPE yylloc; /* position from the lexer */
372 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
373 #ifndef YYLLOC_DEFAULT
374 #define YYLLOC_DEFAULT(loc, rhs, n) \
379 (loc).first_line = ((rhs)[-1]).last_line; \
380 (loc).first_column = ((rhs)[-1]).last_column; \
381 (loc).last_line = ((rhs)[-1]).last_line; \
382 (loc).last_column = ((rhs)[-1]).last_column; \
386 (loc).first_line = ((rhs)[ 0 ]).first_line; \
387 (loc).first_column = ((rhs)[ 0 ]).first_column; \
388 (loc).last_line = ((rhs)[n-1]).last_line; \
389 (loc).last_column = ((rhs)[n-1]).last_column; \
392 #endif /* YYLLOC_DEFAULT */
393 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
396 #ifndef YYLVQUEUEGROWTH
397 #define YYLVQUEUEGROWTH 32
399 #endif /* YYBTYACC */
401 /* define the initial stack-sizes */
404 #define YYMAXDEPTH YYSTACKSIZE
407 #define YYSTACKSIZE YYMAXDEPTH
409 #define YYSTACKSIZE 10000
410 #define YYMAXDEPTH 10000
414 #ifndef YYINITSTACKSIZE
415 #define YYINITSTACKSIZE 200
425 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
432 struct YYParseState_s
434 struct YYParseState_s *save; /* Previously saved parser state */
435 YYSTACKDATA yystack; /* saved parser stack */
436 int state; /* saved parser state */
437 int errflag; /* saved error recovery status */
438 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
439 YYINT ctry; /* saved index in yyctable[] for this conflict */
441 typedef struct YYParseState_s YYParseState;
442 #endif /* YYBTYACC */
443 /* variables for the parser stack */
444 static YYSTACKDATA yystack;
447 /* Current parser state */
448 static YYParseState *yyps = 0;
450 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
451 static YYParseState *yypath = 0;
453 /* Base of the lexical value queue */
454 static YYSTYPE *yylvals = 0;
456 /* Current position at lexical value queue */
457 static YYSTYPE *yylvp = 0;
459 /* End position of lexical value queue */
460 static YYSTYPE *yylve = 0;
462 /* The last allocated position at the lexical value queue */
463 static YYSTYPE *yylvlim = 0;
465 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
466 /* Base of the lexical position queue */
467 static YYLTYPE *yylpsns = 0;
469 /* Current position at lexical position queue */
470 static YYLTYPE *yylpp = 0;
472 /* End position of lexical position queue */
473 static YYLTYPE *yylpe = 0;
475 /* The last allocated position at the lexical position queue */
476 static YYLTYPE *yylplim = 0;
479 /* Current position at lexical token queue */
480 static YYINT *yylexp = 0;
482 static YYINT *yylexemes = 0;
483 #endif /* YYBTYACC */
484 #line 92 "btyacc_destroy3.y"
486 extern int YYLEX_DECL();
487 extern void YYERROR_DECL();
488 #line 489 "btyacc_destroy3.tab.c"
490 /* Release memory associated with symbol. */
491 #if ! defined YYDESTRUCT_IS_DECLARED
498 #line 44 "btyacc_destroy3.y"
500 namelist *p = (*val).nlist;
504 free(pp->s); free(pp);
508 #line 509 "btyacc_destroy3.tab.c"
511 #define YYDESTRUCT_IS_DECLARED 1
514 /* For use in generated program */
515 #define yydepth (int)(yystack.s_mark - yystack.s_base)
517 #define yytrial (yyps->save)
518 #endif /* YYBTYACC */
521 #include <stdio.h> /* needed for printf */
524 #include <stdlib.h> /* needed for malloc, etc */
525 #include <string.h> /* needed for memset */
527 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
528 static int yygrowstack(YYSTACKDATA *data)
534 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
538 if ((newsize = data->stacksize) == 0)
539 newsize = YYINITSTACKSIZE;
540 else if (newsize >= YYMAXDEPTH)
542 else if ((newsize *= 2) > YYMAXDEPTH)
543 newsize = YYMAXDEPTH;
545 i = (int) (data->s_mark - data->s_base);
546 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
550 data->s_base = newss;
551 data->s_mark = newss + i;
553 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
557 data->l_base = newvs;
558 data->l_mark = newvs + i;
560 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
561 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
565 data->p_base = newps;
566 data->p_mark = newps + i;
569 data->stacksize = newsize;
570 data->s_last = data->s_base + newsize - 1;
574 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
579 #if YYPURE || defined(YY_NO_LEAKS)
580 static void yyfreestack(YYSTACKDATA *data)
584 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
587 memset(data, 0, sizeof(*data));
590 #define yyfreestack(data) /* nothing */
591 #endif /* YYPURE || defined(YY_NO_LEAKS) */
594 static YYParseState *
595 yyNewState(unsigned size)
597 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
598 if (p == NULL) return NULL;
600 p->yystack.stacksize = size;
603 p->yystack.s_base = NULL;
604 p->yystack.l_base = NULL;
605 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
606 p->yystack.p_base = NULL;
610 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
611 if (p->yystack.s_base == NULL) return NULL;
612 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
613 if (p->yystack.l_base == NULL) return NULL;
614 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
615 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
616 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
617 if (p->yystack.p_base == NULL) return NULL;
618 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
625 yyFreeState(YYParseState *p)
627 yyfreestack(&p->yystack);
630 #endif /* YYBTYACC */
632 #define YYABORT goto yyabort
633 #define YYREJECT goto yyabort
634 #define YYACCEPT goto yyaccept
635 #define YYERROR goto yyerrlab
637 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
638 #define YYVALID_NESTED do { if (yyps->save && \
639 yyps->save->save == 0) goto yyvalid; } while(0)
640 #endif /* YYBTYACC */
645 int yym, yyn, yystate, yyresult;
648 YYParseState *yyerrctx = NULL;
649 #endif /* YYBTYACC */
650 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
651 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
656 if ((yys = getenv("YYDEBUG")) != 0)
659 if (yyn >= '0' && yyn <= '9')
663 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
665 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
666 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
670 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
672 #endif /* YYBTYACC */
681 memset(&yystack, 0, sizeof(yystack));
684 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
685 yystack.s_mark = yystack.s_base;
686 yystack.l_mark = yystack.l_base;
687 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
688 yystack.p_mark = yystack.p_base;
694 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
701 /* we're currently re-reading tokens */
703 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
711 /* in trial mode; save scanner results for future parse attempts */
712 if (yylvp == yylvlim)
713 { /* Enlarge lexical value queue */
714 size_t p = (size_t) (yylvp - yylvals);
715 size_t s = (size_t) (yylvlim - yylvals);
717 s += YYLVQUEUEGROWTH;
718 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
719 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
720 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
721 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
723 yylvp = yylve = yylvals + p;
724 yylvlim = yylvals + s;
725 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
726 yylpp = yylpe = yylpsns + p;
727 yylplim = yylpsns + s;
729 yylexp = yylexemes + p;
731 *yylexp = (YYINT) YYLEX;
734 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
741 /* normal operation, no conflict encountered */
742 #endif /* YYBTYACC */
746 #endif /* YYBTYACC */
747 if (yychar < 0) yychar = YYEOF;
751 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
752 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
753 YYDEBUGSTR, yydepth, yystate, yychar, yys);
754 #ifdef YYSTYPE_TOSTRING
757 #endif /* YYBTYACC */
758 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
766 /* Do we have a conflict? */
767 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
768 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
777 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
778 YYDEBUGSTR, yydepth, yystate);
780 /* Switch to the next conflict context */
785 if (save->state != yystate) YYABORT;
792 /* Unresolved conflict - start/continue trial parse */
797 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
799 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
801 fputs("Starting trial parse.\n", stderr);
804 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
805 if (save == NULL) goto yyenomem;
806 save->save = yyps->save;
807 save->state = yystate;
808 save->errflag = yyerrflag;
809 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
810 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
811 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
812 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
813 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
814 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
815 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
818 if (yyctable[ctry] == -1)
821 if (yydebug && yychar >= YYEOF)
822 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
827 if (yyps->save == NULL)
829 /* If this is a first conflict in the stack, start saving lexemes */
832 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
833 if (yylexemes == NULL) goto yyenomem;
834 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
835 if (yylvals == NULL) goto yyenomem;
836 yylvlim = yylvals + YYLVQUEUEGROWTH;
837 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
838 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
839 if (yylpsns == NULL) goto yyenomem;
840 yylplim = yylpsns + YYLVQUEUEGROWTH;
845 yylvp = yylve = yylvals;
846 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
847 yylpp = yylpe = yylpsns;
853 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
856 *yylexp = (YYINT) yychar;
864 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
870 save->lexeme = (int) (yylvp - yylvals);
873 if (yytable[yyn] == ctry)
877 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
878 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
883 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
888 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
890 yystate = yyctable[ctry];
891 *++yystack.s_mark = (YYINT) yystate;
892 *++yystack.l_mark = yylval;
893 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
894 *++yystack.p_mark = yylloc;
897 if (yyerrflag > 0) --yyerrflag;
902 yyn = yyctable[ctry];
905 } /* End of code dealing with conflicts */
906 #endif /* YYBTYACC */
907 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
908 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
912 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
913 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
915 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
916 yystate = yytable[yyn];
917 *++yystack.s_mark = yytable[yyn];
918 *++yystack.l_mark = yylval;
919 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
920 *++yystack.p_mark = yylloc;
923 if (yyerrflag > 0) --yyerrflag;
926 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
927 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
932 if (yyerrflag != 0) goto yyinrecovery;
937 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
940 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
941 * before looking for error recovery */
942 yystack.s_mark -= yym;
943 yystate = *yystack.s_mark;
944 yystack.l_mark -= yym;
945 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
946 yystack.p_mark -= yym;
954 YYParseState *save = yyps->save;
957 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
958 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
959 (int)(yylvp - yylvals - yyps->save->lexeme));
961 /* Memorize most forward-looking error state in case it's really an error. */
962 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
964 /* Free old saved error context state */
965 if (yyerrctx) yyFreeState(yyerrctx);
966 /* Create and fill out new saved error context state */
967 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
968 if (yyerrctx == NULL) goto yyenomem;
969 yyerrctx->save = yyps->save;
970 yyerrctx->state = yystate;
971 yyerrctx->errflag = yyerrflag;
972 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
973 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
974 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
975 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
976 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
977 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
978 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
980 yyerrctx->lexeme = (int) (yylvp - yylvals);
982 yylvp = yylvals + save->lexeme;
983 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
984 yylpp = yylpsns + save->lexeme;
986 yylexp = yylexemes + save->lexeme;
988 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
989 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
990 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
991 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
992 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
993 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
994 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
997 yystate = save->state;
998 /* We tried shift, try reduce now */
999 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1000 yyps->save = save->save;
1004 /* Nothing left on the stack -- error */
1009 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1012 /* Restore state as it was in the most forward-advanced error */
1013 yylvp = yylvals + yyerrctx->lexeme;
1014 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1015 yylpp = yylpsns + yyerrctx->lexeme;
1017 yylexp = yylexemes + yyerrctx->lexeme;
1018 yychar = yylexp[-1];
1020 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1023 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1024 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1025 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1026 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1027 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1028 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1029 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1031 yystate = yyerrctx->state;
1032 yyFreeState(yyerrctx);
1037 if (yynewerrflag == 0) goto yyinrecovery;
1038 #endif /* YYBTYACC */
1040 YYERROR_CALL("syntax error");
1041 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1042 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1046 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1057 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1058 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1062 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1063 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1065 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1066 yystate = yytable[yyn];
1067 *++yystack.s_mark = yytable[yyn];
1068 *++yystack.l_mark = yylval;
1069 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1070 /* lookahead position is error end position */
1071 yyerror_loc_range[1] = yylloc;
1072 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1073 *++yystack.p_mark = yyloc;
1081 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1082 YYDEBUGSTR, yydepth, *yystack.s_mark);
1084 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1085 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1086 /* the current TOS position is the error start position */
1087 yyerror_loc_range[0] = *yystack.p_mark;
1089 #if defined(YYDESTRUCT_CALL)
1092 #endif /* YYBTYACC */
1093 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1094 YYDESTRUCT_CALL("error: discarding state",
1095 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1097 YYDESTRUCT_CALL("error: discarding state",
1098 yystos[*yystack.s_mark], yystack.l_mark);
1099 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1100 #endif /* defined(YYDESTRUCT_CALL) */
1103 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1111 if (yychar == YYEOF) goto yyabort;
1115 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1116 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1117 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1120 #if defined(YYDESTRUCT_CALL)
1123 #endif /* YYBTYACC */
1124 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1125 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1127 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1128 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1129 #endif /* defined(YYDESTRUCT_CALL) */
1139 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1140 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1141 #ifdef YYSTYPE_TOSTRING
1144 #endif /* YYBTYACC */
1149 for (i = yym; i > 0; i--)
1151 if (i != yym) fputs(", ", stderr);
1152 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1153 yystack.l_mark[1-i]), stderr);
1158 fputc('\n', stderr);
1162 yyval = yystack.l_mark[1-yym];
1164 memset(&yyval, 0, sizeof yyval);
1165 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1167 /* Perform position reduction */
1168 memset(&yyloc, 0, sizeof(yyloc));
1171 #endif /* YYBTYACC */
1173 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1174 /* just in case YYERROR is invoked within the action, save
1175 the start of the rhs as the error start position */
1176 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1184 #line 65 "btyacc_destroy3.y"
1185 { yyval.nlist = yystack.l_mark[-5].nlist; }
1189 #line 67 "btyacc_destroy3.y"
1190 { yyval.nlist = yystack.l_mark[-3].nlist; }
1194 #line 70 "btyacc_destroy3.y"
1195 { yyval.cval = cGLOBAL; }
1199 #line 71 "btyacc_destroy3.y"
1200 { yyval.cval = cLOCAL; }
1204 #line 74 "btyacc_destroy3.y"
1205 { yyval.tval = tREAL; }
1209 #line 75 "btyacc_destroy3.y"
1210 { yyval.tval = tINTEGER; }
1214 #line 79 "btyacc_destroy3.y"
1215 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
1216 yyval.nlist->next = yystack.l_mark[-1].nlist;
1221 #line 83 "btyacc_destroy3.y"
1222 { yyval.nlist->s = mksymbol(0, 0, yystack.l_mark[0].id);
1223 yyval.nlist->next = NULL;
1228 #line 89 "btyacc_destroy3.y"
1229 { yyval.nlist = yystack.l_mark[-5].nlist; }
1231 #line 1232 "btyacc_destroy3.tab.c"
1235 yystack.s_mark -= yym;
1236 yystate = *yystack.s_mark;
1237 yystack.l_mark -= yym;
1238 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1239 yystack.p_mark -= yym;
1242 if (yystate == 0 && yym == 0)
1247 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1248 #ifdef YYSTYPE_TOSTRING
1251 #endif /* YYBTYACC */
1252 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1254 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1258 *++yystack.s_mark = YYFINAL;
1259 *++yystack.l_mark = yyval;
1260 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1261 *++yystack.p_mark = yyloc;
1269 /* we're currently re-reading tokens */
1271 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1279 /* in trial mode; save scanner results for future parse attempts */
1280 if (yylvp == yylvlim)
1281 { /* Enlarge lexical value queue */
1282 size_t p = (size_t) (yylvp - yylvals);
1283 size_t s = (size_t) (yylvlim - yylvals);
1285 s += YYLVQUEUEGROWTH;
1286 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1288 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1290 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1291 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1294 yylvp = yylve = yylvals + p;
1295 yylvlim = yylvals + s;
1296 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1297 yylpp = yylpe = yylpsns + p;
1298 yylplim = yylpsns + s;
1300 yylexp = yylexemes + p;
1302 *yylexp = (YYINT) YYLEX;
1305 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1312 /* normal operation, no conflict encountered */
1313 #endif /* YYBTYACC */
1317 #endif /* YYBTYACC */
1318 if (yychar < 0) yychar = YYEOF;
1322 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1323 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1324 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1328 if (yychar == YYEOF) goto yyaccept;
1331 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1332 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1333 yystate = yytable[yyn];
1335 yystate = yydgoto[yym];
1339 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1340 #ifdef YYSTYPE_TOSTRING
1343 #endif /* YYBTYACC */
1344 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1346 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1349 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1350 *++yystack.s_mark = (YYINT) yystate;
1351 *++yystack.l_mark = yyval;
1352 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1353 *++yystack.p_mark = yyloc;
1358 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1360 if (yypath) YYABORT;
1363 YYParseState *save = yyps->save;
1364 yyps->save = save->save;
1365 save->save = yypath;
1370 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1371 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1375 yyFreeState(yyerrctx);
1378 yylvp = yylvals + yypath->lexeme;
1379 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1380 yylpp = yylpsns + yypath->lexeme;
1382 yylexp = yylexemes + yypath->lexeme;
1384 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1385 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1386 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1387 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1388 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1389 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1390 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1392 yystate = yypath->state;
1394 #endif /* YYBTYACC */
1397 YYERROR_CALL("yacc stack overflow");
1401 YYERROR_CALL("memory exhausted");
1403 #endif /* YYBTYACC */
1413 if (yyps->save) goto yyvalid;
1414 #endif /* YYBTYACC */
1418 #if defined(YYDESTRUCT_CALL)
1419 if (yychar != YYEOF && yychar != YYEMPTY)
1420 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1421 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1423 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1424 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1428 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1431 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1432 YYDESTRUCT_CALL("cleanup: discarding state",
1433 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1435 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1436 YYDESTRUCT_CALL("cleanup: discarding state",
1437 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1438 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1440 #endif /* defined(YYDESTRUCT_CALL) */
1445 yyFreeState(yyerrctx);
1450 YYParseState *save = yyps;
1457 YYParseState *save = yypath;
1458 yypath = save->save;
1462 #endif /* YYBTYACC */
1463 yyfreestack(&yystack);