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 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
219 static const YYINT calc1_stos[] = { 0,
220 262, 256, 257, 258, 259, 45, 40, 263, 264, 265,
221 10, 61, 61, 257, 258, 263, 264, 263, 264, 43,
222 45, 42, 47, 43, 45, 42, 47, 10, 45, 40,
223 263, 263, 264, 41, 44, 41, 263, 264, 263, 264,
224 263, 264, 263, 264, 264, 264, 264, 264, 263, 263,
225 43, 45, 42, 47, 263, 263, 263, 263, 263, 41,
227 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
228 static const YYINT calc1_dgoto[] = { 1,
231 static const YYINT calc1_sindex[] = { 0,
232 -40, -9, -59, -54, 0, -37, -37, 0, 82, 4,
233 0, -34, -37, 0, 0, 0, 0, -31, -25, -37,
234 -37, -37, -37, -37, -37, -37, -37, 0, -34, -34,
235 132, 0, 82, 0, -34, 0, 0, -12, 0, -12,
236 0, 0, 0, 0, -12, -12, 0, 0, 0, 112,
237 -34, -34, -34, -34, 119, -11, -11, 0, 0, 0,
239 static const YYINT calc1_rindex[] = { 0,
240 0, 0, 51, 58, 0, 0, 0, 0, 11, 0,
241 0, 0, 0, 0, 0, -16, 0, 0, 0, 0,
242 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
243 19, 9, 27, 0, 0, 0, -5, 41, -4, 77,
244 -2, 0, 8, 0, 78, 85, 0, 0, 0, 0,
245 0, 0, 0, 0, 0, 92, 99, 0, 0, 0,
248 static const YYINT calc1_cindex[] = { 0,
249 0, 0, 0, 0, 0, 0, 0, 65, 0, 0,
250 0, 0, 0, 0, 0, 2, 0, 126, 0, 0,
251 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
252 0, 138, 0, 0, 0, 0, 17, 0, 24, 0,
253 31, 0, 38, 0, 0, 0, 0, 0, 0, 0,
254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
257 static const YYINT calc1_gindex[] = { 0,
260 #define YYTABLESIZE 225
261 static const YYINT calc1_table[] = { 7,
262 11, 12, 7, 8, 6, 30, 13, 6, 16, 18,
263 29, 14, 35, 28, 31, 36, 26, 24, 16, 25,
264 5, 27, 37, 39, 41, 43, 20, 14, 6, 26,
265 53, 49, 50, 23, 27, 54, 7, 55, 10, 11,
266 26, 12, 14, 14, 14, 0, 14, 29, 14, 16,
267 20, 13, 0, 56, 57, 58, 59, 20, 6, 20,
268 9, 20, 0, 9, 23, 6, 23, 18, 23, 0,
269 9, 26, 26, 26, 11, 26, 0, 26, 29, 29,
270 29, 20, 29, 20, 29, 20, 22, 19, 0, 0,
271 0, 0, 9, 9, 21, 9, 0, 9, 0, 18,
272 18, 10, 18, 0, 18, 0, 6, 0, 11, 3,
273 0, 9, 0, 0, 0, 0, 0, 22, 19, 22,
274 19, 22, 19, 26, 24, 21, 25, 21, 27, 21,
275 17, 19, 10, 0, 10, 0, 10, 33, 0, 11,
276 0, 11, 0, 11, 38, 40, 42, 44, 45, 46,
277 47, 48, 34, 53, 51, 0, 52, 0, 54, 60,
278 53, 51, 0, 52, 0, 54, 18, 6, 0, 0,
279 3, 0, 9, 53, 51, 0, 52, 0, 54, 6,
280 0, 0, 3, 0, 9, 0, 0, 0, 0, 0,
281 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
282 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
283 0, 0, 0, 0, 0, 2, 3, 4, 5, 14,
286 static const YYINT calc1_check[] = { 40,
287 10, 61, 40, 1, 45, 40, 61, 45, 6, 7,
288 45, 10, 44, 10, 12, 41, 42, 43, 10, 45,
289 10, 47, 20, 21, 22, 23, 10, 44, 10, 42,
290 42, 29, 30, 10, 47, 47, 10, 35, 44, 44,
291 10, 44, 41, 42, 43, -1, 45, 10, 47, 41,
292 10, 44, -1, 51, 52, 53, 54, 41, 42, 43,
293 10, 45, -1, 47, 41, 42, 43, 10, 45, -1,
294 47, 41, 42, 43, 10, 45, -1, 47, 41, 42,
295 43, 41, 45, 43, 47, 45, 10, 10, -1, -1,
296 -1, -1, 42, 43, 10, 45, -1, 47, -1, 42,
297 43, 10, 45, -1, 47, -1, 42, 43, 10, 45,
298 -1, 47, -1, -1, -1, -1, -1, 41, 41, 43,
299 43, 45, 45, 42, 43, 41, 45, 43, 47, 45,
300 6, 7, 41, -1, 43, -1, 45, 13, -1, 41,
301 -1, 43, -1, 45, 20, 21, 22, 23, 24, 25,
302 26, 27, 41, 42, 43, -1, 45, -1, 47, 41,
303 42, 43, -1, 45, -1, 47, 41, 42, 43, -1,
304 45, -1, 47, 42, 43, -1, 45, -1, 47, 42,
305 43, -1, 45, -1, 47, -1, -1, -1, -1, -1,
306 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
307 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
308 -1, -1, -1, -1, -1, 256, 257, 258, 259, 257,
309 258, 259, 257, -1, 259,
312 static const YYINT calc1_ctable[] = { 20,
313 16, -1, 21, 16, -1, 22, 16, -1, 23, 16,
314 -1, 4, 16, -1, 14, 16, -1, 34, 16, -1,
315 10, 16, -1, 11, 16, -1, 12, 16, -1, 13,
316 16, -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,
333 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
334 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
342 #define YYMAXTOKEN 260
343 #define YYUNDFTOKEN 266
344 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
346 static const char *const calc1_name[] = {
348 "$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,
349 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,
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,0,0,
353 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
354 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
355 "error","DREG","VREG","CONST","UMINUS","$accept","lines","dexp","vexp","line",
358 static const char *const calc1_rule[] = {
361 "lines : lines line '\\n'",
362 "lines : lines error '\\n'",
365 "line : DREG '=' dexp",
366 "line : VREG '=' vexp",
369 "dexp : dexp '+' dexp",
370 "dexp : dexp '-' dexp",
371 "dexp : dexp '*' dexp",
372 "dexp : dexp '/' dexp",
374 "dexp : '(' dexp ')'",
376 "vexp : '(' dexp ',' dexp ')'",
378 "vexp : vexp '+' vexp",
379 "vexp : dexp '+' vexp",
380 "vexp : vexp '-' vexp",
381 "vexp : dexp '-' vexp",
382 "vexp : vexp '*' vexp",
383 "vexp : dexp '*' vexp",
384 "vexp : vexp '/' vexp",
385 "vexp : dexp '/' vexp",
387 "vexp : '(' vexp ')'",
395 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
396 #ifndef YYLLOC_DEFAULT
397 #define YYLLOC_DEFAULT(loc, rhs, n) \
402 (loc).first_line = ((rhs)[-1]).last_line; \
403 (loc).first_column = ((rhs)[-1]).last_column; \
404 (loc).last_line = ((rhs)[-1]).last_line; \
405 (loc).last_column = ((rhs)[-1]).last_column; \
409 (loc).first_line = ((rhs)[ 0 ]).first_line; \
410 (loc).first_column = ((rhs)[ 0 ]).first_column; \
411 (loc).last_line = ((rhs)[n-1]).last_line; \
412 (loc).last_column = ((rhs)[n-1]).last_column; \
415 #endif /* YYLLOC_DEFAULT */
416 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
419 #ifndef YYLVQUEUEGROWTH
420 #define YYLVQUEUEGROWTH 32
422 #endif /* YYBTYACC */
424 /* define the initial stack-sizes */
427 #define YYMAXDEPTH YYSTACKSIZE
430 #define YYSTACKSIZE YYMAXDEPTH
432 #define YYSTACKSIZE 10000
433 #define YYMAXDEPTH 10000
437 #ifndef YYINITSTACKSIZE
438 #define YYINITSTACKSIZE 200
448 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
455 struct YYParseState_s
457 struct YYParseState_s *save; /* Previously saved parser state */
458 YYSTACKDATA yystack; /* saved parser stack */
459 int state; /* saved parser state */
460 int errflag; /* saved error recovery status */
461 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
462 YYINT ctry; /* saved index in yyctable[] for this conflict */
464 typedef struct YYParseState_s YYParseState;
465 #endif /* YYBTYACC */
466 #line 174 "btyacc_calc1.y"
467 /* beginning of subroutines section */
472 while(!feof(stdin)) {
478 #define BSZ 50 /* buffer size for floating point numbers */
483 fprintf(stderr, "%s\n", s);
486 /* lexical analysis */
493 while ((c = getchar()) == ' ')
494 { /* skip over blanks */
500 (*yylval).ival = c - 'A';
502 yylval.ival = c - 'A';
509 (*yylval).ival = c - 'a';
511 yylval.ival = c - 'a';
516 if (isdigit(c) || c == '.')
518 /* gobble up digits, points, exponents */
519 char buf[BSZ + 1], *cp = buf;
520 int dot = 0, expr = 0;
522 for (; (cp - buf) < BSZ; ++cp, c = getchar())
531 return ('.'); /* will cause syntax error */
538 return ('e'); /* will cause syntax error */
547 if ((cp - buf) >= BSZ)
548 printf("constant too long: truncated\n");
550 ungetc(c, stdin); /* push back last char read */
552 (*yylval).dval = atof(buf);
554 yylval.dval = atof(buf);
562 hilo(double a, double b, double c, double d)
564 /* returns the smallest interval containing a, b, c, and d */
565 /* used by *, / routines */
597 vmul(double a, double b, INTERVAL v)
599 return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
605 if (v.hi >= 0. && v.lo <= 0.)
607 printf("divisor interval contains 0.\n");
614 vdiv(double a, double b, INTERVAL v)
616 return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
618 #line 619 "btyacc_calc1.tab.c"
620 /* For use in generated program */
621 #define yydepth (int)(yystack.s_mark - yystack.s_base)
623 #define yytrial (yyps->save)
624 #endif /* YYBTYACC */
627 #include <stdio.h> /* needed for printf */
630 #include <stdlib.h> /* needed for malloc, etc */
631 #include <string.h> /* needed for memset */
633 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
634 static int yygrowstack(YYSTACKDATA *data)
640 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
644 if ((newsize = data->stacksize) == 0)
645 newsize = YYINITSTACKSIZE;
646 else if (newsize >= YYMAXDEPTH)
648 else if ((newsize *= 2) > YYMAXDEPTH)
649 newsize = YYMAXDEPTH;
651 i = (int) (data->s_mark - data->s_base);
652 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
656 data->s_base = newss;
657 data->s_mark = newss + i;
659 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
663 data->l_base = newvs;
664 data->l_mark = newvs + i;
666 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
667 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
671 data->p_base = newps;
672 data->p_mark = newps + i;
675 data->stacksize = newsize;
676 data->s_last = data->s_base + newsize - 1;
680 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
685 #if YYPURE || defined(YY_NO_LEAKS)
686 static void yyfreestack(YYSTACKDATA *data)
690 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
693 memset(data, 0, sizeof(*data));
696 #define yyfreestack(data) /* nothing */
697 #endif /* YYPURE || defined(YY_NO_LEAKS) */
700 static YYParseState *
701 yyNewState(unsigned size)
703 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
704 if (p == NULL) return NULL;
706 p->yystack.stacksize = size;
709 p->yystack.s_base = NULL;
710 p->yystack.l_base = NULL;
711 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
712 p->yystack.p_base = NULL;
716 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
717 if (p->yystack.s_base == NULL) return NULL;
718 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
719 if (p->yystack.l_base == NULL) return NULL;
720 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
721 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
722 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
723 if (p->yystack.p_base == NULL) return NULL;
724 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
731 yyFreeState(YYParseState *p)
733 yyfreestack(&p->yystack);
736 #endif /* YYBTYACC */
738 #define YYABORT goto yyabort
739 #define YYREJECT goto yyabort
740 #define YYACCEPT goto yyaccept
741 #define YYERROR goto yyerrlab
743 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
744 #define YYVALID_NESTED do { if (yyps->save && \
745 yyps->save->save == 0) goto yyvalid; } while(0)
746 #endif /* YYBTYACC */
755 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
756 YYLTYPE yyloc; /* position returned by actions */
757 YYLTYPE yylloc; /* position from the lexer */
760 /* variables for the parser stack */
764 /* Current parser state */
765 static YYParseState *yyps = 0;
767 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
768 static YYParseState *yypath = 0;
770 /* Base of the lexical value queue */
771 static YYSTYPE *yylvals = 0;
773 /* Current position at lexical value queue */
774 static YYSTYPE *yylvp = 0;
776 /* End position of lexical value queue */
777 static YYSTYPE *yylve = 0;
779 /* The last allocated position at the lexical value queue */
780 static YYSTYPE *yylvlim = 0;
782 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
783 /* Base of the lexical position queue */
784 static YYLTYPE *yylpsns = 0;
786 /* Current position at lexical position queue */
787 static YYLTYPE *yylpp = 0;
789 /* End position of lexical position queue */
790 static YYLTYPE *yylpe = 0;
792 /* The last allocated position at the lexical position queue */
793 static YYLTYPE *yylplim = 0;
796 /* Current position at lexical token queue */
797 static YYINT *yylexp = 0;
799 static YYINT *yylexemes = 0;
800 #endif /* YYBTYACC */
801 int yym, yyn, yystate, yyresult;
804 YYParseState *yyerrctx = NULL;
805 #endif /* YYBTYACC */
806 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
807 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
812 if ((yys = getenv("YYDEBUG")) != 0)
815 if (yyn >= '0' && yyn <= '9')
819 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
823 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
825 #endif /* YYBTYACC */
834 memset(&yystack, 0, sizeof(yystack));
837 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
838 yystack.s_mark = yystack.s_base;
839 yystack.l_mark = yystack.l_base;
840 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
841 yystack.p_mark = yystack.p_base;
847 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
854 /* we're currently re-reading tokens */
856 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
864 /* in trial mode; save scanner results for future parse attempts */
865 if (yylvp == yylvlim)
866 { /* Enlarge lexical value queue */
867 size_t p = (size_t) (yylvp - yylvals);
868 size_t s = (size_t) (yylvlim - yylvals);
870 s += YYLVQUEUEGROWTH;
871 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
872 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
873 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
874 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
876 yylvp = yylve = yylvals + p;
877 yylvlim = yylvals + s;
878 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
879 yylpp = yylpe = yylpsns + p;
880 yylplim = yylpsns + s;
882 yylexp = yylexemes + p;
884 *yylexp = (YYINT) YYLEX;
887 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
894 /* normal operation, no conflict encountered */
895 #endif /* YYBTYACC */
899 #endif /* YYBTYACC */
900 if (yychar < 0) yychar = YYEOF;
904 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
905 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
906 YYDEBUGSTR, yydepth, yystate, yychar, yys);
907 #ifdef YYSTYPE_TOSTRING
910 #endif /* YYBTYACC */
911 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
919 /* Do we have a conflict? */
920 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
921 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
930 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
931 YYDEBUGSTR, yydepth, yystate);
933 /* Switch to the next conflict context */
938 if (save->state != yystate) YYABORT;
945 /* Unresolved conflict - start/continue trial parse */
950 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
952 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
954 fputs("Starting trial parse.\n", stderr);
957 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
958 if (save == NULL) goto yyenomem;
959 save->save = yyps->save;
960 save->state = yystate;
961 save->errflag = yyerrflag;
962 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
963 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
964 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
965 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
966 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
967 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
968 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
971 if (yyctable[ctry] == -1)
974 if (yydebug && yychar >= YYEOF)
975 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
980 if (yyps->save == NULL)
982 /* If this is a first conflict in the stack, start saving lexemes */
985 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
986 if (yylexemes == NULL) goto yyenomem;
987 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
988 if (yylvals == NULL) goto yyenomem;
989 yylvlim = yylvals + YYLVQUEUEGROWTH;
990 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
991 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
992 if (yylpsns == NULL) goto yyenomem;
993 yylplim = yylpsns + YYLVQUEUEGROWTH;
998 yylvp = yylve = yylvals;
999 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1000 yylpp = yylpe = yylpsns;
1003 if (yychar >= YYEOF)
1006 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1009 *yylexp = (YYINT) yychar;
1014 if (yychar >= YYEOF)
1017 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1023 save->lexeme = (int) (yylvp - yylvals);
1026 if (yytable[yyn] == ctry)
1030 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1031 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
1036 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1041 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
1043 yystate = yyctable[ctry];
1044 *++yystack.s_mark = (YYINT) yystate;
1045 *++yystack.l_mark = yylval;
1046 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1047 *++yystack.p_mark = yylloc;
1050 if (yyerrflag > 0) --yyerrflag;
1055 yyn = yyctable[ctry];
1058 } /* End of code dealing with conflicts */
1059 #endif /* YYBTYACC */
1060 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1061 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1065 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1066 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
1068 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1069 yystate = yytable[yyn];
1070 *++yystack.s_mark = yytable[yyn];
1071 *++yystack.l_mark = yylval;
1072 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1073 *++yystack.p_mark = yylloc;
1076 if (yyerrflag > 0) --yyerrflag;
1079 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1080 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1085 if (yyerrflag != 0) goto yyinrecovery;
1090 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1093 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
1094 * before looking for error recovery */
1095 yystack.s_mark -= yym;
1096 yystate = *yystack.s_mark;
1097 yystack.l_mark -= yym;
1098 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1099 yystack.p_mark -= yym;
1107 YYParseState *save = yyps->save;
1110 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
1111 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
1112 (int)(yylvp - yylvals - yyps->save->lexeme));
1114 /* Memorize most forward-looking error state in case it's really an error. */
1115 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
1117 /* Free old saved error context state */
1118 if (yyerrctx) yyFreeState(yyerrctx);
1119 /* Create and fill out new saved error context state */
1120 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1121 if (yyerrctx == NULL) goto yyenomem;
1122 yyerrctx->save = yyps->save;
1123 yyerrctx->state = yystate;
1124 yyerrctx->errflag = yyerrflag;
1125 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1126 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1127 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1128 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1129 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1130 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1131 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1133 yyerrctx->lexeme = (int) (yylvp - yylvals);
1135 yylvp = yylvals + save->lexeme;
1136 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1137 yylpp = yylpsns + save->lexeme;
1139 yylexp = yylexemes + save->lexeme;
1141 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1142 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1143 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1144 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1145 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1146 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1147 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1149 ctry = ++save->ctry;
1150 yystate = save->state;
1151 /* We tried shift, try reduce now */
1152 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1153 yyps->save = save->save;
1157 /* Nothing left on the stack -- error */
1162 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1165 /* Restore state as it was in the most forward-advanced error */
1166 yylvp = yylvals + yyerrctx->lexeme;
1167 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1168 yylpp = yylpsns + yyerrctx->lexeme;
1170 yylexp = yylexemes + yyerrctx->lexeme;
1171 yychar = yylexp[-1];
1173 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1176 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1177 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1178 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1179 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1180 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1181 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1182 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1184 yystate = yyerrctx->state;
1185 yyFreeState(yyerrctx);
1190 if (yynewerrflag == 0) goto yyinrecovery;
1191 #endif /* YYBTYACC */
1193 YYERROR_CALL("syntax error");
1194 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1195 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1199 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1210 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1211 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1215 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1216 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1218 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1219 yystate = yytable[yyn];
1220 *++yystack.s_mark = yytable[yyn];
1221 *++yystack.l_mark = yylval;
1222 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1223 /* lookahead position is error end position */
1224 yyerror_loc_range[1] = yylloc;
1225 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1226 *++yystack.p_mark = yyloc;
1234 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1235 YYDEBUGSTR, yydepth, *yystack.s_mark);
1237 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1238 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1239 /* the current TOS position is the error start position */
1240 yyerror_loc_range[0] = *yystack.p_mark;
1242 #if defined(YYDESTRUCT_CALL)
1245 #endif /* YYBTYACC */
1246 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1247 YYDESTRUCT_CALL("error: discarding state",
1248 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1250 YYDESTRUCT_CALL("error: discarding state",
1251 yystos[*yystack.s_mark], yystack.l_mark);
1252 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1253 #endif /* defined(YYDESTRUCT_CALL) */
1256 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1264 if (yychar == YYEOF) goto yyabort;
1268 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1269 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1270 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1273 #if defined(YYDESTRUCT_CALL)
1276 #endif /* YYBTYACC */
1277 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1278 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1280 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1281 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1282 #endif /* defined(YYDESTRUCT_CALL) */
1292 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1293 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1294 #ifdef YYSTYPE_TOSTRING
1297 #endif /* YYBTYACC */
1302 for (i = yym; i > 0; i--)
1304 if (i != yym) fputs(", ", stderr);
1305 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1306 yystack.l_mark[1-i]), stderr);
1311 fputc('\n', stderr);
1315 yyval = yystack.l_mark[1-yym];
1317 memset(&yyval, 0, sizeof yyval);
1318 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1320 /* Perform position reduction */
1321 memset(&yyloc, 0, sizeof(yyloc));
1324 #endif /* YYBTYACC */
1326 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1327 /* just in case YYERROR is invoked within the action, save
1328 the start of the rhs as the error start position */
1329 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1336 #line 51 "btyacc_calc1.y"
1340 #line 52 "btyacc_calc1.y"
1341 {YYVALID;} if (!yytrial)
1342 #line 53 "btyacc_calc1.y"
1349 #line 59 "btyacc_calc1.y"
1351 (void) printf("%15.8f\n", yystack.l_mark[0].dval);
1356 #line 63 "btyacc_calc1.y"
1358 (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[0].vval.lo, yystack.l_mark[0].vval.hi);
1363 #line 67 "btyacc_calc1.y"
1365 dreg[yystack.l_mark[-2].ival] = yystack.l_mark[0].dval;
1370 #line 71 "btyacc_calc1.y"
1372 vreg[yystack.l_mark[-2].ival] = yystack.l_mark[0].vval;
1377 #line 78 "btyacc_calc1.y"
1379 yyval.dval = dreg[yystack.l_mark[0].ival];
1384 #line 82 "btyacc_calc1.y"
1386 yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
1391 #line 86 "btyacc_calc1.y"
1393 yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
1398 #line 90 "btyacc_calc1.y"
1400 yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
1405 #line 94 "btyacc_calc1.y"
1407 yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
1412 #line 98 "btyacc_calc1.y"
1414 yyval.dval = -yystack.l_mark[0].dval;
1419 #line 102 "btyacc_calc1.y"
1421 yyval.dval = yystack.l_mark[-1].dval;
1426 #line 108 "btyacc_calc1.y"
1428 yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
1433 #line 112 "btyacc_calc1.y"
1435 yyval.vval.lo = yystack.l_mark[-3].dval;
1436 yyval.vval.hi = yystack.l_mark[-1].dval;
1437 if ( yyval.vval.lo > yyval.vval.hi )
1439 (void) printf("interval out of order\n");
1446 #line 122 "btyacc_calc1.y"
1448 yyval.vval = vreg[yystack.l_mark[0].ival];
1453 #line 126 "btyacc_calc1.y"
1455 yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
1456 yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
1461 #line 131 "btyacc_calc1.y"
1463 yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
1464 yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
1469 #line 136 "btyacc_calc1.y"
1471 yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
1472 yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
1477 #line 141 "btyacc_calc1.y"
1479 yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
1480 yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
1485 #line 146 "btyacc_calc1.y"
1487 yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
1492 #line 150 "btyacc_calc1.y"
1494 yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
1499 #line 154 "btyacc_calc1.y"
1501 if (dcheck(yystack.l_mark[0].vval)) YYERROR;
1502 yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
1507 #line 159 "btyacc_calc1.y"
1509 if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
1510 yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
1515 #line 164 "btyacc_calc1.y"
1517 yyval.vval.hi = -yystack.l_mark[0].vval.lo;
1518 yyval.vval.lo = -yystack.l_mark[0].vval.hi;
1523 #line 169 "btyacc_calc1.y"
1525 yyval.vval = yystack.l_mark[-1].vval;
1528 #line 1529 "btyacc_calc1.tab.c"
1532 yystack.s_mark -= yym;
1533 yystate = *yystack.s_mark;
1534 yystack.l_mark -= yym;
1535 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1536 yystack.p_mark -= yym;
1539 if (yystate == 0 && yym == 0)
1544 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1545 #ifdef YYSTYPE_TOSTRING
1548 #endif /* YYBTYACC */
1549 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1551 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1555 *++yystack.s_mark = YYFINAL;
1556 *++yystack.l_mark = yyval;
1557 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1558 *++yystack.p_mark = yyloc;
1566 /* we're currently re-reading tokens */
1568 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1576 /* in trial mode; save scanner results for future parse attempts */
1577 if (yylvp == yylvlim)
1578 { /* Enlarge lexical value queue */
1579 size_t p = (size_t) (yylvp - yylvals);
1580 size_t s = (size_t) (yylvlim - yylvals);
1582 s += YYLVQUEUEGROWTH;
1583 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1585 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1587 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1588 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1591 yylvp = yylve = yylvals + p;
1592 yylvlim = yylvals + s;
1593 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1594 yylpp = yylpe = yylpsns + p;
1595 yylplim = yylpsns + s;
1597 yylexp = yylexemes + p;
1599 *yylexp = (YYINT) YYLEX;
1602 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1609 /* normal operation, no conflict encountered */
1610 #endif /* YYBTYACC */
1614 #endif /* YYBTYACC */
1615 if (yychar < 0) yychar = YYEOF;
1619 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1620 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1621 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1625 if (yychar == YYEOF) goto yyaccept;
1628 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1629 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1630 yystate = yytable[yyn];
1632 yystate = yydgoto[yym];
1636 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1637 #ifdef YYSTYPE_TOSTRING
1640 #endif /* YYBTYACC */
1641 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1643 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1646 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1647 *++yystack.s_mark = (YYINT) yystate;
1648 *++yystack.l_mark = yyval;
1649 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1650 *++yystack.p_mark = yyloc;
1655 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1657 if (yypath) YYABORT;
1660 YYParseState *save = yyps->save;
1661 yyps->save = save->save;
1662 save->save = yypath;
1667 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1668 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1672 yyFreeState(yyerrctx);
1675 yylvp = yylvals + yypath->lexeme;
1676 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1677 yylpp = yylpsns + yypath->lexeme;
1679 yylexp = yylexemes + yypath->lexeme;
1681 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1682 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1683 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1684 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1685 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1686 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1687 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1689 yystate = yypath->state;
1691 #endif /* YYBTYACC */
1694 YYERROR_CALL("yacc stack overflow");
1698 YYERROR_CALL("memory exhausted");
1700 #endif /* YYBTYACC */
1710 if (yyps->save) goto yyvalid;
1711 #endif /* YYBTYACC */
1715 #if defined(YYDESTRUCT_CALL)
1716 if (yychar != YYEOF && yychar != YYEMPTY)
1717 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1718 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1720 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1721 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1725 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1728 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1729 YYDESTRUCT_CALL("cleanup: discarding state",
1730 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1732 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1733 YYDESTRUCT_CALL("cleanup: discarding state",
1734 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1735 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1737 #endif /* defined(YYDESTRUCT_CALL) */
1742 yyFreeState(yyerrctx);
1747 YYParseState *save = yyps;
1754 YYParseState *save = yypath;
1755 yypath = save->save;
1759 #endif /* YYBTYACC */
1760 yyfreestack(&yystack);