1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent of 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)
144 #line 50 "btyacc_destroy1.y"
146 #undef YYSTYPE_IS_DECLARED
147 #define YYSTYPE_IS_DECLARED 1
149 #ifndef YYSTYPE_IS_DECLARED
150 #define YYSTYPE_IS_DECLARED 1
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 static const YYINT destroy1_stos[] = { 0,
218 257, 258, 259, 260, 263, 265, 266, 266, 261, 264,
219 267, 267, 40, 261, 40, 40, 265, 258, 265, 41,
220 44, 44, 266, 266, 41, 41,
222 static const YYINT destroy1_dgoto[] = { 5,
225 static const YYINT destroy1_sindex[] = { -254,
226 0, 0, 0, 0, 0, -251, -248, -248, 0, -26,
227 -40, -39, -246, 0, -243, -246, -25, -24, -23, 0,
228 -251, -251, -22, -19, 0, 0,
230 static const YYINT destroy1_rindex[] = { 0,
231 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
232 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
236 static const YYINT destroy1_cindex[] = { 0,
237 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
238 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
242 static const YYINT destroy1_gindex[] = { 0,
245 #define YYTABLESIZE 222
246 static const YYINT destroy1_table[] = { 15,
247 16, 8, 1, 2, 3, 4, 17, 3, 4, 19,
248 1, 2, 9, 13, 18, 20, 23, 24, 25, 21,
249 22, 26, 12, 0, 0, 0, 0, 0, 0, 0,
250 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
251 0, 0, 0, 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,
271 static const YYINT destroy1_check[] = { 40,
272 40, 6, 257, 258, 259, 260, 13, 259, 260, 16,
273 257, 258, 261, 40, 258, 41, 21, 22, 41, 44,
274 44, 41, 8, -1, -1, -1, -1, -1, -1, -1,
275 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
276 -1, -1, -1, -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,
297 static const YYINT destroy1_ctable[] = { -1,
298 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
299 -1, -1, -1, -1, -1, -1, -1, -1, -1, -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,
327 #define YYMAXTOKEN 261
328 #define YYUNDFTOKEN 268
329 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
331 static const char *const destroy1_name[] = {
333 "$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,
334 0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
335 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,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,"error","GLOBAL","LOCAL",
340 "REAL","INTEGER","NAME","$accept","declaration","locnamelist","class","type",
341 "namelist","illegal-symbol",
343 static const char *const destroy1_rule[] = {
344 "$accept : declaration",
345 "declaration : class type namelist '(' class ',' type ')'",
346 "declaration : type locnamelist '(' class ')'",
351 "namelist : namelist NAME",
353 "locnamelist : namelist '(' LOCAL ',' type ')'",
365 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
366 YYLTYPE yyloc; /* position returned by actions */
367 YYLTYPE yylloc; /* position from the lexer */
370 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
371 #ifndef YYLLOC_DEFAULT
372 #define YYLLOC_DEFAULT(loc, rhs, n) \
377 (loc).first_line = ((rhs)[-1]).last_line; \
378 (loc).first_column = ((rhs)[-1]).last_column; \
379 (loc).last_line = ((rhs)[-1]).last_line; \
380 (loc).last_column = ((rhs)[-1]).last_column; \
384 (loc).first_line = ((rhs)[ 0 ]).first_line; \
385 (loc).first_column = ((rhs)[ 0 ]).first_column; \
386 (loc).last_line = ((rhs)[n-1]).last_line; \
387 (loc).last_column = ((rhs)[n-1]).last_column; \
390 #endif /* YYLLOC_DEFAULT */
391 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
394 #ifndef YYLVQUEUEGROWTH
395 #define YYLVQUEUEGROWTH 32
397 #endif /* YYBTYACC */
399 /* define the initial stack-sizes */
402 #define YYMAXDEPTH YYSTACKSIZE
405 #define YYSTACKSIZE YYMAXDEPTH
407 #define YYSTACKSIZE 10000
408 #define YYMAXDEPTH 10000
412 #ifndef YYINITSTACKSIZE
413 #define YYINITSTACKSIZE 200
423 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
430 struct YYParseState_s
432 struct YYParseState_s *save; /* Previously saved parser state */
433 YYSTACKDATA yystack; /* saved parser stack */
434 int state; /* saved parser state */
435 int errflag; /* saved error recovery status */
436 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
437 YYINT ctry; /* saved index in yyctable[] for this conflict */
439 typedef struct YYParseState_s YYParseState;
440 #endif /* YYBTYACC */
441 /* variables for the parser stack */
442 static YYSTACKDATA yystack;
445 /* Current parser state */
446 static YYParseState *yyps = 0;
448 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
449 static YYParseState *yypath = 0;
451 /* Base of the lexical value queue */
452 static YYSTYPE *yylvals = 0;
454 /* Current position at lexical value queue */
455 static YYSTYPE *yylvp = 0;
457 /* End position of lexical value queue */
458 static YYSTYPE *yylve = 0;
460 /* The last allocated position at the lexical value queue */
461 static YYSTYPE *yylvlim = 0;
463 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
464 /* Base of the lexical position queue */
465 static YYLTYPE *yylpsns = 0;
467 /* Current position at lexical position queue */
468 static YYLTYPE *yylpp = 0;
470 /* End position of lexical position queue */
471 static YYLTYPE *yylpe = 0;
473 /* The last allocated position at the lexical position queue */
474 static YYLTYPE *yylplim = 0;
477 /* Current position at lexical token queue */
478 static short *yylexp = 0;
480 static short *yylexemes = 0;
481 #endif /* YYBTYACC */
482 #line 89 "btyacc_destroy1.y"
484 extern int YYLEX_DECL();
485 extern void YYERROR_DECL();
486 #line 487 "btyacc_destroy1.tab.c"
488 /* Release memory associated with symbol. */
489 #if ! defined YYDESTRUCT_IS_DECLARED
496 #line 41 "btyacc_destroy1.y"
498 namelist *p = (*val).nlist;
502 free(pp->s); free(pp);
506 #line 507 "btyacc_destroy1.tab.c"
509 #define YYDESTRUCT_IS_DECLARED 1
512 /* For use in generated program */
513 #define yydepth (int)(yystack.s_mark - yystack.s_base)
515 #define yytrial (yyps->save)
516 #endif /* YYBTYACC */
519 #include <stdio.h> /* needed for printf */
522 #include <stdlib.h> /* needed for malloc, etc */
523 #include <string.h> /* needed for memset */
525 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
526 static int yygrowstack(YYSTACKDATA *data)
532 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
536 if ((newsize = data->stacksize) == 0)
537 newsize = YYINITSTACKSIZE;
538 else if (newsize >= YYMAXDEPTH)
540 else if ((newsize *= 2) > YYMAXDEPTH)
541 newsize = YYMAXDEPTH;
543 i = (int) (data->s_mark - data->s_base);
544 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
548 data->s_base = newss;
549 data->s_mark = newss + i;
551 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
555 data->l_base = newvs;
556 data->l_mark = newvs + i;
558 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
559 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
563 data->p_base = newps;
564 data->p_mark = newps + i;
567 data->stacksize = newsize;
568 data->s_last = data->s_base + newsize - 1;
572 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
577 #if YYPURE || defined(YY_NO_LEAKS)
578 static void yyfreestack(YYSTACKDATA *data)
582 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
585 memset(data, 0, sizeof(*data));
588 #define yyfreestack(data) /* nothing */
589 #endif /* YYPURE || defined(YY_NO_LEAKS) */
592 static YYParseState *
593 yyNewState(unsigned size)
595 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
596 if (p == NULL) return NULL;
598 p->yystack.stacksize = size;
601 p->yystack.s_base = NULL;
602 p->yystack.l_base = NULL;
603 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
604 p->yystack.p_base = NULL;
608 p->yystack.s_base = (short *) malloc(size * sizeof(short));
609 if (p->yystack.s_base == NULL) return NULL;
610 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
611 if (p->yystack.l_base == NULL) return NULL;
612 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
613 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
614 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
615 if (p->yystack.p_base == NULL) return NULL;
616 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
623 yyFreeState(YYParseState *p)
625 yyfreestack(&p->yystack);
628 #endif /* YYBTYACC */
630 #define YYABORT goto yyabort
631 #define YYREJECT goto yyabort
632 #define YYACCEPT goto yyaccept
633 #define YYERROR goto yyerrlab
635 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
636 #define YYVALID_NESTED do { if (yyps->save && \
637 yyps->save->save == 0) goto yyvalid; } while(0)
638 #endif /* YYBTYACC */
643 int yym, yyn, yystate, yyresult;
646 YYParseState *yyerrctx = NULL;
647 #endif /* YYBTYACC */
648 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
649 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
654 if ((yys = getenv("YYDEBUG")) != 0)
657 if (yyn >= '0' && yyn <= '9')
661 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
665 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
667 #endif /* YYBTYACC */
674 memset(&yystack, 0, sizeof(yystack));
677 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
678 yystack.s_mark = yystack.s_base;
679 yystack.l_mark = yystack.l_base;
680 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
681 yystack.p_mark = yystack.p_base;
687 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
694 /* we're currently re-reading tokens */
696 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
704 /* in trial mode; save scanner results for future parse attempts */
705 if (yylvp == yylvlim)
706 { /* Enlarge lexical value queue */
707 size_t p = (size_t) (yylvp - yylvals);
708 size_t s = (size_t) (yylvlim - yylvals);
710 s += YYLVQUEUEGROWTH;
711 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
712 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
713 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
714 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
716 yylvp = yylve = yylvals + p;
717 yylvlim = yylvals + s;
718 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
719 yylpp = yylpe = yylpsns + p;
720 yylplim = yylpsns + s;
722 yylexp = yylexemes + p;
724 *yylexp = (short) YYLEX;
727 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
734 /* normal operation, no conflict encountered */
735 #endif /* YYBTYACC */
739 #endif /* YYBTYACC */
740 if (yychar < 0) yychar = YYEOF;
741 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
745 yys = yyname[YYTRANSLATE(yychar)];
746 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
747 YYDEBUGSTR, yydepth, yystate, yychar, yys);
748 #ifdef YYSTYPE_TOSTRING
751 #endif /* YYBTYACC */
752 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
760 /* Do we have a conflict? */
761 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
762 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
771 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
772 YYDEBUGSTR, yydepth, yystate);
774 /* Switch to the next conflict context */
779 if (save->state != yystate) YYABORT;
786 /* Unresolved conflict - start/continue trial parse */
791 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
793 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
795 fputs("Starting trial parse.\n", stderr);
798 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
799 if (save == NULL) goto yyenomem;
800 save->save = yyps->save;
801 save->state = yystate;
802 save->errflag = yyerrflag;
803 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
804 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
805 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
806 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
807 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
808 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
809 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
812 if (yyctable[ctry] == -1)
815 if (yydebug && yychar >= YYEOF)
816 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
821 if (yyps->save == NULL)
823 /* If this is a first conflict in the stack, start saving lexemes */
826 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
827 if (yylexemes == NULL) goto yyenomem;
828 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
829 if (yylvals == NULL) goto yyenomem;
830 yylvlim = yylvals + YYLVQUEUEGROWTH;
831 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
832 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
833 if (yylpsns == NULL) goto yyenomem;
834 yylplim = yylpsns + YYLVQUEUEGROWTH;
839 yylvp = yylve = yylvals;
840 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
841 yylpp = yylpe = yylpsns;
847 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
850 *yylexp = (short) yychar;
858 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
864 save->lexeme = (int) (yylvp - yylvals);
867 if (yytable[yyn] == ctry)
871 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
872 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
877 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
882 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
884 yystate = yyctable[ctry];
885 *++yystack.s_mark = (short) yystate;
886 *++yystack.l_mark = yylval;
887 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
888 *++yystack.p_mark = yylloc;
891 if (yyerrflag > 0) --yyerrflag;
896 yyn = yyctable[ctry];
899 } /* End of code dealing with conflicts */
900 #endif /* YYBTYACC */
901 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
902 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
906 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
907 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
909 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
910 yystate = yytable[yyn];
911 *++yystack.s_mark = yytable[yyn];
912 *++yystack.l_mark = yylval;
913 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
914 *++yystack.p_mark = yylloc;
917 if (yyerrflag > 0) --yyerrflag;
920 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
921 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
926 if (yyerrflag != 0) goto yyinrecovery;
939 YYParseState *save = yyps->save;
942 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
943 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
944 (int)(yylvp - yylvals - yyps->save->lexeme));
946 /* Memorize most forward-looking error state in case it's really an error. */
947 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
949 /* Free old saved error context state */
950 if (yyerrctx) yyFreeState(yyerrctx);
951 /* Create and fill out new saved error context state */
952 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
953 if (yyerrctx == NULL) goto yyenomem;
954 yyerrctx->save = yyps->save;
955 yyerrctx->state = yystate;
956 yyerrctx->errflag = yyerrflag;
957 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
958 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
959 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
960 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
961 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
962 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
963 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
965 yyerrctx->lexeme = (int) (yylvp - yylvals);
967 yylvp = yylvals + save->lexeme;
968 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
969 yylpp = yylpsns + save->lexeme;
971 yylexp = yylexemes + save->lexeme;
973 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
974 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
975 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
976 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
977 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
978 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
979 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
982 yystate = save->state;
983 /* We tried shift, try reduce now */
984 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
985 yyps->save = save->save;
989 /* Nothing left on the stack -- error */
994 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
997 /* Restore state as it was in the most forward-advanced error */
998 yylvp = yylvals + yyerrctx->lexeme;
999 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1000 yylpp = yylpsns + yyerrctx->lexeme;
1002 yylexp = yylexemes + yyerrctx->lexeme;
1003 yychar = yylexp[-1];
1005 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1008 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1009 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1010 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1011 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1012 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1013 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1014 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1016 yystate = yyerrctx->state;
1017 yyFreeState(yyerrctx);
1022 if (yynewerrflag == 0) goto yyinrecovery;
1023 #endif /* YYBTYACC */
1025 YYERROR_CALL("syntax error");
1026 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1027 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1042 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1043 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1047 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1048 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1050 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1051 yystate = yytable[yyn];
1052 *++yystack.s_mark = yytable[yyn];
1053 *++yystack.l_mark = yylval;
1054 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1055 /* lookahead position is error end position */
1056 yyerror_loc_range[1] = yylloc;
1057 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1058 *++yystack.p_mark = yyloc;
1066 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1067 YYDEBUGSTR, yydepth, *yystack.s_mark);
1069 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1070 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1071 /* the current TOS position is the error start position */
1072 yyerror_loc_range[0] = *yystack.p_mark;
1074 #if defined(YYDESTRUCT_CALL)
1077 #endif /* YYBTYACC */
1078 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1079 YYDESTRUCT_CALL("error: discarding state",
1080 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1082 YYDESTRUCT_CALL("error: discarding state",
1083 yystos[*yystack.s_mark], yystack.l_mark);
1084 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1085 #endif /* defined(YYDESTRUCT_CALL) */
1088 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1096 if (yychar == YYEOF) goto yyabort;
1100 yys = yyname[YYTRANSLATE(yychar)];
1101 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1102 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1105 #if defined(YYDESTRUCT_CALL)
1108 #endif /* YYBTYACC */
1109 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1110 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1112 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1113 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1114 #endif /* defined(YYDESTRUCT_CALL) */
1124 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1125 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1126 #ifdef YYSTYPE_TOSTRING
1129 #endif /* YYBTYACC */
1134 for (i = yym; i > 0; i--)
1136 if (i != yym) fputs(", ", stderr);
1137 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1138 yystack.l_mark[1-i]), stderr);
1143 fputc('\n', stderr);
1147 yyval = yystack.l_mark[1-yym];
1149 memset(&yyval, 0, sizeof yyval);
1150 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1152 /* Perform position reduction */
1153 memset(&yyloc, 0, sizeof(yyloc));
1156 #endif /* YYBTYACC */
1158 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1159 /* just in case YYERROR is invoked within the action, save
1160 the start of the rhs as the error start position */
1161 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1169 #line 62 "btyacc_destroy1.y"
1170 { yyval.nlist = yystack.l_mark[-5].nlist; }
1174 #line 64 "btyacc_destroy1.y"
1175 { yyval.nlist = yystack.l_mark[-3].nlist; }
1179 #line 67 "btyacc_destroy1.y"
1180 { yyval.cval = cGLOBAL; }
1184 #line 68 "btyacc_destroy1.y"
1185 { yyval.cval = cLOCAL; }
1189 #line 71 "btyacc_destroy1.y"
1190 { yyval.tval = tREAL; }
1194 #line 72 "btyacc_destroy1.y"
1195 { yyval.tval = tINTEGER; }
1199 #line 76 "btyacc_destroy1.y"
1200 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
1201 yyval.nlist->next = yystack.l_mark[-1].nlist;
1206 #line 80 "btyacc_destroy1.y"
1207 { yyval.nlist->s = mksymbol(0, 0, yystack.l_mark[0].id);
1208 yyval.nlist->next = NULL;
1213 #line 86 "btyacc_destroy1.y"
1214 { yyval.nlist = yystack.l_mark[-5].nlist; }
1216 #line 1217 "btyacc_destroy1.tab.c"
1220 yystack.s_mark -= yym;
1221 yystate = *yystack.s_mark;
1222 yystack.l_mark -= yym;
1223 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1224 yystack.p_mark -= yym;
1227 if (yystate == 0 && yym == 0)
1232 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1233 #ifdef YYSTYPE_TOSTRING
1236 #endif /* YYBTYACC */
1237 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1239 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1243 *++yystack.s_mark = YYFINAL;
1244 *++yystack.l_mark = yyval;
1245 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1246 *++yystack.p_mark = yyloc;
1254 /* we're currently re-reading tokens */
1256 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1264 /* in trial mode; save scanner results for future parse attempts */
1265 if (yylvp == yylvlim)
1266 { /* Enlarge lexical value queue */
1267 size_t p = (size_t) (yylvp - yylvals);
1268 size_t s = (size_t) (yylvlim - yylvals);
1270 s += YYLVQUEUEGROWTH;
1271 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1273 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1275 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1276 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1279 yylvp = yylve = yylvals + p;
1280 yylvlim = yylvals + s;
1281 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1282 yylpp = yylpe = yylpsns + p;
1283 yylplim = yylpsns + s;
1285 yylexp = yylexemes + p;
1287 *yylexp = (short) YYLEX;
1290 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1297 /* normal operation, no conflict encountered */
1298 #endif /* YYBTYACC */
1302 #endif /* YYBTYACC */
1303 if (yychar < 0) yychar = YYEOF;
1304 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1308 yys = yyname[YYTRANSLATE(yychar)];
1309 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1310 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1314 if (yychar == YYEOF) goto yyaccept;
1317 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1318 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1319 yystate = yytable[yyn];
1321 yystate = yydgoto[yym];
1325 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1326 #ifdef YYSTYPE_TOSTRING
1329 #endif /* YYBTYACC */
1330 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1332 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1335 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1336 *++yystack.s_mark = (short) yystate;
1337 *++yystack.l_mark = yyval;
1338 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1339 *++yystack.p_mark = yyloc;
1344 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1346 if (yypath) YYABORT;
1349 YYParseState *save = yyps->save;
1350 yyps->save = save->save;
1351 save->save = yypath;
1356 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1357 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1361 yyFreeState(yyerrctx);
1364 yylvp = yylvals + yypath->lexeme;
1365 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1366 yylpp = yylpsns + yypath->lexeme;
1368 yylexp = yylexemes + yypath->lexeme;
1370 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1371 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1372 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1373 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1374 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1375 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1376 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1378 yystate = yypath->state;
1380 #endif /* YYBTYACC */
1383 YYERROR_CALL("yacc stack overflow");
1387 YYERROR_CALL("memory exhausted");
1389 #endif /* YYBTYACC */
1399 if (yyps->save) goto yyvalid;
1400 #endif /* YYBTYACC */
1404 #if defined(YYDESTRUCT_CALL)
1405 if (yychar != YYEOF && yychar != YYEMPTY)
1406 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1407 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1409 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1410 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1414 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1417 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1418 YYDESTRUCT_CALL("cleanup: discarding state",
1419 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1421 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1422 YYDESTRUCT_CALL("cleanup: discarding state",
1423 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1424 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1426 #endif /* defined(YYDESTRUCT_CALL) */
1431 yyFreeState(yyerrctx);
1436 YYParseState *save = yyps;
1443 YYParseState *save = yypath;
1444 yypath = save->save;
1448 #endif /* YYBTYACC */
1449 yyfreestack(&yystack);