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"
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 = (YYINT *)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 = (YYINT *) malloc(size * sizeof(YYINT));
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 */
676 memset(&yystack, 0, sizeof(yystack));
679 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
680 yystack.s_mark = yystack.s_base;
681 yystack.l_mark = yystack.l_base;
682 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
683 yystack.p_mark = yystack.p_base;
689 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
696 /* we're currently re-reading tokens */
698 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
706 /* in trial mode; save scanner results for future parse attempts */
707 if (yylvp == yylvlim)
708 { /* Enlarge lexical value queue */
709 size_t p = (size_t) (yylvp - yylvals);
710 size_t s = (size_t) (yylvlim - yylvals);
712 s += YYLVQUEUEGROWTH;
713 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
714 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
715 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
716 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
718 yylvp = yylve = yylvals + p;
719 yylvlim = yylvals + s;
720 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
721 yylpp = yylpe = yylpsns + p;
722 yylplim = yylpsns + s;
724 yylexp = yylexemes + p;
726 *yylexp = (short) YYLEX;
729 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
736 /* normal operation, no conflict encountered */
737 #endif /* YYBTYACC */
741 #endif /* YYBTYACC */
742 if (yychar < 0) yychar = YYEOF;
746 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
747 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
748 YYDEBUGSTR, yydepth, yystate, yychar, yys);
749 #ifdef YYSTYPE_TOSTRING
752 #endif /* YYBTYACC */
753 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
761 /* Do we have a conflict? */
762 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
763 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
772 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
773 YYDEBUGSTR, yydepth, yystate);
775 /* Switch to the next conflict context */
780 if (save->state != yystate) YYABORT;
787 /* Unresolved conflict - start/continue trial parse */
792 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
794 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
796 fputs("Starting trial parse.\n", stderr);
799 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
800 if (save == NULL) goto yyenomem;
801 save->save = yyps->save;
802 save->state = yystate;
803 save->errflag = yyerrflag;
804 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
805 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
806 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
807 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
808 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
809 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
810 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
813 if (yyctable[ctry] == -1)
816 if (yydebug && yychar >= YYEOF)
817 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
822 if (yyps->save == NULL)
824 /* If this is a first conflict in the stack, start saving lexemes */
827 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
828 if (yylexemes == NULL) goto yyenomem;
829 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
830 if (yylvals == NULL) goto yyenomem;
831 yylvlim = yylvals + YYLVQUEUEGROWTH;
832 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
833 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
834 if (yylpsns == NULL) goto yyenomem;
835 yylplim = yylpsns + YYLVQUEUEGROWTH;
840 yylvp = yylve = yylvals;
841 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
842 yylpp = yylpe = yylpsns;
848 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
851 *yylexp = (short) yychar;
859 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
865 save->lexeme = (int) (yylvp - yylvals);
868 if (yytable[yyn] == ctry)
872 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
873 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
878 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
883 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
885 yystate = yyctable[ctry];
886 *++yystack.s_mark = (YYINT) yystate;
887 *++yystack.l_mark = yylval;
888 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
889 *++yystack.p_mark = yylloc;
892 if (yyerrflag > 0) --yyerrflag;
897 yyn = yyctable[ctry];
900 } /* End of code dealing with conflicts */
901 #endif /* YYBTYACC */
902 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
903 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
907 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
908 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
910 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
911 yystate = yytable[yyn];
912 *++yystack.s_mark = yytable[yyn];
913 *++yystack.l_mark = yylval;
914 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
915 *++yystack.p_mark = yylloc;
918 if (yyerrflag > 0) --yyerrflag;
921 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
922 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
927 if (yyerrflag != 0) goto yyinrecovery;
932 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
935 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
936 * before looking for error recovery */
937 yystack.s_mark -= yym;
938 yystate = *yystack.s_mark;
939 yystack.l_mark -= yym;
940 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
941 yystack.p_mark -= yym;
949 YYParseState *save = yyps->save;
952 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
953 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
954 (int)(yylvp - yylvals - yyps->save->lexeme));
956 /* Memorize most forward-looking error state in case it's really an error. */
957 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
959 /* Free old saved error context state */
960 if (yyerrctx) yyFreeState(yyerrctx);
961 /* Create and fill out new saved error context state */
962 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
963 if (yyerrctx == NULL) goto yyenomem;
964 yyerrctx->save = yyps->save;
965 yyerrctx->state = yystate;
966 yyerrctx->errflag = yyerrflag;
967 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
968 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
969 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
970 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
971 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
972 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
973 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
975 yyerrctx->lexeme = (int) (yylvp - yylvals);
977 yylvp = yylvals + save->lexeme;
978 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
979 yylpp = yylpsns + save->lexeme;
981 yylexp = yylexemes + save->lexeme;
983 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
984 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
985 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
986 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
987 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
988 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
989 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
992 yystate = save->state;
993 /* We tried shift, try reduce now */
994 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
995 yyps->save = save->save;
999 /* Nothing left on the stack -- error */
1004 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1007 /* Restore state as it was in the most forward-advanced error */
1008 yylvp = yylvals + yyerrctx->lexeme;
1009 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1010 yylpp = yylpsns + yyerrctx->lexeme;
1012 yylexp = yylexemes + yyerrctx->lexeme;
1013 yychar = yylexp[-1];
1015 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1018 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1019 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1020 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1021 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1022 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1023 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1024 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1026 yystate = yyerrctx->state;
1027 yyFreeState(yyerrctx);
1032 if (yynewerrflag == 0) goto yyinrecovery;
1033 #endif /* YYBTYACC */
1035 YYERROR_CALL("syntax error");
1036 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1037 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1041 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1052 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1053 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1057 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1058 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1060 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1061 yystate = yytable[yyn];
1062 *++yystack.s_mark = yytable[yyn];
1063 *++yystack.l_mark = yylval;
1064 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1065 /* lookahead position is error end position */
1066 yyerror_loc_range[1] = yylloc;
1067 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1068 *++yystack.p_mark = yyloc;
1076 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1077 YYDEBUGSTR, yydepth, *yystack.s_mark);
1079 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1080 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1081 /* the current TOS position is the error start position */
1082 yyerror_loc_range[0] = *yystack.p_mark;
1084 #if defined(YYDESTRUCT_CALL)
1087 #endif /* YYBTYACC */
1088 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1089 YYDESTRUCT_CALL("error: discarding state",
1090 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1092 YYDESTRUCT_CALL("error: discarding state",
1093 yystos[*yystack.s_mark], yystack.l_mark);
1094 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1095 #endif /* defined(YYDESTRUCT_CALL) */
1098 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1106 if (yychar == YYEOF) goto yyabort;
1110 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1111 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1112 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1115 #if defined(YYDESTRUCT_CALL)
1118 #endif /* YYBTYACC */
1119 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1120 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1122 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1123 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1124 #endif /* defined(YYDESTRUCT_CALL) */
1134 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1135 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1136 #ifdef YYSTYPE_TOSTRING
1139 #endif /* YYBTYACC */
1144 for (i = yym; i > 0; i--)
1146 if (i != yym) fputs(", ", stderr);
1147 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1148 yystack.l_mark[1-i]), stderr);
1153 fputc('\n', stderr);
1157 yyval = yystack.l_mark[1-yym];
1159 memset(&yyval, 0, sizeof yyval);
1160 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1162 /* Perform position reduction */
1163 memset(&yyloc, 0, sizeof(yyloc));
1166 #endif /* YYBTYACC */
1168 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1169 /* just in case YYERROR is invoked within the action, save
1170 the start of the rhs as the error start position */
1171 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1179 #line 62 "btyacc_destroy1.y"
1180 { yyval.nlist = yystack.l_mark[-5].nlist; }
1184 #line 64 "btyacc_destroy1.y"
1185 { yyval.nlist = yystack.l_mark[-3].nlist; }
1189 #line 67 "btyacc_destroy1.y"
1190 { yyval.cval = cGLOBAL; }
1194 #line 68 "btyacc_destroy1.y"
1195 { yyval.cval = cLOCAL; }
1199 #line 71 "btyacc_destroy1.y"
1200 { yyval.tval = tREAL; }
1204 #line 72 "btyacc_destroy1.y"
1205 { yyval.tval = tINTEGER; }
1209 #line 76 "btyacc_destroy1.y"
1210 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
1211 yyval.nlist->next = yystack.l_mark[-1].nlist;
1216 #line 80 "btyacc_destroy1.y"
1217 { yyval.nlist->s = mksymbol(0, 0, yystack.l_mark[0].id);
1218 yyval.nlist->next = NULL;
1223 #line 86 "btyacc_destroy1.y"
1224 { yyval.nlist = yystack.l_mark[-5].nlist; }
1226 #line 1227 "btyacc_destroy1.tab.c"
1230 yystack.s_mark -= yym;
1231 yystate = *yystack.s_mark;
1232 yystack.l_mark -= yym;
1233 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1234 yystack.p_mark -= yym;
1237 if (yystate == 0 && yym == 0)
1242 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1243 #ifdef YYSTYPE_TOSTRING
1246 #endif /* YYBTYACC */
1247 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1249 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1253 *++yystack.s_mark = YYFINAL;
1254 *++yystack.l_mark = yyval;
1255 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1256 *++yystack.p_mark = yyloc;
1264 /* we're currently re-reading tokens */
1266 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1274 /* in trial mode; save scanner results for future parse attempts */
1275 if (yylvp == yylvlim)
1276 { /* Enlarge lexical value queue */
1277 size_t p = (size_t) (yylvp - yylvals);
1278 size_t s = (size_t) (yylvlim - yylvals);
1280 s += YYLVQUEUEGROWTH;
1281 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1283 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1285 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1286 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1289 yylvp = yylve = yylvals + p;
1290 yylvlim = yylvals + s;
1291 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1292 yylpp = yylpe = yylpsns + p;
1293 yylplim = yylpsns + s;
1295 yylexp = yylexemes + p;
1297 *yylexp = (short) YYLEX;
1300 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1307 /* normal operation, no conflict encountered */
1308 #endif /* YYBTYACC */
1312 #endif /* YYBTYACC */
1313 if (yychar < 0) yychar = YYEOF;
1317 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1318 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1319 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1323 if (yychar == YYEOF) goto yyaccept;
1326 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1327 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1328 yystate = yytable[yyn];
1330 yystate = yydgoto[yym];
1334 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1335 #ifdef YYSTYPE_TOSTRING
1338 #endif /* YYBTYACC */
1339 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1341 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1344 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1345 *++yystack.s_mark = (YYINT) yystate;
1346 *++yystack.l_mark = yyval;
1347 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1348 *++yystack.p_mark = yyloc;
1353 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1355 if (yypath) YYABORT;
1358 YYParseState *save = yyps->save;
1359 yyps->save = save->save;
1360 save->save = yypath;
1365 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1366 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1370 yyFreeState(yyerrctx);
1373 yylvp = yylvals + yypath->lexeme;
1374 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1375 yylpp = yylpsns + yypath->lexeme;
1377 yylexp = yylexemes + yypath->lexeme;
1379 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1380 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1381 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1382 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1383 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1384 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1385 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1387 yystate = yypath->state;
1389 #endif /* YYBTYACC */
1392 YYERROR_CALL("yacc stack overflow");
1396 YYERROR_CALL("memory exhausted");
1398 #endif /* YYBTYACC */
1408 if (yyps->save) goto yyvalid;
1409 #endif /* YYBTYACC */
1413 #if defined(YYDESTRUCT_CALL)
1414 if (yychar != YYEOF && yychar != YYEMPTY)
1415 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1416 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1418 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1419 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1423 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1426 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1427 YYDESTRUCT_CALL("cleanup: discarding state",
1428 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1430 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1431 YYDESTRUCT_CALL("cleanup: discarding state",
1432 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1433 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1435 #endif /* defined(YYDESTRUCT_CALL) */
1440 yyFreeState(yyerrctx);
1445 YYParseState *save = yyps;
1452 YYParseState *save = yypath;
1453 yypath = save->save;
1457 #endif /* YYBTYACC */
1458 yyfreestack(&yystack);