10c8de5b0SBaptiste Daroussin /* original parser id follows */
20c8de5b0SBaptiste Daroussin /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3c5b5d71aSJung-uk Kim /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
40c8de5b0SBaptiste Daroussin
50c8de5b0SBaptiste Daroussin #define YYBYACC 1
68e022d3cSDag-Erling Smørgrav #define YYMAJOR 2
78e022d3cSDag-Erling Smørgrav #define YYMINOR 0
80c8de5b0SBaptiste Daroussin #define YYCHECK "yyyymmdd"
90c8de5b0SBaptiste Daroussin
100c8de5b0SBaptiste Daroussin #define YYEMPTY (-1)
110c8de5b0SBaptiste Daroussin #define yyclearin (yychar = YYEMPTY)
120c8de5b0SBaptiste Daroussin #define yyerrok (yyerrflag = 0)
130c8de5b0SBaptiste Daroussin #define YYRECOVERING() (yyerrflag != 0)
140c8de5b0SBaptiste Daroussin #define YYENOMEM (-2)
150c8de5b0SBaptiste Daroussin #define YYEOF 0
160c8de5b0SBaptiste Daroussin #undef YYBTYACC
170c8de5b0SBaptiste Daroussin #define YYBTYACC 1
180c8de5b0SBaptiste Daroussin #define YYDEBUGSTR (yytrial ? YYPREFIX "debug(trial)" : YYPREFIX "debug")
190c8de5b0SBaptiste Daroussin
200c8de5b0SBaptiste Daroussin #ifndef yyparse
210c8de5b0SBaptiste Daroussin #define yyparse calc1_parse
220c8de5b0SBaptiste Daroussin #endif /* yyparse */
230c8de5b0SBaptiste Daroussin
240c8de5b0SBaptiste Daroussin #ifndef yylex
250c8de5b0SBaptiste Daroussin #define yylex calc1_lex
260c8de5b0SBaptiste Daroussin #endif /* yylex */
270c8de5b0SBaptiste Daroussin
280c8de5b0SBaptiste Daroussin #ifndef yyerror
290c8de5b0SBaptiste Daroussin #define yyerror calc1_error
300c8de5b0SBaptiste Daroussin #endif /* yyerror */
310c8de5b0SBaptiste Daroussin
320c8de5b0SBaptiste Daroussin #ifndef yychar
330c8de5b0SBaptiste Daroussin #define yychar calc1_char
340c8de5b0SBaptiste Daroussin #endif /* yychar */
350c8de5b0SBaptiste Daroussin
360c8de5b0SBaptiste Daroussin #ifndef yyval
370c8de5b0SBaptiste Daroussin #define yyval calc1_val
380c8de5b0SBaptiste Daroussin #endif /* yyval */
390c8de5b0SBaptiste Daroussin
400c8de5b0SBaptiste Daroussin #ifndef yylval
410c8de5b0SBaptiste Daroussin #define yylval calc1_lval
420c8de5b0SBaptiste Daroussin #endif /* yylval */
430c8de5b0SBaptiste Daroussin
440c8de5b0SBaptiste Daroussin #ifndef yydebug
450c8de5b0SBaptiste Daroussin #define yydebug calc1_debug
460c8de5b0SBaptiste Daroussin #endif /* yydebug */
470c8de5b0SBaptiste Daroussin
480c8de5b0SBaptiste Daroussin #ifndef yynerrs
490c8de5b0SBaptiste Daroussin #define yynerrs calc1_nerrs
500c8de5b0SBaptiste Daroussin #endif /* yynerrs */
510c8de5b0SBaptiste Daroussin
520c8de5b0SBaptiste Daroussin #ifndef yyerrflag
530c8de5b0SBaptiste Daroussin #define yyerrflag calc1_errflag
540c8de5b0SBaptiste Daroussin #endif /* yyerrflag */
550c8de5b0SBaptiste Daroussin
560c8de5b0SBaptiste Daroussin #ifndef yylhs
570c8de5b0SBaptiste Daroussin #define yylhs calc1_lhs
580c8de5b0SBaptiste Daroussin #endif /* yylhs */
590c8de5b0SBaptiste Daroussin
600c8de5b0SBaptiste Daroussin #ifndef yylen
610c8de5b0SBaptiste Daroussin #define yylen calc1_len
620c8de5b0SBaptiste Daroussin #endif /* yylen */
630c8de5b0SBaptiste Daroussin
640c8de5b0SBaptiste Daroussin #ifndef yydefred
650c8de5b0SBaptiste Daroussin #define yydefred calc1_defred
660c8de5b0SBaptiste Daroussin #endif /* yydefred */
670c8de5b0SBaptiste Daroussin
680c8de5b0SBaptiste Daroussin #ifndef yystos
690c8de5b0SBaptiste Daroussin #define yystos calc1_stos
700c8de5b0SBaptiste Daroussin #endif /* yystos */
710c8de5b0SBaptiste Daroussin
720c8de5b0SBaptiste Daroussin #ifndef yydgoto
730c8de5b0SBaptiste Daroussin #define yydgoto calc1_dgoto
740c8de5b0SBaptiste Daroussin #endif /* yydgoto */
750c8de5b0SBaptiste Daroussin
760c8de5b0SBaptiste Daroussin #ifndef yysindex
770c8de5b0SBaptiste Daroussin #define yysindex calc1_sindex
780c8de5b0SBaptiste Daroussin #endif /* yysindex */
790c8de5b0SBaptiste Daroussin
800c8de5b0SBaptiste Daroussin #ifndef yyrindex
810c8de5b0SBaptiste Daroussin #define yyrindex calc1_rindex
820c8de5b0SBaptiste Daroussin #endif /* yyrindex */
830c8de5b0SBaptiste Daroussin
840c8de5b0SBaptiste Daroussin #ifndef yygindex
850c8de5b0SBaptiste Daroussin #define yygindex calc1_gindex
860c8de5b0SBaptiste Daroussin #endif /* yygindex */
870c8de5b0SBaptiste Daroussin
880c8de5b0SBaptiste Daroussin #ifndef yytable
890c8de5b0SBaptiste Daroussin #define yytable calc1_table
900c8de5b0SBaptiste Daroussin #endif /* yytable */
910c8de5b0SBaptiste Daroussin
920c8de5b0SBaptiste Daroussin #ifndef yycheck
930c8de5b0SBaptiste Daroussin #define yycheck calc1_check
940c8de5b0SBaptiste Daroussin #endif /* yycheck */
950c8de5b0SBaptiste Daroussin
960c8de5b0SBaptiste Daroussin #ifndef yyname
970c8de5b0SBaptiste Daroussin #define yyname calc1_name
980c8de5b0SBaptiste Daroussin #endif /* yyname */
990c8de5b0SBaptiste Daroussin
1000c8de5b0SBaptiste Daroussin #ifndef yyrule
1010c8de5b0SBaptiste Daroussin #define yyrule calc1_rule
1020c8de5b0SBaptiste Daroussin #endif /* yyrule */
1030c8de5b0SBaptiste Daroussin
1040c8de5b0SBaptiste Daroussin #if YYBTYACC
1050c8de5b0SBaptiste Daroussin
1060c8de5b0SBaptiste Daroussin #ifndef yycindex
1070c8de5b0SBaptiste Daroussin #define yycindex calc1_cindex
1080c8de5b0SBaptiste Daroussin #endif /* yycindex */
1090c8de5b0SBaptiste Daroussin
1100c8de5b0SBaptiste Daroussin #ifndef yyctable
1110c8de5b0SBaptiste Daroussin #define yyctable calc1_ctable
1120c8de5b0SBaptiste Daroussin #endif /* yyctable */
1130c8de5b0SBaptiste Daroussin
1140c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
1150c8de5b0SBaptiste Daroussin
1160c8de5b0SBaptiste Daroussin #define YYPREFIX "calc1_"
1170c8de5b0SBaptiste Daroussin
1180c8de5b0SBaptiste Daroussin #define YYPURE 1
1190c8de5b0SBaptiste Daroussin
1200c8de5b0SBaptiste Daroussin #line 3 "btyacc_calc1.y"
1210c8de5b0SBaptiste Daroussin
1220c8de5b0SBaptiste Daroussin /* http://dinosaur.compilertools.net/yacc/index.html */
1230c8de5b0SBaptiste Daroussin
1240c8de5b0SBaptiste Daroussin #include <stdlib.h>
1250c8de5b0SBaptiste Daroussin #include <stdio.h>
1260c8de5b0SBaptiste Daroussin #include <ctype.h>
1270c8de5b0SBaptiste Daroussin #include <math.h>
1280c8de5b0SBaptiste Daroussin
1290c8de5b0SBaptiste Daroussin typedef struct interval
1300c8de5b0SBaptiste Daroussin {
1310c8de5b0SBaptiste Daroussin double lo, hi;
1320c8de5b0SBaptiste Daroussin }
1330c8de5b0SBaptiste Daroussin INTERVAL;
1340c8de5b0SBaptiste Daroussin
1350c8de5b0SBaptiste Daroussin INTERVAL vmul(double, double, INTERVAL);
1360c8de5b0SBaptiste Daroussin INTERVAL vdiv(double, double, INTERVAL);
1370c8de5b0SBaptiste Daroussin
1380c8de5b0SBaptiste Daroussin int dcheck(INTERVAL);
1390c8de5b0SBaptiste Daroussin
1400c8de5b0SBaptiste Daroussin double dreg[26];
1410c8de5b0SBaptiste Daroussin INTERVAL vreg[26];
1420c8de5b0SBaptiste Daroussin
1430c8de5b0SBaptiste Daroussin #ifdef YYSTYPE
1440c8de5b0SBaptiste Daroussin #undef YYSTYPE_IS_DECLARED
1450c8de5b0SBaptiste Daroussin #define YYSTYPE_IS_DECLARED 1
1460c8de5b0SBaptiste Daroussin #endif
1470c8de5b0SBaptiste Daroussin #ifndef YYSTYPE_IS_DECLARED
1480c8de5b0SBaptiste Daroussin #define YYSTYPE_IS_DECLARED 1
149c5b5d71aSJung-uk Kim #line 29 "btyacc_calc1.y"
150*822ca327SBaptiste Daroussin typedef union YYSTYPE
1510c8de5b0SBaptiste Daroussin {
1520c8de5b0SBaptiste Daroussin int ival;
1530c8de5b0SBaptiste Daroussin double dval;
1540c8de5b0SBaptiste Daroussin INTERVAL vval;
1550c8de5b0SBaptiste Daroussin } YYSTYPE;
1560c8de5b0SBaptiste Daroussin #endif /* !YYSTYPE_IS_DECLARED */
1570c8de5b0SBaptiste Daroussin #line 158 "btyacc_calc1.tab.c"
1580c8de5b0SBaptiste Daroussin
1590c8de5b0SBaptiste Daroussin /* compatibility with bison */
1600c8de5b0SBaptiste Daroussin #ifdef YYPARSE_PARAM
1610c8de5b0SBaptiste Daroussin /* compatibility with FreeBSD */
1620c8de5b0SBaptiste Daroussin # ifdef YYPARSE_PARAM_TYPE
1630c8de5b0SBaptiste Daroussin # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
1640c8de5b0SBaptiste Daroussin # else
1650c8de5b0SBaptiste Daroussin # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
1660c8de5b0SBaptiste Daroussin # endif
1670c8de5b0SBaptiste Daroussin #else
1680c8de5b0SBaptiste Daroussin # define YYPARSE_DECL() yyparse(void)
1690c8de5b0SBaptiste Daroussin #endif
1700c8de5b0SBaptiste Daroussin
1710c8de5b0SBaptiste Daroussin /* Parameters sent to lex. */
1720c8de5b0SBaptiste Daroussin #ifdef YYLEX_PARAM
1730c8de5b0SBaptiste Daroussin # ifdef YYLEX_PARAM_TYPE
1740c8de5b0SBaptiste Daroussin # define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
1750c8de5b0SBaptiste Daroussin # else
1760c8de5b0SBaptiste Daroussin # define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
1770c8de5b0SBaptiste Daroussin # endif
1780c8de5b0SBaptiste Daroussin # define YYLEX yylex(&yylval, YYLEX_PARAM)
1790c8de5b0SBaptiste Daroussin #else
1800c8de5b0SBaptiste Daroussin # define YYLEX_DECL() yylex(YYSTYPE *yylval)
1810c8de5b0SBaptiste Daroussin # define YYLEX yylex(&yylval)
1820c8de5b0SBaptiste Daroussin #endif
1830c8de5b0SBaptiste Daroussin
1840c8de5b0SBaptiste Daroussin /* Parameters sent to yyerror. */
1850c8de5b0SBaptiste Daroussin #ifndef YYERROR_DECL
1860c8de5b0SBaptiste Daroussin #define YYERROR_DECL() yyerror(const char *s)
1870c8de5b0SBaptiste Daroussin #endif
1880c8de5b0SBaptiste Daroussin #ifndef YYERROR_CALL
1890c8de5b0SBaptiste Daroussin #define YYERROR_CALL(msg) yyerror(msg)
1900c8de5b0SBaptiste Daroussin #endif
1910c8de5b0SBaptiste Daroussin
1920c8de5b0SBaptiste Daroussin extern int YYPARSE_DECL();
1930c8de5b0SBaptiste Daroussin
1940c8de5b0SBaptiste Daroussin #define DREG 257
1950c8de5b0SBaptiste Daroussin #define VREG 258
1960c8de5b0SBaptiste Daroussin #define CONST 259
1970c8de5b0SBaptiste Daroussin #define UMINUS 260
1980c8de5b0SBaptiste Daroussin #define YYERRCODE 256
199b53bb29fSJung-uk Kim typedef int YYINT;
2000c8de5b0SBaptiste Daroussin static const YYINT calc1_lhs[] = { -1,
2010c8de5b0SBaptiste Daroussin 0, 0, 0, 3, 3, 3, 3, 1, 1, 1,
2020c8de5b0SBaptiste Daroussin 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
2030c8de5b0SBaptiste Daroussin 2, 2, 2, 2, 2, 2, 2, 2,
2040c8de5b0SBaptiste Daroussin };
2050c8de5b0SBaptiste Daroussin static const YYINT calc1_len[] = { 2,
2060c8de5b0SBaptiste Daroussin 0, 3, 3, 1, 1, 3, 3, 1, 1, 3,
2070c8de5b0SBaptiste Daroussin 3, 3, 3, 2, 3, 1, 5, 1, 3, 3,
2080c8de5b0SBaptiste Daroussin 3, 3, 3, 3, 3, 3, 2, 3,
2090c8de5b0SBaptiste Daroussin };
2100c8de5b0SBaptiste Daroussin static const YYINT calc1_defred[] = { 1,
2110c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
2120c8de5b0SBaptiste Daroussin 3, 0, 0, 9, 18, 0, 27, 0, 0, 0,
2130c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
2140c8de5b0SBaptiste Daroussin 0, 0, 0, 15, 0, 28, 0, 0, 0, 0,
2150c8de5b0SBaptiste Daroussin 0, 24, 0, 26, 0, 0, 23, 25, 14, 0,
2160c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 12, 13, 17,
2170c8de5b0SBaptiste Daroussin };
2182aca18c7SJung-uk Kim #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
2190c8de5b0SBaptiste Daroussin static const YYINT calc1_stos[] = { 0,
2200c8de5b0SBaptiste Daroussin 262, 256, 257, 258, 259, 45, 40, 263, 264, 265,
2210c8de5b0SBaptiste Daroussin 10, 61, 61, 257, 258, 263, 264, 263, 264, 43,
2220c8de5b0SBaptiste Daroussin 45, 42, 47, 43, 45, 42, 47, 10, 45, 40,
2230c8de5b0SBaptiste Daroussin 263, 263, 264, 41, 44, 41, 263, 264, 263, 264,
2240c8de5b0SBaptiste Daroussin 263, 264, 263, 264, 264, 264, 264, 264, 263, 263,
2250c8de5b0SBaptiste Daroussin 43, 45, 42, 47, 263, 263, 263, 263, 263, 41,
2260c8de5b0SBaptiste Daroussin };
2272aca18c7SJung-uk Kim #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
2280c8de5b0SBaptiste Daroussin static const YYINT calc1_dgoto[] = { 1,
2290c8de5b0SBaptiste Daroussin 32, 9, 10,
2300c8de5b0SBaptiste Daroussin };
2310c8de5b0SBaptiste Daroussin static const YYINT calc1_sindex[] = { 0,
2320c8de5b0SBaptiste Daroussin -40, -9, -59, -54, 0, -37, -37, 0, 82, 4,
2330c8de5b0SBaptiste Daroussin 0, -34, -37, 0, 0, 0, 0, -31, -25, -37,
2340c8de5b0SBaptiste Daroussin -37, -37, -37, -37, -37, -37, -37, 0, -34, -34,
2350c8de5b0SBaptiste Daroussin 132, 0, 82, 0, -34, 0, 0, -12, 0, -12,
2360c8de5b0SBaptiste Daroussin 0, 0, 0, 0, -12, -12, 0, 0, 0, 112,
2370c8de5b0SBaptiste Daroussin -34, -34, -34, -34, 119, -11, -11, 0, 0, 0,
2380c8de5b0SBaptiste Daroussin };
2390c8de5b0SBaptiste Daroussin static const YYINT calc1_rindex[] = { 0,
2400c8de5b0SBaptiste Daroussin 0, 0, 51, 58, 0, 0, 0, 0, 11, 0,
2410c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, -16, 0, 0, 0, 0,
2420c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2430c8de5b0SBaptiste Daroussin 19, 9, 27, 0, 0, 0, -5, 41, -4, 77,
2440c8de5b0SBaptiste Daroussin -2, 0, 8, 0, 78, 85, 0, 0, 0, 0,
2450c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 92, 99, 0, 0, 0,
2460c8de5b0SBaptiste Daroussin };
2470c8de5b0SBaptiste Daroussin #if YYBTYACC
2480c8de5b0SBaptiste Daroussin static const YYINT calc1_cindex[] = { 0,
2490c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 65, 0, 0,
2500c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 2, 0, 126, 0, 0,
2510c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2520c8de5b0SBaptiste Daroussin 0, 138, 0, 0, 0, 0, 17, 0, 24, 0,
2530c8de5b0SBaptiste Daroussin 31, 0, 38, 0, 0, 0, 0, 0, 0, 0,
2540c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2550c8de5b0SBaptiste Daroussin };
2560c8de5b0SBaptiste Daroussin #endif
2570c8de5b0SBaptiste Daroussin static const YYINT calc1_gindex[] = { 0,
2580c8de5b0SBaptiste Daroussin 3, 125, 0,
2590c8de5b0SBaptiste Daroussin };
2600c8de5b0SBaptiste Daroussin #define YYTABLESIZE 225
2610c8de5b0SBaptiste Daroussin static const YYINT calc1_table[] = { 7,
2620c8de5b0SBaptiste Daroussin 11, 12, 7, 8, 6, 30, 13, 6, 16, 18,
2630c8de5b0SBaptiste Daroussin 29, 14, 35, 28, 31, 36, 26, 24, 16, 25,
2640c8de5b0SBaptiste Daroussin 5, 27, 37, 39, 41, 43, 20, 14, 6, 26,
2650c8de5b0SBaptiste Daroussin 53, 49, 50, 23, 27, 54, 7, 55, 10, 11,
2660c8de5b0SBaptiste Daroussin 26, 12, 14, 14, 14, 0, 14, 29, 14, 16,
2670c8de5b0SBaptiste Daroussin 20, 13, 0, 56, 57, 58, 59, 20, 6, 20,
2680c8de5b0SBaptiste Daroussin 9, 20, 0, 9, 23, 6, 23, 18, 23, 0,
2690c8de5b0SBaptiste Daroussin 9, 26, 26, 26, 11, 26, 0, 26, 29, 29,
2700c8de5b0SBaptiste Daroussin 29, 20, 29, 20, 29, 20, 22, 19, 0, 0,
2710c8de5b0SBaptiste Daroussin 0, 0, 9, 9, 21, 9, 0, 9, 0, 18,
2720c8de5b0SBaptiste Daroussin 18, 10, 18, 0, 18, 0, 6, 0, 11, 3,
2730c8de5b0SBaptiste Daroussin 0, 9, 0, 0, 0, 0, 0, 22, 19, 22,
2740c8de5b0SBaptiste Daroussin 19, 22, 19, 26, 24, 21, 25, 21, 27, 21,
2750c8de5b0SBaptiste Daroussin 17, 19, 10, 0, 10, 0, 10, 33, 0, 11,
2760c8de5b0SBaptiste Daroussin 0, 11, 0, 11, 38, 40, 42, 44, 45, 46,
2770c8de5b0SBaptiste Daroussin 47, 48, 34, 53, 51, 0, 52, 0, 54, 60,
2780c8de5b0SBaptiste Daroussin 53, 51, 0, 52, 0, 54, 18, 6, 0, 0,
2790c8de5b0SBaptiste Daroussin 3, 0, 9, 53, 51, 0, 52, 0, 54, 6,
2800c8de5b0SBaptiste Daroussin 0, 0, 3, 0, 9, 0, 0, 0, 0, 0,
2810c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2820c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2830c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 2, 3, 4, 5, 14,
2840c8de5b0SBaptiste Daroussin 15, 5, 14, 0, 5,
2850c8de5b0SBaptiste Daroussin };
2860c8de5b0SBaptiste Daroussin static const YYINT calc1_check[] = { 40,
2870c8de5b0SBaptiste Daroussin 10, 61, 40, 1, 45, 40, 61, 45, 6, 7,
2880c8de5b0SBaptiste Daroussin 45, 10, 44, 10, 12, 41, 42, 43, 10, 45,
2890c8de5b0SBaptiste Daroussin 10, 47, 20, 21, 22, 23, 10, 44, 10, 42,
2900c8de5b0SBaptiste Daroussin 42, 29, 30, 10, 47, 47, 10, 35, 44, 44,
2910c8de5b0SBaptiste Daroussin 10, 44, 41, 42, 43, -1, 45, 10, 47, 41,
2920c8de5b0SBaptiste Daroussin 10, 44, -1, 51, 52, 53, 54, 41, 42, 43,
2930c8de5b0SBaptiste Daroussin 10, 45, -1, 47, 41, 42, 43, 10, 45, -1,
2940c8de5b0SBaptiste Daroussin 47, 41, 42, 43, 10, 45, -1, 47, 41, 42,
2950c8de5b0SBaptiste Daroussin 43, 41, 45, 43, 47, 45, 10, 10, -1, -1,
2960c8de5b0SBaptiste Daroussin -1, -1, 42, 43, 10, 45, -1, 47, -1, 42,
2970c8de5b0SBaptiste Daroussin 43, 10, 45, -1, 47, -1, 42, 43, 10, 45,
2980c8de5b0SBaptiste Daroussin -1, 47, -1, -1, -1, -1, -1, 41, 41, 43,
2990c8de5b0SBaptiste Daroussin 43, 45, 45, 42, 43, 41, 45, 43, 47, 45,
3000c8de5b0SBaptiste Daroussin 6, 7, 41, -1, 43, -1, 45, 13, -1, 41,
3010c8de5b0SBaptiste Daroussin -1, 43, -1, 45, 20, 21, 22, 23, 24, 25,
3020c8de5b0SBaptiste Daroussin 26, 27, 41, 42, 43, -1, 45, -1, 47, 41,
3030c8de5b0SBaptiste Daroussin 42, 43, -1, 45, -1, 47, 41, 42, 43, -1,
3040c8de5b0SBaptiste Daroussin 45, -1, 47, 42, 43, -1, 45, -1, 47, 42,
3050c8de5b0SBaptiste Daroussin 43, -1, 45, -1, 47, -1, -1, -1, -1, -1,
3060c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3070c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3080c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, 256, 257, 258, 259, 257,
3090c8de5b0SBaptiste Daroussin 258, 259, 257, -1, 259,
3100c8de5b0SBaptiste Daroussin };
3110c8de5b0SBaptiste Daroussin #if YYBTYACC
3120c8de5b0SBaptiste Daroussin static const YYINT calc1_ctable[] = { 20,
3130c8de5b0SBaptiste Daroussin 16, -1, 21, 16, -1, 22, 16, -1, 23, 16,
3140c8de5b0SBaptiste Daroussin -1, 4, 16, -1, 14, 16, -1, 34, 16, -1,
3150c8de5b0SBaptiste Daroussin 10, 16, -1, 11, 16, -1, 12, 16, -1, 13,
31611fce282SBaptiste Daroussin 16, -1, -1, -1, -1, -1, -1, -1, -1, -1,
31711fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
31811fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
31911fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
32011fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
32111fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
32211fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
32311fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
32411fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
32511fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
32611fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
32711fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
32811fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
32911fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
33011fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
33111fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
33211fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
33311fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
33411fce282SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
33511fce282SBaptiste Daroussin -1, -1, -1, -1,
3360c8de5b0SBaptiste Daroussin };
3370c8de5b0SBaptiste Daroussin #endif
3380c8de5b0SBaptiste Daroussin #define YYFINAL 1
3390c8de5b0SBaptiste Daroussin #ifndef YYDEBUG
3400c8de5b0SBaptiste Daroussin #define YYDEBUG 0
3410c8de5b0SBaptiste Daroussin #endif
3420c8de5b0SBaptiste Daroussin #define YYMAXTOKEN 260
3430c8de5b0SBaptiste Daroussin #define YYUNDFTOKEN 266
3440c8de5b0SBaptiste Daroussin #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
3450c8de5b0SBaptiste Daroussin #if YYDEBUG
3460c8de5b0SBaptiste Daroussin static const char *const calc1_name[] = {
3470c8de5b0SBaptiste Daroussin
3480c8de5b0SBaptiste Daroussin "$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,
3490c8de5b0SBaptiste Daroussin 0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,0,0,
3500c8de5b0SBaptiste Daroussin 0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3510c8de5b0SBaptiste Daroussin 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3520c8de5b0SBaptiste Daroussin 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3530c8de5b0SBaptiste Daroussin 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3540c8de5b0SBaptiste Daroussin 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3550c8de5b0SBaptiste Daroussin "error","DREG","VREG","CONST","UMINUS","$accept","lines","dexp","vexp","line",
3560c8de5b0SBaptiste Daroussin "illegal-symbol",
3570c8de5b0SBaptiste Daroussin };
3580c8de5b0SBaptiste Daroussin static const char *const calc1_rule[] = {
3590c8de5b0SBaptiste Daroussin "$accept : lines",
3600c8de5b0SBaptiste Daroussin "lines :",
3610c8de5b0SBaptiste Daroussin "lines : lines line '\\n'",
3620c8de5b0SBaptiste Daroussin "lines : lines error '\\n'",
3630c8de5b0SBaptiste Daroussin "line : dexp",
3640c8de5b0SBaptiste Daroussin "line : vexp",
3650c8de5b0SBaptiste Daroussin "line : DREG '=' dexp",
3660c8de5b0SBaptiste Daroussin "line : VREG '=' vexp",
3670c8de5b0SBaptiste Daroussin "dexp : CONST",
3680c8de5b0SBaptiste Daroussin "dexp : DREG",
3690c8de5b0SBaptiste Daroussin "dexp : dexp '+' dexp",
3700c8de5b0SBaptiste Daroussin "dexp : dexp '-' dexp",
3710c8de5b0SBaptiste Daroussin "dexp : dexp '*' dexp",
3720c8de5b0SBaptiste Daroussin "dexp : dexp '/' dexp",
3730c8de5b0SBaptiste Daroussin "dexp : '-' dexp",
3740c8de5b0SBaptiste Daroussin "dexp : '(' dexp ')'",
3750c8de5b0SBaptiste Daroussin "vexp : dexp",
3760c8de5b0SBaptiste Daroussin "vexp : '(' dexp ',' dexp ')'",
3770c8de5b0SBaptiste Daroussin "vexp : VREG",
3780c8de5b0SBaptiste Daroussin "vexp : vexp '+' vexp",
3790c8de5b0SBaptiste Daroussin "vexp : dexp '+' vexp",
3800c8de5b0SBaptiste Daroussin "vexp : vexp '-' vexp",
3810c8de5b0SBaptiste Daroussin "vexp : dexp '-' vexp",
3820c8de5b0SBaptiste Daroussin "vexp : vexp '*' vexp",
3830c8de5b0SBaptiste Daroussin "vexp : dexp '*' vexp",
3840c8de5b0SBaptiste Daroussin "vexp : vexp '/' vexp",
3850c8de5b0SBaptiste Daroussin "vexp : dexp '/' vexp",
3860c8de5b0SBaptiste Daroussin "vexp : '-' vexp",
3870c8de5b0SBaptiste Daroussin "vexp : '(' vexp ')'",
3880c8de5b0SBaptiste Daroussin
3890c8de5b0SBaptiste Daroussin };
3900c8de5b0SBaptiste Daroussin #endif
3910c8de5b0SBaptiste Daroussin
392b53bb29fSJung-uk Kim #if YYDEBUG
3930c8de5b0SBaptiste Daroussin int yydebug;
394b53bb29fSJung-uk Kim #endif
3950c8de5b0SBaptiste Daroussin
3960c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
3970c8de5b0SBaptiste Daroussin #ifndef YYLLOC_DEFAULT
3980c8de5b0SBaptiste Daroussin #define YYLLOC_DEFAULT(loc, rhs, n) \
3990c8de5b0SBaptiste Daroussin do \
4000c8de5b0SBaptiste Daroussin { \
4010c8de5b0SBaptiste Daroussin if (n == 0) \
4020c8de5b0SBaptiste Daroussin { \
403b53bb29fSJung-uk Kim (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
404b53bb29fSJung-uk Kim (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
405b53bb29fSJung-uk Kim (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
406b53bb29fSJung-uk Kim (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
4070c8de5b0SBaptiste Daroussin } \
4080c8de5b0SBaptiste Daroussin else \
4090c8de5b0SBaptiste Daroussin { \
410b53bb29fSJung-uk Kim (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
411b53bb29fSJung-uk Kim (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
412b53bb29fSJung-uk Kim (loc).last_line = YYRHSLOC(rhs, n).last_line; \
413b53bb29fSJung-uk Kim (loc).last_column = YYRHSLOC(rhs, n).last_column; \
4140c8de5b0SBaptiste Daroussin } \
4150c8de5b0SBaptiste Daroussin } while (0)
4160c8de5b0SBaptiste Daroussin #endif /* YYLLOC_DEFAULT */
4170c8de5b0SBaptiste Daroussin #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
4180c8de5b0SBaptiste Daroussin #if YYBTYACC
4190c8de5b0SBaptiste Daroussin
4200c8de5b0SBaptiste Daroussin #ifndef YYLVQUEUEGROWTH
4210c8de5b0SBaptiste Daroussin #define YYLVQUEUEGROWTH 32
4220c8de5b0SBaptiste Daroussin #endif
4230c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
4240c8de5b0SBaptiste Daroussin
4250c8de5b0SBaptiste Daroussin /* define the initial stack-sizes */
4260c8de5b0SBaptiste Daroussin #ifdef YYSTACKSIZE
4270c8de5b0SBaptiste Daroussin #undef YYMAXDEPTH
4280c8de5b0SBaptiste Daroussin #define YYMAXDEPTH YYSTACKSIZE
4290c8de5b0SBaptiste Daroussin #else
4300c8de5b0SBaptiste Daroussin #ifdef YYMAXDEPTH
4310c8de5b0SBaptiste Daroussin #define YYSTACKSIZE YYMAXDEPTH
4320c8de5b0SBaptiste Daroussin #else
4330c8de5b0SBaptiste Daroussin #define YYSTACKSIZE 10000
4340c8de5b0SBaptiste Daroussin #define YYMAXDEPTH 10000
4350c8de5b0SBaptiste Daroussin #endif
4360c8de5b0SBaptiste Daroussin #endif
4370c8de5b0SBaptiste Daroussin
4380c8de5b0SBaptiste Daroussin #ifndef YYINITSTACKSIZE
4390c8de5b0SBaptiste Daroussin #define YYINITSTACKSIZE 200
4400c8de5b0SBaptiste Daroussin #endif
4410c8de5b0SBaptiste Daroussin
4420c8de5b0SBaptiste Daroussin typedef struct {
4430c8de5b0SBaptiste Daroussin unsigned stacksize;
444c5b5d71aSJung-uk Kim YYINT *s_base;
445c5b5d71aSJung-uk Kim YYINT *s_mark;
446c5b5d71aSJung-uk Kim YYINT *s_last;
4470c8de5b0SBaptiste Daroussin YYSTYPE *l_base;
4480c8de5b0SBaptiste Daroussin YYSTYPE *l_mark;
4490c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
4500c8de5b0SBaptiste Daroussin YYLTYPE *p_base;
4510c8de5b0SBaptiste Daroussin YYLTYPE *p_mark;
4520c8de5b0SBaptiste Daroussin #endif
4530c8de5b0SBaptiste Daroussin } YYSTACKDATA;
4540c8de5b0SBaptiste Daroussin #if YYBTYACC
4550c8de5b0SBaptiste Daroussin
4560c8de5b0SBaptiste Daroussin struct YYParseState_s
4570c8de5b0SBaptiste Daroussin {
4580c8de5b0SBaptiste Daroussin struct YYParseState_s *save; /* Previously saved parser state */
4590c8de5b0SBaptiste Daroussin YYSTACKDATA yystack; /* saved parser stack */
4600c8de5b0SBaptiste Daroussin int state; /* saved parser state */
4610c8de5b0SBaptiste Daroussin int errflag; /* saved error recovery status */
4620c8de5b0SBaptiste Daroussin int lexeme; /* saved index of the conflict lexeme in the lexical queue */
4630c8de5b0SBaptiste Daroussin YYINT ctry; /* saved index in yyctable[] for this conflict */
4640c8de5b0SBaptiste Daroussin };
4650c8de5b0SBaptiste Daroussin typedef struct YYParseState_s YYParseState;
4660c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
4670c8de5b0SBaptiste Daroussin #line 174 "btyacc_calc1.y"
4680c8de5b0SBaptiste Daroussin /* beginning of subroutines section */
4690c8de5b0SBaptiste Daroussin
4700c8de5b0SBaptiste Daroussin int
main(void)4710c8de5b0SBaptiste Daroussin main (void)
4720c8de5b0SBaptiste Daroussin {
4730c8de5b0SBaptiste Daroussin while(!feof(stdin)) {
4740c8de5b0SBaptiste Daroussin yyparse();
4750c8de5b0SBaptiste Daroussin }
4760c8de5b0SBaptiste Daroussin return 0;
4770c8de5b0SBaptiste Daroussin }
4780c8de5b0SBaptiste Daroussin
4790c8de5b0SBaptiste Daroussin #define BSZ 50 /* buffer size for floating point numbers */
4800c8de5b0SBaptiste Daroussin
4810c8de5b0SBaptiste Daroussin static void
YYERROR_DECL()4820c8de5b0SBaptiste Daroussin YYERROR_DECL()
4830c8de5b0SBaptiste Daroussin {
4840c8de5b0SBaptiste Daroussin fprintf(stderr, "%s\n", s);
4850c8de5b0SBaptiste Daroussin }
4860c8de5b0SBaptiste Daroussin
4870c8de5b0SBaptiste Daroussin /* lexical analysis */
4880c8de5b0SBaptiste Daroussin
4890c8de5b0SBaptiste Daroussin static int
YYLEX_DECL()4900c8de5b0SBaptiste Daroussin YYLEX_DECL()
4910c8de5b0SBaptiste Daroussin {
4920c8de5b0SBaptiste Daroussin int c;
4930c8de5b0SBaptiste Daroussin
4940c8de5b0SBaptiste Daroussin while ((c = getchar()) == ' ')
4950c8de5b0SBaptiste Daroussin { /* skip over blanks */
4960c8de5b0SBaptiste Daroussin }
4970c8de5b0SBaptiste Daroussin
4980c8de5b0SBaptiste Daroussin if (isupper(c))
4990c8de5b0SBaptiste Daroussin {
5000c8de5b0SBaptiste Daroussin #if YYPURE
5010c8de5b0SBaptiste Daroussin (*yylval).ival = c - 'A';
5020c8de5b0SBaptiste Daroussin #else
5030c8de5b0SBaptiste Daroussin yylval.ival = c - 'A';
5040c8de5b0SBaptiste Daroussin #endif
5050c8de5b0SBaptiste Daroussin return (VREG);
5060c8de5b0SBaptiste Daroussin }
5070c8de5b0SBaptiste Daroussin if (islower(c))
5080c8de5b0SBaptiste Daroussin {
5090c8de5b0SBaptiste Daroussin #if YYPURE
5100c8de5b0SBaptiste Daroussin (*yylval).ival = c - 'a';
5110c8de5b0SBaptiste Daroussin #else
5120c8de5b0SBaptiste Daroussin yylval.ival = c - 'a';
5130c8de5b0SBaptiste Daroussin #endif
5140c8de5b0SBaptiste Daroussin return (DREG);
5150c8de5b0SBaptiste Daroussin }
5160c8de5b0SBaptiste Daroussin
5170c8de5b0SBaptiste Daroussin if (isdigit(c) || c == '.')
5180c8de5b0SBaptiste Daroussin {
5190c8de5b0SBaptiste Daroussin /* gobble up digits, points, exponents */
5200c8de5b0SBaptiste Daroussin char buf[BSZ + 1], *cp = buf;
5210c8de5b0SBaptiste Daroussin int dot = 0, expr = 0;
5220c8de5b0SBaptiste Daroussin
5230c8de5b0SBaptiste Daroussin for (; (cp - buf) < BSZ; ++cp, c = getchar())
5240c8de5b0SBaptiste Daroussin {
5250c8de5b0SBaptiste Daroussin
5260c8de5b0SBaptiste Daroussin *cp = (char) c;
5270c8de5b0SBaptiste Daroussin if (isdigit(c))
5280c8de5b0SBaptiste Daroussin continue;
5290c8de5b0SBaptiste Daroussin if (c == '.')
5300c8de5b0SBaptiste Daroussin {
5310c8de5b0SBaptiste Daroussin if (dot++ || expr)
5320c8de5b0SBaptiste Daroussin return ('.'); /* will cause syntax error */
5330c8de5b0SBaptiste Daroussin continue;
5340c8de5b0SBaptiste Daroussin }
5350c8de5b0SBaptiste Daroussin
5360c8de5b0SBaptiste Daroussin if (c == 'e')
5370c8de5b0SBaptiste Daroussin {
5380c8de5b0SBaptiste Daroussin if (expr++)
5390c8de5b0SBaptiste Daroussin return ('e'); /* will cause syntax error */
5400c8de5b0SBaptiste Daroussin continue;
5410c8de5b0SBaptiste Daroussin }
5420c8de5b0SBaptiste Daroussin
5430c8de5b0SBaptiste Daroussin /* end of number */
5440c8de5b0SBaptiste Daroussin break;
5450c8de5b0SBaptiste Daroussin }
5460c8de5b0SBaptiste Daroussin *cp = '\0';
5470c8de5b0SBaptiste Daroussin
5480c8de5b0SBaptiste Daroussin if ((cp - buf) >= BSZ)
5490c8de5b0SBaptiste Daroussin printf("constant too long: truncated\n");
5500c8de5b0SBaptiste Daroussin else
5510c8de5b0SBaptiste Daroussin ungetc(c, stdin); /* push back last char read */
5520c8de5b0SBaptiste Daroussin #if YYPURE
5530c8de5b0SBaptiste Daroussin (*yylval).dval = atof(buf);
5540c8de5b0SBaptiste Daroussin #else
5550c8de5b0SBaptiste Daroussin yylval.dval = atof(buf);
5560c8de5b0SBaptiste Daroussin #endif
5570c8de5b0SBaptiste Daroussin return (CONST);
5580c8de5b0SBaptiste Daroussin }
5590c8de5b0SBaptiste Daroussin return (c);
5600c8de5b0SBaptiste Daroussin }
5610c8de5b0SBaptiste Daroussin
5620c8de5b0SBaptiste Daroussin static INTERVAL
hilo(double a,double b,double c,double d)5630c8de5b0SBaptiste Daroussin hilo(double a, double b, double c, double d)
5640c8de5b0SBaptiste Daroussin {
5650c8de5b0SBaptiste Daroussin /* returns the smallest interval containing a, b, c, and d */
5660c8de5b0SBaptiste Daroussin /* used by *, / routines */
5670c8de5b0SBaptiste Daroussin INTERVAL v;
5680c8de5b0SBaptiste Daroussin
5690c8de5b0SBaptiste Daroussin if (a > b)
5700c8de5b0SBaptiste Daroussin {
5710c8de5b0SBaptiste Daroussin v.hi = a;
5720c8de5b0SBaptiste Daroussin v.lo = b;
5730c8de5b0SBaptiste Daroussin }
5740c8de5b0SBaptiste Daroussin else
5750c8de5b0SBaptiste Daroussin {
5760c8de5b0SBaptiste Daroussin v.hi = b;
5770c8de5b0SBaptiste Daroussin v.lo = a;
5780c8de5b0SBaptiste Daroussin }
5790c8de5b0SBaptiste Daroussin
5800c8de5b0SBaptiste Daroussin if (c > d)
5810c8de5b0SBaptiste Daroussin {
5820c8de5b0SBaptiste Daroussin if (c > v.hi)
5830c8de5b0SBaptiste Daroussin v.hi = c;
5840c8de5b0SBaptiste Daroussin if (d < v.lo)
5850c8de5b0SBaptiste Daroussin v.lo = d;
5860c8de5b0SBaptiste Daroussin }
5870c8de5b0SBaptiste Daroussin else
5880c8de5b0SBaptiste Daroussin {
5890c8de5b0SBaptiste Daroussin if (d > v.hi)
5900c8de5b0SBaptiste Daroussin v.hi = d;
5910c8de5b0SBaptiste Daroussin if (c < v.lo)
5920c8de5b0SBaptiste Daroussin v.lo = c;
5930c8de5b0SBaptiste Daroussin }
5940c8de5b0SBaptiste Daroussin return (v);
5950c8de5b0SBaptiste Daroussin }
5960c8de5b0SBaptiste Daroussin
5970c8de5b0SBaptiste Daroussin INTERVAL
vmul(double a,double b,INTERVAL v)5980c8de5b0SBaptiste Daroussin vmul(double a, double b, INTERVAL v)
5990c8de5b0SBaptiste Daroussin {
6000c8de5b0SBaptiste Daroussin return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
6010c8de5b0SBaptiste Daroussin }
6020c8de5b0SBaptiste Daroussin
6030c8de5b0SBaptiste Daroussin int
dcheck(INTERVAL v)6040c8de5b0SBaptiste Daroussin dcheck(INTERVAL v)
6050c8de5b0SBaptiste Daroussin {
6060c8de5b0SBaptiste Daroussin if (v.hi >= 0. && v.lo <= 0.)
6070c8de5b0SBaptiste Daroussin {
6080c8de5b0SBaptiste Daroussin printf("divisor interval contains 0.\n");
6090c8de5b0SBaptiste Daroussin return (1);
6100c8de5b0SBaptiste Daroussin }
6110c8de5b0SBaptiste Daroussin return (0);
6120c8de5b0SBaptiste Daroussin }
6130c8de5b0SBaptiste Daroussin
6140c8de5b0SBaptiste Daroussin INTERVAL
vdiv(double a,double b,INTERVAL v)6150c8de5b0SBaptiste Daroussin vdiv(double a, double b, INTERVAL v)
6160c8de5b0SBaptiste Daroussin {
6170c8de5b0SBaptiste Daroussin return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
6180c8de5b0SBaptiste Daroussin }
619b53bb29fSJung-uk Kim #line 620 "btyacc_calc1.tab.c"
6200c8de5b0SBaptiste Daroussin
6210c8de5b0SBaptiste Daroussin /* For use in generated program */
6220c8de5b0SBaptiste Daroussin #define yydepth (int)(yystack.s_mark - yystack.s_base)
6230c8de5b0SBaptiste Daroussin #if YYBTYACC
6240c8de5b0SBaptiste Daroussin #define yytrial (yyps->save)
6250c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
6260c8de5b0SBaptiste Daroussin
6270c8de5b0SBaptiste Daroussin #if YYDEBUG
6280c8de5b0SBaptiste Daroussin #include <stdio.h> /* needed for printf */
6290c8de5b0SBaptiste Daroussin #endif
6300c8de5b0SBaptiste Daroussin
6310c8de5b0SBaptiste Daroussin #include <stdlib.h> /* needed for malloc, etc */
6320c8de5b0SBaptiste Daroussin #include <string.h> /* needed for memset */
6330c8de5b0SBaptiste Daroussin
6340c8de5b0SBaptiste Daroussin /* allocate initial stack or double stack size, up to YYMAXDEPTH */
yygrowstack(YYSTACKDATA * data)6350c8de5b0SBaptiste Daroussin static int yygrowstack(YYSTACKDATA *data)
6360c8de5b0SBaptiste Daroussin {
6370c8de5b0SBaptiste Daroussin int i;
6380c8de5b0SBaptiste Daroussin unsigned newsize;
639c5b5d71aSJung-uk Kim YYINT *newss;
6400c8de5b0SBaptiste Daroussin YYSTYPE *newvs;
6410c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
6420c8de5b0SBaptiste Daroussin YYLTYPE *newps;
6430c8de5b0SBaptiste Daroussin #endif
6440c8de5b0SBaptiste Daroussin
6450c8de5b0SBaptiste Daroussin if ((newsize = data->stacksize) == 0)
6460c8de5b0SBaptiste Daroussin newsize = YYINITSTACKSIZE;
6470c8de5b0SBaptiste Daroussin else if (newsize >= YYMAXDEPTH)
6480c8de5b0SBaptiste Daroussin return YYENOMEM;
6490c8de5b0SBaptiste Daroussin else if ((newsize *= 2) > YYMAXDEPTH)
6500c8de5b0SBaptiste Daroussin newsize = YYMAXDEPTH;
6510c8de5b0SBaptiste Daroussin
6520c8de5b0SBaptiste Daroussin i = (int) (data->s_mark - data->s_base);
653c5b5d71aSJung-uk Kim newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
654bf80e08eSJung-uk Kim if (newss == NULL)
6550c8de5b0SBaptiste Daroussin return YYENOMEM;
6560c8de5b0SBaptiste Daroussin
6570c8de5b0SBaptiste Daroussin data->s_base = newss;
6580c8de5b0SBaptiste Daroussin data->s_mark = newss + i;
6590c8de5b0SBaptiste Daroussin
6600c8de5b0SBaptiste Daroussin newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
661bf80e08eSJung-uk Kim if (newvs == NULL)
6620c8de5b0SBaptiste Daroussin return YYENOMEM;
6630c8de5b0SBaptiste Daroussin
6640c8de5b0SBaptiste Daroussin data->l_base = newvs;
6650c8de5b0SBaptiste Daroussin data->l_mark = newvs + i;
6660c8de5b0SBaptiste Daroussin
6670c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
6680c8de5b0SBaptiste Daroussin newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
669bf80e08eSJung-uk Kim if (newps == NULL)
6700c8de5b0SBaptiste Daroussin return YYENOMEM;
6710c8de5b0SBaptiste Daroussin
6720c8de5b0SBaptiste Daroussin data->p_base = newps;
6730c8de5b0SBaptiste Daroussin data->p_mark = newps + i;
6740c8de5b0SBaptiste Daroussin #endif
6750c8de5b0SBaptiste Daroussin
6760c8de5b0SBaptiste Daroussin data->stacksize = newsize;
6770c8de5b0SBaptiste Daroussin data->s_last = data->s_base + newsize - 1;
6780c8de5b0SBaptiste Daroussin
6790c8de5b0SBaptiste Daroussin #if YYDEBUG
6800c8de5b0SBaptiste Daroussin if (yydebug)
6810c8de5b0SBaptiste Daroussin fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
6820c8de5b0SBaptiste Daroussin #endif
6830c8de5b0SBaptiste Daroussin return 0;
6840c8de5b0SBaptiste Daroussin }
6850c8de5b0SBaptiste Daroussin
6860c8de5b0SBaptiste Daroussin #if YYPURE || defined(YY_NO_LEAKS)
yyfreestack(YYSTACKDATA * data)6870c8de5b0SBaptiste Daroussin static void yyfreestack(YYSTACKDATA *data)
6880c8de5b0SBaptiste Daroussin {
6890c8de5b0SBaptiste Daroussin free(data->s_base);
6900c8de5b0SBaptiste Daroussin free(data->l_base);
6910c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
6920c8de5b0SBaptiste Daroussin free(data->p_base);
6930c8de5b0SBaptiste Daroussin #endif
6940c8de5b0SBaptiste Daroussin memset(data, 0, sizeof(*data));
6950c8de5b0SBaptiste Daroussin }
6960c8de5b0SBaptiste Daroussin #else
6970c8de5b0SBaptiste Daroussin #define yyfreestack(data) /* nothing */
6980c8de5b0SBaptiste Daroussin #endif /* YYPURE || defined(YY_NO_LEAKS) */
6990c8de5b0SBaptiste Daroussin #if YYBTYACC
7000c8de5b0SBaptiste Daroussin
7010c8de5b0SBaptiste Daroussin static YYParseState *
yyNewState(unsigned size)7020c8de5b0SBaptiste Daroussin yyNewState(unsigned size)
7030c8de5b0SBaptiste Daroussin {
7040c8de5b0SBaptiste Daroussin YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
7050c8de5b0SBaptiste Daroussin if (p == NULL) return NULL;
7060c8de5b0SBaptiste Daroussin
7070c8de5b0SBaptiste Daroussin p->yystack.stacksize = size;
7080c8de5b0SBaptiste Daroussin if (size == 0)
7090c8de5b0SBaptiste Daroussin {
7100c8de5b0SBaptiste Daroussin p->yystack.s_base = NULL;
7110c8de5b0SBaptiste Daroussin p->yystack.l_base = NULL;
7120c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
7130c8de5b0SBaptiste Daroussin p->yystack.p_base = NULL;
7140c8de5b0SBaptiste Daroussin #endif
7150c8de5b0SBaptiste Daroussin return p;
7160c8de5b0SBaptiste Daroussin }
717c5b5d71aSJung-uk Kim p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
7180c8de5b0SBaptiste Daroussin if (p->yystack.s_base == NULL) return NULL;
7190c8de5b0SBaptiste Daroussin p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
7200c8de5b0SBaptiste Daroussin if (p->yystack.l_base == NULL) return NULL;
7210c8de5b0SBaptiste Daroussin memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
7220c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
7230c8de5b0SBaptiste Daroussin p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
7240c8de5b0SBaptiste Daroussin if (p->yystack.p_base == NULL) return NULL;
7250c8de5b0SBaptiste Daroussin memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
7260c8de5b0SBaptiste Daroussin #endif
7270c8de5b0SBaptiste Daroussin
7280c8de5b0SBaptiste Daroussin return p;
7290c8de5b0SBaptiste Daroussin }
7300c8de5b0SBaptiste Daroussin
7310c8de5b0SBaptiste Daroussin static void
yyFreeState(YYParseState * p)7320c8de5b0SBaptiste Daroussin yyFreeState(YYParseState *p)
7330c8de5b0SBaptiste Daroussin {
7340c8de5b0SBaptiste Daroussin yyfreestack(&p->yystack);
7350c8de5b0SBaptiste Daroussin free(p);
7360c8de5b0SBaptiste Daroussin }
7370c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
7380c8de5b0SBaptiste Daroussin
7390c8de5b0SBaptiste Daroussin #define YYABORT goto yyabort
7400c8de5b0SBaptiste Daroussin #define YYREJECT goto yyabort
7410c8de5b0SBaptiste Daroussin #define YYACCEPT goto yyaccept
7420c8de5b0SBaptiste Daroussin #define YYERROR goto yyerrlab
7430c8de5b0SBaptiste Daroussin #if YYBTYACC
7440c8de5b0SBaptiste Daroussin #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
7450c8de5b0SBaptiste Daroussin #define YYVALID_NESTED do { if (yyps->save && \
7460c8de5b0SBaptiste Daroussin yyps->save->save == 0) goto yyvalid; } while(0)
7470c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
7480c8de5b0SBaptiste Daroussin
7490c8de5b0SBaptiste Daroussin int
YYPARSE_DECL()7500c8de5b0SBaptiste Daroussin YYPARSE_DECL()
7510c8de5b0SBaptiste Daroussin {
7520c8de5b0SBaptiste Daroussin int yyerrflag;
7530c8de5b0SBaptiste Daroussin int yychar;
7540c8de5b0SBaptiste Daroussin YYSTYPE yyval;
7550c8de5b0SBaptiste Daroussin YYSTYPE yylval;
756b53bb29fSJung-uk Kim int yynerrs;
757b53bb29fSJung-uk Kim
7580c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
7590c8de5b0SBaptiste Daroussin YYLTYPE yyloc; /* position returned by actions */
7600c8de5b0SBaptiste Daroussin YYLTYPE yylloc; /* position from the lexer */
7610c8de5b0SBaptiste Daroussin #endif
7620c8de5b0SBaptiste Daroussin
7630c8de5b0SBaptiste Daroussin /* variables for the parser stack */
7640c8de5b0SBaptiste Daroussin YYSTACKDATA yystack;
7650c8de5b0SBaptiste Daroussin #if YYBTYACC
7660c8de5b0SBaptiste Daroussin
7670c8de5b0SBaptiste Daroussin /* Current parser state */
7680c8de5b0SBaptiste Daroussin static YYParseState *yyps = 0;
7690c8de5b0SBaptiste Daroussin
7700c8de5b0SBaptiste Daroussin /* yypath != NULL: do the full parse, starting at *yypath parser state. */
7710c8de5b0SBaptiste Daroussin static YYParseState *yypath = 0;
7720c8de5b0SBaptiste Daroussin
7730c8de5b0SBaptiste Daroussin /* Base of the lexical value queue */
7740c8de5b0SBaptiste Daroussin static YYSTYPE *yylvals = 0;
7750c8de5b0SBaptiste Daroussin
7760c8de5b0SBaptiste Daroussin /* Current position at lexical value queue */
7770c8de5b0SBaptiste Daroussin static YYSTYPE *yylvp = 0;
7780c8de5b0SBaptiste Daroussin
7790c8de5b0SBaptiste Daroussin /* End position of lexical value queue */
7800c8de5b0SBaptiste Daroussin static YYSTYPE *yylve = 0;
7810c8de5b0SBaptiste Daroussin
7820c8de5b0SBaptiste Daroussin /* The last allocated position at the lexical value queue */
7830c8de5b0SBaptiste Daroussin static YYSTYPE *yylvlim = 0;
7840c8de5b0SBaptiste Daroussin
7850c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
7860c8de5b0SBaptiste Daroussin /* Base of the lexical position queue */
7870c8de5b0SBaptiste Daroussin static YYLTYPE *yylpsns = 0;
7880c8de5b0SBaptiste Daroussin
7890c8de5b0SBaptiste Daroussin /* Current position at lexical position queue */
7900c8de5b0SBaptiste Daroussin static YYLTYPE *yylpp = 0;
7910c8de5b0SBaptiste Daroussin
7920c8de5b0SBaptiste Daroussin /* End position of lexical position queue */
7930c8de5b0SBaptiste Daroussin static YYLTYPE *yylpe = 0;
7940c8de5b0SBaptiste Daroussin
7950c8de5b0SBaptiste Daroussin /* The last allocated position at the lexical position queue */
7960c8de5b0SBaptiste Daroussin static YYLTYPE *yylplim = 0;
7970c8de5b0SBaptiste Daroussin #endif
7980c8de5b0SBaptiste Daroussin
7990c8de5b0SBaptiste Daroussin /* Current position at lexical token queue */
8002aca18c7SJung-uk Kim static YYINT *yylexp = 0;
8010c8de5b0SBaptiste Daroussin
8022aca18c7SJung-uk Kim static YYINT *yylexemes = 0;
8030c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
8040c8de5b0SBaptiste Daroussin int yym, yyn, yystate, yyresult;
8050c8de5b0SBaptiste Daroussin #if YYBTYACC
8060c8de5b0SBaptiste Daroussin int yynewerrflag;
8070c8de5b0SBaptiste Daroussin YYParseState *yyerrctx = NULL;
8080c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
8090c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
810b53bb29fSJung-uk Kim YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
8110c8de5b0SBaptiste Daroussin #endif
8120c8de5b0SBaptiste Daroussin #if YYDEBUG
8130c8de5b0SBaptiste Daroussin const char *yys;
8140c8de5b0SBaptiste Daroussin
815bf80e08eSJung-uk Kim if ((yys = getenv("YYDEBUG")) != NULL)
8160c8de5b0SBaptiste Daroussin {
8170c8de5b0SBaptiste Daroussin yyn = *yys;
8180c8de5b0SBaptiste Daroussin if (yyn >= '0' && yyn <= '9')
8190c8de5b0SBaptiste Daroussin yydebug = yyn - '0';
8200c8de5b0SBaptiste Daroussin }
8210c8de5b0SBaptiste Daroussin if (yydebug)
8220c8de5b0SBaptiste Daroussin fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
8230c8de5b0SBaptiste Daroussin #endif
8246166fdceSJung-uk Kim #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
8256166fdceSJung-uk Kim memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
8266166fdceSJung-uk Kim #endif
8276166fdceSJung-uk Kim
8286166fdceSJung-uk Kim yyerrflag = 0;
8296166fdceSJung-uk Kim yychar = 0;
8306166fdceSJung-uk Kim memset(&yyval, 0, sizeof(yyval));
8316166fdceSJung-uk Kim memset(&yylval, 0, sizeof(yylval));
8326166fdceSJung-uk Kim #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
8336166fdceSJung-uk Kim memset(&yyloc, 0, sizeof(yyloc));
8346166fdceSJung-uk Kim memset(&yylloc, 0, sizeof(yylloc));
8356166fdceSJung-uk Kim #endif
8360c8de5b0SBaptiste Daroussin
8370c8de5b0SBaptiste Daroussin #if YYBTYACC
8380c8de5b0SBaptiste Daroussin yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
8390c8de5b0SBaptiste Daroussin yyps->save = 0;
8400c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
841c5b5d71aSJung-uk Kim yym = 0;
8428e022d3cSDag-Erling Smørgrav /* yyn is set below */
8430c8de5b0SBaptiste Daroussin yynerrs = 0;
8440c8de5b0SBaptiste Daroussin yyerrflag = 0;
8450c8de5b0SBaptiste Daroussin yychar = YYEMPTY;
8460c8de5b0SBaptiste Daroussin yystate = 0;
8470c8de5b0SBaptiste Daroussin
8480c8de5b0SBaptiste Daroussin #if YYPURE
8490c8de5b0SBaptiste Daroussin memset(&yystack, 0, sizeof(yystack));
8500c8de5b0SBaptiste Daroussin #endif
8510c8de5b0SBaptiste Daroussin
8520c8de5b0SBaptiste Daroussin if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
8530c8de5b0SBaptiste Daroussin yystack.s_mark = yystack.s_base;
8540c8de5b0SBaptiste Daroussin yystack.l_mark = yystack.l_base;
8550c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
8560c8de5b0SBaptiste Daroussin yystack.p_mark = yystack.p_base;
8570c8de5b0SBaptiste Daroussin #endif
8580c8de5b0SBaptiste Daroussin yystate = 0;
8590c8de5b0SBaptiste Daroussin *yystack.s_mark = 0;
8600c8de5b0SBaptiste Daroussin
8610c8de5b0SBaptiste Daroussin yyloop:
8620c8de5b0SBaptiste Daroussin if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
8630c8de5b0SBaptiste Daroussin if (yychar < 0)
8640c8de5b0SBaptiste Daroussin {
8650c8de5b0SBaptiste Daroussin #if YYBTYACC
8660c8de5b0SBaptiste Daroussin do {
8670c8de5b0SBaptiste Daroussin if (yylvp < yylve)
8680c8de5b0SBaptiste Daroussin {
8690c8de5b0SBaptiste Daroussin /* we're currently re-reading tokens */
8700c8de5b0SBaptiste Daroussin yylval = *yylvp++;
8710c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
8720c8de5b0SBaptiste Daroussin yylloc = *yylpp++;
8730c8de5b0SBaptiste Daroussin #endif
8740c8de5b0SBaptiste Daroussin yychar = *yylexp++;
8750c8de5b0SBaptiste Daroussin break;
8760c8de5b0SBaptiste Daroussin }
8770c8de5b0SBaptiste Daroussin if (yyps->save)
8780c8de5b0SBaptiste Daroussin {
8790c8de5b0SBaptiste Daroussin /* in trial mode; save scanner results for future parse attempts */
8800c8de5b0SBaptiste Daroussin if (yylvp == yylvlim)
8810c8de5b0SBaptiste Daroussin { /* Enlarge lexical value queue */
88211fce282SBaptiste Daroussin size_t p = (size_t) (yylvp - yylvals);
88311fce282SBaptiste Daroussin size_t s = (size_t) (yylvlim - yylvals);
8840c8de5b0SBaptiste Daroussin
8850c8de5b0SBaptiste Daroussin s += YYLVQUEUEGROWTH;
886b53bb29fSJung-uk Kim if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
887b53bb29fSJung-uk Kim if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
8880c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
889b53bb29fSJung-uk Kim if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
8900c8de5b0SBaptiste Daroussin #endif
8910c8de5b0SBaptiste Daroussin yylvp = yylve = yylvals + p;
8920c8de5b0SBaptiste Daroussin yylvlim = yylvals + s;
8930c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
8940c8de5b0SBaptiste Daroussin yylpp = yylpe = yylpsns + p;
8950c8de5b0SBaptiste Daroussin yylplim = yylpsns + s;
8960c8de5b0SBaptiste Daroussin #endif
8970c8de5b0SBaptiste Daroussin yylexp = yylexemes + p;
8980c8de5b0SBaptiste Daroussin }
8992aca18c7SJung-uk Kim *yylexp = (YYINT) YYLEX;
9000c8de5b0SBaptiste Daroussin *yylvp++ = yylval;
9010c8de5b0SBaptiste Daroussin yylve++;
9020c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
9030c8de5b0SBaptiste Daroussin *yylpp++ = yylloc;
9040c8de5b0SBaptiste Daroussin yylpe++;
9050c8de5b0SBaptiste Daroussin #endif
9060c8de5b0SBaptiste Daroussin yychar = *yylexp++;
9070c8de5b0SBaptiste Daroussin break;
9080c8de5b0SBaptiste Daroussin }
9090c8de5b0SBaptiste Daroussin /* normal operation, no conflict encountered */
9100c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
9110c8de5b0SBaptiste Daroussin yychar = YYLEX;
9120c8de5b0SBaptiste Daroussin #if YYBTYACC
9130c8de5b0SBaptiste Daroussin } while (0);
9140c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
9150c8de5b0SBaptiste Daroussin if (yychar < 0) yychar = YYEOF;
9160c8de5b0SBaptiste Daroussin #if YYDEBUG
9170c8de5b0SBaptiste Daroussin if (yydebug)
9180c8de5b0SBaptiste Daroussin {
919c5b5d71aSJung-uk Kim if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
9200c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
9210c8de5b0SBaptiste Daroussin YYDEBUGSTR, yydepth, yystate, yychar, yys);
9220c8de5b0SBaptiste Daroussin #ifdef YYSTYPE_TOSTRING
9230c8de5b0SBaptiste Daroussin #if YYBTYACC
9240c8de5b0SBaptiste Daroussin if (!yytrial)
9250c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
9260c8de5b0SBaptiste Daroussin fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
9270c8de5b0SBaptiste Daroussin #endif
9280c8de5b0SBaptiste Daroussin fputc('\n', stderr);
9290c8de5b0SBaptiste Daroussin }
9300c8de5b0SBaptiste Daroussin #endif
9310c8de5b0SBaptiste Daroussin }
9320c8de5b0SBaptiste Daroussin #if YYBTYACC
9330c8de5b0SBaptiste Daroussin
9340c8de5b0SBaptiste Daroussin /* Do we have a conflict? */
9350c8de5b0SBaptiste Daroussin if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
9360c8de5b0SBaptiste Daroussin yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
9370c8de5b0SBaptiste Daroussin {
9380c8de5b0SBaptiste Daroussin YYINT ctry;
9390c8de5b0SBaptiste Daroussin
9400c8de5b0SBaptiste Daroussin if (yypath)
9410c8de5b0SBaptiste Daroussin {
9420c8de5b0SBaptiste Daroussin YYParseState *save;
9430c8de5b0SBaptiste Daroussin #if YYDEBUG
9440c8de5b0SBaptiste Daroussin if (yydebug)
9450c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
9460c8de5b0SBaptiste Daroussin YYDEBUGSTR, yydepth, yystate);
9470c8de5b0SBaptiste Daroussin #endif
9480c8de5b0SBaptiste Daroussin /* Switch to the next conflict context */
9490c8de5b0SBaptiste Daroussin save = yypath;
9500c8de5b0SBaptiste Daroussin yypath = save->save;
9510c8de5b0SBaptiste Daroussin save->save = NULL;
9520c8de5b0SBaptiste Daroussin ctry = save->ctry;
9530c8de5b0SBaptiste Daroussin if (save->state != yystate) YYABORT;
9540c8de5b0SBaptiste Daroussin yyFreeState(save);
9550c8de5b0SBaptiste Daroussin
9560c8de5b0SBaptiste Daroussin }
9570c8de5b0SBaptiste Daroussin else
9580c8de5b0SBaptiste Daroussin {
9590c8de5b0SBaptiste Daroussin
9600c8de5b0SBaptiste Daroussin /* Unresolved conflict - start/continue trial parse */
9610c8de5b0SBaptiste Daroussin YYParseState *save;
9620c8de5b0SBaptiste Daroussin #if YYDEBUG
9630c8de5b0SBaptiste Daroussin if (yydebug)
9640c8de5b0SBaptiste Daroussin {
9650c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
9660c8de5b0SBaptiste Daroussin if (yyps->save)
9670c8de5b0SBaptiste Daroussin fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
9680c8de5b0SBaptiste Daroussin else
9690c8de5b0SBaptiste Daroussin fputs("Starting trial parse.\n", stderr);
9700c8de5b0SBaptiste Daroussin }
9710c8de5b0SBaptiste Daroussin #endif
9720c8de5b0SBaptiste Daroussin save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
9730c8de5b0SBaptiste Daroussin if (save == NULL) goto yyenomem;
9740c8de5b0SBaptiste Daroussin save->save = yyps->save;
9750c8de5b0SBaptiste Daroussin save->state = yystate;
9760c8de5b0SBaptiste Daroussin save->errflag = yyerrflag;
9770c8de5b0SBaptiste Daroussin save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
978c5b5d71aSJung-uk Kim memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
9790c8de5b0SBaptiste Daroussin save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
98011fce282SBaptiste Daroussin memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
9810c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
9820c8de5b0SBaptiste Daroussin save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
98311fce282SBaptiste Daroussin memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
9840c8de5b0SBaptiste Daroussin #endif
9850c8de5b0SBaptiste Daroussin ctry = yytable[yyn];
9860c8de5b0SBaptiste Daroussin if (yyctable[ctry] == -1)
9870c8de5b0SBaptiste Daroussin {
9880c8de5b0SBaptiste Daroussin #if YYDEBUG
9890c8de5b0SBaptiste Daroussin if (yydebug && yychar >= YYEOF)
9900c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
9910c8de5b0SBaptiste Daroussin #endif
9920c8de5b0SBaptiste Daroussin ctry++;
9930c8de5b0SBaptiste Daroussin }
9940c8de5b0SBaptiste Daroussin save->ctry = ctry;
9950c8de5b0SBaptiste Daroussin if (yyps->save == NULL)
9960c8de5b0SBaptiste Daroussin {
9970c8de5b0SBaptiste Daroussin /* If this is a first conflict in the stack, start saving lexemes */
9980c8de5b0SBaptiste Daroussin if (!yylexemes)
9990c8de5b0SBaptiste Daroussin {
1000b53bb29fSJung-uk Kim yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
10010c8de5b0SBaptiste Daroussin if (yylexemes == NULL) goto yyenomem;
10020c8de5b0SBaptiste Daroussin yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
10030c8de5b0SBaptiste Daroussin if (yylvals == NULL) goto yyenomem;
10040c8de5b0SBaptiste Daroussin yylvlim = yylvals + YYLVQUEUEGROWTH;
10050c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
10060c8de5b0SBaptiste Daroussin yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
10070c8de5b0SBaptiste Daroussin if (yylpsns == NULL) goto yyenomem;
10080c8de5b0SBaptiste Daroussin yylplim = yylpsns + YYLVQUEUEGROWTH;
10090c8de5b0SBaptiste Daroussin #endif
10100c8de5b0SBaptiste Daroussin }
10110c8de5b0SBaptiste Daroussin if (yylvp == yylve)
10120c8de5b0SBaptiste Daroussin {
10130c8de5b0SBaptiste Daroussin yylvp = yylve = yylvals;
10140c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
10150c8de5b0SBaptiste Daroussin yylpp = yylpe = yylpsns;
10160c8de5b0SBaptiste Daroussin #endif
10170c8de5b0SBaptiste Daroussin yylexp = yylexemes;
10180c8de5b0SBaptiste Daroussin if (yychar >= YYEOF)
10190c8de5b0SBaptiste Daroussin {
10200c8de5b0SBaptiste Daroussin *yylve++ = yylval;
10210c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
10220c8de5b0SBaptiste Daroussin *yylpe++ = yylloc;
10230c8de5b0SBaptiste Daroussin #endif
10242aca18c7SJung-uk Kim *yylexp = (YYINT) yychar;
10250c8de5b0SBaptiste Daroussin yychar = YYEMPTY;
10260c8de5b0SBaptiste Daroussin }
10270c8de5b0SBaptiste Daroussin }
10280c8de5b0SBaptiste Daroussin }
10290c8de5b0SBaptiste Daroussin if (yychar >= YYEOF)
10300c8de5b0SBaptiste Daroussin {
10310c8de5b0SBaptiste Daroussin yylvp--;
10320c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
10330c8de5b0SBaptiste Daroussin yylpp--;
10340c8de5b0SBaptiste Daroussin #endif
10350c8de5b0SBaptiste Daroussin yylexp--;
10360c8de5b0SBaptiste Daroussin yychar = YYEMPTY;
10370c8de5b0SBaptiste Daroussin }
103811fce282SBaptiste Daroussin save->lexeme = (int) (yylvp - yylvals);
10390c8de5b0SBaptiste Daroussin yyps->save = save;
10400c8de5b0SBaptiste Daroussin }
10410c8de5b0SBaptiste Daroussin if (yytable[yyn] == ctry)
10420c8de5b0SBaptiste Daroussin {
10430c8de5b0SBaptiste Daroussin #if YYDEBUG
10440c8de5b0SBaptiste Daroussin if (yydebug)
10450c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
10460c8de5b0SBaptiste Daroussin YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
10470c8de5b0SBaptiste Daroussin #endif
10480c8de5b0SBaptiste Daroussin if (yychar < 0)
10490c8de5b0SBaptiste Daroussin {
10500c8de5b0SBaptiste Daroussin yylvp++;
10510c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
10520c8de5b0SBaptiste Daroussin yylpp++;
10530c8de5b0SBaptiste Daroussin #endif
10540c8de5b0SBaptiste Daroussin yylexp++;
10550c8de5b0SBaptiste Daroussin }
10560c8de5b0SBaptiste Daroussin if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
10570c8de5b0SBaptiste Daroussin goto yyoverflow;
10580c8de5b0SBaptiste Daroussin yystate = yyctable[ctry];
1059c5b5d71aSJung-uk Kim *++yystack.s_mark = (YYINT) yystate;
10600c8de5b0SBaptiste Daroussin *++yystack.l_mark = yylval;
10610c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
10620c8de5b0SBaptiste Daroussin *++yystack.p_mark = yylloc;
10630c8de5b0SBaptiste Daroussin #endif
10640c8de5b0SBaptiste Daroussin yychar = YYEMPTY;
10650c8de5b0SBaptiste Daroussin if (yyerrflag > 0) --yyerrflag;
10660c8de5b0SBaptiste Daroussin goto yyloop;
10670c8de5b0SBaptiste Daroussin }
10680c8de5b0SBaptiste Daroussin else
10690c8de5b0SBaptiste Daroussin {
10700c8de5b0SBaptiste Daroussin yyn = yyctable[ctry];
10710c8de5b0SBaptiste Daroussin goto yyreduce;
10720c8de5b0SBaptiste Daroussin }
10730c8de5b0SBaptiste Daroussin } /* End of code dealing with conflicts */
10740c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
10750c8de5b0SBaptiste Daroussin if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
10760c8de5b0SBaptiste Daroussin yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
10770c8de5b0SBaptiste Daroussin {
10780c8de5b0SBaptiste Daroussin #if YYDEBUG
10790c8de5b0SBaptiste Daroussin if (yydebug)
10800c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
10810c8de5b0SBaptiste Daroussin YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
10820c8de5b0SBaptiste Daroussin #endif
10830c8de5b0SBaptiste Daroussin if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
10840c8de5b0SBaptiste Daroussin yystate = yytable[yyn];
10850c8de5b0SBaptiste Daroussin *++yystack.s_mark = yytable[yyn];
10860c8de5b0SBaptiste Daroussin *++yystack.l_mark = yylval;
10870c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
10880c8de5b0SBaptiste Daroussin *++yystack.p_mark = yylloc;
10890c8de5b0SBaptiste Daroussin #endif
10900c8de5b0SBaptiste Daroussin yychar = YYEMPTY;
10910c8de5b0SBaptiste Daroussin if (yyerrflag > 0) --yyerrflag;
10920c8de5b0SBaptiste Daroussin goto yyloop;
10930c8de5b0SBaptiste Daroussin }
10940c8de5b0SBaptiste Daroussin if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
10950c8de5b0SBaptiste Daroussin yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
10960c8de5b0SBaptiste Daroussin {
10970c8de5b0SBaptiste Daroussin yyn = yytable[yyn];
10980c8de5b0SBaptiste Daroussin goto yyreduce;
10990c8de5b0SBaptiste Daroussin }
11000c8de5b0SBaptiste Daroussin if (yyerrflag != 0) goto yyinrecovery;
11010c8de5b0SBaptiste Daroussin #if YYBTYACC
11020c8de5b0SBaptiste Daroussin
11030c8de5b0SBaptiste Daroussin yynewerrflag = 1;
11040c8de5b0SBaptiste Daroussin goto yyerrhandler;
1105c5b5d71aSJung-uk Kim goto yyerrlab; /* redundant goto avoids 'unused label' warning */
11060c8de5b0SBaptiste Daroussin
11070c8de5b0SBaptiste Daroussin yyerrlab:
1108c5b5d71aSJung-uk Kim /* explicit YYERROR from an action -- pop the rhs of the rule reduced
1109c5b5d71aSJung-uk Kim * before looking for error recovery */
1110c5b5d71aSJung-uk Kim yystack.s_mark -= yym;
1111c5b5d71aSJung-uk Kim yystate = *yystack.s_mark;
1112c5b5d71aSJung-uk Kim yystack.l_mark -= yym;
1113c5b5d71aSJung-uk Kim #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1114c5b5d71aSJung-uk Kim yystack.p_mark -= yym;
1115c5b5d71aSJung-uk Kim #endif
1116c5b5d71aSJung-uk Kim
11170c8de5b0SBaptiste Daroussin yynewerrflag = 0;
11180c8de5b0SBaptiste Daroussin yyerrhandler:
11190c8de5b0SBaptiste Daroussin while (yyps->save)
11200c8de5b0SBaptiste Daroussin {
11210c8de5b0SBaptiste Daroussin int ctry;
11220c8de5b0SBaptiste Daroussin YYParseState *save = yyps->save;
11230c8de5b0SBaptiste Daroussin #if YYDEBUG
11240c8de5b0SBaptiste Daroussin if (yydebug)
11250c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
11260c8de5b0SBaptiste Daroussin YYDEBUGSTR, yydepth, yystate, yyps->save->state,
11270c8de5b0SBaptiste Daroussin (int)(yylvp - yylvals - yyps->save->lexeme));
11280c8de5b0SBaptiste Daroussin #endif
11290c8de5b0SBaptiste Daroussin /* Memorize most forward-looking error state in case it's really an error. */
11300c8de5b0SBaptiste Daroussin if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
11310c8de5b0SBaptiste Daroussin {
11320c8de5b0SBaptiste Daroussin /* Free old saved error context state */
11330c8de5b0SBaptiste Daroussin if (yyerrctx) yyFreeState(yyerrctx);
11340c8de5b0SBaptiste Daroussin /* Create and fill out new saved error context state */
11350c8de5b0SBaptiste Daroussin yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
11360c8de5b0SBaptiste Daroussin if (yyerrctx == NULL) goto yyenomem;
11370c8de5b0SBaptiste Daroussin yyerrctx->save = yyps->save;
11380c8de5b0SBaptiste Daroussin yyerrctx->state = yystate;
11390c8de5b0SBaptiste Daroussin yyerrctx->errflag = yyerrflag;
11400c8de5b0SBaptiste Daroussin yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1141c5b5d71aSJung-uk Kim memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
11420c8de5b0SBaptiste Daroussin yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
114311fce282SBaptiste Daroussin memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
11440c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
11450c8de5b0SBaptiste Daroussin yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
114611fce282SBaptiste Daroussin memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
11470c8de5b0SBaptiste Daroussin #endif
114811fce282SBaptiste Daroussin yyerrctx->lexeme = (int) (yylvp - yylvals);
11490c8de5b0SBaptiste Daroussin }
11500c8de5b0SBaptiste Daroussin yylvp = yylvals + save->lexeme;
11510c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
11520c8de5b0SBaptiste Daroussin yylpp = yylpsns + save->lexeme;
11530c8de5b0SBaptiste Daroussin #endif
11540c8de5b0SBaptiste Daroussin yylexp = yylexemes + save->lexeme;
11550c8de5b0SBaptiste Daroussin yychar = YYEMPTY;
11560c8de5b0SBaptiste Daroussin yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1157c5b5d71aSJung-uk Kim memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
11580c8de5b0SBaptiste Daroussin yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
115911fce282SBaptiste Daroussin memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
11600c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
11610c8de5b0SBaptiste Daroussin yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
116211fce282SBaptiste Daroussin memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
11630c8de5b0SBaptiste Daroussin #endif
11640c8de5b0SBaptiste Daroussin ctry = ++save->ctry;
11650c8de5b0SBaptiste Daroussin yystate = save->state;
11660c8de5b0SBaptiste Daroussin /* We tried shift, try reduce now */
11670c8de5b0SBaptiste Daroussin if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
11680c8de5b0SBaptiste Daroussin yyps->save = save->save;
11690c8de5b0SBaptiste Daroussin save->save = NULL;
11700c8de5b0SBaptiste Daroussin yyFreeState(save);
11710c8de5b0SBaptiste Daroussin
11720c8de5b0SBaptiste Daroussin /* Nothing left on the stack -- error */
11730c8de5b0SBaptiste Daroussin if (!yyps->save)
11740c8de5b0SBaptiste Daroussin {
11750c8de5b0SBaptiste Daroussin #if YYDEBUG
11760c8de5b0SBaptiste Daroussin if (yydebug)
11770c8de5b0SBaptiste Daroussin fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
11780c8de5b0SBaptiste Daroussin YYPREFIX, yydepth);
11790c8de5b0SBaptiste Daroussin #endif
11800c8de5b0SBaptiste Daroussin /* Restore state as it was in the most forward-advanced error */
11810c8de5b0SBaptiste Daroussin yylvp = yylvals + yyerrctx->lexeme;
11820c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
11830c8de5b0SBaptiste Daroussin yylpp = yylpsns + yyerrctx->lexeme;
11840c8de5b0SBaptiste Daroussin #endif
11850c8de5b0SBaptiste Daroussin yylexp = yylexemes + yyerrctx->lexeme;
11860c8de5b0SBaptiste Daroussin yychar = yylexp[-1];
11870c8de5b0SBaptiste Daroussin yylval = yylvp[-1];
11880c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
11890c8de5b0SBaptiste Daroussin yylloc = yylpp[-1];
11900c8de5b0SBaptiste Daroussin #endif
11910c8de5b0SBaptiste Daroussin yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1192c5b5d71aSJung-uk Kim memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
11930c8de5b0SBaptiste Daroussin yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
119411fce282SBaptiste Daroussin memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
11950c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
11960c8de5b0SBaptiste Daroussin yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
119711fce282SBaptiste Daroussin memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
11980c8de5b0SBaptiste Daroussin #endif
11990c8de5b0SBaptiste Daroussin yystate = yyerrctx->state;
12000c8de5b0SBaptiste Daroussin yyFreeState(yyerrctx);
12010c8de5b0SBaptiste Daroussin yyerrctx = NULL;
12020c8de5b0SBaptiste Daroussin }
12030c8de5b0SBaptiste Daroussin yynewerrflag = 1;
12040c8de5b0SBaptiste Daroussin }
12050c8de5b0SBaptiste Daroussin if (yynewerrflag == 0) goto yyinrecovery;
12060c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
12070c8de5b0SBaptiste Daroussin
12080c8de5b0SBaptiste Daroussin YYERROR_CALL("syntax error");
12090c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1210b53bb29fSJung-uk Kim yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
12110c8de5b0SBaptiste Daroussin #endif
12120c8de5b0SBaptiste Daroussin
12130c8de5b0SBaptiste Daroussin #if !YYBTYACC
1214c5b5d71aSJung-uk Kim goto yyerrlab; /* redundant goto avoids 'unused label' warning */
12150c8de5b0SBaptiste Daroussin yyerrlab:
12160c8de5b0SBaptiste Daroussin #endif
12170c8de5b0SBaptiste Daroussin ++yynerrs;
12180c8de5b0SBaptiste Daroussin
12190c8de5b0SBaptiste Daroussin yyinrecovery:
12200c8de5b0SBaptiste Daroussin if (yyerrflag < 3)
12210c8de5b0SBaptiste Daroussin {
12220c8de5b0SBaptiste Daroussin yyerrflag = 3;
12230c8de5b0SBaptiste Daroussin for (;;)
12240c8de5b0SBaptiste Daroussin {
12250c8de5b0SBaptiste Daroussin if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
12260c8de5b0SBaptiste Daroussin yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
12270c8de5b0SBaptiste Daroussin {
12280c8de5b0SBaptiste Daroussin #if YYDEBUG
12290c8de5b0SBaptiste Daroussin if (yydebug)
12300c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
12310c8de5b0SBaptiste Daroussin YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
12320c8de5b0SBaptiste Daroussin #endif
12330c8de5b0SBaptiste Daroussin if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
12340c8de5b0SBaptiste Daroussin yystate = yytable[yyn];
12350c8de5b0SBaptiste Daroussin *++yystack.s_mark = yytable[yyn];
12360c8de5b0SBaptiste Daroussin *++yystack.l_mark = yylval;
12370c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
12380c8de5b0SBaptiste Daroussin /* lookahead position is error end position */
1239b53bb29fSJung-uk Kim yyerror_loc_range[2] = yylloc;
12400c8de5b0SBaptiste Daroussin YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
12410c8de5b0SBaptiste Daroussin *++yystack.p_mark = yyloc;
12420c8de5b0SBaptiste Daroussin #endif
12430c8de5b0SBaptiste Daroussin goto yyloop;
12440c8de5b0SBaptiste Daroussin }
12450c8de5b0SBaptiste Daroussin else
12460c8de5b0SBaptiste Daroussin {
12470c8de5b0SBaptiste Daroussin #if YYDEBUG
12480c8de5b0SBaptiste Daroussin if (yydebug)
12490c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
12500c8de5b0SBaptiste Daroussin YYDEBUGSTR, yydepth, *yystack.s_mark);
12510c8de5b0SBaptiste Daroussin #endif
12520c8de5b0SBaptiste Daroussin if (yystack.s_mark <= yystack.s_base) goto yyabort;
12530c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
12540c8de5b0SBaptiste Daroussin /* the current TOS position is the error start position */
1255b53bb29fSJung-uk Kim yyerror_loc_range[1] = *yystack.p_mark;
12560c8de5b0SBaptiste Daroussin #endif
12570c8de5b0SBaptiste Daroussin #if defined(YYDESTRUCT_CALL)
12580c8de5b0SBaptiste Daroussin #if YYBTYACC
12590c8de5b0SBaptiste Daroussin if (!yytrial)
12600c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
12610c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
12620c8de5b0SBaptiste Daroussin YYDESTRUCT_CALL("error: discarding state",
12630c8de5b0SBaptiste Daroussin yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
12640c8de5b0SBaptiste Daroussin #else
12650c8de5b0SBaptiste Daroussin YYDESTRUCT_CALL("error: discarding state",
12660c8de5b0SBaptiste Daroussin yystos[*yystack.s_mark], yystack.l_mark);
12670c8de5b0SBaptiste Daroussin #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
12680c8de5b0SBaptiste Daroussin #endif /* defined(YYDESTRUCT_CALL) */
12690c8de5b0SBaptiste Daroussin --yystack.s_mark;
12700c8de5b0SBaptiste Daroussin --yystack.l_mark;
12710c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
12720c8de5b0SBaptiste Daroussin --yystack.p_mark;
12730c8de5b0SBaptiste Daroussin #endif
12740c8de5b0SBaptiste Daroussin }
12750c8de5b0SBaptiste Daroussin }
12760c8de5b0SBaptiste Daroussin }
12770c8de5b0SBaptiste Daroussin else
12780c8de5b0SBaptiste Daroussin {
12790c8de5b0SBaptiste Daroussin if (yychar == YYEOF) goto yyabort;
12800c8de5b0SBaptiste Daroussin #if YYDEBUG
12810c8de5b0SBaptiste Daroussin if (yydebug)
12820c8de5b0SBaptiste Daroussin {
1283c5b5d71aSJung-uk Kim if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
12840c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
12850c8de5b0SBaptiste Daroussin YYDEBUGSTR, yydepth, yystate, yychar, yys);
12860c8de5b0SBaptiste Daroussin }
12870c8de5b0SBaptiste Daroussin #endif
12880c8de5b0SBaptiste Daroussin #if defined(YYDESTRUCT_CALL)
12890c8de5b0SBaptiste Daroussin #if YYBTYACC
12900c8de5b0SBaptiste Daroussin if (!yytrial)
12910c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
12920c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
12930c8de5b0SBaptiste Daroussin YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
12940c8de5b0SBaptiste Daroussin #else
12950c8de5b0SBaptiste Daroussin YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
12960c8de5b0SBaptiste Daroussin #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
12970c8de5b0SBaptiste Daroussin #endif /* defined(YYDESTRUCT_CALL) */
12980c8de5b0SBaptiste Daroussin yychar = YYEMPTY;
12990c8de5b0SBaptiste Daroussin goto yyloop;
13000c8de5b0SBaptiste Daroussin }
13010c8de5b0SBaptiste Daroussin
13020c8de5b0SBaptiste Daroussin yyreduce:
13030c8de5b0SBaptiste Daroussin yym = yylen[yyn];
13040c8de5b0SBaptiste Daroussin #if YYDEBUG
13050c8de5b0SBaptiste Daroussin if (yydebug)
13060c8de5b0SBaptiste Daroussin {
13070c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
13080c8de5b0SBaptiste Daroussin YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
13090c8de5b0SBaptiste Daroussin #ifdef YYSTYPE_TOSTRING
13100c8de5b0SBaptiste Daroussin #if YYBTYACC
13110c8de5b0SBaptiste Daroussin if (!yytrial)
13120c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
13130c8de5b0SBaptiste Daroussin if (yym > 0)
13140c8de5b0SBaptiste Daroussin {
13150c8de5b0SBaptiste Daroussin int i;
13160c8de5b0SBaptiste Daroussin fputc('<', stderr);
13170c8de5b0SBaptiste Daroussin for (i = yym; i > 0; i--)
13180c8de5b0SBaptiste Daroussin {
13190c8de5b0SBaptiste Daroussin if (i != yym) fputs(", ", stderr);
13200c8de5b0SBaptiste Daroussin fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
13210c8de5b0SBaptiste Daroussin yystack.l_mark[1-i]), stderr);
13220c8de5b0SBaptiste Daroussin }
13230c8de5b0SBaptiste Daroussin fputc('>', stderr);
13240c8de5b0SBaptiste Daroussin }
13250c8de5b0SBaptiste Daroussin #endif
13260c8de5b0SBaptiste Daroussin fputc('\n', stderr);
13270c8de5b0SBaptiste Daroussin }
13280c8de5b0SBaptiste Daroussin #endif
13290c8de5b0SBaptiste Daroussin if (yym > 0)
13300c8de5b0SBaptiste Daroussin yyval = yystack.l_mark[1-yym];
13310c8de5b0SBaptiste Daroussin else
13320c8de5b0SBaptiste Daroussin memset(&yyval, 0, sizeof yyval);
13330c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
13340c8de5b0SBaptiste Daroussin
13350c8de5b0SBaptiste Daroussin /* Perform position reduction */
13360c8de5b0SBaptiste Daroussin memset(&yyloc, 0, sizeof(yyloc));
13370c8de5b0SBaptiste Daroussin #if YYBTYACC
13380c8de5b0SBaptiste Daroussin if (!yytrial)
13390c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
13400c8de5b0SBaptiste Daroussin {
1341b53bb29fSJung-uk Kim YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
13420c8de5b0SBaptiste Daroussin /* just in case YYERROR is invoked within the action, save
13430c8de5b0SBaptiste Daroussin the start of the rhs as the error start position */
1344b53bb29fSJung-uk Kim yyerror_loc_range[1] = yystack.p_mark[1-yym];
13450c8de5b0SBaptiste Daroussin }
13460c8de5b0SBaptiste Daroussin #endif
13470c8de5b0SBaptiste Daroussin
13480c8de5b0SBaptiste Daroussin switch (yyn)
13490c8de5b0SBaptiste Daroussin {
13500c8de5b0SBaptiste Daroussin case 2:
13510c8de5b0SBaptiste Daroussin #line 51 "btyacc_calc1.y"
13520c8de5b0SBaptiste Daroussin {YYVALID;}
13538e022d3cSDag-Erling Smørgrav #line 1354 "btyacc_calc1.tab.c"
13540c8de5b0SBaptiste Daroussin break;
13550c8de5b0SBaptiste Daroussin case 3:
13560c8de5b0SBaptiste Daroussin #line 52 "btyacc_calc1.y"
13570c8de5b0SBaptiste Daroussin {YYVALID;} if (!yytrial)
13580c8de5b0SBaptiste Daroussin #line 53 "btyacc_calc1.y"
13590c8de5b0SBaptiste Daroussin {
13600c8de5b0SBaptiste Daroussin yyerrok;
13610c8de5b0SBaptiste Daroussin }
13628e022d3cSDag-Erling Smørgrav #line 1363 "btyacc_calc1.tab.c"
13630c8de5b0SBaptiste Daroussin break;
13640c8de5b0SBaptiste Daroussin case 4:
13650c8de5b0SBaptiste Daroussin if (!yytrial)
13660c8de5b0SBaptiste Daroussin #line 59 "btyacc_calc1.y"
13670c8de5b0SBaptiste Daroussin {
13680c8de5b0SBaptiste Daroussin (void) printf("%15.8f\n", yystack.l_mark[0].dval);
13690c8de5b0SBaptiste Daroussin }
13708e022d3cSDag-Erling Smørgrav #line 1371 "btyacc_calc1.tab.c"
13710c8de5b0SBaptiste Daroussin break;
13720c8de5b0SBaptiste Daroussin case 5:
13730c8de5b0SBaptiste Daroussin if (!yytrial)
13740c8de5b0SBaptiste Daroussin #line 63 "btyacc_calc1.y"
13750c8de5b0SBaptiste Daroussin {
13760c8de5b0SBaptiste Daroussin (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[0].vval.lo, yystack.l_mark[0].vval.hi);
13770c8de5b0SBaptiste Daroussin }
13788e022d3cSDag-Erling Smørgrav #line 1379 "btyacc_calc1.tab.c"
13790c8de5b0SBaptiste Daroussin break;
13800c8de5b0SBaptiste Daroussin case 6:
13810c8de5b0SBaptiste Daroussin if (!yytrial)
13820c8de5b0SBaptiste Daroussin #line 67 "btyacc_calc1.y"
13830c8de5b0SBaptiste Daroussin {
13840c8de5b0SBaptiste Daroussin dreg[yystack.l_mark[-2].ival] = yystack.l_mark[0].dval;
13850c8de5b0SBaptiste Daroussin }
13868e022d3cSDag-Erling Smørgrav #line 1387 "btyacc_calc1.tab.c"
13870c8de5b0SBaptiste Daroussin break;
13880c8de5b0SBaptiste Daroussin case 7:
13890c8de5b0SBaptiste Daroussin if (!yytrial)
13900c8de5b0SBaptiste Daroussin #line 71 "btyacc_calc1.y"
13910c8de5b0SBaptiste Daroussin {
13920c8de5b0SBaptiste Daroussin vreg[yystack.l_mark[-2].ival] = yystack.l_mark[0].vval;
13930c8de5b0SBaptiste Daroussin }
13948e022d3cSDag-Erling Smørgrav #line 1395 "btyacc_calc1.tab.c"
13950c8de5b0SBaptiste Daroussin break;
13960c8de5b0SBaptiste Daroussin case 9:
13970c8de5b0SBaptiste Daroussin if (!yytrial)
13980c8de5b0SBaptiste Daroussin #line 78 "btyacc_calc1.y"
13990c8de5b0SBaptiste Daroussin {
14000c8de5b0SBaptiste Daroussin yyval.dval = dreg[yystack.l_mark[0].ival];
14010c8de5b0SBaptiste Daroussin }
14028e022d3cSDag-Erling Smørgrav #line 1403 "btyacc_calc1.tab.c"
14030c8de5b0SBaptiste Daroussin break;
14040c8de5b0SBaptiste Daroussin case 10:
14050c8de5b0SBaptiste Daroussin if (!yytrial)
14060c8de5b0SBaptiste Daroussin #line 82 "btyacc_calc1.y"
14070c8de5b0SBaptiste Daroussin {
14080c8de5b0SBaptiste Daroussin yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
14090c8de5b0SBaptiste Daroussin }
14108e022d3cSDag-Erling Smørgrav #line 1411 "btyacc_calc1.tab.c"
14110c8de5b0SBaptiste Daroussin break;
14120c8de5b0SBaptiste Daroussin case 11:
14130c8de5b0SBaptiste Daroussin if (!yytrial)
14140c8de5b0SBaptiste Daroussin #line 86 "btyacc_calc1.y"
14150c8de5b0SBaptiste Daroussin {
14160c8de5b0SBaptiste Daroussin yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
14170c8de5b0SBaptiste Daroussin }
14188e022d3cSDag-Erling Smørgrav #line 1419 "btyacc_calc1.tab.c"
14190c8de5b0SBaptiste Daroussin break;
14200c8de5b0SBaptiste Daroussin case 12:
14210c8de5b0SBaptiste Daroussin if (!yytrial)
14220c8de5b0SBaptiste Daroussin #line 90 "btyacc_calc1.y"
14230c8de5b0SBaptiste Daroussin {
14240c8de5b0SBaptiste Daroussin yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
14250c8de5b0SBaptiste Daroussin }
14268e022d3cSDag-Erling Smørgrav #line 1427 "btyacc_calc1.tab.c"
14270c8de5b0SBaptiste Daroussin break;
14280c8de5b0SBaptiste Daroussin case 13:
14290c8de5b0SBaptiste Daroussin if (!yytrial)
14300c8de5b0SBaptiste Daroussin #line 94 "btyacc_calc1.y"
14310c8de5b0SBaptiste Daroussin {
14320c8de5b0SBaptiste Daroussin yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
14330c8de5b0SBaptiste Daroussin }
14348e022d3cSDag-Erling Smørgrav #line 1435 "btyacc_calc1.tab.c"
14350c8de5b0SBaptiste Daroussin break;
14360c8de5b0SBaptiste Daroussin case 14:
14370c8de5b0SBaptiste Daroussin if (!yytrial)
14380c8de5b0SBaptiste Daroussin #line 98 "btyacc_calc1.y"
14390c8de5b0SBaptiste Daroussin {
14400c8de5b0SBaptiste Daroussin yyval.dval = -yystack.l_mark[0].dval;
14410c8de5b0SBaptiste Daroussin }
14428e022d3cSDag-Erling Smørgrav #line 1443 "btyacc_calc1.tab.c"
14430c8de5b0SBaptiste Daroussin break;
14440c8de5b0SBaptiste Daroussin case 15:
14450c8de5b0SBaptiste Daroussin if (!yytrial)
14460c8de5b0SBaptiste Daroussin #line 102 "btyacc_calc1.y"
14470c8de5b0SBaptiste Daroussin {
14480c8de5b0SBaptiste Daroussin yyval.dval = yystack.l_mark[-1].dval;
14490c8de5b0SBaptiste Daroussin }
14508e022d3cSDag-Erling Smørgrav #line 1451 "btyacc_calc1.tab.c"
14510c8de5b0SBaptiste Daroussin break;
14520c8de5b0SBaptiste Daroussin case 16:
14530c8de5b0SBaptiste Daroussin if (!yytrial)
14540c8de5b0SBaptiste Daroussin #line 108 "btyacc_calc1.y"
14550c8de5b0SBaptiste Daroussin {
14560c8de5b0SBaptiste Daroussin yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
14570c8de5b0SBaptiste Daroussin }
14588e022d3cSDag-Erling Smørgrav #line 1459 "btyacc_calc1.tab.c"
14590c8de5b0SBaptiste Daroussin break;
14600c8de5b0SBaptiste Daroussin case 17:
14610c8de5b0SBaptiste Daroussin if (!yytrial)
14620c8de5b0SBaptiste Daroussin #line 112 "btyacc_calc1.y"
14630c8de5b0SBaptiste Daroussin {
14640c8de5b0SBaptiste Daroussin yyval.vval.lo = yystack.l_mark[-3].dval;
14650c8de5b0SBaptiste Daroussin yyval.vval.hi = yystack.l_mark[-1].dval;
14660c8de5b0SBaptiste Daroussin if ( yyval.vval.lo > yyval.vval.hi )
14670c8de5b0SBaptiste Daroussin {
14680c8de5b0SBaptiste Daroussin (void) printf("interval out of order\n");
14690c8de5b0SBaptiste Daroussin YYERROR;
14700c8de5b0SBaptiste Daroussin }
14710c8de5b0SBaptiste Daroussin }
14728e022d3cSDag-Erling Smørgrav #line 1473 "btyacc_calc1.tab.c"
14730c8de5b0SBaptiste Daroussin break;
14740c8de5b0SBaptiste Daroussin case 18:
14750c8de5b0SBaptiste Daroussin if (!yytrial)
14760c8de5b0SBaptiste Daroussin #line 122 "btyacc_calc1.y"
14770c8de5b0SBaptiste Daroussin {
14780c8de5b0SBaptiste Daroussin yyval.vval = vreg[yystack.l_mark[0].ival];
14790c8de5b0SBaptiste Daroussin }
14808e022d3cSDag-Erling Smørgrav #line 1481 "btyacc_calc1.tab.c"
14810c8de5b0SBaptiste Daroussin break;
14820c8de5b0SBaptiste Daroussin case 19:
14830c8de5b0SBaptiste Daroussin if (!yytrial)
14840c8de5b0SBaptiste Daroussin #line 126 "btyacc_calc1.y"
14850c8de5b0SBaptiste Daroussin {
14860c8de5b0SBaptiste Daroussin yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
14870c8de5b0SBaptiste Daroussin yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
14880c8de5b0SBaptiste Daroussin }
14898e022d3cSDag-Erling Smørgrav #line 1490 "btyacc_calc1.tab.c"
14900c8de5b0SBaptiste Daroussin break;
14910c8de5b0SBaptiste Daroussin case 20:
14920c8de5b0SBaptiste Daroussin if (!yytrial)
14930c8de5b0SBaptiste Daroussin #line 131 "btyacc_calc1.y"
14940c8de5b0SBaptiste Daroussin {
14950c8de5b0SBaptiste Daroussin yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
14960c8de5b0SBaptiste Daroussin yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
14970c8de5b0SBaptiste Daroussin }
14988e022d3cSDag-Erling Smørgrav #line 1499 "btyacc_calc1.tab.c"
14990c8de5b0SBaptiste Daroussin break;
15000c8de5b0SBaptiste Daroussin case 21:
15010c8de5b0SBaptiste Daroussin if (!yytrial)
15020c8de5b0SBaptiste Daroussin #line 136 "btyacc_calc1.y"
15030c8de5b0SBaptiste Daroussin {
15040c8de5b0SBaptiste Daroussin yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
15050c8de5b0SBaptiste Daroussin yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
15060c8de5b0SBaptiste Daroussin }
15078e022d3cSDag-Erling Smørgrav #line 1508 "btyacc_calc1.tab.c"
15080c8de5b0SBaptiste Daroussin break;
15090c8de5b0SBaptiste Daroussin case 22:
15100c8de5b0SBaptiste Daroussin if (!yytrial)
15110c8de5b0SBaptiste Daroussin #line 141 "btyacc_calc1.y"
15120c8de5b0SBaptiste Daroussin {
15130c8de5b0SBaptiste Daroussin yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
15140c8de5b0SBaptiste Daroussin yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
15150c8de5b0SBaptiste Daroussin }
15168e022d3cSDag-Erling Smørgrav #line 1517 "btyacc_calc1.tab.c"
15170c8de5b0SBaptiste Daroussin break;
15180c8de5b0SBaptiste Daroussin case 23:
15190c8de5b0SBaptiste Daroussin if (!yytrial)
15200c8de5b0SBaptiste Daroussin #line 146 "btyacc_calc1.y"
15210c8de5b0SBaptiste Daroussin {
15220c8de5b0SBaptiste Daroussin yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
15230c8de5b0SBaptiste Daroussin }
15248e022d3cSDag-Erling Smørgrav #line 1525 "btyacc_calc1.tab.c"
15250c8de5b0SBaptiste Daroussin break;
15260c8de5b0SBaptiste Daroussin case 24:
15270c8de5b0SBaptiste Daroussin if (!yytrial)
15280c8de5b0SBaptiste Daroussin #line 150 "btyacc_calc1.y"
15290c8de5b0SBaptiste Daroussin {
15300c8de5b0SBaptiste Daroussin yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
15310c8de5b0SBaptiste Daroussin }
15328e022d3cSDag-Erling Smørgrav #line 1533 "btyacc_calc1.tab.c"
15330c8de5b0SBaptiste Daroussin break;
15340c8de5b0SBaptiste Daroussin case 25:
15350c8de5b0SBaptiste Daroussin if (!yytrial)
15360c8de5b0SBaptiste Daroussin #line 154 "btyacc_calc1.y"
15370c8de5b0SBaptiste Daroussin {
15380c8de5b0SBaptiste Daroussin if (dcheck(yystack.l_mark[0].vval)) YYERROR;
15390c8de5b0SBaptiste Daroussin yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
15400c8de5b0SBaptiste Daroussin }
15418e022d3cSDag-Erling Smørgrav #line 1542 "btyacc_calc1.tab.c"
15420c8de5b0SBaptiste Daroussin break;
15430c8de5b0SBaptiste Daroussin case 26:
15440c8de5b0SBaptiste Daroussin if (!yytrial)
15450c8de5b0SBaptiste Daroussin #line 159 "btyacc_calc1.y"
15460c8de5b0SBaptiste Daroussin {
15470c8de5b0SBaptiste Daroussin if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
15480c8de5b0SBaptiste Daroussin yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
15490c8de5b0SBaptiste Daroussin }
15508e022d3cSDag-Erling Smørgrav #line 1551 "btyacc_calc1.tab.c"
15510c8de5b0SBaptiste Daroussin break;
15520c8de5b0SBaptiste Daroussin case 27:
15530c8de5b0SBaptiste Daroussin if (!yytrial)
15540c8de5b0SBaptiste Daroussin #line 164 "btyacc_calc1.y"
15550c8de5b0SBaptiste Daroussin {
15560c8de5b0SBaptiste Daroussin yyval.vval.hi = -yystack.l_mark[0].vval.lo;
15570c8de5b0SBaptiste Daroussin yyval.vval.lo = -yystack.l_mark[0].vval.hi;
15580c8de5b0SBaptiste Daroussin }
15598e022d3cSDag-Erling Smørgrav #line 1560 "btyacc_calc1.tab.c"
15600c8de5b0SBaptiste Daroussin break;
15610c8de5b0SBaptiste Daroussin case 28:
15620c8de5b0SBaptiste Daroussin if (!yytrial)
15630c8de5b0SBaptiste Daroussin #line 169 "btyacc_calc1.y"
15640c8de5b0SBaptiste Daroussin {
15650c8de5b0SBaptiste Daroussin yyval.vval = yystack.l_mark[-1].vval;
15660c8de5b0SBaptiste Daroussin }
15678e022d3cSDag-Erling Smørgrav #line 1568 "btyacc_calc1.tab.c"
15680c8de5b0SBaptiste Daroussin break;
15698e022d3cSDag-Erling Smørgrav #line 1570 "btyacc_calc1.tab.c"
15700c8de5b0SBaptiste Daroussin default:
15710c8de5b0SBaptiste Daroussin break;
15720c8de5b0SBaptiste Daroussin }
15730c8de5b0SBaptiste Daroussin yystack.s_mark -= yym;
15740c8de5b0SBaptiste Daroussin yystate = *yystack.s_mark;
15750c8de5b0SBaptiste Daroussin yystack.l_mark -= yym;
15760c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
15770c8de5b0SBaptiste Daroussin yystack.p_mark -= yym;
15780c8de5b0SBaptiste Daroussin #endif
15790c8de5b0SBaptiste Daroussin yym = yylhs[yyn];
15800c8de5b0SBaptiste Daroussin if (yystate == 0 && yym == 0)
15810c8de5b0SBaptiste Daroussin {
15820c8de5b0SBaptiste Daroussin #if YYDEBUG
15830c8de5b0SBaptiste Daroussin if (yydebug)
15840c8de5b0SBaptiste Daroussin {
15850c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
15860c8de5b0SBaptiste Daroussin #ifdef YYSTYPE_TOSTRING
15870c8de5b0SBaptiste Daroussin #if YYBTYACC
15880c8de5b0SBaptiste Daroussin if (!yytrial)
15890c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
15900c8de5b0SBaptiste Daroussin fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
15910c8de5b0SBaptiste Daroussin #endif
15920c8de5b0SBaptiste Daroussin fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
15930c8de5b0SBaptiste Daroussin }
15940c8de5b0SBaptiste Daroussin #endif
15950c8de5b0SBaptiste Daroussin yystate = YYFINAL;
15960c8de5b0SBaptiste Daroussin *++yystack.s_mark = YYFINAL;
15970c8de5b0SBaptiste Daroussin *++yystack.l_mark = yyval;
15980c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
15990c8de5b0SBaptiste Daroussin *++yystack.p_mark = yyloc;
16000c8de5b0SBaptiste Daroussin #endif
16010c8de5b0SBaptiste Daroussin if (yychar < 0)
16020c8de5b0SBaptiste Daroussin {
16030c8de5b0SBaptiste Daroussin #if YYBTYACC
16040c8de5b0SBaptiste Daroussin do {
16050c8de5b0SBaptiste Daroussin if (yylvp < yylve)
16060c8de5b0SBaptiste Daroussin {
16070c8de5b0SBaptiste Daroussin /* we're currently re-reading tokens */
16080c8de5b0SBaptiste Daroussin yylval = *yylvp++;
16090c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
16100c8de5b0SBaptiste Daroussin yylloc = *yylpp++;
16110c8de5b0SBaptiste Daroussin #endif
16120c8de5b0SBaptiste Daroussin yychar = *yylexp++;
16130c8de5b0SBaptiste Daroussin break;
16140c8de5b0SBaptiste Daroussin }
16150c8de5b0SBaptiste Daroussin if (yyps->save)
16160c8de5b0SBaptiste Daroussin {
16170c8de5b0SBaptiste Daroussin /* in trial mode; save scanner results for future parse attempts */
16180c8de5b0SBaptiste Daroussin if (yylvp == yylvlim)
16190c8de5b0SBaptiste Daroussin { /* Enlarge lexical value queue */
162011fce282SBaptiste Daroussin size_t p = (size_t) (yylvp - yylvals);
162111fce282SBaptiste Daroussin size_t s = (size_t) (yylvlim - yylvals);
16220c8de5b0SBaptiste Daroussin
16230c8de5b0SBaptiste Daroussin s += YYLVQUEUEGROWTH;
1624b53bb29fSJung-uk Kim if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
16250c8de5b0SBaptiste Daroussin goto yyenomem;
1626b53bb29fSJung-uk Kim if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
16270c8de5b0SBaptiste Daroussin goto yyenomem;
16280c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1629b53bb29fSJung-uk Kim if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
16300c8de5b0SBaptiste Daroussin goto yyenomem;
16310c8de5b0SBaptiste Daroussin #endif
16320c8de5b0SBaptiste Daroussin yylvp = yylve = yylvals + p;
16330c8de5b0SBaptiste Daroussin yylvlim = yylvals + s;
16340c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
16350c8de5b0SBaptiste Daroussin yylpp = yylpe = yylpsns + p;
16360c8de5b0SBaptiste Daroussin yylplim = yylpsns + s;
16370c8de5b0SBaptiste Daroussin #endif
16380c8de5b0SBaptiste Daroussin yylexp = yylexemes + p;
16390c8de5b0SBaptiste Daroussin }
16402aca18c7SJung-uk Kim *yylexp = (YYINT) YYLEX;
16410c8de5b0SBaptiste Daroussin *yylvp++ = yylval;
16420c8de5b0SBaptiste Daroussin yylve++;
16430c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
16440c8de5b0SBaptiste Daroussin *yylpp++ = yylloc;
16450c8de5b0SBaptiste Daroussin yylpe++;
16460c8de5b0SBaptiste Daroussin #endif
16470c8de5b0SBaptiste Daroussin yychar = *yylexp++;
16480c8de5b0SBaptiste Daroussin break;
16490c8de5b0SBaptiste Daroussin }
16500c8de5b0SBaptiste Daroussin /* normal operation, no conflict encountered */
16510c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
16520c8de5b0SBaptiste Daroussin yychar = YYLEX;
16530c8de5b0SBaptiste Daroussin #if YYBTYACC
16540c8de5b0SBaptiste Daroussin } while (0);
16550c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
16560c8de5b0SBaptiste Daroussin if (yychar < 0) yychar = YYEOF;
16570c8de5b0SBaptiste Daroussin #if YYDEBUG
16580c8de5b0SBaptiste Daroussin if (yydebug)
16590c8de5b0SBaptiste Daroussin {
1660c5b5d71aSJung-uk Kim if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1661c5b5d71aSJung-uk Kim fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
16620c8de5b0SBaptiste Daroussin YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
16630c8de5b0SBaptiste Daroussin }
16640c8de5b0SBaptiste Daroussin #endif
16650c8de5b0SBaptiste Daroussin }
16660c8de5b0SBaptiste Daroussin if (yychar == YYEOF) goto yyaccept;
16670c8de5b0SBaptiste Daroussin goto yyloop;
16680c8de5b0SBaptiste Daroussin }
16690c8de5b0SBaptiste Daroussin if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
16700c8de5b0SBaptiste Daroussin yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
16710c8de5b0SBaptiste Daroussin yystate = yytable[yyn];
16720c8de5b0SBaptiste Daroussin else
16730c8de5b0SBaptiste Daroussin yystate = yydgoto[yym];
16740c8de5b0SBaptiste Daroussin #if YYDEBUG
16750c8de5b0SBaptiste Daroussin if (yydebug)
16760c8de5b0SBaptiste Daroussin {
16770c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
16780c8de5b0SBaptiste Daroussin #ifdef YYSTYPE_TOSTRING
16790c8de5b0SBaptiste Daroussin #if YYBTYACC
16800c8de5b0SBaptiste Daroussin if (!yytrial)
16810c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
16820c8de5b0SBaptiste Daroussin fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
16830c8de5b0SBaptiste Daroussin #endif
16840c8de5b0SBaptiste Daroussin fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
16850c8de5b0SBaptiste Daroussin }
16860c8de5b0SBaptiste Daroussin #endif
16870c8de5b0SBaptiste Daroussin if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1688c5b5d71aSJung-uk Kim *++yystack.s_mark = (YYINT) yystate;
16890c8de5b0SBaptiste Daroussin *++yystack.l_mark = yyval;
16900c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
16910c8de5b0SBaptiste Daroussin *++yystack.p_mark = yyloc;
16920c8de5b0SBaptiste Daroussin #endif
16930c8de5b0SBaptiste Daroussin goto yyloop;
16940c8de5b0SBaptiste Daroussin #if YYBTYACC
16950c8de5b0SBaptiste Daroussin
16960c8de5b0SBaptiste Daroussin /* Reduction declares that this path is valid. Set yypath and do a full parse */
16970c8de5b0SBaptiste Daroussin yyvalid:
16980c8de5b0SBaptiste Daroussin if (yypath) YYABORT;
16990c8de5b0SBaptiste Daroussin while (yyps->save)
17000c8de5b0SBaptiste Daroussin {
17010c8de5b0SBaptiste Daroussin YYParseState *save = yyps->save;
17020c8de5b0SBaptiste Daroussin yyps->save = save->save;
17030c8de5b0SBaptiste Daroussin save->save = yypath;
17040c8de5b0SBaptiste Daroussin yypath = save;
17050c8de5b0SBaptiste Daroussin }
17060c8de5b0SBaptiste Daroussin #if YYDEBUG
17070c8de5b0SBaptiste Daroussin if (yydebug)
17080c8de5b0SBaptiste Daroussin fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
17090c8de5b0SBaptiste Daroussin YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
17100c8de5b0SBaptiste Daroussin #endif
17110c8de5b0SBaptiste Daroussin if (yyerrctx)
17120c8de5b0SBaptiste Daroussin {
17130c8de5b0SBaptiste Daroussin yyFreeState(yyerrctx);
17140c8de5b0SBaptiste Daroussin yyerrctx = NULL;
17150c8de5b0SBaptiste Daroussin }
17160c8de5b0SBaptiste Daroussin yylvp = yylvals + yypath->lexeme;
17170c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
17180c8de5b0SBaptiste Daroussin yylpp = yylpsns + yypath->lexeme;
17190c8de5b0SBaptiste Daroussin #endif
17200c8de5b0SBaptiste Daroussin yylexp = yylexemes + yypath->lexeme;
17210c8de5b0SBaptiste Daroussin yychar = YYEMPTY;
17220c8de5b0SBaptiste Daroussin yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1723c5b5d71aSJung-uk Kim memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
17240c8de5b0SBaptiste Daroussin yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
172511fce282SBaptiste Daroussin memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
17260c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
17270c8de5b0SBaptiste Daroussin yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
172811fce282SBaptiste Daroussin memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
17290c8de5b0SBaptiste Daroussin #endif
17300c8de5b0SBaptiste Daroussin yystate = yypath->state;
17310c8de5b0SBaptiste Daroussin goto yyloop;
17320c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
17330c8de5b0SBaptiste Daroussin
17340c8de5b0SBaptiste Daroussin yyoverflow:
17350c8de5b0SBaptiste Daroussin YYERROR_CALL("yacc stack overflow");
17360c8de5b0SBaptiste Daroussin #if YYBTYACC
17370c8de5b0SBaptiste Daroussin goto yyabort_nomem;
17380c8de5b0SBaptiste Daroussin yyenomem:
17390c8de5b0SBaptiste Daroussin YYERROR_CALL("memory exhausted");
17400c8de5b0SBaptiste Daroussin yyabort_nomem:
17410c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
17420c8de5b0SBaptiste Daroussin yyresult = 2;
17430c8de5b0SBaptiste Daroussin goto yyreturn;
17440c8de5b0SBaptiste Daroussin
17450c8de5b0SBaptiste Daroussin yyabort:
17460c8de5b0SBaptiste Daroussin yyresult = 1;
17470c8de5b0SBaptiste Daroussin goto yyreturn;
17480c8de5b0SBaptiste Daroussin
17490c8de5b0SBaptiste Daroussin yyaccept:
17500c8de5b0SBaptiste Daroussin #if YYBTYACC
17510c8de5b0SBaptiste Daroussin if (yyps->save) goto yyvalid;
17520c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
17530c8de5b0SBaptiste Daroussin yyresult = 0;
17540c8de5b0SBaptiste Daroussin
17550c8de5b0SBaptiste Daroussin yyreturn:
17560c8de5b0SBaptiste Daroussin #if defined(YYDESTRUCT_CALL)
17570c8de5b0SBaptiste Daroussin if (yychar != YYEOF && yychar != YYEMPTY)
17580c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
17590c8de5b0SBaptiste Daroussin YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
17600c8de5b0SBaptiste Daroussin #else
17610c8de5b0SBaptiste Daroussin YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
17620c8de5b0SBaptiste Daroussin #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
17630c8de5b0SBaptiste Daroussin
17640c8de5b0SBaptiste Daroussin {
17650c8de5b0SBaptiste Daroussin YYSTYPE *pv;
17660c8de5b0SBaptiste Daroussin #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
17670c8de5b0SBaptiste Daroussin YYLTYPE *pp;
17680c8de5b0SBaptiste Daroussin
17690c8de5b0SBaptiste Daroussin for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
17700c8de5b0SBaptiste Daroussin YYDESTRUCT_CALL("cleanup: discarding state",
17710c8de5b0SBaptiste Daroussin yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
17720c8de5b0SBaptiste Daroussin #else
17730c8de5b0SBaptiste Daroussin for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
17740c8de5b0SBaptiste Daroussin YYDESTRUCT_CALL("cleanup: discarding state",
17750c8de5b0SBaptiste Daroussin yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
17760c8de5b0SBaptiste Daroussin #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
17770c8de5b0SBaptiste Daroussin }
17780c8de5b0SBaptiste Daroussin #endif /* defined(YYDESTRUCT_CALL) */
17790c8de5b0SBaptiste Daroussin
17800c8de5b0SBaptiste Daroussin #if YYBTYACC
17810c8de5b0SBaptiste Daroussin if (yyerrctx)
17820c8de5b0SBaptiste Daroussin {
17830c8de5b0SBaptiste Daroussin yyFreeState(yyerrctx);
17840c8de5b0SBaptiste Daroussin yyerrctx = NULL;
17850c8de5b0SBaptiste Daroussin }
17860c8de5b0SBaptiste Daroussin while (yyps)
17870c8de5b0SBaptiste Daroussin {
17880c8de5b0SBaptiste Daroussin YYParseState *save = yyps;
17890c8de5b0SBaptiste Daroussin yyps = save->save;
17900c8de5b0SBaptiste Daroussin save->save = NULL;
17910c8de5b0SBaptiste Daroussin yyFreeState(save);
17920c8de5b0SBaptiste Daroussin }
17930c8de5b0SBaptiste Daroussin while (yypath)
17940c8de5b0SBaptiste Daroussin {
17950c8de5b0SBaptiste Daroussin YYParseState *save = yypath;
17960c8de5b0SBaptiste Daroussin yypath = save->save;
17970c8de5b0SBaptiste Daroussin save->save = NULL;
17980c8de5b0SBaptiste Daroussin yyFreeState(save);
17990c8de5b0SBaptiste Daroussin }
18000c8de5b0SBaptiste Daroussin #endif /* YYBTYACC */
18010c8de5b0SBaptiste Daroussin yyfreestack(&yystack);
18020c8de5b0SBaptiste Daroussin return (yyresult);
18030c8de5b0SBaptiste Daroussin }
1804