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 calc1_parse
25 #define yylex calc1_lex
29 #define yyerror calc1_error
33 #define yychar calc1_char
37 #define yyval calc1_val
41 #define yylval calc1_lval
45 #define yydebug calc1_debug
49 #define yynerrs calc1_nerrs
53 #define yyerrflag calc1_errflag
54 #endif /* yyerrflag */
57 #define yylhs calc1_lhs
61 #define yylen calc1_len
65 #define yydefred calc1_defred
69 #define yystos calc1_stos
73 #define yydgoto calc1_dgoto
77 #define yysindex calc1_sindex
81 #define yyrindex calc1_rindex
85 #define yygindex calc1_gindex
89 #define yytable calc1_table
93 #define yycheck calc1_check
97 #define yyname calc1_name
101 #define yyrule calc1_rule
107 #define yycindex calc1_cindex
108 #endif /* yycindex */
111 #define yyctable calc1_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "calc1_"
120 #line 3 "btyacc_calc1.y"
122 /* http://dinosaur.compilertools.net/yacc/index.html */
129 typedef struct interval
135 INTERVAL vmul(double, double, INTERVAL);
136 INTERVAL vdiv(double, double, INTERVAL);
138 int dcheck(INTERVAL);
143 #line 29 "btyacc_calc1.y"
145 #undef YYSTYPE_IS_DECLARED
146 #define YYSTYPE_IS_DECLARED 1
148 #ifndef YYSTYPE_IS_DECLARED
149 #define YYSTYPE_IS_DECLARED 1
156 #endif /* !YYSTYPE_IS_DECLARED */
157 #line 158 "btyacc_calc1.tab.c"
159 /* compatibility with bison */
161 /* compatibility with FreeBSD */
162 # ifdef YYPARSE_PARAM_TYPE
163 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
165 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
168 # define YYPARSE_DECL() yyparse(void)
171 /* Parameters sent to lex. */
173 # ifdef YYLEX_PARAM_TYPE
174 # define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
176 # define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
178 # define YYLEX yylex(&yylval, YYLEX_PARAM)
180 # define YYLEX_DECL() yylex(YYSTYPE *yylval)
181 # define YYLEX yylex(&yylval)
184 /* Parameters sent to yyerror. */
186 #define YYERROR_DECL() yyerror(const char *s)
189 #define YYERROR_CALL(msg) yyerror(msg)
192 extern int YYPARSE_DECL();
198 #define YYERRCODE 256
200 static const YYINT calc1_lhs[] = { -1,
201 0, 0, 0, 3, 3, 3, 3, 1, 1, 1,
202 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
203 2, 2, 2, 2, 2, 2, 2, 2,
205 static const YYINT calc1_len[] = { 2,
206 0, 3, 3, 1, 1, 3, 3, 1, 1, 3,
207 3, 3, 3, 2, 3, 1, 5, 1, 3, 3,
208 3, 3, 3, 3, 3, 3, 2, 3,
210 static const YYINT calc1_defred[] = { 1,
211 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
212 3, 0, 0, 9, 18, 0, 27, 0, 0, 0,
213 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
214 0, 0, 0, 15, 0, 28, 0, 0, 0, 0,
215 0, 24, 0, 26, 0, 0, 23, 25, 14, 0,
216 0, 0, 0, 0, 0, 0, 0, 12, 13, 17,
218 static const YYINT calc1_stos[] = { 0,
219 262, 256, 257, 258, 259, 45, 40, 263, 264, 265,
220 10, 61, 61, 257, 258, 263, 264, 263, 264, 43,
221 45, 42, 47, 43, 45, 42, 47, 10, 45, 40,
222 263, 263, 264, 41, 44, 41, 263, 264, 263, 264,
223 263, 264, 263, 264, 264, 264, 264, 264, 263, 263,
224 43, 45, 42, 47, 263, 263, 263, 263, 263, 41,
226 static const YYINT calc1_dgoto[] = { 1,
229 static const YYINT calc1_sindex[] = { 0,
230 -40, -9, -59, -54, 0, -37, -37, 0, 82, 4,
231 0, -34, -37, 0, 0, 0, 0, -31, -25, -37,
232 -37, -37, -37, -37, -37, -37, -37, 0, -34, -34,
233 132, 0, 82, 0, -34, 0, 0, -12, 0, -12,
234 0, 0, 0, 0, -12, -12, 0, 0, 0, 112,
235 -34, -34, -34, -34, 119, -11, -11, 0, 0, 0,
237 static const YYINT calc1_rindex[] = { 0,
238 0, 0, 51, 58, 0, 0, 0, 0, 11, 0,
239 0, 0, 0, 0, 0, -16, 0, 0, 0, 0,
240 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
241 19, 9, 27, 0, 0, 0, -5, 41, -4, 77,
242 -2, 0, 8, 0, 78, 85, 0, 0, 0, 0,
243 0, 0, 0, 0, 0, 92, 99, 0, 0, 0,
246 static const YYINT calc1_cindex[] = { 0,
247 0, 0, 0, 0, 0, 0, 0, 65, 0, 0,
248 0, 0, 0, 0, 0, 2, 0, 126, 0, 0,
249 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
250 0, 138, 0, 0, 0, 0, 17, 0, 24, 0,
251 31, 0, 38, 0, 0, 0, 0, 0, 0, 0,
252 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
255 static const YYINT calc1_gindex[] = { 0,
258 #define YYTABLESIZE 225
259 static const YYINT calc1_table[] = { 7,
260 11, 12, 7, 8, 6, 30, 13, 6, 16, 18,
261 29, 14, 35, 28, 31, 36, 26, 24, 16, 25,
262 5, 27, 37, 39, 41, 43, 20, 14, 6, 26,
263 53, 49, 50, 23, 27, 54, 7, 55, 10, 11,
264 26, 12, 14, 14, 14, 0, 14, 29, 14, 16,
265 20, 13, 0, 56, 57, 58, 59, 20, 6, 20,
266 9, 20, 0, 9, 23, 6, 23, 18, 23, 0,
267 9, 26, 26, 26, 11, 26, 0, 26, 29, 29,
268 29, 20, 29, 20, 29, 20, 22, 19, 0, 0,
269 0, 0, 9, 9, 21, 9, 0, 9, 0, 18,
270 18, 10, 18, 0, 18, 0, 6, 0, 11, 3,
271 0, 9, 0, 0, 0, 0, 0, 22, 19, 22,
272 19, 22, 19, 26, 24, 21, 25, 21, 27, 21,
273 17, 19, 10, 0, 10, 0, 10, 33, 0, 11,
274 0, 11, 0, 11, 38, 40, 42, 44, 45, 46,
275 47, 48, 34, 53, 51, 0, 52, 0, 54, 60,
276 53, 51, 0, 52, 0, 54, 18, 6, 0, 0,
277 3, 0, 9, 53, 51, 0, 52, 0, 54, 6,
278 0, 0, 3, 0, 9, 0, 0, 0, 0, 0,
279 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
280 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
281 0, 0, 0, 0, 0, 2, 3, 4, 5, 14,
284 static const YYINT calc1_check[] = { 40,
285 10, 61, 40, 1, 45, 40, 61, 45, 6, 7,
286 45, 10, 44, 10, 12, 41, 42, 43, 10, 45,
287 10, 47, 20, 21, 22, 23, 10, 44, 10, 42,
288 42, 29, 30, 10, 47, 47, 10, 35, 44, 44,
289 10, 44, 41, 42, 43, -1, 45, 10, 47, 41,
290 10, 44, -1, 51, 52, 53, 54, 41, 42, 43,
291 10, 45, -1, 47, 41, 42, 43, 10, 45, -1,
292 47, 41, 42, 43, 10, 45, -1, 47, 41, 42,
293 43, 41, 45, 43, 47, 45, 10, 10, -1, -1,
294 -1, -1, 42, 43, 10, 45, -1, 47, -1, 42,
295 43, 10, 45, -1, 47, -1, 42, 43, 10, 45,
296 -1, 47, -1, -1, -1, -1, -1, 41, 41, 43,
297 43, 45, 45, 42, 43, 41, 45, 43, 47, 45,
298 6, 7, 41, -1, 43, -1, 45, 13, -1, 41,
299 -1, 43, -1, 45, 20, 21, 22, 23, 24, 25,
300 26, 27, 41, 42, 43, -1, 45, -1, 47, 41,
301 42, 43, -1, 45, -1, 47, 41, 42, 43, -1,
302 45, -1, 47, 42, 43, -1, 45, -1, 47, 42,
303 43, -1, 45, -1, 47, -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, 256, 257, 258, 259, 257,
307 258, 259, 257, -1, 259,
310 static const YYINT calc1_ctable[] = { 20,
311 16, -1, 21, 16, -1, 22, 16, -1, 23, 16,
312 -1, 4, 16, -1, 14, 16, -1, 34, 16, -1,
313 10, 16, -1, 11, 16, -1, 12, 16, -1, 13,
321 #define YYMAXTOKEN 260
322 #define YYUNDFTOKEN 266
323 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
325 static const char *const calc1_name[] = {
327 "$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
328 0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,0,0,
329 0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
330 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
331 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
332 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
333 0,0,0,0,0,0,0,0,0,0,0,0,0,0,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 "error","DREG","VREG","CONST","UMINUS","$accept","lines","dexp","vexp","line",
337 static const char *const calc1_rule[] = {
340 "lines : lines line '\\n'",
341 "lines : lines error '\\n'",
344 "line : DREG '=' dexp",
345 "line : VREG '=' vexp",
348 "dexp : dexp '+' dexp",
349 "dexp : dexp '-' dexp",
350 "dexp : dexp '*' dexp",
351 "dexp : dexp '/' dexp",
353 "dexp : '(' dexp ')'",
355 "vexp : '(' dexp ',' dexp ')'",
357 "vexp : vexp '+' vexp",
358 "vexp : dexp '+' vexp",
359 "vexp : vexp '-' vexp",
360 "vexp : dexp '-' vexp",
361 "vexp : vexp '*' vexp",
362 "vexp : dexp '*' vexp",
363 "vexp : vexp '/' vexp",
364 "vexp : dexp '/' vexp",
366 "vexp : '(' vexp ')'",
374 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
375 #ifndef YYLLOC_DEFAULT
376 #define YYLLOC_DEFAULT(loc, rhs, n) \
381 (loc).first_line = ((rhs)[-1]).last_line; \
382 (loc).first_column = ((rhs)[-1]).last_column; \
383 (loc).last_line = ((rhs)[-1]).last_line; \
384 (loc).last_column = ((rhs)[-1]).last_column; \
388 (loc).first_line = ((rhs)[ 0 ]).first_line; \
389 (loc).first_column = ((rhs)[ 0 ]).first_column; \
390 (loc).last_line = ((rhs)[n-1]).last_line; \
391 (loc).last_column = ((rhs)[n-1]).last_column; \
394 #endif /* YYLLOC_DEFAULT */
395 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
398 #ifndef YYLVQUEUEGROWTH
399 #define YYLVQUEUEGROWTH 32
401 #endif /* YYBTYACC */
403 /* define the initial stack-sizes */
406 #define YYMAXDEPTH YYSTACKSIZE
409 #define YYSTACKSIZE YYMAXDEPTH
411 #define YYSTACKSIZE 10000
412 #define YYMAXDEPTH 10000
416 #ifndef YYINITSTACKSIZE
417 #define YYINITSTACKSIZE 200
427 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
434 struct YYParseState_s
436 struct YYParseState_s *save; /* Previously saved parser state */
437 YYSTACKDATA yystack; /* saved parser stack */
438 int state; /* saved parser state */
439 int errflag; /* saved error recovery status */
440 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
441 YYINT ctry; /* saved index in yyctable[] for this conflict */
443 typedef struct YYParseState_s YYParseState;
444 #endif /* YYBTYACC */
445 #line 174 "btyacc_calc1.y"
446 /* beginning of subroutines section */
451 while(!feof(stdin)) {
457 #define BSZ 50 /* buffer size for floating point numbers */
462 fprintf(stderr, "%s\n", s);
465 /* lexical analysis */
472 while ((c = getchar()) == ' ')
473 { /* skip over blanks */
479 (*yylval).ival = c - 'A';
481 yylval.ival = c - 'A';
488 (*yylval).ival = c - 'a';
490 yylval.ival = c - 'a';
495 if (isdigit(c) || c == '.')
497 /* gobble up digits, points, exponents */
498 char buf[BSZ + 1], *cp = buf;
499 int dot = 0, expr = 0;
501 for (; (cp - buf) < BSZ; ++cp, c = getchar())
510 return ('.'); /* will cause syntax error */
517 return ('e'); /* will cause syntax error */
526 if ((cp - buf) >= BSZ)
527 printf("constant too long: truncated\n");
529 ungetc(c, stdin); /* push back last char read */
531 (*yylval).dval = atof(buf);
533 yylval.dval = atof(buf);
541 hilo(double a, double b, double c, double d)
543 /* returns the smallest interval containing a, b, c, and d */
544 /* used by *, / routines */
576 vmul(double a, double b, INTERVAL v)
578 return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
584 if (v.hi >= 0. && v.lo <= 0.)
586 printf("divisor interval contains 0.\n");
593 vdiv(double a, double b, INTERVAL v)
595 return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
597 #line 598 "btyacc_calc1.tab.c"
599 /* For use in generated program */
600 #define yydepth (int)(yystack.s_mark - yystack.s_base)
602 #define yytrial (yyps->save)
603 #endif /* YYBTYACC */
606 #include <stdio.h> /* needed for printf */
609 #include <stdlib.h> /* needed for malloc, etc */
610 #include <string.h> /* needed for memset */
612 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
613 static int yygrowstack(YYSTACKDATA *data)
619 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
623 if ((newsize = data->stacksize) == 0)
624 newsize = YYINITSTACKSIZE;
625 else if (newsize >= YYMAXDEPTH)
627 else if ((newsize *= 2) > YYMAXDEPTH)
628 newsize = YYMAXDEPTH;
630 i = (int) (data->s_mark - data->s_base);
631 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
635 data->s_base = newss;
636 data->s_mark = newss + i;
638 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
642 data->l_base = newvs;
643 data->l_mark = newvs + i;
645 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
646 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
650 data->p_base = newps;
651 data->p_mark = newps + i;
654 data->stacksize = newsize;
655 data->s_last = data->s_base + newsize - 1;
659 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
664 #if YYPURE || defined(YY_NO_LEAKS)
665 static void yyfreestack(YYSTACKDATA *data)
669 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
672 memset(data, 0, sizeof(*data));
675 #define yyfreestack(data) /* nothing */
676 #endif /* YYPURE || defined(YY_NO_LEAKS) */
679 static YYParseState *
680 yyNewState(unsigned size)
682 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
683 if (p == NULL) return NULL;
685 p->yystack.stacksize = size;
688 p->yystack.s_base = NULL;
689 p->yystack.l_base = NULL;
690 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
691 p->yystack.p_base = NULL;
695 p->yystack.s_base = (short *) malloc(size * sizeof(short));
696 if (p->yystack.s_base == NULL) return NULL;
697 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
698 if (p->yystack.l_base == NULL) return NULL;
699 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
700 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
701 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
702 if (p->yystack.p_base == NULL) return NULL;
703 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
710 yyFreeState(YYParseState *p)
712 yyfreestack(&p->yystack);
715 #endif /* YYBTYACC */
717 #define YYABORT goto yyabort
718 #define YYREJECT goto yyabort
719 #define YYACCEPT goto yyaccept
720 #define YYERROR goto yyerrlab
722 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
723 #define YYVALID_NESTED do { if (yyps->save && \
724 yyps->save->save == 0) goto yyvalid; } while(0)
725 #endif /* YYBTYACC */
734 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
735 YYLTYPE yyloc; /* position returned by actions */
736 YYLTYPE yylloc; /* position from the lexer */
739 /* variables for the parser stack */
743 /* Current parser state */
744 static YYParseState *yyps = 0;
746 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
747 static YYParseState *yypath = 0;
749 /* Base of the lexical value queue */
750 static YYSTYPE *yylvals = 0;
752 /* Current position at lexical value queue */
753 static YYSTYPE *yylvp = 0;
755 /* End position of lexical value queue */
756 static YYSTYPE *yylve = 0;
758 /* The last allocated position at the lexical value queue */
759 static YYSTYPE *yylvlim = 0;
761 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
762 /* Base of the lexical position queue */
763 static YYLTYPE *yylpsns = 0;
765 /* Current position at lexical position queue */
766 static YYLTYPE *yylpp = 0;
768 /* End position of lexical position queue */
769 static YYLTYPE *yylpe = 0;
771 /* The last allocated position at the lexical position queue */
772 static YYLTYPE *yylplim = 0;
775 /* Current position at lexical token queue */
776 static short *yylexp = 0;
778 static short *yylexemes = 0;
779 #endif /* YYBTYACC */
780 int yym, yyn, yystate, yyresult;
783 YYParseState *yyerrctx = NULL;
784 #endif /* YYBTYACC */
785 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
786 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
791 if ((yys = getenv("YYDEBUG")) != 0)
794 if (yyn >= '0' && yyn <= '9')
798 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
802 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
804 #endif /* YYBTYACC */
811 memset(&yystack, 0, sizeof(yystack));
814 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
815 yystack.s_mark = yystack.s_base;
816 yystack.l_mark = yystack.l_base;
817 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
818 yystack.p_mark = yystack.p_base;
824 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
831 /* we're currently re-reading tokens */
833 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
841 /* in trial mode; save scanner results for future parse attempts */
842 if (yylvp == yylvlim)
843 { /* Enlarge lexical value queue */
844 int p = yylvp - yylvals;
845 int s = yylvlim - yylvals;
847 s += YYLVQUEUEGROWTH;
848 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
849 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
850 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
851 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
853 yylvp = yylve = yylvals + p;
854 yylvlim = yylvals + s;
855 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
856 yylpp = yylpe = yylpsns + p;
857 yylplim = yylpsns + s;
859 yylexp = yylexemes + p;
861 *yylexp = (short) YYLEX;
864 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
871 /* normal operation, no conflict encountered */
872 #endif /* YYBTYACC */
876 #endif /* YYBTYACC */
877 if (yychar < 0) yychar = YYEOF;
878 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
882 yys = yyname[YYTRANSLATE(yychar)];
883 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
884 YYDEBUGSTR, yydepth, yystate, yychar, yys);
885 #ifdef YYSTYPE_TOSTRING
888 #endif /* YYBTYACC */
889 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
897 /* Do we have a conflict? */
898 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
899 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
908 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
909 YYDEBUGSTR, yydepth, yystate);
911 /* Switch to the next conflict context */
916 if (save->state != yystate) YYABORT;
923 /* Unresolved conflict - start/continue trial parse */
928 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
930 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
932 fputs("Starting trial parse.\n", stderr);
935 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
936 if (save == NULL) goto yyenomem;
937 save->save = yyps->save;
938 save->state = yystate;
939 save->errflag = yyerrflag;
940 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
941 memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
942 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
943 memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
944 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
945 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
946 memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
949 if (yyctable[ctry] == -1)
952 if (yydebug && yychar >= YYEOF)
953 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
958 if (yyps->save == NULL)
960 /* If this is a first conflict in the stack, start saving lexemes */
963 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
964 if (yylexemes == NULL) goto yyenomem;
965 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
966 if (yylvals == NULL) goto yyenomem;
967 yylvlim = yylvals + YYLVQUEUEGROWTH;
968 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
969 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
970 if (yylpsns == NULL) goto yyenomem;
971 yylplim = yylpsns + YYLVQUEUEGROWTH;
976 yylvp = yylve = yylvals;
977 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
978 yylpp = yylpe = yylpsns;
984 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
987 *yylexp = (short) yychar;
995 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1001 save->lexeme = yylvp - yylvals;
1004 if (yytable[yyn] == ctry)
1008 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1009 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
1014 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1019 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
1021 yystate = yyctable[ctry];
1022 *++yystack.s_mark = (short) yystate;
1023 *++yystack.l_mark = yylval;
1024 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1025 *++yystack.p_mark = yylloc;
1028 if (yyerrflag > 0) --yyerrflag;
1033 yyn = yyctable[ctry];
1036 } /* End of code dealing with conflicts */
1037 #endif /* YYBTYACC */
1038 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1039 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1043 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1044 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
1046 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1047 yystate = yytable[yyn];
1048 *++yystack.s_mark = yytable[yyn];
1049 *++yystack.l_mark = yylval;
1050 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1051 *++yystack.p_mark = yylloc;
1054 if (yyerrflag > 0) --yyerrflag;
1057 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1058 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1063 if (yyerrflag != 0) goto yyinrecovery;
1076 YYParseState *save = yyps->save;
1079 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
1080 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
1081 (int)(yylvp - yylvals - yyps->save->lexeme));
1083 /* Memorize most forward-looking error state in case it's really an error. */
1084 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
1086 /* Free old saved error context state */
1087 if (yyerrctx) yyFreeState(yyerrctx);
1088 /* Create and fill out new saved error context state */
1089 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1090 if (yyerrctx == NULL) goto yyenomem;
1091 yyerrctx->save = yyps->save;
1092 yyerrctx->state = yystate;
1093 yyerrctx->errflag = yyerrflag;
1094 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1095 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1096 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1097 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1098 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1099 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1100 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1102 yyerrctx->lexeme = yylvp - yylvals;
1104 yylvp = yylvals + save->lexeme;
1105 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1106 yylpp = yylpsns + save->lexeme;
1108 yylexp = yylexemes + save->lexeme;
1110 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1111 memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1112 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1113 memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1114 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1115 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1116 memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1118 ctry = ++save->ctry;
1119 yystate = save->state;
1120 /* We tried shift, try reduce now */
1121 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1122 yyps->save = save->save;
1126 /* Nothing left on the stack -- error */
1131 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1134 /* Restore state as it was in the most forward-advanced error */
1135 yylvp = yylvals + yyerrctx->lexeme;
1136 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1137 yylpp = yylpsns + yyerrctx->lexeme;
1139 yylexp = yylexemes + yyerrctx->lexeme;
1140 yychar = yylexp[-1];
1142 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1145 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1146 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1147 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1148 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1149 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1150 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1151 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1153 yystate = yyerrctx->state;
1154 yyFreeState(yyerrctx);
1159 if (yynewerrflag == 0) goto yyinrecovery;
1160 #endif /* YYBTYACC */
1162 YYERROR_CALL("syntax error");
1163 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1164 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1179 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1180 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1184 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1185 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1187 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1188 yystate = yytable[yyn];
1189 *++yystack.s_mark = yytable[yyn];
1190 *++yystack.l_mark = yylval;
1191 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1192 /* lookahead position is error end position */
1193 yyerror_loc_range[1] = yylloc;
1194 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1195 *++yystack.p_mark = yyloc;
1203 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1204 YYDEBUGSTR, yydepth, *yystack.s_mark);
1206 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1207 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1208 /* the current TOS position is the error start position */
1209 yyerror_loc_range[0] = *yystack.p_mark;
1211 #if defined(YYDESTRUCT_CALL)
1214 #endif /* YYBTYACC */
1215 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1216 YYDESTRUCT_CALL("error: discarding state",
1217 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1219 YYDESTRUCT_CALL("error: discarding state",
1220 yystos[*yystack.s_mark], yystack.l_mark);
1221 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1222 #endif /* defined(YYDESTRUCT_CALL) */
1225 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1233 if (yychar == YYEOF) goto yyabort;
1237 yys = yyname[YYTRANSLATE(yychar)];
1238 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1239 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1242 #if defined(YYDESTRUCT_CALL)
1245 #endif /* YYBTYACC */
1246 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1247 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1249 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1250 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1251 #endif /* defined(YYDESTRUCT_CALL) */
1261 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1262 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1263 #ifdef YYSTYPE_TOSTRING
1266 #endif /* YYBTYACC */
1271 for (i = yym; i > 0; i--)
1273 if (i != yym) fputs(", ", stderr);
1274 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1275 yystack.l_mark[1-i]), stderr);
1280 fputc('\n', stderr);
1284 yyval = yystack.l_mark[1-yym];
1286 memset(&yyval, 0, sizeof yyval);
1287 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1289 /* Perform position reduction */
1290 memset(&yyloc, 0, sizeof(yyloc));
1293 #endif /* YYBTYACC */
1295 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1296 /* just in case YYERROR is invoked within the action, save
1297 the start of the rhs as the error start position */
1298 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1305 #line 51 "btyacc_calc1.y"
1309 #line 52 "btyacc_calc1.y"
1310 {YYVALID;} if (!yytrial)
1311 #line 53 "btyacc_calc1.y"
1318 #line 59 "btyacc_calc1.y"
1320 (void) printf("%15.8f\n", yystack.l_mark[0].dval);
1325 #line 63 "btyacc_calc1.y"
1327 (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[0].vval.lo, yystack.l_mark[0].vval.hi);
1332 #line 67 "btyacc_calc1.y"
1334 dreg[yystack.l_mark[-2].ival] = yystack.l_mark[0].dval;
1339 #line 71 "btyacc_calc1.y"
1341 vreg[yystack.l_mark[-2].ival] = yystack.l_mark[0].vval;
1346 #line 78 "btyacc_calc1.y"
1348 yyval.dval = dreg[yystack.l_mark[0].ival];
1353 #line 82 "btyacc_calc1.y"
1355 yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
1360 #line 86 "btyacc_calc1.y"
1362 yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
1367 #line 90 "btyacc_calc1.y"
1369 yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
1374 #line 94 "btyacc_calc1.y"
1376 yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
1381 #line 98 "btyacc_calc1.y"
1383 yyval.dval = -yystack.l_mark[0].dval;
1388 #line 102 "btyacc_calc1.y"
1390 yyval.dval = yystack.l_mark[-1].dval;
1395 #line 108 "btyacc_calc1.y"
1397 yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
1402 #line 112 "btyacc_calc1.y"
1404 yyval.vval.lo = yystack.l_mark[-3].dval;
1405 yyval.vval.hi = yystack.l_mark[-1].dval;
1406 if ( yyval.vval.lo > yyval.vval.hi )
1408 (void) printf("interval out of order\n");
1415 #line 122 "btyacc_calc1.y"
1417 yyval.vval = vreg[yystack.l_mark[0].ival];
1422 #line 126 "btyacc_calc1.y"
1424 yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
1425 yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
1430 #line 131 "btyacc_calc1.y"
1432 yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
1433 yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
1438 #line 136 "btyacc_calc1.y"
1440 yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
1441 yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
1446 #line 141 "btyacc_calc1.y"
1448 yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
1449 yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
1454 #line 146 "btyacc_calc1.y"
1456 yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
1461 #line 150 "btyacc_calc1.y"
1463 yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
1468 #line 154 "btyacc_calc1.y"
1470 if (dcheck(yystack.l_mark[0].vval)) YYERROR;
1471 yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
1476 #line 159 "btyacc_calc1.y"
1478 if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
1479 yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
1484 #line 164 "btyacc_calc1.y"
1486 yyval.vval.hi = -yystack.l_mark[0].vval.lo;
1487 yyval.vval.lo = -yystack.l_mark[0].vval.hi;
1492 #line 169 "btyacc_calc1.y"
1494 yyval.vval = yystack.l_mark[-1].vval;
1497 #line 1498 "btyacc_calc1.tab.c"
1501 yystack.s_mark -= yym;
1502 yystate = *yystack.s_mark;
1503 yystack.l_mark -= yym;
1504 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1505 yystack.p_mark -= yym;
1508 if (yystate == 0 && yym == 0)
1513 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1514 #ifdef YYSTYPE_TOSTRING
1517 #endif /* YYBTYACC */
1518 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1520 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1524 *++yystack.s_mark = YYFINAL;
1525 *++yystack.l_mark = yyval;
1526 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1527 *++yystack.p_mark = yyloc;
1535 /* we're currently re-reading tokens */
1537 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1545 /* in trial mode; save scanner results for future parse attempts */
1546 if (yylvp == yylvlim)
1547 { /* Enlarge lexical value queue */
1548 int p = yylvp - yylvals;
1549 int s = yylvlim - yylvals;
1551 s += YYLVQUEUEGROWTH;
1552 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1554 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1556 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1557 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1560 yylvp = yylve = yylvals + p;
1561 yylvlim = yylvals + s;
1562 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1563 yylpp = yylpe = yylpsns + p;
1564 yylplim = yylpsns + s;
1566 yylexp = yylexemes + p;
1568 *yylexp = (short) YYLEX;
1571 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1578 /* normal operation, no conflict encountered */
1579 #endif /* YYBTYACC */
1583 #endif /* YYBTYACC */
1584 if (yychar < 0) yychar = YYEOF;
1585 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1589 yys = yyname[YYTRANSLATE(yychar)];
1590 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1591 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1595 if (yychar == YYEOF) goto yyaccept;
1598 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1599 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1600 yystate = yytable[yyn];
1602 yystate = yydgoto[yym];
1606 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1607 #ifdef YYSTYPE_TOSTRING
1610 #endif /* YYBTYACC */
1611 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1613 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1616 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1617 *++yystack.s_mark = (short) yystate;
1618 *++yystack.l_mark = yyval;
1619 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1620 *++yystack.p_mark = yyloc;
1625 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1627 if (yypath) YYABORT;
1630 YYParseState *save = yyps->save;
1631 yyps->save = save->save;
1632 save->save = yypath;
1637 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1638 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1642 yyFreeState(yyerrctx);
1645 yylvp = yylvals + yypath->lexeme;
1646 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1647 yylpp = yylpsns + yypath->lexeme;
1649 yylexp = yylexemes + yypath->lexeme;
1651 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1652 memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1653 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1654 memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1655 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1656 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1657 memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1659 yystate = yypath->state;
1661 #endif /* YYBTYACC */
1664 YYERROR_CALL("yacc stack overflow");
1668 YYERROR_CALL("memory exhausted");
1670 #endif /* YYBTYACC */
1680 if (yyps->save) goto yyvalid;
1681 #endif /* YYBTYACC */
1685 #if defined(YYDESTRUCT_CALL)
1686 if (yychar != YYEOF && yychar != YYEMPTY)
1687 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1688 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1690 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1691 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1695 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1698 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1699 YYDESTRUCT_CALL("cleanup: discarding state",
1700 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1702 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1703 YYDESTRUCT_CALL("cleanup: discarding state",
1704 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1705 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1707 #endif /* defined(YYDESTRUCT_CALL) */
1712 yyFreeState(yyerrctx);
1717 YYParseState *save = yyps;
1724 YYParseState *save = yypath;
1725 yypath = save->save;
1729 #endif /* YYBTYACC */
1730 yyfreestack(&yystack);