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 destroy1_parse
25 #define yylex destroy1_lex
29 #define yyerror destroy1_error
33 #define yychar destroy1_char
37 #define yyval destroy1_val
41 #define yylval destroy1_lval
45 #define yydebug destroy1_debug
49 #define yynerrs destroy1_nerrs
53 #define yyerrflag destroy1_errflag
54 #endif /* yyerrflag */
57 #define yylhs destroy1_lhs
61 #define yylen destroy1_len
65 #define yydefred destroy1_defred
69 #define yystos destroy1_stos
73 #define yydgoto destroy1_dgoto
77 #define yysindex destroy1_sindex
81 #define yyrindex destroy1_rindex
85 #define yygindex destroy1_gindex
89 #define yytable destroy1_table
93 #define yycheck destroy1_check
97 #define yyname destroy1_name
101 #define yyrule destroy1_rule
107 #define yycindex destroy1_cindex
108 #endif /* yycindex */
111 #define yyctable destroy1_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "destroy1_"
120 #line 4 "btyacc_destroy1.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 50 "btyacc_destroy1.y"
151 typedef union YYSTYPE
158 #endif /* !YYSTYPE_IS_DECLARED */
159 #line 160 "btyacc_destroy1.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 destroy1_lhs[] = { -1,
207 0, 0, 2, 2, 3, 3, 4, 4, 1,
209 static const YYINT destroy1_len[] = { 2,
210 8, 5, 1, 1, 1, 1, 2, 1, 6,
212 static const YYINT destroy1_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 destroy1_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 destroy1_dgoto[] = { 5,
227 static const YYINT destroy1_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 destroy1_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 destroy1_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 destroy1_gindex[] = { 0,
247 #define YYTABLESIZE 222
248 static const YYINT destroy1_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 destroy1_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 destroy1_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 destroy1_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 destroy1_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 ')'",
370 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
371 YYLTYPE yyloc; /* position returned by actions */
372 YYLTYPE yylloc; /* position from the lexer */
375 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
376 #ifndef YYLLOC_DEFAULT
377 #define YYLLOC_DEFAULT(loc, rhs, n) \
382 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
383 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
384 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
385 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
389 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
390 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
391 (loc).last_line = YYRHSLOC(rhs, n).last_line; \
392 (loc).last_column = YYRHSLOC(rhs, n).last_column; \
395 #endif /* YYLLOC_DEFAULT */
396 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
399 #ifndef YYLVQUEUEGROWTH
400 #define YYLVQUEUEGROWTH 32
402 #endif /* YYBTYACC */
404 /* define the initial stack-sizes */
407 #define YYMAXDEPTH YYSTACKSIZE
410 #define YYSTACKSIZE YYMAXDEPTH
412 #define YYSTACKSIZE 10000
413 #define YYMAXDEPTH 10000
417 #ifndef YYINITSTACKSIZE
418 #define YYINITSTACKSIZE 200
428 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
435 struct YYParseState_s
437 struct YYParseState_s *save; /* Previously saved parser state */
438 YYSTACKDATA yystack; /* saved parser stack */
439 int state; /* saved parser state */
440 int errflag; /* saved error recovery status */
441 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
442 YYINT ctry; /* saved index in yyctable[] for this conflict */
444 typedef struct YYParseState_s YYParseState;
445 #endif /* YYBTYACC */
446 /* variables for the parser stack */
447 static YYSTACKDATA yystack;
450 /* Current parser state */
451 static YYParseState *yyps = 0;
453 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
454 static YYParseState *yypath = 0;
456 /* Base of the lexical value queue */
457 static YYSTYPE *yylvals = 0;
459 /* Current position at lexical value queue */
460 static YYSTYPE *yylvp = 0;
462 /* End position of lexical value queue */
463 static YYSTYPE *yylve = 0;
465 /* The last allocated position at the lexical value queue */
466 static YYSTYPE *yylvlim = 0;
468 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
469 /* Base of the lexical position queue */
470 static YYLTYPE *yylpsns = 0;
472 /* Current position at lexical position queue */
473 static YYLTYPE *yylpp = 0;
475 /* End position of lexical position queue */
476 static YYLTYPE *yylpe = 0;
478 /* The last allocated position at the lexical position queue */
479 static YYLTYPE *yylplim = 0;
482 /* Current position at lexical token queue */
483 static YYINT *yylexp = 0;
485 static YYINT *yylexemes = 0;
486 #endif /* YYBTYACC */
487 #line 89 "btyacc_destroy1.y"
489 extern int YYLEX_DECL();
490 extern void YYERROR_DECL();
491 #line 492 "btyacc_destroy1.tab.c"
493 /* Release memory associated with symbol. */
494 #if ! defined YYDESTRUCT_IS_DECLARED
501 #line 41 "btyacc_destroy1.y"
503 namelist *p = (*val).nlist;
507 free(pp->s); free(pp);
510 #line 511 "btyacc_destroy1.tab.c"
514 #define YYDESTRUCT_IS_DECLARED 1
517 /* For use in generated program */
518 #define yydepth (int)(yystack.s_mark - yystack.s_base)
520 #define yytrial (yyps->save)
521 #endif /* YYBTYACC */
524 #include <stdio.h> /* needed for printf */
527 #include <stdlib.h> /* needed for malloc, etc */
528 #include <string.h> /* needed for memset */
530 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
531 static int yygrowstack(YYSTACKDATA *data)
537 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
541 if ((newsize = data->stacksize) == 0)
542 newsize = YYINITSTACKSIZE;
543 else if (newsize >= YYMAXDEPTH)
545 else if ((newsize *= 2) > YYMAXDEPTH)
546 newsize = YYMAXDEPTH;
548 i = (int) (data->s_mark - data->s_base);
549 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
553 data->s_base = newss;
554 data->s_mark = newss + i;
556 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
560 data->l_base = newvs;
561 data->l_mark = newvs + i;
563 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
564 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
568 data->p_base = newps;
569 data->p_mark = newps + i;
572 data->stacksize = newsize;
573 data->s_last = data->s_base + newsize - 1;
577 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
582 #if YYPURE || defined(YY_NO_LEAKS)
583 static void yyfreestack(YYSTACKDATA *data)
587 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
590 memset(data, 0, sizeof(*data));
593 #define yyfreestack(data) /* nothing */
594 #endif /* YYPURE || defined(YY_NO_LEAKS) */
597 static YYParseState *
598 yyNewState(unsigned size)
600 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
601 if (p == NULL) return NULL;
603 p->yystack.stacksize = size;
606 p->yystack.s_base = NULL;
607 p->yystack.l_base = NULL;
608 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
609 p->yystack.p_base = NULL;
613 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
614 if (p->yystack.s_base == NULL) return NULL;
615 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
616 if (p->yystack.l_base == NULL) return NULL;
617 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
618 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
619 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
620 if (p->yystack.p_base == NULL) return NULL;
621 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
628 yyFreeState(YYParseState *p)
630 yyfreestack(&p->yystack);
633 #endif /* YYBTYACC */
635 #define YYABORT goto yyabort
636 #define YYREJECT goto yyabort
637 #define YYACCEPT goto yyaccept
638 #define YYERROR goto yyerrlab
640 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
641 #define YYVALID_NESTED do { if (yyps->save && \
642 yyps->save->save == 0) goto yyvalid; } while(0)
643 #endif /* YYBTYACC */
648 int yym, yyn, yystate, yyresult;
651 YYParseState *yyerrctx = NULL;
652 #endif /* YYBTYACC */
653 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
654 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
659 if ((yys = getenv("YYDEBUG")) != 0)
662 if (yyn >= '0' && yyn <= '9')
666 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
668 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
669 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
673 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
675 #endif /* YYBTYACC */
677 /* yyn is set below */
681 /* yystate is set below */
684 memset(&yystack, 0, sizeof(yystack));
687 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
688 yystack.s_mark = yystack.s_base;
689 yystack.l_mark = yystack.l_base;
690 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
691 yystack.p_mark = yystack.p_base;
697 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
704 /* we're currently re-reading tokens */
706 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
714 /* in trial mode; save scanner results for future parse attempts */
715 if (yylvp == yylvlim)
716 { /* Enlarge lexical value queue */
717 size_t p = (size_t) (yylvp - yylvals);
718 size_t s = (size_t) (yylvlim - yylvals);
720 s += YYLVQUEUEGROWTH;
721 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
722 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
723 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
724 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
726 yylvp = yylve = yylvals + p;
727 yylvlim = yylvals + s;
728 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
729 yylpp = yylpe = yylpsns + p;
730 yylplim = yylpsns + s;
732 yylexp = yylexemes + p;
734 *yylexp = (YYINT) YYLEX;
737 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
744 /* normal operation, no conflict encountered */
745 #endif /* YYBTYACC */
749 #endif /* YYBTYACC */
750 if (yychar < 0) yychar = YYEOF;
754 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
755 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
756 YYDEBUGSTR, yydepth, yystate, yychar, yys);
757 #ifdef YYSTYPE_TOSTRING
760 #endif /* YYBTYACC */
761 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
769 /* Do we have a conflict? */
770 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
771 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
780 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
781 YYDEBUGSTR, yydepth, yystate);
783 /* Switch to the next conflict context */
788 if (save->state != yystate) YYABORT;
795 /* Unresolved conflict - start/continue trial parse */
800 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
802 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
804 fputs("Starting trial parse.\n", stderr);
807 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
808 if (save == NULL) goto yyenomem;
809 save->save = yyps->save;
810 save->state = yystate;
811 save->errflag = yyerrflag;
812 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
813 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
814 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
815 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
816 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
817 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
818 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
821 if (yyctable[ctry] == -1)
824 if (yydebug && yychar >= YYEOF)
825 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
830 if (yyps->save == NULL)
832 /* If this is a first conflict in the stack, start saving lexemes */
835 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
836 if (yylexemes == NULL) goto yyenomem;
837 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
838 if (yylvals == NULL) goto yyenomem;
839 yylvlim = yylvals + YYLVQUEUEGROWTH;
840 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
841 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
842 if (yylpsns == NULL) goto yyenomem;
843 yylplim = yylpsns + YYLVQUEUEGROWTH;
848 yylvp = yylve = yylvals;
849 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
850 yylpp = yylpe = yylpsns;
856 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
859 *yylexp = (YYINT) yychar;
867 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
873 save->lexeme = (int) (yylvp - yylvals);
876 if (yytable[yyn] == ctry)
880 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
881 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
886 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
891 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
893 yystate = yyctable[ctry];
894 *++yystack.s_mark = (YYINT) yystate;
895 *++yystack.l_mark = yylval;
896 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
897 *++yystack.p_mark = yylloc;
900 if (yyerrflag > 0) --yyerrflag;
905 yyn = yyctable[ctry];
908 } /* End of code dealing with conflicts */
909 #endif /* YYBTYACC */
910 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
911 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
915 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
916 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
918 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
919 yystate = yytable[yyn];
920 *++yystack.s_mark = yytable[yyn];
921 *++yystack.l_mark = yylval;
922 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
923 *++yystack.p_mark = yylloc;
926 if (yyerrflag > 0) --yyerrflag;
929 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
930 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
935 if (yyerrflag != 0) goto yyinrecovery;
940 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
943 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
944 * before looking for error recovery */
945 yystack.s_mark -= yym;
946 yystate = *yystack.s_mark;
947 yystack.l_mark -= yym;
948 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
949 yystack.p_mark -= yym;
957 YYParseState *save = yyps->save;
960 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
961 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
962 (int)(yylvp - yylvals - yyps->save->lexeme));
964 /* Memorize most forward-looking error state in case it's really an error. */
965 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
967 /* Free old saved error context state */
968 if (yyerrctx) yyFreeState(yyerrctx);
969 /* Create and fill out new saved error context state */
970 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
971 if (yyerrctx == NULL) goto yyenomem;
972 yyerrctx->save = yyps->save;
973 yyerrctx->state = yystate;
974 yyerrctx->errflag = yyerrflag;
975 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
976 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
977 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
978 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
979 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
980 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
981 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
983 yyerrctx->lexeme = (int) (yylvp - yylvals);
985 yylvp = yylvals + save->lexeme;
986 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
987 yylpp = yylpsns + save->lexeme;
989 yylexp = yylexemes + save->lexeme;
991 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
992 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
993 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
994 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
995 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
996 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
997 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1000 yystate = save->state;
1001 /* We tried shift, try reduce now */
1002 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1003 yyps->save = save->save;
1007 /* Nothing left on the stack -- error */
1012 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1015 /* Restore state as it was in the most forward-advanced error */
1016 yylvp = yylvals + yyerrctx->lexeme;
1017 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1018 yylpp = yylpsns + yyerrctx->lexeme;
1020 yylexp = yylexemes + yyerrctx->lexeme;
1021 yychar = yylexp[-1];
1023 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1026 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1027 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1028 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1029 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1030 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1031 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1032 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1034 yystate = yyerrctx->state;
1035 yyFreeState(yyerrctx);
1040 if (yynewerrflag == 0) goto yyinrecovery;
1041 #endif /* YYBTYACC */
1043 YYERROR_CALL("syntax error");
1044 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1045 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
1049 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1060 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1061 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1065 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1066 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1068 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1069 yystate = yytable[yyn];
1070 *++yystack.s_mark = yytable[yyn];
1071 *++yystack.l_mark = yylval;
1072 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1073 /* lookahead position is error end position */
1074 yyerror_loc_range[2] = yylloc;
1075 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1076 *++yystack.p_mark = yyloc;
1084 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1085 YYDEBUGSTR, yydepth, *yystack.s_mark);
1087 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1088 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1089 /* the current TOS position is the error start position */
1090 yyerror_loc_range[1] = *yystack.p_mark;
1092 #if defined(YYDESTRUCT_CALL)
1095 #endif /* YYBTYACC */
1096 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1097 YYDESTRUCT_CALL("error: discarding state",
1098 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1100 YYDESTRUCT_CALL("error: discarding state",
1101 yystos[*yystack.s_mark], yystack.l_mark);
1102 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1103 #endif /* defined(YYDESTRUCT_CALL) */
1106 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1114 if (yychar == YYEOF) goto yyabort;
1118 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1119 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1120 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1123 #if defined(YYDESTRUCT_CALL)
1126 #endif /* YYBTYACC */
1127 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1128 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1130 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1131 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1132 #endif /* defined(YYDESTRUCT_CALL) */
1142 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1143 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1144 #ifdef YYSTYPE_TOSTRING
1147 #endif /* YYBTYACC */
1152 for (i = yym; i > 0; i--)
1154 if (i != yym) fputs(", ", stderr);
1155 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1156 yystack.l_mark[1-i]), stderr);
1161 fputc('\n', stderr);
1165 yyval = yystack.l_mark[1-yym];
1167 memset(&yyval, 0, sizeof yyval);
1168 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1170 /* Perform position reduction */
1171 memset(&yyloc, 0, sizeof(yyloc));
1174 #endif /* YYBTYACC */
1176 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
1177 /* just in case YYERROR is invoked within the action, save
1178 the start of the rhs as the error start position */
1179 yyerror_loc_range[1] = yystack.p_mark[1-yym];
1187 #line 62 "btyacc_destroy1.y"
1188 { yyval.nlist = yystack.l_mark[-5].nlist; }
1189 #line 1190 "btyacc_destroy1.tab.c"
1193 #line 64 "btyacc_destroy1.y"
1194 { yyval.nlist = yystack.l_mark[-3].nlist; }
1195 #line 1196 "btyacc_destroy1.tab.c"
1199 #line 67 "btyacc_destroy1.y"
1200 { yyval.cval = cGLOBAL; }
1201 #line 1202 "btyacc_destroy1.tab.c"
1205 #line 68 "btyacc_destroy1.y"
1206 { yyval.cval = cLOCAL; }
1207 #line 1208 "btyacc_destroy1.tab.c"
1211 #line 71 "btyacc_destroy1.y"
1212 { yyval.tval = tREAL; }
1213 #line 1214 "btyacc_destroy1.tab.c"
1217 #line 72 "btyacc_destroy1.y"
1218 { yyval.tval = tINTEGER; }
1219 #line 1220 "btyacc_destroy1.tab.c"
1223 #line 76 "btyacc_destroy1.y"
1224 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
1225 yyval.nlist->next = yystack.l_mark[-1].nlist;
1227 #line 1228 "btyacc_destroy1.tab.c"
1231 #line 80 "btyacc_destroy1.y"
1232 { yyval.nlist->s = mksymbol(0, 0, yystack.l_mark[0].id);
1233 yyval.nlist->next = NULL;
1235 #line 1236 "btyacc_destroy1.tab.c"
1239 #line 86 "btyacc_destroy1.y"
1240 { yyval.nlist = yystack.l_mark[-5].nlist; }
1241 #line 1242 "btyacc_destroy1.tab.c"
1243 #line 1244 "btyacc_destroy1.tab.c"
1247 yystack.s_mark -= yym;
1248 yystate = *yystack.s_mark;
1249 yystack.l_mark -= yym;
1250 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1251 yystack.p_mark -= yym;
1254 if (yystate == 0 && yym == 0)
1259 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1260 #ifdef YYSTYPE_TOSTRING
1263 #endif /* YYBTYACC */
1264 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1266 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1270 *++yystack.s_mark = YYFINAL;
1271 *++yystack.l_mark = yyval;
1272 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1273 *++yystack.p_mark = yyloc;
1281 /* we're currently re-reading tokens */
1283 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1291 /* in trial mode; save scanner results for future parse attempts */
1292 if (yylvp == yylvlim)
1293 { /* Enlarge lexical value queue */
1294 size_t p = (size_t) (yylvp - yylvals);
1295 size_t s = (size_t) (yylvlim - yylvals);
1297 s += YYLVQUEUEGROWTH;
1298 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1300 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1302 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1303 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1306 yylvp = yylve = yylvals + p;
1307 yylvlim = yylvals + s;
1308 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1309 yylpp = yylpe = yylpsns + p;
1310 yylplim = yylpsns + s;
1312 yylexp = yylexemes + p;
1314 *yylexp = (YYINT) YYLEX;
1317 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1324 /* normal operation, no conflict encountered */
1325 #endif /* YYBTYACC */
1329 #endif /* YYBTYACC */
1330 if (yychar < 0) yychar = YYEOF;
1334 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1335 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1336 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1340 if (yychar == YYEOF) goto yyaccept;
1343 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1344 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1345 yystate = yytable[yyn];
1347 yystate = yydgoto[yym];
1351 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1352 #ifdef YYSTYPE_TOSTRING
1355 #endif /* YYBTYACC */
1356 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1358 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1361 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1362 *++yystack.s_mark = (YYINT) yystate;
1363 *++yystack.l_mark = yyval;
1364 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1365 *++yystack.p_mark = yyloc;
1370 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1372 if (yypath) YYABORT;
1375 YYParseState *save = yyps->save;
1376 yyps->save = save->save;
1377 save->save = yypath;
1382 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1383 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1387 yyFreeState(yyerrctx);
1390 yylvp = yylvals + yypath->lexeme;
1391 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1392 yylpp = yylpsns + yypath->lexeme;
1394 yylexp = yylexemes + yypath->lexeme;
1396 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1397 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1398 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1399 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1400 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1401 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1402 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1404 yystate = yypath->state;
1406 #endif /* YYBTYACC */
1409 YYERROR_CALL("yacc stack overflow");
1413 YYERROR_CALL("memory exhausted");
1415 #endif /* YYBTYACC */
1425 if (yyps->save) goto yyvalid;
1426 #endif /* YYBTYACC */
1430 #if defined(YYDESTRUCT_CALL)
1431 if (yychar != YYEOF && yychar != YYEMPTY)
1432 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1433 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1435 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1436 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1440 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1443 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1444 YYDESTRUCT_CALL("cleanup: discarding state",
1445 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1447 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1448 YYDESTRUCT_CALL("cleanup: discarding state",
1449 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1450 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1452 #endif /* defined(YYDESTRUCT_CALL) */
1457 yyFreeState(yyerrctx);
1462 YYParseState *save = yyps;
1469 YYParseState *save = yypath;
1470 yypath = save->save;
1474 #endif /* YYBTYACC */
1475 yyfreestack(&yystack);