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);
144 #undef YYSTYPE_IS_DECLARED
145 #define YYSTYPE_IS_DECLARED 1
147 #ifndef YYSTYPE_IS_DECLARED
148 #define YYSTYPE_IS_DECLARED 1
149 #line 29 "btyacc_calc1.y"
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 = (YYINT *)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 = (YYINT *) malloc(size * sizeof(YYINT));
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 */
832 memset(&yystack, 0, sizeof(yystack));
835 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
836 yystack.s_mark = yystack.s_base;
837 yystack.l_mark = yystack.l_base;
838 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
839 yystack.p_mark = yystack.p_base;
845 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
852 /* we're currently re-reading tokens */
854 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
862 /* in trial mode; save scanner results for future parse attempts */
863 if (yylvp == yylvlim)
864 { /* Enlarge lexical value queue */
865 size_t p = (size_t) (yylvp - yylvals);
866 size_t s = (size_t) (yylvlim - yylvals);
868 s += YYLVQUEUEGROWTH;
869 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
870 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
871 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
872 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
874 yylvp = yylve = yylvals + p;
875 yylvlim = yylvals + s;
876 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
877 yylpp = yylpe = yylpsns + p;
878 yylplim = yylpsns + s;
880 yylexp = yylexemes + p;
882 *yylexp = (short) YYLEX;
885 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
892 /* normal operation, no conflict encountered */
893 #endif /* YYBTYACC */
897 #endif /* YYBTYACC */
898 if (yychar < 0) yychar = YYEOF;
902 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
903 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
904 YYDEBUGSTR, yydepth, yystate, yychar, yys);
905 #ifdef YYSTYPE_TOSTRING
908 #endif /* YYBTYACC */
909 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
917 /* Do we have a conflict? */
918 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
919 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
928 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
929 YYDEBUGSTR, yydepth, yystate);
931 /* Switch to the next conflict context */
936 if (save->state != yystate) YYABORT;
943 /* Unresolved conflict - start/continue trial parse */
948 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
950 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
952 fputs("Starting trial parse.\n", stderr);
955 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
956 if (save == NULL) goto yyenomem;
957 save->save = yyps->save;
958 save->state = yystate;
959 save->errflag = yyerrflag;
960 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
961 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
962 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
963 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
964 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
965 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
966 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
969 if (yyctable[ctry] == -1)
972 if (yydebug && yychar >= YYEOF)
973 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
978 if (yyps->save == NULL)
980 /* If this is a first conflict in the stack, start saving lexemes */
983 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
984 if (yylexemes == NULL) goto yyenomem;
985 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
986 if (yylvals == NULL) goto yyenomem;
987 yylvlim = yylvals + YYLVQUEUEGROWTH;
988 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
989 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
990 if (yylpsns == NULL) goto yyenomem;
991 yylplim = yylpsns + YYLVQUEUEGROWTH;
996 yylvp = yylve = yylvals;
997 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
998 yylpp = yylpe = yylpsns;
1001 if (yychar >= YYEOF)
1004 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1007 *yylexp = (short) yychar;
1012 if (yychar >= YYEOF)
1015 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1021 save->lexeme = (int) (yylvp - yylvals);
1024 if (yytable[yyn] == ctry)
1028 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1029 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
1034 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1039 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
1041 yystate = yyctable[ctry];
1042 *++yystack.s_mark = (YYINT) yystate;
1043 *++yystack.l_mark = yylval;
1044 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1045 *++yystack.p_mark = yylloc;
1048 if (yyerrflag > 0) --yyerrflag;
1053 yyn = yyctable[ctry];
1056 } /* End of code dealing with conflicts */
1057 #endif /* YYBTYACC */
1058 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1059 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1063 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1064 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
1066 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1067 yystate = yytable[yyn];
1068 *++yystack.s_mark = yytable[yyn];
1069 *++yystack.l_mark = yylval;
1070 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1071 *++yystack.p_mark = yylloc;
1074 if (yyerrflag > 0) --yyerrflag;
1077 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1078 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1083 if (yyerrflag != 0) goto yyinrecovery;
1088 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1091 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
1092 * before looking for error recovery */
1093 yystack.s_mark -= yym;
1094 yystate = *yystack.s_mark;
1095 yystack.l_mark -= yym;
1096 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1097 yystack.p_mark -= yym;
1105 YYParseState *save = yyps->save;
1108 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
1109 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
1110 (int)(yylvp - yylvals - yyps->save->lexeme));
1112 /* Memorize most forward-looking error state in case it's really an error. */
1113 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
1115 /* Free old saved error context state */
1116 if (yyerrctx) yyFreeState(yyerrctx);
1117 /* Create and fill out new saved error context state */
1118 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1119 if (yyerrctx == NULL) goto yyenomem;
1120 yyerrctx->save = yyps->save;
1121 yyerrctx->state = yystate;
1122 yyerrctx->errflag = yyerrflag;
1123 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1124 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1125 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1126 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1127 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1128 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1129 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1131 yyerrctx->lexeme = (int) (yylvp - yylvals);
1133 yylvp = yylvals + save->lexeme;
1134 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1135 yylpp = yylpsns + save->lexeme;
1137 yylexp = yylexemes + save->lexeme;
1139 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1140 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1141 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1142 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1143 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1144 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1145 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1147 ctry = ++save->ctry;
1148 yystate = save->state;
1149 /* We tried shift, try reduce now */
1150 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1151 yyps->save = save->save;
1155 /* Nothing left on the stack -- error */
1160 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1163 /* Restore state as it was in the most forward-advanced error */
1164 yylvp = yylvals + yyerrctx->lexeme;
1165 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1166 yylpp = yylpsns + yyerrctx->lexeme;
1168 yylexp = yylexemes + yyerrctx->lexeme;
1169 yychar = yylexp[-1];
1171 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1174 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1175 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1176 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1177 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1178 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1179 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1180 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1182 yystate = yyerrctx->state;
1183 yyFreeState(yyerrctx);
1188 if (yynewerrflag == 0) goto yyinrecovery;
1189 #endif /* YYBTYACC */
1191 YYERROR_CALL("syntax error");
1192 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1193 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1197 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1208 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1209 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1213 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1214 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1216 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1217 yystate = yytable[yyn];
1218 *++yystack.s_mark = yytable[yyn];
1219 *++yystack.l_mark = yylval;
1220 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1221 /* lookahead position is error end position */
1222 yyerror_loc_range[1] = yylloc;
1223 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1224 *++yystack.p_mark = yyloc;
1232 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1233 YYDEBUGSTR, yydepth, *yystack.s_mark);
1235 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1236 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1237 /* the current TOS position is the error start position */
1238 yyerror_loc_range[0] = *yystack.p_mark;
1240 #if defined(YYDESTRUCT_CALL)
1243 #endif /* YYBTYACC */
1244 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1245 YYDESTRUCT_CALL("error: discarding state",
1246 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1248 YYDESTRUCT_CALL("error: discarding state",
1249 yystos[*yystack.s_mark], yystack.l_mark);
1250 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1251 #endif /* defined(YYDESTRUCT_CALL) */
1254 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1262 if (yychar == YYEOF) goto yyabort;
1266 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1267 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1268 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1271 #if defined(YYDESTRUCT_CALL)
1274 #endif /* YYBTYACC */
1275 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1276 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1278 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1279 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1280 #endif /* defined(YYDESTRUCT_CALL) */
1290 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1291 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1292 #ifdef YYSTYPE_TOSTRING
1295 #endif /* YYBTYACC */
1300 for (i = yym; i > 0; i--)
1302 if (i != yym) fputs(", ", stderr);
1303 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1304 yystack.l_mark[1-i]), stderr);
1309 fputc('\n', stderr);
1313 yyval = yystack.l_mark[1-yym];
1315 memset(&yyval, 0, sizeof yyval);
1316 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1318 /* Perform position reduction */
1319 memset(&yyloc, 0, sizeof(yyloc));
1322 #endif /* YYBTYACC */
1324 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1325 /* just in case YYERROR is invoked within the action, save
1326 the start of the rhs as the error start position */
1327 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1334 #line 51 "btyacc_calc1.y"
1338 #line 52 "btyacc_calc1.y"
1339 {YYVALID;} if (!yytrial)
1340 #line 53 "btyacc_calc1.y"
1347 #line 59 "btyacc_calc1.y"
1349 (void) printf("%15.8f\n", yystack.l_mark[0].dval);
1354 #line 63 "btyacc_calc1.y"
1356 (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[0].vval.lo, yystack.l_mark[0].vval.hi);
1361 #line 67 "btyacc_calc1.y"
1363 dreg[yystack.l_mark[-2].ival] = yystack.l_mark[0].dval;
1368 #line 71 "btyacc_calc1.y"
1370 vreg[yystack.l_mark[-2].ival] = yystack.l_mark[0].vval;
1375 #line 78 "btyacc_calc1.y"
1377 yyval.dval = dreg[yystack.l_mark[0].ival];
1382 #line 82 "btyacc_calc1.y"
1384 yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
1389 #line 86 "btyacc_calc1.y"
1391 yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
1396 #line 90 "btyacc_calc1.y"
1398 yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
1403 #line 94 "btyacc_calc1.y"
1405 yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
1410 #line 98 "btyacc_calc1.y"
1412 yyval.dval = -yystack.l_mark[0].dval;
1417 #line 102 "btyacc_calc1.y"
1419 yyval.dval = yystack.l_mark[-1].dval;
1424 #line 108 "btyacc_calc1.y"
1426 yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
1431 #line 112 "btyacc_calc1.y"
1433 yyval.vval.lo = yystack.l_mark[-3].dval;
1434 yyval.vval.hi = yystack.l_mark[-1].dval;
1435 if ( yyval.vval.lo > yyval.vval.hi )
1437 (void) printf("interval out of order\n");
1444 #line 122 "btyacc_calc1.y"
1446 yyval.vval = vreg[yystack.l_mark[0].ival];
1451 #line 126 "btyacc_calc1.y"
1453 yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
1454 yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
1459 #line 131 "btyacc_calc1.y"
1461 yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
1462 yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
1467 #line 136 "btyacc_calc1.y"
1469 yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
1470 yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
1475 #line 141 "btyacc_calc1.y"
1477 yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
1478 yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
1483 #line 146 "btyacc_calc1.y"
1485 yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
1490 #line 150 "btyacc_calc1.y"
1492 yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
1497 #line 154 "btyacc_calc1.y"
1499 if (dcheck(yystack.l_mark[0].vval)) YYERROR;
1500 yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
1505 #line 159 "btyacc_calc1.y"
1507 if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
1508 yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
1513 #line 164 "btyacc_calc1.y"
1515 yyval.vval.hi = -yystack.l_mark[0].vval.lo;
1516 yyval.vval.lo = -yystack.l_mark[0].vval.hi;
1521 #line 169 "btyacc_calc1.y"
1523 yyval.vval = yystack.l_mark[-1].vval;
1526 #line 1527 "btyacc_calc1.tab.c"
1530 yystack.s_mark -= yym;
1531 yystate = *yystack.s_mark;
1532 yystack.l_mark -= yym;
1533 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1534 yystack.p_mark -= yym;
1537 if (yystate == 0 && yym == 0)
1542 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1543 #ifdef YYSTYPE_TOSTRING
1546 #endif /* YYBTYACC */
1547 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1549 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1553 *++yystack.s_mark = YYFINAL;
1554 *++yystack.l_mark = yyval;
1555 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1556 *++yystack.p_mark = yyloc;
1564 /* we're currently re-reading tokens */
1566 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1574 /* in trial mode; save scanner results for future parse attempts */
1575 if (yylvp == yylvlim)
1576 { /* Enlarge lexical value queue */
1577 size_t p = (size_t) (yylvp - yylvals);
1578 size_t s = (size_t) (yylvlim - yylvals);
1580 s += YYLVQUEUEGROWTH;
1581 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1583 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1585 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1586 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1589 yylvp = yylve = yylvals + p;
1590 yylvlim = yylvals + s;
1591 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1592 yylpp = yylpe = yylpsns + p;
1593 yylplim = yylpsns + s;
1595 yylexp = yylexemes + p;
1597 *yylexp = (short) YYLEX;
1600 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1607 /* normal operation, no conflict encountered */
1608 #endif /* YYBTYACC */
1612 #endif /* YYBTYACC */
1613 if (yychar < 0) yychar = YYEOF;
1617 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1618 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1619 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1623 if (yychar == YYEOF) goto yyaccept;
1626 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1627 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1628 yystate = yytable[yyn];
1630 yystate = yydgoto[yym];
1634 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1635 #ifdef YYSTYPE_TOSTRING
1638 #endif /* YYBTYACC */
1639 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1641 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1644 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1645 *++yystack.s_mark = (YYINT) yystate;
1646 *++yystack.l_mark = yyval;
1647 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1648 *++yystack.p_mark = yyloc;
1653 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1655 if (yypath) YYABORT;
1658 YYParseState *save = yyps->save;
1659 yyps->save = save->save;
1660 save->save = yypath;
1665 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1666 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1670 yyFreeState(yyerrctx);
1673 yylvp = yylvals + yypath->lexeme;
1674 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1675 yylpp = yylpsns + yypath->lexeme;
1677 yylexp = yylexemes + yypath->lexeme;
1679 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1680 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1681 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1682 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1683 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1684 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1685 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1687 yystate = yypath->state;
1689 #endif /* YYBTYACC */
1692 YYERROR_CALL("yacc stack overflow");
1696 YYERROR_CALL("memory exhausted");
1698 #endif /* YYBTYACC */
1708 if (yyps->save) goto yyvalid;
1709 #endif /* YYBTYACC */
1713 #if defined(YYDESTRUCT_CALL)
1714 if (yychar != YYEOF && yychar != YYEMPTY)
1715 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1716 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1718 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1719 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1723 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1726 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1727 YYDESTRUCT_CALL("cleanup: discarding state",
1728 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1730 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1731 YYDESTRUCT_CALL("cleanup: discarding state",
1732 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1733 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1735 #endif /* defined(YYDESTRUCT_CALL) */
1740 yyFreeState(yyerrctx);
1745 YYParseState *save = yyps;
1752 YYParseState *save = yypath;
1753 yypath = save->save;
1757 #endif /* YYBTYACC */
1758 yyfreestack(&yystack);