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 destroy2_parse
25 #define yylex destroy2_lex
29 #define yyerror destroy2_error
33 #define yychar destroy2_char
37 #define yyval destroy2_val
41 #define yylval destroy2_lval
45 #define yydebug destroy2_debug
49 #define yynerrs destroy2_nerrs
53 #define yyerrflag destroy2_errflag
54 #endif /* yyerrflag */
57 #define yylhs destroy2_lhs
61 #define yylen destroy2_len
65 #define yydefred destroy2_defred
69 #define yystos destroy2_stos
73 #define yydgoto destroy2_dgoto
77 #define yysindex destroy2_sindex
81 #define yyrindex destroy2_rindex
85 #define yygindex destroy2_gindex
89 #define yytable destroy2_table
93 #define yycheck destroy2_check
97 #define yyname destroy2_name
101 #define yyrule destroy2_rule
107 #define yycindex destroy2_cindex
108 #endif /* yycindex */
111 #define yyctable destroy2_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "destroy2_"
120 #line 4 "btyacc_destroy2.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_destroy2.y"
158 #endif /* !YYSTYPE_IS_DECLARED */
159 #line 160 "btyacc_destroy2.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 destroy2_lhs[] = { -1,
207 0, 0, 2, 2, 3, 3, 4, 4, 1,
209 static const YYINT destroy2_len[] = { 2,
210 8, 5, 1, 1, 1, 1, 2, 1, 6,
212 static const YYINT destroy2_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 destroy2_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 destroy2_dgoto[] = { 5,
227 static const YYINT destroy2_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 destroy2_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 destroy2_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 destroy2_gindex[] = { 0,
247 #define YYTABLESIZE 222
248 static const YYINT destroy2_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 destroy2_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 destroy2_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 destroy2_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 destroy2_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 89 "btyacc_destroy2.y"
486 extern int YYLEX_DECL();
487 extern void YYERROR_DECL();
488 #line 489 "btyacc_destroy2.tab.c"
490 /* Release memory associated with symbol. */
491 #if ! defined YYDESTRUCT_IS_DECLARED
498 #line 41 "btyacc_destroy2.y"
500 namelist *p = (*val).nlist;
504 free(pp->s); free(pp);
508 #line 509 "btyacc_destroy2.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);
667 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
669 #endif /* YYBTYACC */
678 memset(&yystack, 0, sizeof(yystack));
681 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
682 yystack.s_mark = yystack.s_base;
683 yystack.l_mark = yystack.l_base;
684 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
685 yystack.p_mark = yystack.p_base;
691 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
698 /* we're currently re-reading tokens */
700 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
708 /* in trial mode; save scanner results for future parse attempts */
709 if (yylvp == yylvlim)
710 { /* Enlarge lexical value queue */
711 size_t p = (size_t) (yylvp - yylvals);
712 size_t s = (size_t) (yylvlim - yylvals);
714 s += YYLVQUEUEGROWTH;
715 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
716 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
717 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
718 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
720 yylvp = yylve = yylvals + p;
721 yylvlim = yylvals + s;
722 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
723 yylpp = yylpe = yylpsns + p;
724 yylplim = yylpsns + s;
726 yylexp = yylexemes + p;
728 *yylexp = (YYINT) YYLEX;
731 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
738 /* normal operation, no conflict encountered */
739 #endif /* YYBTYACC */
743 #endif /* YYBTYACC */
744 if (yychar < 0) yychar = YYEOF;
748 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
749 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
750 YYDEBUGSTR, yydepth, yystate, yychar, yys);
751 #ifdef YYSTYPE_TOSTRING
754 #endif /* YYBTYACC */
755 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
763 /* Do we have a conflict? */
764 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
765 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
774 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
775 YYDEBUGSTR, yydepth, yystate);
777 /* Switch to the next conflict context */
782 if (save->state != yystate) YYABORT;
789 /* Unresolved conflict - start/continue trial parse */
794 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
796 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
798 fputs("Starting trial parse.\n", stderr);
801 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
802 if (save == NULL) goto yyenomem;
803 save->save = yyps->save;
804 save->state = yystate;
805 save->errflag = yyerrflag;
806 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
807 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
808 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
809 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
810 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
811 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
812 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
815 if (yyctable[ctry] == -1)
818 if (yydebug && yychar >= YYEOF)
819 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
824 if (yyps->save == NULL)
826 /* If this is a first conflict in the stack, start saving lexemes */
829 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
830 if (yylexemes == NULL) goto yyenomem;
831 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
832 if (yylvals == NULL) goto yyenomem;
833 yylvlim = yylvals + YYLVQUEUEGROWTH;
834 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
835 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
836 if (yylpsns == NULL) goto yyenomem;
837 yylplim = yylpsns + YYLVQUEUEGROWTH;
842 yylvp = yylve = yylvals;
843 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
844 yylpp = yylpe = yylpsns;
850 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
853 *yylexp = (YYINT) yychar;
861 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
867 save->lexeme = (int) (yylvp - yylvals);
870 if (yytable[yyn] == ctry)
874 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
875 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
880 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
885 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
887 yystate = yyctable[ctry];
888 *++yystack.s_mark = (YYINT) yystate;
889 *++yystack.l_mark = yylval;
890 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
891 *++yystack.p_mark = yylloc;
894 if (yyerrflag > 0) --yyerrflag;
899 yyn = yyctable[ctry];
902 } /* End of code dealing with conflicts */
903 #endif /* YYBTYACC */
904 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
905 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
909 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
910 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
912 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
913 yystate = yytable[yyn];
914 *++yystack.s_mark = yytable[yyn];
915 *++yystack.l_mark = yylval;
916 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
917 *++yystack.p_mark = yylloc;
920 if (yyerrflag > 0) --yyerrflag;
923 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
924 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
929 if (yyerrflag != 0) goto yyinrecovery;
934 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
937 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
938 * before looking for error recovery */
939 yystack.s_mark -= yym;
940 yystate = *yystack.s_mark;
941 yystack.l_mark -= yym;
942 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
943 yystack.p_mark -= yym;
951 YYParseState *save = yyps->save;
954 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
955 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
956 (int)(yylvp - yylvals - yyps->save->lexeme));
958 /* Memorize most forward-looking error state in case it's really an error. */
959 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
961 /* Free old saved error context state */
962 if (yyerrctx) yyFreeState(yyerrctx);
963 /* Create and fill out new saved error context state */
964 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
965 if (yyerrctx == NULL) goto yyenomem;
966 yyerrctx->save = yyps->save;
967 yyerrctx->state = yystate;
968 yyerrctx->errflag = yyerrflag;
969 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
970 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
971 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
972 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
973 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
974 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
975 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
977 yyerrctx->lexeme = (int) (yylvp - yylvals);
979 yylvp = yylvals + save->lexeme;
980 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
981 yylpp = yylpsns + save->lexeme;
983 yylexp = yylexemes + save->lexeme;
985 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
986 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
987 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
988 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
989 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
990 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
991 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
994 yystate = save->state;
995 /* We tried shift, try reduce now */
996 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
997 yyps->save = save->save;
1001 /* Nothing left on the stack -- error */
1006 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1009 /* Restore state as it was in the most forward-advanced error */
1010 yylvp = yylvals + yyerrctx->lexeme;
1011 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1012 yylpp = yylpsns + yyerrctx->lexeme;
1014 yylexp = yylexemes + yyerrctx->lexeme;
1015 yychar = yylexp[-1];
1017 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1020 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1021 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1022 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1023 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1024 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1025 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1026 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1028 yystate = yyerrctx->state;
1029 yyFreeState(yyerrctx);
1034 if (yynewerrflag == 0) goto yyinrecovery;
1035 #endif /* YYBTYACC */
1037 YYERROR_CALL("syntax error");
1038 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1039 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1043 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1054 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1055 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1059 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1060 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1062 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1063 yystate = yytable[yyn];
1064 *++yystack.s_mark = yytable[yyn];
1065 *++yystack.l_mark = yylval;
1066 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1067 /* lookahead position is error end position */
1068 yyerror_loc_range[1] = yylloc;
1069 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1070 *++yystack.p_mark = yyloc;
1078 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1079 YYDEBUGSTR, yydepth, *yystack.s_mark);
1081 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1082 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1083 /* the current TOS position is the error start position */
1084 yyerror_loc_range[0] = *yystack.p_mark;
1086 #if defined(YYDESTRUCT_CALL)
1089 #endif /* YYBTYACC */
1090 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1091 YYDESTRUCT_CALL("error: discarding state",
1092 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1094 YYDESTRUCT_CALL("error: discarding state",
1095 yystos[*yystack.s_mark], yystack.l_mark);
1096 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1097 #endif /* defined(YYDESTRUCT_CALL) */
1100 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1108 if (yychar == YYEOF) goto yyabort;
1112 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1113 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1114 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1117 #if defined(YYDESTRUCT_CALL)
1120 #endif /* YYBTYACC */
1121 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1122 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1124 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1125 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1126 #endif /* defined(YYDESTRUCT_CALL) */
1136 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1137 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1138 #ifdef YYSTYPE_TOSTRING
1141 #endif /* YYBTYACC */
1146 for (i = yym; i > 0; i--)
1148 if (i != yym) fputs(", ", stderr);
1149 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1150 yystack.l_mark[1-i]), stderr);
1155 fputc('\n', stderr);
1159 yyval = yystack.l_mark[1-yym];
1161 memset(&yyval, 0, sizeof yyval);
1162 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1164 /* Perform position reduction */
1165 memset(&yyloc, 0, sizeof(yyloc));
1168 #endif /* YYBTYACC */
1170 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1171 /* just in case YYERROR is invoked within the action, save
1172 the start of the rhs as the error start position */
1173 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1181 #line 62 "btyacc_destroy2.y"
1182 { yyval.nlist = yystack.l_mark[-5].nlist; }
1186 #line 64 "btyacc_destroy2.y"
1187 { yyval.nlist = yystack.l_mark[-3].nlist; }
1191 #line 67 "btyacc_destroy2.y"
1192 { yyval.cval = cGLOBAL; }
1196 #line 68 "btyacc_destroy2.y"
1197 { yyval.cval = cLOCAL; }
1201 #line 71 "btyacc_destroy2.y"
1202 { yyval.tval = tREAL; }
1206 #line 72 "btyacc_destroy2.y"
1207 { yyval.tval = tINTEGER; }
1211 #line 76 "btyacc_destroy2.y"
1212 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
1213 yyval.nlist->next = yystack.l_mark[-1].nlist;
1218 #line 80 "btyacc_destroy2.y"
1219 { yyval.nlist->s = mksymbol(0, 0, yystack.l_mark[0].id);
1220 yyval.nlist->next = NULL;
1225 #line 86 "btyacc_destroy2.y"
1226 { yyval.nlist = yystack.l_mark[-5].nlist; }
1228 #line 1229 "btyacc_destroy2.tab.c"
1232 yystack.s_mark -= yym;
1233 yystate = *yystack.s_mark;
1234 yystack.l_mark -= yym;
1235 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1236 yystack.p_mark -= yym;
1239 if (yystate == 0 && yym == 0)
1244 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1245 #ifdef YYSTYPE_TOSTRING
1248 #endif /* YYBTYACC */
1249 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1251 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1255 *++yystack.s_mark = YYFINAL;
1256 *++yystack.l_mark = yyval;
1257 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1258 *++yystack.p_mark = yyloc;
1266 /* we're currently re-reading tokens */
1268 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1276 /* in trial mode; save scanner results for future parse attempts */
1277 if (yylvp == yylvlim)
1278 { /* Enlarge lexical value queue */
1279 size_t p = (size_t) (yylvp - yylvals);
1280 size_t s = (size_t) (yylvlim - yylvals);
1282 s += YYLVQUEUEGROWTH;
1283 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1285 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1287 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1288 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1291 yylvp = yylve = yylvals + p;
1292 yylvlim = yylvals + s;
1293 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1294 yylpp = yylpe = yylpsns + p;
1295 yylplim = yylpsns + s;
1297 yylexp = yylexemes + p;
1299 *yylexp = (YYINT) YYLEX;
1302 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1309 /* normal operation, no conflict encountered */
1310 #endif /* YYBTYACC */
1314 #endif /* YYBTYACC */
1315 if (yychar < 0) yychar = YYEOF;
1319 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1320 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1321 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1325 if (yychar == YYEOF) goto yyaccept;
1328 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1329 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1330 yystate = yytable[yyn];
1332 yystate = yydgoto[yym];
1336 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1337 #ifdef YYSTYPE_TOSTRING
1340 #endif /* YYBTYACC */
1341 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1343 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1346 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1347 *++yystack.s_mark = (YYINT) yystate;
1348 *++yystack.l_mark = yyval;
1349 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1350 *++yystack.p_mark = yyloc;
1355 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1357 if (yypath) YYABORT;
1360 YYParseState *save = yyps->save;
1361 yyps->save = save->save;
1362 save->save = yypath;
1367 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1368 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1372 yyFreeState(yyerrctx);
1375 yylvp = yylvals + yypath->lexeme;
1376 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1377 yylpp = yylpsns + yypath->lexeme;
1379 yylexp = yylexemes + yypath->lexeme;
1381 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1382 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1383 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1384 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1385 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1386 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1387 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1389 yystate = yypath->state;
1391 #endif /* YYBTYACC */
1394 YYERROR_CALL("yacc stack overflow");
1398 YYERROR_CALL("memory exhausted");
1400 #endif /* YYBTYACC */
1410 if (yyps->save) goto yyvalid;
1411 #endif /* YYBTYACC */
1415 #if defined(YYDESTRUCT_CALL)
1416 if (yychar != YYEOF && yychar != YYEMPTY)
1417 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1418 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1420 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1421 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1425 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1428 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1429 YYDESTRUCT_CALL("cleanup: discarding state",
1430 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1432 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1433 YYDESTRUCT_CALL("cleanup: discarding state",
1434 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1435 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1437 #endif /* defined(YYDESTRUCT_CALL) */
1442 yyFreeState(yyerrctx);
1447 YYParseState *save = yyps;
1454 YYParseState *save = yypath;
1455 yypath = save->save;
1459 #endif /* YYBTYACC */
1460 yyfreestack(&yystack);