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 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,
314 16, -1, -1, -1, -1, -1, -1, -1, -1, -1,
315 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
316 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
317 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
318 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
319 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
320 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
321 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
322 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
323 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
324 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
325 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
326 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
327 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
328 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
329 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
330 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
331 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
332 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
340 #define YYMAXTOKEN 260
341 #define YYUNDFTOKEN 266
342 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
344 static const char *const calc1_name[] = {
346 "$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,
347 0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,0,0,
348 0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
349 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
350 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
351 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
352 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
353 "error","DREG","VREG","CONST","UMINUS","$accept","lines","dexp","vexp","line",
356 static const char *const calc1_rule[] = {
359 "lines : lines line '\\n'",
360 "lines : lines error '\\n'",
363 "line : DREG '=' dexp",
364 "line : VREG '=' vexp",
367 "dexp : dexp '+' dexp",
368 "dexp : dexp '-' dexp",
369 "dexp : dexp '*' dexp",
370 "dexp : dexp '/' dexp",
372 "dexp : '(' dexp ')'",
374 "vexp : '(' dexp ',' dexp ')'",
376 "vexp : vexp '+' vexp",
377 "vexp : dexp '+' vexp",
378 "vexp : vexp '-' vexp",
379 "vexp : dexp '-' vexp",
380 "vexp : vexp '*' vexp",
381 "vexp : dexp '*' vexp",
382 "vexp : vexp '/' vexp",
383 "vexp : dexp '/' vexp",
385 "vexp : '(' vexp ')'",
393 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
394 #ifndef YYLLOC_DEFAULT
395 #define YYLLOC_DEFAULT(loc, rhs, n) \
400 (loc).first_line = ((rhs)[-1]).last_line; \
401 (loc).first_column = ((rhs)[-1]).last_column; \
402 (loc).last_line = ((rhs)[-1]).last_line; \
403 (loc).last_column = ((rhs)[-1]).last_column; \
407 (loc).first_line = ((rhs)[ 0 ]).first_line; \
408 (loc).first_column = ((rhs)[ 0 ]).first_column; \
409 (loc).last_line = ((rhs)[n-1]).last_line; \
410 (loc).last_column = ((rhs)[n-1]).last_column; \
413 #endif /* YYLLOC_DEFAULT */
414 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
417 #ifndef YYLVQUEUEGROWTH
418 #define YYLVQUEUEGROWTH 32
420 #endif /* YYBTYACC */
422 /* define the initial stack-sizes */
425 #define YYMAXDEPTH YYSTACKSIZE
428 #define YYSTACKSIZE YYMAXDEPTH
430 #define YYSTACKSIZE 10000
431 #define YYMAXDEPTH 10000
435 #ifndef YYINITSTACKSIZE
436 #define YYINITSTACKSIZE 200
446 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
453 struct YYParseState_s
455 struct YYParseState_s *save; /* Previously saved parser state */
456 YYSTACKDATA yystack; /* saved parser stack */
457 int state; /* saved parser state */
458 int errflag; /* saved error recovery status */
459 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
460 YYINT ctry; /* saved index in yyctable[] for this conflict */
462 typedef struct YYParseState_s YYParseState;
463 #endif /* YYBTYACC */
464 #line 174 "btyacc_calc1.y"
465 /* beginning of subroutines section */
470 while(!feof(stdin)) {
476 #define BSZ 50 /* buffer size for floating point numbers */
481 fprintf(stderr, "%s\n", s);
484 /* lexical analysis */
491 while ((c = getchar()) == ' ')
492 { /* skip over blanks */
498 (*yylval).ival = c - 'A';
500 yylval.ival = c - 'A';
507 (*yylval).ival = c - 'a';
509 yylval.ival = c - 'a';
514 if (isdigit(c) || c == '.')
516 /* gobble up digits, points, exponents */
517 char buf[BSZ + 1], *cp = buf;
518 int dot = 0, expr = 0;
520 for (; (cp - buf) < BSZ; ++cp, c = getchar())
529 return ('.'); /* will cause syntax error */
536 return ('e'); /* will cause syntax error */
545 if ((cp - buf) >= BSZ)
546 printf("constant too long: truncated\n");
548 ungetc(c, stdin); /* push back last char read */
550 (*yylval).dval = atof(buf);
552 yylval.dval = atof(buf);
560 hilo(double a, double b, double c, double d)
562 /* returns the smallest interval containing a, b, c, and d */
563 /* used by *, / routines */
595 vmul(double a, double b, INTERVAL v)
597 return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
603 if (v.hi >= 0. && v.lo <= 0.)
605 printf("divisor interval contains 0.\n");
612 vdiv(double a, double b, INTERVAL v)
614 return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
616 #line 617 "btyacc_calc1.tab.c"
618 /* For use in generated program */
619 #define yydepth (int)(yystack.s_mark - yystack.s_base)
621 #define yytrial (yyps->save)
622 #endif /* YYBTYACC */
625 #include <stdio.h> /* needed for printf */
628 #include <stdlib.h> /* needed for malloc, etc */
629 #include <string.h> /* needed for memset */
631 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
632 static int yygrowstack(YYSTACKDATA *data)
638 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
642 if ((newsize = data->stacksize) == 0)
643 newsize = YYINITSTACKSIZE;
644 else if (newsize >= YYMAXDEPTH)
646 else if ((newsize *= 2) > YYMAXDEPTH)
647 newsize = YYMAXDEPTH;
649 i = (int) (data->s_mark - data->s_base);
650 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
654 data->s_base = newss;
655 data->s_mark = newss + i;
657 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
661 data->l_base = newvs;
662 data->l_mark = newvs + i;
664 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
665 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
669 data->p_base = newps;
670 data->p_mark = newps + i;
673 data->stacksize = newsize;
674 data->s_last = data->s_base + newsize - 1;
678 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
683 #if YYPURE || defined(YY_NO_LEAKS)
684 static void yyfreestack(YYSTACKDATA *data)
688 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
691 memset(data, 0, sizeof(*data));
694 #define yyfreestack(data) /* nothing */
695 #endif /* YYPURE || defined(YY_NO_LEAKS) */
698 static YYParseState *
699 yyNewState(unsigned size)
701 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
702 if (p == NULL) return NULL;
704 p->yystack.stacksize = size;
707 p->yystack.s_base = NULL;
708 p->yystack.l_base = NULL;
709 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
710 p->yystack.p_base = NULL;
714 p->yystack.s_base = (short *) malloc(size * sizeof(short));
715 if (p->yystack.s_base == NULL) return NULL;
716 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
717 if (p->yystack.l_base == NULL) return NULL;
718 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
719 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
720 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
721 if (p->yystack.p_base == NULL) return NULL;
722 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
729 yyFreeState(YYParseState *p)
731 yyfreestack(&p->yystack);
734 #endif /* YYBTYACC */
736 #define YYABORT goto yyabort
737 #define YYREJECT goto yyabort
738 #define YYACCEPT goto yyaccept
739 #define YYERROR goto yyerrlab
741 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
742 #define YYVALID_NESTED do { if (yyps->save && \
743 yyps->save->save == 0) goto yyvalid; } while(0)
744 #endif /* YYBTYACC */
753 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
754 YYLTYPE yyloc; /* position returned by actions */
755 YYLTYPE yylloc; /* position from the lexer */
758 /* variables for the parser stack */
762 /* Current parser state */
763 static YYParseState *yyps = 0;
765 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
766 static YYParseState *yypath = 0;
768 /* Base of the lexical value queue */
769 static YYSTYPE *yylvals = 0;
771 /* Current position at lexical value queue */
772 static YYSTYPE *yylvp = 0;
774 /* End position of lexical value queue */
775 static YYSTYPE *yylve = 0;
777 /* The last allocated position at the lexical value queue */
778 static YYSTYPE *yylvlim = 0;
780 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
781 /* Base of the lexical position queue */
782 static YYLTYPE *yylpsns = 0;
784 /* Current position at lexical position queue */
785 static YYLTYPE *yylpp = 0;
787 /* End position of lexical position queue */
788 static YYLTYPE *yylpe = 0;
790 /* The last allocated position at the lexical position queue */
791 static YYLTYPE *yylplim = 0;
794 /* Current position at lexical token queue */
795 static short *yylexp = 0;
797 static short *yylexemes = 0;
798 #endif /* YYBTYACC */
799 int yym, yyn, yystate, yyresult;
802 YYParseState *yyerrctx = NULL;
803 #endif /* YYBTYACC */
804 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
805 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
810 if ((yys = getenv("YYDEBUG")) != 0)
813 if (yyn >= '0' && yyn <= '9')
817 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
821 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
823 #endif /* YYBTYACC */
830 memset(&yystack, 0, sizeof(yystack));
833 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
834 yystack.s_mark = yystack.s_base;
835 yystack.l_mark = yystack.l_base;
836 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
837 yystack.p_mark = yystack.p_base;
843 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
850 /* we're currently re-reading tokens */
852 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
860 /* in trial mode; save scanner results for future parse attempts */
861 if (yylvp == yylvlim)
862 { /* Enlarge lexical value queue */
863 size_t p = (size_t) (yylvp - yylvals);
864 size_t s = (size_t) (yylvlim - yylvals);
866 s += YYLVQUEUEGROWTH;
867 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
868 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
869 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
870 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
872 yylvp = yylve = yylvals + p;
873 yylvlim = yylvals + s;
874 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
875 yylpp = yylpe = yylpsns + p;
876 yylplim = yylpsns + s;
878 yylexp = yylexemes + p;
880 *yylexp = (short) YYLEX;
883 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
890 /* normal operation, no conflict encountered */
891 #endif /* YYBTYACC */
895 #endif /* YYBTYACC */
896 if (yychar < 0) yychar = YYEOF;
897 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
901 yys = yyname[YYTRANSLATE(yychar)];
902 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
903 YYDEBUGSTR, yydepth, yystate, yychar, yys);
904 #ifdef YYSTYPE_TOSTRING
907 #endif /* YYBTYACC */
908 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
916 /* Do we have a conflict? */
917 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
918 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
927 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
928 YYDEBUGSTR, yydepth, yystate);
930 /* Switch to the next conflict context */
935 if (save->state != yystate) YYABORT;
942 /* Unresolved conflict - start/continue trial parse */
947 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
949 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
951 fputs("Starting trial parse.\n", stderr);
954 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
955 if (save == NULL) goto yyenomem;
956 save->save = yyps->save;
957 save->state = yystate;
958 save->errflag = yyerrflag;
959 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
960 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
961 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
962 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
963 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
964 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
965 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
968 if (yyctable[ctry] == -1)
971 if (yydebug && yychar >= YYEOF)
972 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
977 if (yyps->save == NULL)
979 /* If this is a first conflict in the stack, start saving lexemes */
982 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
983 if (yylexemes == NULL) goto yyenomem;
984 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
985 if (yylvals == NULL) goto yyenomem;
986 yylvlim = yylvals + YYLVQUEUEGROWTH;
987 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
988 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
989 if (yylpsns == NULL) goto yyenomem;
990 yylplim = yylpsns + YYLVQUEUEGROWTH;
995 yylvp = yylve = yylvals;
996 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
997 yylpp = yylpe = yylpsns;
1000 if (yychar >= YYEOF)
1003 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1006 *yylexp = (short) yychar;
1011 if (yychar >= YYEOF)
1014 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1020 save->lexeme = (int) (yylvp - yylvals);
1023 if (yytable[yyn] == ctry)
1027 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1028 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
1033 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1038 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
1040 yystate = yyctable[ctry];
1041 *++yystack.s_mark = (short) yystate;
1042 *++yystack.l_mark = yylval;
1043 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1044 *++yystack.p_mark = yylloc;
1047 if (yyerrflag > 0) --yyerrflag;
1052 yyn = yyctable[ctry];
1055 } /* End of code dealing with conflicts */
1056 #endif /* YYBTYACC */
1057 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1058 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1062 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1063 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
1065 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1066 yystate = yytable[yyn];
1067 *++yystack.s_mark = yytable[yyn];
1068 *++yystack.l_mark = yylval;
1069 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1070 *++yystack.p_mark = yylloc;
1073 if (yyerrflag > 0) --yyerrflag;
1076 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1077 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1082 if (yyerrflag != 0) goto yyinrecovery;
1095 YYParseState *save = yyps->save;
1098 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
1099 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
1100 (int)(yylvp - yylvals - yyps->save->lexeme));
1102 /* Memorize most forward-looking error state in case it's really an error. */
1103 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
1105 /* Free old saved error context state */
1106 if (yyerrctx) yyFreeState(yyerrctx);
1107 /* Create and fill out new saved error context state */
1108 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1109 if (yyerrctx == NULL) goto yyenomem;
1110 yyerrctx->save = yyps->save;
1111 yyerrctx->state = yystate;
1112 yyerrctx->errflag = yyerrflag;
1113 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1114 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1115 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1116 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1117 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1118 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1119 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1121 yyerrctx->lexeme = (int) (yylvp - yylvals);
1123 yylvp = yylvals + save->lexeme;
1124 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1125 yylpp = yylpsns + save->lexeme;
1127 yylexp = yylexemes + save->lexeme;
1129 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1130 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1131 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1132 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1133 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1134 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1135 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1137 ctry = ++save->ctry;
1138 yystate = save->state;
1139 /* We tried shift, try reduce now */
1140 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1141 yyps->save = save->save;
1145 /* Nothing left on the stack -- error */
1150 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1153 /* Restore state as it was in the most forward-advanced error */
1154 yylvp = yylvals + yyerrctx->lexeme;
1155 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1156 yylpp = yylpsns + yyerrctx->lexeme;
1158 yylexp = yylexemes + yyerrctx->lexeme;
1159 yychar = yylexp[-1];
1161 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1164 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1165 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1166 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1167 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1168 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1169 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1170 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1172 yystate = yyerrctx->state;
1173 yyFreeState(yyerrctx);
1178 if (yynewerrflag == 0) goto yyinrecovery;
1179 #endif /* YYBTYACC */
1181 YYERROR_CALL("syntax error");
1182 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1183 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1198 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1199 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1203 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1204 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1206 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1207 yystate = yytable[yyn];
1208 *++yystack.s_mark = yytable[yyn];
1209 *++yystack.l_mark = yylval;
1210 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1211 /* lookahead position is error end position */
1212 yyerror_loc_range[1] = yylloc;
1213 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1214 *++yystack.p_mark = yyloc;
1222 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1223 YYDEBUGSTR, yydepth, *yystack.s_mark);
1225 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1226 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1227 /* the current TOS position is the error start position */
1228 yyerror_loc_range[0] = *yystack.p_mark;
1230 #if defined(YYDESTRUCT_CALL)
1233 #endif /* YYBTYACC */
1234 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1235 YYDESTRUCT_CALL("error: discarding state",
1236 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1238 YYDESTRUCT_CALL("error: discarding state",
1239 yystos[*yystack.s_mark], yystack.l_mark);
1240 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1241 #endif /* defined(YYDESTRUCT_CALL) */
1244 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1252 if (yychar == YYEOF) goto yyabort;
1256 yys = yyname[YYTRANSLATE(yychar)];
1257 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1258 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1261 #if defined(YYDESTRUCT_CALL)
1264 #endif /* YYBTYACC */
1265 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1266 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1268 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1269 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1270 #endif /* defined(YYDESTRUCT_CALL) */
1280 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1281 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1282 #ifdef YYSTYPE_TOSTRING
1285 #endif /* YYBTYACC */
1290 for (i = yym; i > 0; i--)
1292 if (i != yym) fputs(", ", stderr);
1293 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1294 yystack.l_mark[1-i]), stderr);
1299 fputc('\n', stderr);
1303 yyval = yystack.l_mark[1-yym];
1305 memset(&yyval, 0, sizeof yyval);
1306 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1308 /* Perform position reduction */
1309 memset(&yyloc, 0, sizeof(yyloc));
1312 #endif /* YYBTYACC */
1314 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1315 /* just in case YYERROR is invoked within the action, save
1316 the start of the rhs as the error start position */
1317 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1324 #line 51 "btyacc_calc1.y"
1328 #line 52 "btyacc_calc1.y"
1329 {YYVALID;} if (!yytrial)
1330 #line 53 "btyacc_calc1.y"
1337 #line 59 "btyacc_calc1.y"
1339 (void) printf("%15.8f\n", yystack.l_mark[0].dval);
1344 #line 63 "btyacc_calc1.y"
1346 (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[0].vval.lo, yystack.l_mark[0].vval.hi);
1351 #line 67 "btyacc_calc1.y"
1353 dreg[yystack.l_mark[-2].ival] = yystack.l_mark[0].dval;
1358 #line 71 "btyacc_calc1.y"
1360 vreg[yystack.l_mark[-2].ival] = yystack.l_mark[0].vval;
1365 #line 78 "btyacc_calc1.y"
1367 yyval.dval = dreg[yystack.l_mark[0].ival];
1372 #line 82 "btyacc_calc1.y"
1374 yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
1379 #line 86 "btyacc_calc1.y"
1381 yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
1386 #line 90 "btyacc_calc1.y"
1388 yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
1393 #line 94 "btyacc_calc1.y"
1395 yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
1400 #line 98 "btyacc_calc1.y"
1402 yyval.dval = -yystack.l_mark[0].dval;
1407 #line 102 "btyacc_calc1.y"
1409 yyval.dval = yystack.l_mark[-1].dval;
1414 #line 108 "btyacc_calc1.y"
1416 yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
1421 #line 112 "btyacc_calc1.y"
1423 yyval.vval.lo = yystack.l_mark[-3].dval;
1424 yyval.vval.hi = yystack.l_mark[-1].dval;
1425 if ( yyval.vval.lo > yyval.vval.hi )
1427 (void) printf("interval out of order\n");
1434 #line 122 "btyacc_calc1.y"
1436 yyval.vval = vreg[yystack.l_mark[0].ival];
1441 #line 126 "btyacc_calc1.y"
1443 yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
1444 yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
1449 #line 131 "btyacc_calc1.y"
1451 yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
1452 yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
1457 #line 136 "btyacc_calc1.y"
1459 yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
1460 yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
1465 #line 141 "btyacc_calc1.y"
1467 yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
1468 yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
1473 #line 146 "btyacc_calc1.y"
1475 yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
1480 #line 150 "btyacc_calc1.y"
1482 yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
1487 #line 154 "btyacc_calc1.y"
1489 if (dcheck(yystack.l_mark[0].vval)) YYERROR;
1490 yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
1495 #line 159 "btyacc_calc1.y"
1497 if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
1498 yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
1503 #line 164 "btyacc_calc1.y"
1505 yyval.vval.hi = -yystack.l_mark[0].vval.lo;
1506 yyval.vval.lo = -yystack.l_mark[0].vval.hi;
1511 #line 169 "btyacc_calc1.y"
1513 yyval.vval = yystack.l_mark[-1].vval;
1516 #line 1517 "btyacc_calc1.tab.c"
1520 yystack.s_mark -= yym;
1521 yystate = *yystack.s_mark;
1522 yystack.l_mark -= yym;
1523 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1524 yystack.p_mark -= yym;
1527 if (yystate == 0 && yym == 0)
1532 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1533 #ifdef YYSTYPE_TOSTRING
1536 #endif /* YYBTYACC */
1537 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1539 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1543 *++yystack.s_mark = YYFINAL;
1544 *++yystack.l_mark = yyval;
1545 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1546 *++yystack.p_mark = yyloc;
1554 /* we're currently re-reading tokens */
1556 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1564 /* in trial mode; save scanner results for future parse attempts */
1565 if (yylvp == yylvlim)
1566 { /* Enlarge lexical value queue */
1567 size_t p = (size_t) (yylvp - yylvals);
1568 size_t s = (size_t) (yylvlim - yylvals);
1570 s += YYLVQUEUEGROWTH;
1571 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1573 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1575 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1576 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1579 yylvp = yylve = yylvals + p;
1580 yylvlim = yylvals + s;
1581 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1582 yylpp = yylpe = yylpsns + p;
1583 yylplim = yylpsns + s;
1585 yylexp = yylexemes + p;
1587 *yylexp = (short) YYLEX;
1590 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1597 /* normal operation, no conflict encountered */
1598 #endif /* YYBTYACC */
1602 #endif /* YYBTYACC */
1603 if (yychar < 0) yychar = YYEOF;
1604 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1608 yys = yyname[YYTRANSLATE(yychar)];
1609 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1610 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1614 if (yychar == YYEOF) goto yyaccept;
1617 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1618 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1619 yystate = yytable[yyn];
1621 yystate = yydgoto[yym];
1625 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1626 #ifdef YYSTYPE_TOSTRING
1629 #endif /* YYBTYACC */
1630 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1632 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1635 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1636 *++yystack.s_mark = (short) yystate;
1637 *++yystack.l_mark = yyval;
1638 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1639 *++yystack.p_mark = yyloc;
1644 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1646 if (yypath) YYABORT;
1649 YYParseState *save = yyps->save;
1650 yyps->save = save->save;
1651 save->save = yypath;
1656 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1657 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1661 yyFreeState(yyerrctx);
1664 yylvp = yylvals + yypath->lexeme;
1665 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1666 yylpp = yylpsns + yypath->lexeme;
1668 yylexp = yylexemes + yypath->lexeme;
1670 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1671 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1672 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1673 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1674 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1675 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1676 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1678 yystate = yypath->state;
1680 #endif /* YYBTYACC */
1683 YYERROR_CALL("yacc stack overflow");
1687 YYERROR_CALL("memory exhausted");
1689 #endif /* YYBTYACC */
1699 if (yyps->save) goto yyvalid;
1700 #endif /* YYBTYACC */
1704 #if defined(YYDESTRUCT_CALL)
1705 if (yychar != YYEOF && yychar != YYEMPTY)
1706 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1707 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1709 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1710 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1714 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1717 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1718 YYDESTRUCT_CALL("cleanup: discarding state",
1719 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1721 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1722 YYDESTRUCT_CALL("cleanup: discarding state",
1723 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1724 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1726 #endif /* defined(YYDESTRUCT_CALL) */
1731 yyFreeState(yyerrctx);
1736 YYParseState *save = yyps;
1743 YYParseState *save = yypath;
1744 yypath = save->save;
1748 #endif /* YYBTYACC */
1749 yyfreestack(&yystack);