1 1.5 christos /* $NetBSD: varsyntax_calc1.tab.c,v 1.7 2026/01/18 16:41:30 christos Exp $ */ 2 1.1 christos 3 1.1 christos /* original parser id follows */ 4 1.1 christos /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ 5 1.2 christos /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ 6 1.1 christos 7 1.1 christos #define YYBYACC 1 8 1.5 christos #define YYMAJOR 2 9 1.5 christos #define YYMINOR 0 10 1.1 christos #define YYCHECK "yyyymmdd" 11 1.1 christos 12 1.1 christos #define YYEMPTY (-1) 13 1.1 christos #define yyclearin (yychar = YYEMPTY) 14 1.1 christos #define yyerrok (yyerrflag = 0) 15 1.1 christos #define YYRECOVERING() (yyerrflag != 0) 16 1.1 christos #define YYENOMEM (-2) 17 1.1 christos #define YYEOF 0 18 1.1 christos #ident "check variant syntax features" 19 1.1 christos #undef YYBTYACC 20 1.1 christos #define YYBTYACC 0 21 1.1 christos #define YYDEBUGSTR YYPREFIX "debug" 22 1.1 christos 23 1.1 christos #ifndef yyparse 24 1.1 christos #define yyparse varsyntax_calc1_parse 25 1.1 christos #endif /* yyparse */ 26 1.1 christos 27 1.1 christos #ifndef yylex 28 1.1 christos #define yylex varsyntax_calc1_lex 29 1.1 christos #endif /* yylex */ 30 1.1 christos 31 1.1 christos #ifndef yyerror 32 1.1 christos #define yyerror varsyntax_calc1_error 33 1.1 christos #endif /* yyerror */ 34 1.1 christos 35 1.1 christos #ifndef yychar 36 1.1 christos #define yychar varsyntax_calc1_char 37 1.1 christos #endif /* yychar */ 38 1.1 christos 39 1.1 christos #ifndef yyval 40 1.1 christos #define yyval varsyntax_calc1_val 41 1.1 christos #endif /* yyval */ 42 1.1 christos 43 1.1 christos #ifndef yylval 44 1.1 christos #define yylval varsyntax_calc1_lval 45 1.1 christos #endif /* yylval */ 46 1.1 christos 47 1.1 christos #ifndef yydebug 48 1.1 christos #define yydebug varsyntax_calc1_debug 49 1.1 christos #endif /* yydebug */ 50 1.1 christos 51 1.1 christos #ifndef yynerrs 52 1.1 christos #define yynerrs varsyntax_calc1_nerrs 53 1.1 christos #endif /* yynerrs */ 54 1.1 christos 55 1.1 christos #ifndef yyerrflag 56 1.1 christos #define yyerrflag varsyntax_calc1_errflag 57 1.1 christos #endif /* yyerrflag */ 58 1.1 christos 59 1.1 christos #ifndef yylhs 60 1.1 christos #define yylhs varsyntax_calc1_lhs 61 1.1 christos #endif /* yylhs */ 62 1.1 christos 63 1.1 christos #ifndef yylen 64 1.1 christos #define yylen varsyntax_calc1_len 65 1.1 christos #endif /* yylen */ 66 1.1 christos 67 1.1 christos #ifndef yydefred 68 1.1 christos #define yydefred varsyntax_calc1_defred 69 1.1 christos #endif /* yydefred */ 70 1.1 christos 71 1.1 christos #ifndef yystos 72 1.1 christos #define yystos varsyntax_calc1_stos 73 1.1 christos #endif /* yystos */ 74 1.1 christos 75 1.1 christos #ifndef yydgoto 76 1.1 christos #define yydgoto varsyntax_calc1_dgoto 77 1.1 christos #endif /* yydgoto */ 78 1.1 christos 79 1.1 christos #ifndef yysindex 80 1.1 christos #define yysindex varsyntax_calc1_sindex 81 1.1 christos #endif /* yysindex */ 82 1.1 christos 83 1.1 christos #ifndef yyrindex 84 1.1 christos #define yyrindex varsyntax_calc1_rindex 85 1.1 christos #endif /* yyrindex */ 86 1.1 christos 87 1.1 christos #ifndef yygindex 88 1.1 christos #define yygindex varsyntax_calc1_gindex 89 1.1 christos #endif /* yygindex */ 90 1.1 christos 91 1.1 christos #ifndef yytable 92 1.1 christos #define yytable varsyntax_calc1_table 93 1.1 christos #endif /* yytable */ 94 1.1 christos 95 1.1 christos #ifndef yycheck 96 1.1 christos #define yycheck varsyntax_calc1_check 97 1.1 christos #endif /* yycheck */ 98 1.1 christos 99 1.1 christos #ifndef yyname 100 1.1 christos #define yyname varsyntax_calc1_name 101 1.1 christos #endif /* yyname */ 102 1.1 christos 103 1.1 christos #ifndef yyrule 104 1.1 christos #define yyrule varsyntax_calc1_rule 105 1.1 christos #endif /* yyrule */ 106 1.1 christos 107 1.1 christos #if YYBTYACC 108 1.1 christos 109 1.1 christos #ifndef yycindex 110 1.1 christos #define yycindex varsyntax_calc1_cindex 111 1.1 christos #endif /* yycindex */ 112 1.1 christos 113 1.1 christos #ifndef yyctable 114 1.1 christos #define yyctable varsyntax_calc1_ctable 115 1.1 christos #endif /* yyctable */ 116 1.1 christos 117 1.1 christos #endif /* YYBTYACC */ 118 1.1 christos 119 1.1 christos #define YYPREFIX "varsyntax_calc1_" 120 1.1 christos 121 1.1 christos #define YYPURE 0 122 1.1 christos 123 1.1 christos #line 3 "varsyntax_calc1.y" 124 1.1 christos 125 1.1 christos /* http://dinosaur.compilertools.net/yacc/index.html * /*/ 126 1.1 christos 127 1.1 christos #include <stdlib.h> 128 1.1 christos #include <stdio.h> 129 1.1 christos #include <ctype.h> 130 1.1 christos #include <math.h> 131 1.1 christos 132 1.1 christos typedef struct interval 133 1.1 christos { 134 1.1 christos double lo, hi; 135 1.1 christos } 136 1.1 christos INTERVAL; 137 1.1 christos 138 1.1 christos INTERVAL vmul(double, double, INTERVAL); 139 1.1 christos INTERVAL vdiv(double, double, INTERVAL); 140 1.1 christos 141 1.1 christos extern int yylex(void); 142 1.1 christos static void yyerror(const char *s); 143 1.1 christos 144 1.1 christos int dcheck(INTERVAL); 145 1.1 christos 146 1.1 christos double dreg[26]; 147 1.1 christos INTERVAL vreg[26]; 148 1.1 christos 149 1.1 christos #ifdef YYSTYPE 150 1.1 christos #undef YYSTYPE_IS_DECLARED 151 1.1 christos #define YYSTYPE_IS_DECLARED 1 152 1.1 christos #endif 153 1.1 christos #ifndef YYSTYPE_IS_DECLARED 154 1.1 christos #define YYSTYPE_IS_DECLARED 1 155 1.2 christos #line 32 "varsyntax_calc1.y" 156 1.6 christos typedef union YYSTYPE 157 1.1 christos { 158 1.1 christos int ival; /* dreg & vreg array index values*/ 159 1.1 christos double dval; /* floating point values*/ 160 1.1 christos INTERVAL vval; /* interval values*/ 161 1.1 christos } YYSTYPE; 162 1.1 christos #endif /* !YYSTYPE_IS_DECLARED */ 163 1.1 christos #line 162 "varsyntax_calc1.tab.c" 164 1.1 christos 165 1.1 christos /* compatibility with bison */ 166 1.1 christos #ifdef YYPARSE_PARAM 167 1.1 christos /* compatibility with FreeBSD */ 168 1.1 christos # ifdef YYPARSE_PARAM_TYPE 169 1.1 christos # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 170 1.1 christos # else 171 1.1 christos # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 172 1.1 christos # endif 173 1.1 christos #else 174 1.1 christos # define YYPARSE_DECL() yyparse(void) 175 1.1 christos #endif 176 1.1 christos 177 1.1 christos /* Parameters sent to lex. */ 178 1.1 christos #ifdef YYLEX_PARAM 179 1.1 christos # define YYLEX_DECL() yylex(void *YYLEX_PARAM) 180 1.1 christos # define YYLEX yylex(YYLEX_PARAM) 181 1.1 christos #else 182 1.1 christos # define YYLEX_DECL() yylex(void) 183 1.1 christos # define YYLEX yylex() 184 1.1 christos #endif 185 1.1 christos 186 1.1 christos /* Parameters sent to yyerror. */ 187 1.1 christos #ifndef YYERROR_DECL 188 1.1 christos #define YYERROR_DECL() yyerror(const char *s) 189 1.1 christos #endif 190 1.1 christos #ifndef YYERROR_CALL 191 1.1 christos #define YYERROR_CALL(msg) yyerror(msg) 192 1.1 christos #endif 193 1.1 christos 194 1.1 christos extern int YYPARSE_DECL(); 195 1.1 christos 196 1.1 christos #define DREG 257 197 1.1 christos #define VREG 258 198 1.1 christos #define CONST 259 199 1.1 christos #define UMINUS 260 200 1.1 christos #define YYERRCODE 256 201 1.6 christos typedef int YYINT; 202 1.1 christos static const YYINT varsyntax_calc1_lhs[] = { -1, 203 1.1 christos 3, 3, 0, 0, 0, 0, 0, 1, 1, 1, 204 1.1 christos 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 205 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 206 1.1 christos }; 207 1.1 christos static const YYINT varsyntax_calc1_len[] = { 2, 208 1.1 christos 0, 2, 2, 2, 4, 4, 2, 1, 1, 3, 209 1.1 christos 3, 3, 3, 2, 3, 1, 5, 1, 3, 3, 210 1.1 christos 3, 3, 3, 3, 3, 3, 2, 3, 211 1.1 christos }; 212 1.1 christos static const YYINT varsyntax_calc1_defred[] = { 0, 213 1.1 christos 0, 0, 0, 8, 0, 0, 0, 0, 0, 7, 214 1.1 christos 0, 0, 9, 18, 14, 27, 0, 0, 0, 0, 215 1.1 christos 0, 0, 3, 0, 0, 0, 0, 4, 0, 0, 216 1.1 christos 0, 0, 0, 15, 0, 28, 0, 0, 0, 0, 217 1.1 christos 12, 24, 13, 26, 0, 0, 23, 25, 14, 0, 218 1.1 christos 0, 0, 0, 0, 5, 6, 0, 0, 0, 12, 219 1.1 christos 13, 17, 220 1.1 christos }; 221 1.2 christos #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) 222 1.1 christos static const YYINT varsyntax_calc1_stos[] = { 0, 223 1.1 christos 256, 257, 258, 259, 45, 40, 262, 263, 264, 10, 224 1.1 christos 61, 61, 257, 258, 263, 264, 263, 264, 43, 45, 225 1.1 christos 42, 47, 10, 43, 45, 42, 47, 10, 45, 40, 226 1.1 christos 263, 263, 264, 41, 44, 41, 263, 264, 263, 264, 227 1.1 christos 263, 264, 263, 264, 264, 264, 264, 264, 263, 263, 228 1.1 christos 43, 45, 42, 47, 10, 10, 263, 263, 263, 263, 229 1.1 christos 263, 41, 230 1.1 christos }; 231 1.2 christos #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ 232 1.1 christos static const YYINT varsyntax_calc1_dgoto[] = { 7, 233 1.1 christos 32, 9, 0, 234 1.1 christos }; 235 1.1 christos static const YYINT varsyntax_calc1_sindex[] = { -40, 236 1.1 christos -8, -48, -47, 0, -37, -37, 0, 2, 17, 0, 237 1.1 christos -34, -37, 0, 0, 0, 0, -25, 90, -37, -37, 238 1.1 christos -37, -37, 0, -37, -37, -37, -37, 0, -34, -34, 239 1.1 christos 25, 125, 31, 0, -34, 0, -11, 37, -11, 37, 240 1.1 christos 0, 0, 0, 0, 37, 37, 0, 0, 0, 111, 241 1.1 christos -34, -34, -34, -34, 0, 0, 118, 69, 69, 0, 242 1.1 christos 0, 0, 243 1.1 christos }; 244 1.1 christos static const YYINT varsyntax_calc1_rindex[] = { 0, 245 1.1 christos 0, 38, 44, 0, 0, 0, 0, 0, 0, 0, 246 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248 1.1 christos 0, -9, 0, 0, 0, 0, 51, -3, 56, 61, 249 1.1 christos 0, 0, 0, 0, 67, 72, 0, 0, 0, 0, 250 1.1 christos 0, 0, 0, 0, 0, 0, 0, 78, 83, 0, 251 1.1 christos 0, 0, 252 1.1 christos }; 253 1.1 christos #if YYBTYACC 254 1.1 christos static const YYINT varsyntax_calc1_cindex[] = { 0, 255 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 256 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 257 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 258 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 259 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 260 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 261 1.1 christos 0, 0, 262 1.1 christos }; 263 1.1 christos #endif 264 1.1 christos static const YYINT varsyntax_calc1_gindex[] = { 0, 265 1.1 christos 4, 124, 0, 266 1.1 christos }; 267 1.1 christos #define YYTABLESIZE 225 268 1.1 christos static const YYINT varsyntax_calc1_table[] = { 6, 269 1.1 christos 16, 10, 6, 8, 5, 30, 20, 5, 15, 17, 270 1.1 christos 29, 23, 11, 12, 31, 34, 21, 19, 35, 20, 271 1.1 christos 0, 22, 37, 39, 41, 43, 28, 0, 0, 0, 272 1.1 christos 21, 16, 49, 50, 55, 22, 0, 20, 57, 20, 273 1.1 christos 56, 20, 0, 21, 19, 0, 20, 9, 22, 0, 274 1.1 christos 0, 0, 0, 18, 58, 59, 60, 61, 26, 24, 275 1.1 christos 10, 25, 0, 27, 0, 11, 53, 51, 0, 52, 276 1.1 christos 22, 54, 26, 24, 0, 25, 19, 27, 26, 9, 277 1.1 christos 9, 21, 9, 27, 9, 18, 18, 10, 18, 0, 278 1.1 christos 18, 10, 11, 10, 10, 10, 11, 0, 11, 11, 279 1.1 christos 11, 22, 0, 22, 0, 22, 0, 19, 0, 19, 280 1.1 christos 53, 19, 21, 0, 21, 54, 21, 0, 10, 0, 281 1.1 christos 10, 0, 10, 11, 0, 11, 0, 11, 16, 18, 282 1.1 christos 36, 26, 24, 0, 25, 33, 27, 0, 0, 0, 283 1.1 christos 0, 0, 38, 40, 42, 44, 0, 45, 46, 47, 284 1.1 christos 48, 34, 53, 51, 0, 52, 0, 54, 62, 53, 285 1.1 christos 51, 0, 52, 0, 54, 0, 21, 19, 0, 20, 286 1.1 christos 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 287 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 288 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 289 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 290 1.1 christos 0, 0, 0, 0, 0, 1, 2, 3, 4, 13, 291 1.1 christos 14, 4, 13, 0, 4, 292 1.1 christos }; 293 1.1 christos static const YYINT varsyntax_calc1_check[] = { 40, 294 1.1 christos 10, 10, 40, 0, 45, 40, 10, 45, 5, 6, 295 1.1 christos 45, 10, 61, 61, 11, 41, 42, 43, 44, 45, 296 1.1 christos -1, 47, 19, 20, 21, 22, 10, -1, -1, -1, 297 1.1 christos 42, 41, 29, 30, 10, 47, -1, 41, 35, 43, 298 1.1 christos 10, 45, -1, 42, 43, -1, 45, 10, 47, -1, 299 1.1 christos -1, -1, -1, 10, 51, 52, 53, 54, 42, 43, 300 1.1 christos 10, 45, -1, 47, -1, 10, 42, 43, -1, 45, 301 1.1 christos 10, 47, 42, 43, -1, 45, 10, 47, 42, 42, 302 1.1 christos 43, 10, 45, 47, 47, 42, 43, 10, 45, -1, 303 1.1 christos 47, 41, 10, 43, 44, 45, 41, -1, 43, 44, 304 1.1 christos 45, 41, -1, 43, -1, 45, -1, 41, -1, 43, 305 1.1 christos 42, 45, 41, -1, 43, 47, 45, -1, 41, -1, 306 1.1 christos 43, -1, 45, 41, -1, 43, -1, 45, 5, 6, 307 1.1 christos 41, 42, 43, -1, 45, 12, 47, -1, -1, -1, 308 1.1 christos -1, -1, 19, 20, 21, 22, -1, 24, 25, 26, 309 1.1 christos 27, 41, 42, 43, -1, 45, -1, 47, 41, 42, 310 1.1 christos 43, -1, 45, -1, 47, -1, 42, 43, -1, 45, 311 1.1 christos -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, 312 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 315 1.1 christos -1, -1, -1, -1, -1, 256, 257, 258, 259, 257, 316 1.1 christos 258, 259, 257, -1, 259, 317 1.1 christos }; 318 1.1 christos #if YYBTYACC 319 1.1 christos static const YYINT varsyntax_calc1_ctable[] = { -1, 320 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 321 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 322 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 323 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 324 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 325 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 326 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 327 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 328 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 329 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 330 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 331 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 332 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 333 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 334 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 335 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 336 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 337 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 338 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 339 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 340 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 341 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 342 1.1 christos -1, -1, -1, -1, 343 1.1 christos }; 344 1.1 christos #endif 345 1.1 christos #define YYFINAL 7 346 1.1 christos #ifndef YYDEBUG 347 1.1 christos #define YYDEBUG 0 348 1.1 christos #endif 349 1.1 christos #define YYMAXTOKEN 260 350 1.1 christos #define YYUNDFTOKEN 266 351 1.1 christos #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) 352 1.1 christos #if YYDEBUG 353 1.7 christos #ifndef NULL 354 1.7 christos #define NULL (void*)0 355 1.7 christos #endif 356 1.1 christos static const char *const varsyntax_calc1_name[] = { 357 1.1 christos 358 1.7 christos "$end",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"'\\n'",NULL,NULL,NULL,NULL, 359 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 360 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"'('","')'","'*'","'+'","','", 361 1.7 christos "'-'",NULL,"'/'",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 362 1.7 christos NULL,"'='",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 363 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 364 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 365 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 366 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 367 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 368 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 369 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 370 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 371 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 372 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 373 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 374 1.7 christos NULL,NULL,NULL,NULL,NULL,"error","DREG","VREG","CONST","UMINUS","$accept", 375 1.7 christos "line","dexp","vexp","lines","illegal-symbol", 376 1.1 christos }; 377 1.1 christos static const char *const varsyntax_calc1_rule[] = { 378 1.1 christos "$accept : line", 379 1.1 christos "lines :", 380 1.1 christos "lines : lines line", 381 1.1 christos "line : dexp '\\n'", 382 1.1 christos "line : vexp '\\n'", 383 1.1 christos "line : DREG '=' dexp '\\n'", 384 1.1 christos "line : VREG '=' vexp '\\n'", 385 1.1 christos "line : error '\\n'", 386 1.1 christos "dexp : CONST", 387 1.1 christos "dexp : DREG", 388 1.1 christos "dexp : dexp '+' dexp", 389 1.1 christos "dexp : dexp '-' dexp", 390 1.1 christos "dexp : dexp '*' dexp", 391 1.1 christos "dexp : dexp '/' dexp", 392 1.1 christos "dexp : '-' dexp", 393 1.1 christos "dexp : '(' dexp ')'", 394 1.1 christos "vexp : dexp", 395 1.1 christos "vexp : '(' dexp ',' dexp ')'", 396 1.1 christos "vexp : VREG", 397 1.1 christos "vexp : vexp '+' vexp", 398 1.1 christos "vexp : dexp '+' vexp", 399 1.1 christos "vexp : vexp '-' vexp", 400 1.1 christos "vexp : dexp '-' vexp", 401 1.1 christos "vexp : vexp '*' vexp", 402 1.1 christos "vexp : dexp '*' vexp", 403 1.1 christos "vexp : vexp '/' vexp", 404 1.1 christos "vexp : dexp '/' vexp", 405 1.1 christos "vexp : '-' vexp", 406 1.1 christos "vexp : '(' vexp ')'", 407 1.1 christos 408 1.1 christos }; 409 1.1 christos #endif 410 1.1 christos 411 1.4 christos #if YYDEBUG 412 1.1 christos int yydebug; 413 1.4 christos #endif 414 1.1 christos 415 1.1 christos int yyerrflag; 416 1.1 christos int yychar; 417 1.1 christos YYSTYPE yyval; 418 1.1 christos YYSTYPE yylval; 419 1.4 christos int yynerrs; 420 1.4 christos 421 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 422 1.1 christos YYLTYPE yyloc; /* position returned by actions */ 423 1.1 christos YYLTYPE yylloc; /* position from the lexer */ 424 1.1 christos #endif 425 1.1 christos 426 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 427 1.1 christos #ifndef YYLLOC_DEFAULT 428 1.1 christos #define YYLLOC_DEFAULT(loc, rhs, n) \ 429 1.1 christos do \ 430 1.1 christos { \ 431 1.1 christos if (n == 0) \ 432 1.1 christos { \ 433 1.4 christos (loc).first_line = YYRHSLOC(rhs, 0).last_line; \ 434 1.4 christos (loc).first_column = YYRHSLOC(rhs, 0).last_column; \ 435 1.4 christos (loc).last_line = YYRHSLOC(rhs, 0).last_line; \ 436 1.4 christos (loc).last_column = YYRHSLOC(rhs, 0).last_column; \ 437 1.1 christos } \ 438 1.1 christos else \ 439 1.1 christos { \ 440 1.4 christos (loc).first_line = YYRHSLOC(rhs, 1).first_line; \ 441 1.4 christos (loc).first_column = YYRHSLOC(rhs, 1).first_column; \ 442 1.4 christos (loc).last_line = YYRHSLOC(rhs, n).last_line; \ 443 1.4 christos (loc).last_column = YYRHSLOC(rhs, n).last_column; \ 444 1.1 christos } \ 445 1.1 christos } while (0) 446 1.1 christos #endif /* YYLLOC_DEFAULT */ 447 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 448 1.1 christos #if YYBTYACC 449 1.1 christos 450 1.1 christos #ifndef YYLVQUEUEGROWTH 451 1.1 christos #define YYLVQUEUEGROWTH 32 452 1.1 christos #endif 453 1.1 christos #endif /* YYBTYACC */ 454 1.1 christos 455 1.1 christos /* define the initial stack-sizes */ 456 1.1 christos #ifdef YYSTACKSIZE 457 1.1 christos #undef YYMAXDEPTH 458 1.1 christos #define YYMAXDEPTH YYSTACKSIZE 459 1.1 christos #else 460 1.1 christos #ifdef YYMAXDEPTH 461 1.1 christos #define YYSTACKSIZE YYMAXDEPTH 462 1.1 christos #else 463 1.1 christos #define YYSTACKSIZE 10000 464 1.1 christos #define YYMAXDEPTH 10000 465 1.1 christos #endif 466 1.1 christos #endif 467 1.1 christos 468 1.1 christos #ifndef YYINITSTACKSIZE 469 1.1 christos #define YYINITSTACKSIZE 200 470 1.1 christos #endif 471 1.1 christos 472 1.1 christos typedef struct { 473 1.1 christos unsigned stacksize; 474 1.2 christos YYINT *s_base; 475 1.2 christos YYINT *s_mark; 476 1.2 christos YYINT *s_last; 477 1.1 christos YYSTYPE *l_base; 478 1.1 christos YYSTYPE *l_mark; 479 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 480 1.1 christos YYLTYPE *p_base; 481 1.1 christos YYLTYPE *p_mark; 482 1.1 christos #endif 483 1.1 christos } YYSTACKDATA; 484 1.1 christos #if YYBTYACC 485 1.1 christos 486 1.1 christos struct YYParseState_s 487 1.1 christos { 488 1.1 christos struct YYParseState_s *save; /* Previously saved parser state */ 489 1.1 christos YYSTACKDATA yystack; /* saved parser stack */ 490 1.1 christos int state; /* saved parser state */ 491 1.1 christos int errflag; /* saved error recovery status */ 492 1.1 christos int lexeme; /* saved index of the conflict lexeme in the lexical queue */ 493 1.1 christos YYINT ctry; /* saved index in yyctable[] for this conflict */ 494 1.1 christos }; 495 1.1 christos typedef struct YYParseState_s YYParseState; 496 1.1 christos #endif /* YYBTYACC */ 497 1.1 christos /* variables for the parser stack */ 498 1.1 christos static YYSTACKDATA yystack; 499 1.1 christos #if YYBTYACC 500 1.1 christos 501 1.1 christos /* Current parser state */ 502 1.7 christos static YYParseState *yyps = NULL; 503 1.1 christos 504 1.1 christos /* yypath != NULL: do the full parse, starting at *yypath parser state. */ 505 1.7 christos static YYParseState *yypath = NULL; 506 1.1 christos 507 1.1 christos /* Base of the lexical value queue */ 508 1.7 christos static YYSTYPE *yylvals = NULL; 509 1.1 christos 510 1.1 christos /* Current position at lexical value queue */ 511 1.7 christos static YYSTYPE *yylvp = NULL; 512 1.1 christos 513 1.1 christos /* End position of lexical value queue */ 514 1.7 christos static YYSTYPE *yylve = NULL; 515 1.1 christos 516 1.1 christos /* The last allocated position at the lexical value queue */ 517 1.7 christos static YYSTYPE *yylvlim = NULL; 518 1.1 christos 519 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 520 1.1 christos /* Base of the lexical position queue */ 521 1.7 christos static YYLTYPE *yylpsns = NULL; 522 1.1 christos 523 1.1 christos /* Current position at lexical position queue */ 524 1.7 christos static YYLTYPE *yylpp = NULL; 525 1.1 christos 526 1.1 christos /* End position of lexical position queue */ 527 1.7 christos static YYLTYPE *yylpe = NULL; 528 1.1 christos 529 1.1 christos /* The last allocated position at the lexical position queue */ 530 1.7 christos static YYLTYPE *yylplim = NULL; 531 1.1 christos #endif 532 1.1 christos 533 1.1 christos /* Current position at lexical token queue */ 534 1.7 christos static YYINT *yylexp = NULL; 535 1.1 christos 536 1.7 christos static YYINT *yylexemes = NULL; 537 1.1 christos #endif /* YYBTYACC */ 538 1.1 christos #line 178 "varsyntax_calc1.y" 539 1.1 christos /* beginning of subroutines section */ 540 1.1 christos 541 1.1 christos #define BSZ 50 /* buffer size for floating point numbers */ 542 1.1 christos 543 1.1 christos /* lexical analysis */ 544 1.1 christos 545 1.1 christos static void 546 1.1 christos yyerror(const char *s) 547 1.1 christos { 548 1.1 christos fprintf(stderr, "%s\n", s); 549 1.1 christos } 550 1.1 christos 551 1.1 christos int 552 1.1 christos yylex(void) 553 1.1 christos { 554 1.1 christos int c; 555 1.1 christos 556 1.1 christos while ((c = getchar()) == ' ') 557 1.1 christos { /* skip over blanks */ 558 1.1 christos } 559 1.1 christos 560 1.1 christos if (isupper(c)) 561 1.1 christos { 562 1.1 christos yylval.ival = c - 'A'; 563 1.1 christos return (VREG); 564 1.1 christos } 565 1.1 christos if (islower(c)) 566 1.1 christos { 567 1.1 christos yylval.ival = c - 'a'; 568 1.1 christos return (DREG); 569 1.1 christos } 570 1.1 christos 571 1.1 christos if (isdigit(c) || c == '.') 572 1.1 christos { 573 1.1 christos /* gobble up digits, points, exponents */ 574 1.1 christos char buf[BSZ + 1], *cp = buf; 575 1.1 christos int dot = 0, expr = 0; 576 1.1 christos 577 1.1 christos for (; (cp - buf) < BSZ; ++cp, c = getchar()) 578 1.1 christos { 579 1.1 christos 580 1.1 christos *cp = (char) c; 581 1.1 christos if (isdigit(c)) 582 1.1 christos continue; 583 1.1 christos if (c == '.') 584 1.1 christos { 585 1.1 christos if (dot++ || expr) 586 1.1 christos return ('.'); /* will cause syntax error */ 587 1.1 christos continue; 588 1.1 christos } 589 1.1 christos 590 1.1 christos if (c == 'e') 591 1.1 christos { 592 1.1 christos if (expr++) 593 1.1 christos return ('e'); /* will cause syntax error */ 594 1.1 christos continue; 595 1.1 christos } 596 1.1 christos 597 1.1 christos /* end of number */ 598 1.1 christos break; 599 1.1 christos } 600 1.1 christos *cp = '\0'; 601 1.1 christos 602 1.1 christos if ((cp - buf) >= BSZ) 603 1.1 christos printf("constant too long: truncated\n"); 604 1.1 christos else 605 1.1 christos ungetc(c, stdin); /* push back last char read */ 606 1.1 christos yylval.dval = atof(buf); 607 1.1 christos return (CONST); 608 1.1 christos } 609 1.1 christos return (c); 610 1.1 christos } 611 1.1 christos 612 1.1 christos static INTERVAL 613 1.1 christos hilo(double a, double b, double c, double d) 614 1.1 christos { 615 1.1 christos /* returns the smallest interval containing a, b, c, and d */ 616 1.1 christos /* used by *, / routines */ 617 1.1 christos INTERVAL v; 618 1.1 christos 619 1.1 christos if (a > b) 620 1.1 christos { 621 1.1 christos v.hi = a; 622 1.1 christos v.lo = b; 623 1.1 christos } 624 1.1 christos else 625 1.1 christos { 626 1.1 christos v.hi = b; 627 1.1 christos v.lo = a; 628 1.1 christos } 629 1.1 christos 630 1.1 christos if (c > d) 631 1.1 christos { 632 1.1 christos if (c > v.hi) 633 1.1 christos v.hi = c; 634 1.1 christos if (d < v.lo) 635 1.1 christos v.lo = d; 636 1.1 christos } 637 1.1 christos else 638 1.1 christos { 639 1.1 christos if (d > v.hi) 640 1.1 christos v.hi = d; 641 1.1 christos if (c < v.lo) 642 1.1 christos v.lo = c; 643 1.1 christos } 644 1.1 christos return (v); 645 1.1 christos } 646 1.1 christos 647 1.1 christos INTERVAL 648 1.1 christos vmul(double a, double b, INTERVAL v) 649 1.1 christos { 650 1.1 christos return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo)); 651 1.1 christos } 652 1.1 christos 653 1.1 christos int 654 1.1 christos dcheck(INTERVAL v) 655 1.1 christos { 656 1.1 christos if (v.hi >= 0. && v.lo <= 0.) 657 1.1 christos { 658 1.1 christos printf("divisor interval contains 0.\n"); 659 1.1 christos return (1); 660 1.1 christos } 661 1.1 christos return (0); 662 1.1 christos } 663 1.1 christos 664 1.1 christos INTERVAL 665 1.1 christos vdiv(double a, double b, INTERVAL v) 666 1.1 christos { 667 1.1 christos return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo)); 668 1.1 christos } 669 1.7 christos #line 668 "varsyntax_calc1.tab.c" 670 1.1 christos 671 1.1 christos /* For use in generated program */ 672 1.1 christos #define yydepth (int)(yystack.s_mark - yystack.s_base) 673 1.1 christos #if YYBTYACC 674 1.1 christos #define yytrial (yyps->save) 675 1.1 christos #endif /* YYBTYACC */ 676 1.1 christos 677 1.1 christos #if YYDEBUG 678 1.2 christos #include <stdio.h> /* needed for printf */ 679 1.1 christos #endif 680 1.1 christos 681 1.2 christos #include <stdlib.h> /* needed for malloc, etc */ 682 1.2 christos #include <string.h> /* needed for memset */ 683 1.1 christos 684 1.1 christos /* allocate initial stack or double stack size, up to YYMAXDEPTH */ 685 1.1 christos static int yygrowstack(YYSTACKDATA *data) 686 1.1 christos { 687 1.1 christos int i; 688 1.1 christos unsigned newsize; 689 1.2 christos YYINT *newss; 690 1.1 christos YYSTYPE *newvs; 691 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 692 1.1 christos YYLTYPE *newps; 693 1.1 christos #endif 694 1.1 christos 695 1.1 christos if ((newsize = data->stacksize) == 0) 696 1.1 christos newsize = YYINITSTACKSIZE; 697 1.1 christos else if (newsize >= YYMAXDEPTH) 698 1.1 christos return YYENOMEM; 699 1.1 christos else if ((newsize *= 2) > YYMAXDEPTH) 700 1.1 christos newsize = YYMAXDEPTH; 701 1.1 christos 702 1.1 christos i = (int) (data->s_mark - data->s_base); 703 1.2 christos newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); 704 1.7 christos if (newss == NULL) 705 1.1 christos return YYENOMEM; 706 1.1 christos 707 1.1 christos data->s_base = newss; 708 1.1 christos data->s_mark = newss + i; 709 1.1 christos 710 1.1 christos newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 711 1.7 christos if (newvs == NULL) 712 1.1 christos return YYENOMEM; 713 1.1 christos 714 1.1 christos data->l_base = newvs; 715 1.1 christos data->l_mark = newvs + i; 716 1.1 christos 717 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 718 1.1 christos newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps)); 719 1.7 christos if (newps == NULL) 720 1.1 christos return YYENOMEM; 721 1.1 christos 722 1.1 christos data->p_base = newps; 723 1.1 christos data->p_mark = newps + i; 724 1.1 christos #endif 725 1.1 christos 726 1.1 christos data->stacksize = newsize; 727 1.1 christos data->s_last = data->s_base + newsize - 1; 728 1.1 christos 729 1.1 christos #if YYDEBUG 730 1.1 christos if (yydebug) 731 1.1 christos fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize); 732 1.1 christos #endif 733 1.1 christos return 0; 734 1.1 christos } 735 1.1 christos 736 1.1 christos #if YYPURE || defined(YY_NO_LEAKS) 737 1.1 christos static void yyfreestack(YYSTACKDATA *data) 738 1.1 christos { 739 1.1 christos free(data->s_base); 740 1.1 christos free(data->l_base); 741 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 742 1.1 christos free(data->p_base); 743 1.1 christos #endif 744 1.1 christos memset(data, 0, sizeof(*data)); 745 1.1 christos } 746 1.1 christos #else 747 1.1 christos #define yyfreestack(data) /* nothing */ 748 1.1 christos #endif /* YYPURE || defined(YY_NO_LEAKS) */ 749 1.1 christos #if YYBTYACC 750 1.1 christos 751 1.1 christos static YYParseState * 752 1.1 christos yyNewState(unsigned size) 753 1.1 christos { 754 1.1 christos YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState)); 755 1.1 christos if (p == NULL) return NULL; 756 1.1 christos 757 1.1 christos p->yystack.stacksize = size; 758 1.1 christos if (size == 0) 759 1.1 christos { 760 1.1 christos p->yystack.s_base = NULL; 761 1.1 christos p->yystack.l_base = NULL; 762 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 763 1.1 christos p->yystack.p_base = NULL; 764 1.1 christos #endif 765 1.1 christos return p; 766 1.1 christos } 767 1.2 christos p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT)); 768 1.1 christos if (p->yystack.s_base == NULL) return NULL; 769 1.1 christos p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE)); 770 1.1 christos if (p->yystack.l_base == NULL) return NULL; 771 1.1 christos memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE)); 772 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 773 1.1 christos p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE)); 774 1.1 christos if (p->yystack.p_base == NULL) return NULL; 775 1.1 christos memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE)); 776 1.1 christos #endif 777 1.1 christos 778 1.1 christos return p; 779 1.1 christos } 780 1.1 christos 781 1.1 christos static void 782 1.1 christos yyFreeState(YYParseState *p) 783 1.1 christos { 784 1.1 christos yyfreestack(&p->yystack); 785 1.1 christos free(p); 786 1.1 christos } 787 1.1 christos #endif /* YYBTYACC */ 788 1.1 christos 789 1.1 christos #define YYABORT goto yyabort 790 1.1 christos #define YYREJECT goto yyabort 791 1.1 christos #define YYACCEPT goto yyaccept 792 1.1 christos #define YYERROR goto yyerrlab 793 1.1 christos #if YYBTYACC 794 1.1 christos #define YYVALID do { if (yyps->save) goto yyvalid; } while(0) 795 1.1 christos #define YYVALID_NESTED do { if (yyps->save && \ 796 1.1 christos yyps->save->save == 0) goto yyvalid; } while(0) 797 1.1 christos #endif /* YYBTYACC */ 798 1.1 christos 799 1.1 christos int 800 1.1 christos YYPARSE_DECL() 801 1.1 christos { 802 1.1 christos int yym, yyn, yystate, yyresult; 803 1.1 christos #if YYBTYACC 804 1.1 christos int yynewerrflag; 805 1.1 christos YYParseState *yyerrctx = NULL; 806 1.1 christos #endif /* YYBTYACC */ 807 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 808 1.4 christos YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */ 809 1.1 christos #endif 810 1.1 christos #if YYDEBUG 811 1.1 christos const char *yys; 812 1.1 christos 813 1.7 christos if ((yys = getenv("YYDEBUG")) != NULL) 814 1.1 christos { 815 1.1 christos yyn = *yys; 816 1.1 christos if (yyn >= '0' && yyn <= '9') 817 1.1 christos yydebug = yyn - '0'; 818 1.1 christos } 819 1.1 christos if (yydebug) 820 1.1 christos fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX); 821 1.1 christos #endif 822 1.3 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 823 1.3 christos memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range)); 824 1.3 christos #endif 825 1.1 christos 826 1.1 christos #if YYBTYACC 827 1.7 christos yyps = yyNewState(0); if (yyps == NULL) goto yyenomem; 828 1.7 christos yyps->save = NULL; 829 1.1 christos #endif /* YYBTYACC */ 830 1.2 christos yym = 0; 831 1.6 christos /* yyn is set below */ 832 1.1 christos yynerrs = 0; 833 1.1 christos yyerrflag = 0; 834 1.1 christos yychar = YYEMPTY; 835 1.1 christos yystate = 0; 836 1.1 christos 837 1.1 christos #if YYPURE 838 1.1 christos memset(&yystack, 0, sizeof(yystack)); 839 1.1 christos #endif 840 1.1 christos 841 1.1 christos if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 842 1.1 christos yystack.s_mark = yystack.s_base; 843 1.1 christos yystack.l_mark = yystack.l_base; 844 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 845 1.1 christos yystack.p_mark = yystack.p_base; 846 1.1 christos #endif 847 1.1 christos yystate = 0; 848 1.1 christos *yystack.s_mark = 0; 849 1.1 christos 850 1.1 christos yyloop: 851 1.1 christos if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 852 1.1 christos if (yychar < 0) 853 1.1 christos { 854 1.1 christos #if YYBTYACC 855 1.1 christos do { 856 1.1 christos if (yylvp < yylve) 857 1.1 christos { 858 1.1 christos /* we're currently re-reading tokens */ 859 1.1 christos yylval = *yylvp++; 860 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 861 1.1 christos yylloc = *yylpp++; 862 1.1 christos #endif 863 1.1 christos yychar = *yylexp++; 864 1.1 christos break; 865 1.1 christos } 866 1.1 christos if (yyps->save) 867 1.1 christos { 868 1.1 christos /* in trial mode; save scanner results for future parse attempts */ 869 1.1 christos if (yylvp == yylvlim) 870 1.1 christos { /* Enlarge lexical value queue */ 871 1.1 christos size_t p = (size_t) (yylvp - yylvals); 872 1.1 christos size_t s = (size_t) (yylvlim - yylvals); 873 1.1 christos 874 1.1 christos s += YYLVQUEUEGROWTH; 875 1.4 christos if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; 876 1.4 christos if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; 877 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 878 1.4 christos if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; 879 1.1 christos #endif 880 1.1 christos yylvp = yylve = yylvals + p; 881 1.1 christos yylvlim = yylvals + s; 882 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 883 1.1 christos yylpp = yylpe = yylpsns + p; 884 1.1 christos yylplim = yylpsns + s; 885 1.1 christos #endif 886 1.1 christos yylexp = yylexemes + p; 887 1.1 christos } 888 1.2 christos *yylexp = (YYINT) YYLEX; 889 1.1 christos *yylvp++ = yylval; 890 1.1 christos yylve++; 891 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 892 1.1 christos *yylpp++ = yylloc; 893 1.1 christos yylpe++; 894 1.1 christos #endif 895 1.1 christos yychar = *yylexp++; 896 1.1 christos break; 897 1.1 christos } 898 1.1 christos /* normal operation, no conflict encountered */ 899 1.1 christos #endif /* YYBTYACC */ 900 1.1 christos yychar = YYLEX; 901 1.1 christos #if YYBTYACC 902 1.1 christos } while (0); 903 1.1 christos #endif /* YYBTYACC */ 904 1.1 christos if (yychar < 0) yychar = YYEOF; 905 1.1 christos #if YYDEBUG 906 1.1 christos if (yydebug) 907 1.1 christos { 908 1.2 christos if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 909 1.1 christos fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)", 910 1.1 christos YYDEBUGSTR, yydepth, yystate, yychar, yys); 911 1.1 christos #ifdef YYSTYPE_TOSTRING 912 1.1 christos #if YYBTYACC 913 1.1 christos if (!yytrial) 914 1.1 christos #endif /* YYBTYACC */ 915 1.1 christos fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval)); 916 1.1 christos #endif 917 1.1 christos fputc('\n', stderr); 918 1.1 christos } 919 1.1 christos #endif 920 1.1 christos } 921 1.1 christos #if YYBTYACC 922 1.1 christos 923 1.1 christos /* Do we have a conflict? */ 924 1.1 christos if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 && 925 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 926 1.1 christos { 927 1.1 christos YYINT ctry; 928 1.1 christos 929 1.1 christos if (yypath) 930 1.1 christos { 931 1.1 christos YYParseState *save; 932 1.1 christos #if YYDEBUG 933 1.1 christos if (yydebug) 934 1.1 christos fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n", 935 1.1 christos YYDEBUGSTR, yydepth, yystate); 936 1.1 christos #endif 937 1.1 christos /* Switch to the next conflict context */ 938 1.1 christos save = yypath; 939 1.1 christos yypath = save->save; 940 1.1 christos save->save = NULL; 941 1.1 christos ctry = save->ctry; 942 1.1 christos if (save->state != yystate) YYABORT; 943 1.1 christos yyFreeState(save); 944 1.1 christos 945 1.1 christos } 946 1.1 christos else 947 1.1 christos { 948 1.1 christos 949 1.1 christos /* Unresolved conflict - start/continue trial parse */ 950 1.1 christos YYParseState *save; 951 1.1 christos #if YYDEBUG 952 1.1 christos if (yydebug) 953 1.1 christos { 954 1.1 christos fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate); 955 1.1 christos if (yyps->save) 956 1.1 christos fputs("ALREADY in conflict, continuing trial parse.\n", stderr); 957 1.1 christos else 958 1.1 christos fputs("Starting trial parse.\n", stderr); 959 1.1 christos } 960 1.1 christos #endif 961 1.1 christos save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 962 1.1 christos if (save == NULL) goto yyenomem; 963 1.1 christos save->save = yyps->save; 964 1.1 christos save->state = yystate; 965 1.1 christos save->errflag = yyerrflag; 966 1.1 christos save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); 967 1.2 christos memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 968 1.1 christos save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); 969 1.1 christos memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 970 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 971 1.1 christos save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); 972 1.1 christos memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 973 1.1 christos #endif 974 1.1 christos ctry = yytable[yyn]; 975 1.1 christos if (yyctable[ctry] == -1) 976 1.1 christos { 977 1.1 christos #if YYDEBUG 978 1.1 christos if (yydebug && yychar >= YYEOF) 979 1.1 christos fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth); 980 1.1 christos #endif 981 1.1 christos ctry++; 982 1.1 christos } 983 1.1 christos save->ctry = ctry; 984 1.1 christos if (yyps->save == NULL) 985 1.1 christos { 986 1.1 christos /* If this is a first conflict in the stack, start saving lexemes */ 987 1.1 christos if (!yylexemes) 988 1.1 christos { 989 1.4 christos yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); 990 1.1 christos if (yylexemes == NULL) goto yyenomem; 991 1.1 christos yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); 992 1.1 christos if (yylvals == NULL) goto yyenomem; 993 1.1 christos yylvlim = yylvals + YYLVQUEUEGROWTH; 994 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 995 1.1 christos yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE)); 996 1.1 christos if (yylpsns == NULL) goto yyenomem; 997 1.1 christos yylplim = yylpsns + YYLVQUEUEGROWTH; 998 1.1 christos #endif 999 1.1 christos } 1000 1.1 christos if (yylvp == yylve) 1001 1.1 christos { 1002 1.1 christos yylvp = yylve = yylvals; 1003 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1004 1.1 christos yylpp = yylpe = yylpsns; 1005 1.1 christos #endif 1006 1.1 christos yylexp = yylexemes; 1007 1.1 christos if (yychar >= YYEOF) 1008 1.1 christos { 1009 1.1 christos *yylve++ = yylval; 1010 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1011 1.1 christos *yylpe++ = yylloc; 1012 1.1 christos #endif 1013 1.2 christos *yylexp = (YYINT) yychar; 1014 1.1 christos yychar = YYEMPTY; 1015 1.1 christos } 1016 1.1 christos } 1017 1.1 christos } 1018 1.1 christos if (yychar >= YYEOF) 1019 1.1 christos { 1020 1.1 christos yylvp--; 1021 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1022 1.1 christos yylpp--; 1023 1.1 christos #endif 1024 1.1 christos yylexp--; 1025 1.1 christos yychar = YYEMPTY; 1026 1.1 christos } 1027 1.1 christos save->lexeme = (int) (yylvp - yylvals); 1028 1.1 christos yyps->save = save; 1029 1.1 christos } 1030 1.1 christos if (yytable[yyn] == ctry) 1031 1.1 christos { 1032 1.1 christos #if YYDEBUG 1033 1.1 christos if (yydebug) 1034 1.1 christos fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 1035 1.1 christos YYDEBUGSTR, yydepth, yystate, yyctable[ctry]); 1036 1.1 christos #endif 1037 1.1 christos if (yychar < 0) 1038 1.1 christos { 1039 1.1 christos yylvp++; 1040 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1041 1.1 christos yylpp++; 1042 1.1 christos #endif 1043 1.1 christos yylexp++; 1044 1.1 christos } 1045 1.1 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) 1046 1.1 christos goto yyoverflow; 1047 1.1 christos yystate = yyctable[ctry]; 1048 1.2 christos *++yystack.s_mark = (YYINT) yystate; 1049 1.1 christos *++yystack.l_mark = yylval; 1050 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1051 1.1 christos *++yystack.p_mark = yylloc; 1052 1.1 christos #endif 1053 1.1 christos yychar = YYEMPTY; 1054 1.1 christos if (yyerrflag > 0) --yyerrflag; 1055 1.1 christos goto yyloop; 1056 1.1 christos } 1057 1.1 christos else 1058 1.1 christos { 1059 1.1 christos yyn = yyctable[ctry]; 1060 1.1 christos goto yyreduce; 1061 1.1 christos } 1062 1.1 christos } /* End of code dealing with conflicts */ 1063 1.1 christos #endif /* YYBTYACC */ 1064 1.1 christos if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 1065 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 1066 1.1 christos { 1067 1.1 christos #if YYDEBUG 1068 1.1 christos if (yydebug) 1069 1.1 christos fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 1070 1.1 christos YYDEBUGSTR, yydepth, yystate, yytable[yyn]); 1071 1.1 christos #endif 1072 1.1 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1073 1.1 christos yystate = yytable[yyn]; 1074 1.1 christos *++yystack.s_mark = yytable[yyn]; 1075 1.1 christos *++yystack.l_mark = yylval; 1076 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1077 1.1 christos *++yystack.p_mark = yylloc; 1078 1.1 christos #endif 1079 1.1 christos yychar = YYEMPTY; 1080 1.1 christos if (yyerrflag > 0) --yyerrflag; 1081 1.1 christos goto yyloop; 1082 1.1 christos } 1083 1.1 christos if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 1084 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 1085 1.1 christos { 1086 1.1 christos yyn = yytable[yyn]; 1087 1.1 christos goto yyreduce; 1088 1.1 christos } 1089 1.1 christos if (yyerrflag != 0) goto yyinrecovery; 1090 1.1 christos #if YYBTYACC 1091 1.1 christos 1092 1.1 christos yynewerrflag = 1; 1093 1.1 christos goto yyerrhandler; 1094 1.2 christos goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 1095 1.1 christos 1096 1.1 christos yyerrlab: 1097 1.2 christos /* explicit YYERROR from an action -- pop the rhs of the rule reduced 1098 1.2 christos * before looking for error recovery */ 1099 1.2 christos yystack.s_mark -= yym; 1100 1.2 christos yystate = *yystack.s_mark; 1101 1.2 christos yystack.l_mark -= yym; 1102 1.2 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1103 1.2 christos yystack.p_mark -= yym; 1104 1.2 christos #endif 1105 1.2 christos 1106 1.1 christos yynewerrflag = 0; 1107 1.1 christos yyerrhandler: 1108 1.1 christos while (yyps->save) 1109 1.1 christos { 1110 1.1 christos int ctry; 1111 1.1 christos YYParseState *save = yyps->save; 1112 1.1 christos #if YYDEBUG 1113 1.1 christos if (yydebug) 1114 1.1 christos fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n", 1115 1.1 christos YYDEBUGSTR, yydepth, yystate, yyps->save->state, 1116 1.1 christos (int)(yylvp - yylvals - yyps->save->lexeme)); 1117 1.1 christos #endif 1118 1.1 christos /* Memorize most forward-looking error state in case it's really an error. */ 1119 1.1 christos if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals) 1120 1.1 christos { 1121 1.1 christos /* Free old saved error context state */ 1122 1.1 christos if (yyerrctx) yyFreeState(yyerrctx); 1123 1.1 christos /* Create and fill out new saved error context state */ 1124 1.1 christos yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 1125 1.1 christos if (yyerrctx == NULL) goto yyenomem; 1126 1.1 christos yyerrctx->save = yyps->save; 1127 1.1 christos yyerrctx->state = yystate; 1128 1.1 christos yyerrctx->errflag = yyerrflag; 1129 1.1 christos yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); 1130 1.2 christos memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 1131 1.1 christos yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); 1132 1.1 christos memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1133 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1134 1.1 christos yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); 1135 1.1 christos memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1136 1.1 christos #endif 1137 1.1 christos yyerrctx->lexeme = (int) (yylvp - yylvals); 1138 1.1 christos } 1139 1.1 christos yylvp = yylvals + save->lexeme; 1140 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1141 1.1 christos yylpp = yylpsns + save->lexeme; 1142 1.1 christos #endif 1143 1.1 christos yylexp = yylexemes + save->lexeme; 1144 1.1 christos yychar = YYEMPTY; 1145 1.1 christos yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); 1146 1.2 christos memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 1147 1.1 christos yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); 1148 1.1 christos memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1149 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1150 1.1 christos yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); 1151 1.1 christos memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1152 1.1 christos #endif 1153 1.1 christos ctry = ++save->ctry; 1154 1.1 christos yystate = save->state; 1155 1.1 christos /* We tried shift, try reduce now */ 1156 1.1 christos if ((yyn = yyctable[ctry]) >= 0) goto yyreduce; 1157 1.1 christos yyps->save = save->save; 1158 1.1 christos save->save = NULL; 1159 1.1 christos yyFreeState(save); 1160 1.1 christos 1161 1.1 christos /* Nothing left on the stack -- error */ 1162 1.1 christos if (!yyps->save) 1163 1.1 christos { 1164 1.1 christos #if YYDEBUG 1165 1.1 christos if (yydebug) 1166 1.1 christos fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n", 1167 1.1 christos YYPREFIX, yydepth); 1168 1.1 christos #endif 1169 1.1 christos /* Restore state as it was in the most forward-advanced error */ 1170 1.1 christos yylvp = yylvals + yyerrctx->lexeme; 1171 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1172 1.1 christos yylpp = yylpsns + yyerrctx->lexeme; 1173 1.1 christos #endif 1174 1.1 christos yylexp = yylexemes + yyerrctx->lexeme; 1175 1.1 christos yychar = yylexp[-1]; 1176 1.1 christos yylval = yylvp[-1]; 1177 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1178 1.1 christos yylloc = yylpp[-1]; 1179 1.1 christos #endif 1180 1.1 christos yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); 1181 1.2 christos memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 1182 1.1 christos yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); 1183 1.1 christos memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1184 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1185 1.1 christos yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); 1186 1.1 christos memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1187 1.1 christos #endif 1188 1.1 christos yystate = yyerrctx->state; 1189 1.1 christos yyFreeState(yyerrctx); 1190 1.1 christos yyerrctx = NULL; 1191 1.1 christos } 1192 1.1 christos yynewerrflag = 1; 1193 1.1 christos } 1194 1.1 christos if (yynewerrflag == 0) goto yyinrecovery; 1195 1.1 christos #endif /* YYBTYACC */ 1196 1.1 christos 1197 1.1 christos YYERROR_CALL("syntax error"); 1198 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1199 1.4 christos yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */ 1200 1.1 christos #endif 1201 1.1 christos 1202 1.1 christos #if !YYBTYACC 1203 1.2 christos goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 1204 1.1 christos yyerrlab: 1205 1.1 christos #endif 1206 1.1 christos ++yynerrs; 1207 1.1 christos 1208 1.1 christos yyinrecovery: 1209 1.1 christos if (yyerrflag < 3) 1210 1.1 christos { 1211 1.1 christos yyerrflag = 3; 1212 1.1 christos for (;;) 1213 1.1 christos { 1214 1.1 christos if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 1215 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 1216 1.1 christos { 1217 1.1 christos #if YYDEBUG 1218 1.1 christos if (yydebug) 1219 1.1 christos fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n", 1220 1.1 christos YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]); 1221 1.1 christos #endif 1222 1.1 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1223 1.1 christos yystate = yytable[yyn]; 1224 1.1 christos *++yystack.s_mark = yytable[yyn]; 1225 1.1 christos *++yystack.l_mark = yylval; 1226 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1227 1.1 christos /* lookahead position is error end position */ 1228 1.4 christos yyerror_loc_range[2] = yylloc; 1229 1.1 christos YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */ 1230 1.1 christos *++yystack.p_mark = yyloc; 1231 1.1 christos #endif 1232 1.1 christos goto yyloop; 1233 1.1 christos } 1234 1.1 christos else 1235 1.1 christos { 1236 1.1 christos #if YYDEBUG 1237 1.1 christos if (yydebug) 1238 1.1 christos fprintf(stderr, "%s[%d]: error recovery discarding state %d\n", 1239 1.1 christos YYDEBUGSTR, yydepth, *yystack.s_mark); 1240 1.1 christos #endif 1241 1.1 christos if (yystack.s_mark <= yystack.s_base) goto yyabort; 1242 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1243 1.1 christos /* the current TOS position is the error start position */ 1244 1.4 christos yyerror_loc_range[1] = *yystack.p_mark; 1245 1.1 christos #endif 1246 1.1 christos #if defined(YYDESTRUCT_CALL) 1247 1.1 christos #if YYBTYACC 1248 1.1 christos if (!yytrial) 1249 1.1 christos #endif /* YYBTYACC */ 1250 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1251 1.1 christos YYDESTRUCT_CALL("error: discarding state", 1252 1.1 christos yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark); 1253 1.1 christos #else 1254 1.1 christos YYDESTRUCT_CALL("error: discarding state", 1255 1.1 christos yystos[*yystack.s_mark], yystack.l_mark); 1256 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1257 1.1 christos #endif /* defined(YYDESTRUCT_CALL) */ 1258 1.1 christos --yystack.s_mark; 1259 1.1 christos --yystack.l_mark; 1260 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1261 1.1 christos --yystack.p_mark; 1262 1.1 christos #endif 1263 1.1 christos } 1264 1.1 christos } 1265 1.1 christos } 1266 1.1 christos else 1267 1.1 christos { 1268 1.1 christos if (yychar == YYEOF) goto yyabort; 1269 1.1 christos #if YYDEBUG 1270 1.1 christos if (yydebug) 1271 1.1 christos { 1272 1.2 christos if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 1273 1.1 christos fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n", 1274 1.1 christos YYDEBUGSTR, yydepth, yystate, yychar, yys); 1275 1.1 christos } 1276 1.1 christos #endif 1277 1.1 christos #if defined(YYDESTRUCT_CALL) 1278 1.1 christos #if YYBTYACC 1279 1.1 christos if (!yytrial) 1280 1.1 christos #endif /* YYBTYACC */ 1281 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1282 1.1 christos YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc); 1283 1.1 christos #else 1284 1.1 christos YYDESTRUCT_CALL("error: discarding token", yychar, &yylval); 1285 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1286 1.1 christos #endif /* defined(YYDESTRUCT_CALL) */ 1287 1.1 christos yychar = YYEMPTY; 1288 1.1 christos goto yyloop; 1289 1.1 christos } 1290 1.1 christos 1291 1.1 christos yyreduce: 1292 1.1 christos yym = yylen[yyn]; 1293 1.1 christos #if YYDEBUG 1294 1.1 christos if (yydebug) 1295 1.1 christos { 1296 1.1 christos fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)", 1297 1.1 christos YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]); 1298 1.1 christos #ifdef YYSTYPE_TOSTRING 1299 1.1 christos #if YYBTYACC 1300 1.1 christos if (!yytrial) 1301 1.1 christos #endif /* YYBTYACC */ 1302 1.1 christos if (yym > 0) 1303 1.1 christos { 1304 1.1 christos int i; 1305 1.1 christos fputc('<', stderr); 1306 1.1 christos for (i = yym; i > 0; i--) 1307 1.1 christos { 1308 1.1 christos if (i != yym) fputs(", ", stderr); 1309 1.1 christos fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]], 1310 1.1 christos yystack.l_mark[1-i]), stderr); 1311 1.1 christos } 1312 1.1 christos fputc('>', stderr); 1313 1.1 christos } 1314 1.1 christos #endif 1315 1.1 christos fputc('\n', stderr); 1316 1.1 christos } 1317 1.1 christos #endif 1318 1.1 christos if (yym > 0) 1319 1.1 christos yyval = yystack.l_mark[1-yym]; 1320 1.1 christos else 1321 1.1 christos memset(&yyval, 0, sizeof yyval); 1322 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1323 1.1 christos 1324 1.1 christos /* Perform position reduction */ 1325 1.1 christos memset(&yyloc, 0, sizeof(yyloc)); 1326 1.1 christos #if YYBTYACC 1327 1.1 christos if (!yytrial) 1328 1.1 christos #endif /* YYBTYACC */ 1329 1.1 christos { 1330 1.4 christos YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym); 1331 1.1 christos /* just in case YYERROR is invoked within the action, save 1332 1.1 christos the start of the rhs as the error start position */ 1333 1.4 christos yyerror_loc_range[1] = yystack.p_mark[1-yym]; 1334 1.1 christos } 1335 1.1 christos #endif 1336 1.1 christos 1337 1.1 christos switch (yyn) 1338 1.1 christos { 1339 1.1 christos case 3: 1340 1.1 christos #line 59 "varsyntax_calc1.y" 1341 1.1 christos { 1342 1.1 christos (void) printf("%15.8f\n", yystack.l_mark[-1].dval); 1343 1.1 christos } 1344 1.7 christos #line 1343 "varsyntax_calc1.tab.c" 1345 1.1 christos break; 1346 1.1 christos case 4: 1347 1.1 christos #line 63 "varsyntax_calc1.y" 1348 1.1 christos { 1349 1.1 christos (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.l_mark[-1].vval.hi); 1350 1.1 christos } 1351 1.7 christos #line 1350 "varsyntax_calc1.tab.c" 1352 1.1 christos break; 1353 1.1 christos case 5: 1354 1.1 christos #line 67 "varsyntax_calc1.y" 1355 1.1 christos { 1356 1.1 christos dreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].dval; 1357 1.1 christos } 1358 1.7 christos #line 1357 "varsyntax_calc1.tab.c" 1359 1.1 christos break; 1360 1.1 christos case 6: 1361 1.1 christos #line 71 "varsyntax_calc1.y" 1362 1.1 christos { 1363 1.1 christos vreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].vval; 1364 1.1 christos } 1365 1.7 christos #line 1364 "varsyntax_calc1.tab.c" 1366 1.1 christos break; 1367 1.1 christos case 7: 1368 1.1 christos #line 75 "varsyntax_calc1.y" 1369 1.1 christos { 1370 1.1 christos yyerrok; 1371 1.1 christos } 1372 1.7 christos #line 1371 "varsyntax_calc1.tab.c" 1373 1.1 christos break; 1374 1.1 christos case 9: 1375 1.1 christos #line 82 "varsyntax_calc1.y" 1376 1.1 christos { 1377 1.1 christos yyval.dval = dreg[yystack.l_mark[0].ival]; /* $$ & $1 are sufficient here*/ 1378 1.1 christos } 1379 1.7 christos #line 1378 "varsyntax_calc1.tab.c" 1380 1.1 christos break; 1381 1.1 christos case 10: 1382 1.1 christos #line 86 "varsyntax_calc1.y" 1383 1.1 christos { 1384 1.1 christos yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval; 1385 1.1 christos } 1386 1.7 christos #line 1385 "varsyntax_calc1.tab.c" 1387 1.1 christos break; 1388 1.1 christos case 11: 1389 1.1 christos #line 90 "varsyntax_calc1.y" 1390 1.1 christos { 1391 1.1 christos yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval; 1392 1.1 christos } 1393 1.7 christos #line 1392 "varsyntax_calc1.tab.c" 1394 1.1 christos break; 1395 1.1 christos case 12: 1396 1.1 christos #line 94 "varsyntax_calc1.y" 1397 1.1 christos { 1398 1.1 christos yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval; 1399 1.1 christos } 1400 1.7 christos #line 1399 "varsyntax_calc1.tab.c" 1401 1.1 christos break; 1402 1.1 christos case 13: 1403 1.1 christos #line 98 "varsyntax_calc1.y" 1404 1.1 christos { 1405 1.1 christos yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval; 1406 1.1 christos } 1407 1.7 christos #line 1406 "varsyntax_calc1.tab.c" 1408 1.1 christos break; 1409 1.1 christos case 14: 1410 1.1 christos #line 102 "varsyntax_calc1.y" 1411 1.1 christos { 1412 1.1 christos yyval.dval = -yystack.l_mark[0].dval; 1413 1.1 christos } 1414 1.7 christos #line 1413 "varsyntax_calc1.tab.c" 1415 1.1 christos break; 1416 1.1 christos case 15: 1417 1.1 christos #line 106 "varsyntax_calc1.y" 1418 1.1 christos { 1419 1.1 christos yyval.dval = yystack.l_mark[-1].dval; 1420 1.1 christos } 1421 1.7 christos #line 1420 "varsyntax_calc1.tab.c" 1422 1.1 christos break; 1423 1.1 christos case 16: 1424 1.1 christos #line 112 "varsyntax_calc1.y" 1425 1.1 christos { 1426 1.1 christos yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval; 1427 1.1 christos } 1428 1.7 christos #line 1427 "varsyntax_calc1.tab.c" 1429 1.1 christos break; 1430 1.1 christos case 17: 1431 1.1 christos #line 116 "varsyntax_calc1.y" 1432 1.1 christos { 1433 1.1 christos yyval.vval.lo = yystack.l_mark[-3].dval; 1434 1.1 christos yyval.vval.hi = yystack.l_mark[-1].dval; 1435 1.7 christos if ( yyval.vval.lo > yyval.vval.hi ) 1436 1.1 christos { 1437 1.1 christos (void) printf("interval out of order\n"); 1438 1.1 christos YYERROR; 1439 1.1 christos } 1440 1.1 christos } 1441 1.7 christos #line 1440 "varsyntax_calc1.tab.c" 1442 1.1 christos break; 1443 1.1 christos case 18: 1444 1.1 christos #line 126 "varsyntax_calc1.y" 1445 1.1 christos { 1446 1.1 christos yyval.vval = vreg[yystack.l_mark[0].ival]; 1447 1.1 christos } 1448 1.7 christos #line 1447 "varsyntax_calc1.tab.c" 1449 1.1 christos break; 1450 1.1 christos case 19: 1451 1.1 christos #line 130 "varsyntax_calc1.y" 1452 1.1 christos { 1453 1.1 christos yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi; 1454 1.1 christos yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo; 1455 1.1 christos } 1456 1.7 christos #line 1455 "varsyntax_calc1.tab.c" 1457 1.1 christos break; 1458 1.1 christos case 20: 1459 1.1 christos #line 135 "varsyntax_calc1.y" 1460 1.1 christos { 1461 1.1 christos yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi; 1462 1.1 christos yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo; 1463 1.1 christos } 1464 1.7 christos #line 1463 "varsyntax_calc1.tab.c" 1465 1.1 christos break; 1466 1.1 christos case 21: 1467 1.1 christos #line 140 "varsyntax_calc1.y" 1468 1.1 christos { 1469 1.1 christos yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo; 1470 1.1 christos yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi; 1471 1.1 christos } 1472 1.7 christos #line 1471 "varsyntax_calc1.tab.c" 1473 1.1 christos break; 1474 1.1 christos case 22: 1475 1.1 christos #line 145 "varsyntax_calc1.y" 1476 1.1 christos { 1477 1.1 christos yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo; 1478 1.1 christos yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi; 1479 1.1 christos } 1480 1.7 christos #line 1479 "varsyntax_calc1.tab.c" 1481 1.1 christos break; 1482 1.1 christos case 23: 1483 1.1 christos #line 150 "varsyntax_calc1.y" 1484 1.1 christos { 1485 1.1 christos yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval ); 1486 1.1 christos } 1487 1.7 christos #line 1486 "varsyntax_calc1.tab.c" 1488 1.1 christos break; 1489 1.1 christos case 24: 1490 1.1 christos #line 154 "varsyntax_calc1.y" 1491 1.1 christos { 1492 1.1 christos yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval ); 1493 1.1 christos } 1494 1.7 christos #line 1493 "varsyntax_calc1.tab.c" 1495 1.1 christos break; 1496 1.1 christos case 25: 1497 1.1 christos #line 158 "varsyntax_calc1.y" 1498 1.1 christos { 1499 1.1 christos if (dcheck(yystack.l_mark[0].vval)) YYERROR; 1500 1.1 christos yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval ); 1501 1.1 christos } 1502 1.7 christos #line 1501 "varsyntax_calc1.tab.c" 1503 1.1 christos break; 1504 1.1 christos case 26: 1505 1.1 christos #line 163 "varsyntax_calc1.y" 1506 1.1 christos { 1507 1.1 christos if (dcheck ( yystack.l_mark[0].vval )) YYERROR; 1508 1.1 christos yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval ); 1509 1.1 christos } 1510 1.7 christos #line 1509 "varsyntax_calc1.tab.c" 1511 1.1 christos break; 1512 1.1 christos case 27: 1513 1.1 christos #line 168 "varsyntax_calc1.y" 1514 1.1 christos { 1515 1.1 christos yyval.vval.hi = -yystack.l_mark[0].vval.lo; 1516 1.1 christos yyval.vval.lo = -yystack.l_mark[0].vval.hi; 1517 1.1 christos } 1518 1.7 christos #line 1517 "varsyntax_calc1.tab.c" 1519 1.1 christos break; 1520 1.1 christos case 28: 1521 1.1 christos #line 173 "varsyntax_calc1.y" 1522 1.1 christos { 1523 1.1 christos yyval.vval = yystack.l_mark[-1].vval; 1524 1.1 christos } 1525 1.7 christos #line 1524 "varsyntax_calc1.tab.c" 1526 1.1 christos break; 1527 1.7 christos #line 1526 "varsyntax_calc1.tab.c" 1528 1.1 christos default: 1529 1.1 christos break; 1530 1.1 christos } 1531 1.1 christos yystack.s_mark -= yym; 1532 1.1 christos yystate = *yystack.s_mark; 1533 1.1 christos yystack.l_mark -= yym; 1534 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1535 1.1 christos yystack.p_mark -= yym; 1536 1.1 christos #endif 1537 1.1 christos yym = yylhs[yyn]; 1538 1.1 christos if (yystate == 0 && yym == 0) 1539 1.1 christos { 1540 1.1 christos #if YYDEBUG 1541 1.1 christos if (yydebug) 1542 1.1 christos { 1543 1.1 christos fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1544 1.1 christos #ifdef YYSTYPE_TOSTRING 1545 1.1 christos #if YYBTYACC 1546 1.1 christos if (!yytrial) 1547 1.1 christos #endif /* YYBTYACC */ 1548 1.1 christos fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); 1549 1.1 christos #endif 1550 1.1 christos fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); 1551 1.1 christos } 1552 1.1 christos #endif 1553 1.1 christos yystate = YYFINAL; 1554 1.1 christos *++yystack.s_mark = YYFINAL; 1555 1.1 christos *++yystack.l_mark = yyval; 1556 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1557 1.1 christos *++yystack.p_mark = yyloc; 1558 1.1 christos #endif 1559 1.1 christos if (yychar < 0) 1560 1.1 christos { 1561 1.1 christos #if YYBTYACC 1562 1.1 christos do { 1563 1.1 christos if (yylvp < yylve) 1564 1.1 christos { 1565 1.1 christos /* we're currently re-reading tokens */ 1566 1.1 christos yylval = *yylvp++; 1567 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1568 1.1 christos yylloc = *yylpp++; 1569 1.1 christos #endif 1570 1.1 christos yychar = *yylexp++; 1571 1.1 christos break; 1572 1.1 christos } 1573 1.1 christos if (yyps->save) 1574 1.1 christos { 1575 1.1 christos /* in trial mode; save scanner results for future parse attempts */ 1576 1.1 christos if (yylvp == yylvlim) 1577 1.1 christos { /* Enlarge lexical value queue */ 1578 1.1 christos size_t p = (size_t) (yylvp - yylvals); 1579 1.1 christos size_t s = (size_t) (yylvlim - yylvals); 1580 1.1 christos 1581 1.1 christos s += YYLVQUEUEGROWTH; 1582 1.4 christos if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) 1583 1.1 christos goto yyenomem; 1584 1.4 christos if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) 1585 1.1 christos goto yyenomem; 1586 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1587 1.4 christos if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) 1588 1.1 christos goto yyenomem; 1589 1.1 christos #endif 1590 1.1 christos yylvp = yylve = yylvals + p; 1591 1.1 christos yylvlim = yylvals + s; 1592 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1593 1.1 christos yylpp = yylpe = yylpsns + p; 1594 1.1 christos yylplim = yylpsns + s; 1595 1.1 christos #endif 1596 1.1 christos yylexp = yylexemes + p; 1597 1.1 christos } 1598 1.2 christos *yylexp = (YYINT) YYLEX; 1599 1.1 christos *yylvp++ = yylval; 1600 1.1 christos yylve++; 1601 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1602 1.1 christos *yylpp++ = yylloc; 1603 1.1 christos yylpe++; 1604 1.1 christos #endif 1605 1.1 christos yychar = *yylexp++; 1606 1.1 christos break; 1607 1.1 christos } 1608 1.1 christos /* normal operation, no conflict encountered */ 1609 1.1 christos #endif /* YYBTYACC */ 1610 1.1 christos yychar = YYLEX; 1611 1.1 christos #if YYBTYACC 1612 1.1 christos } while (0); 1613 1.1 christos #endif /* YYBTYACC */ 1614 1.1 christos if (yychar < 0) yychar = YYEOF; 1615 1.1 christos #if YYDEBUG 1616 1.1 christos if (yydebug) 1617 1.1 christos { 1618 1.2 christos if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 1619 1.2 christos fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n", 1620 1.1 christos YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); 1621 1.1 christos } 1622 1.1 christos #endif 1623 1.1 christos } 1624 1.1 christos if (yychar == YYEOF) goto yyaccept; 1625 1.1 christos goto yyloop; 1626 1.1 christos } 1627 1.1 christos if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 1628 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 1629 1.1 christos yystate = yytable[yyn]; 1630 1.1 christos else 1631 1.1 christos yystate = yydgoto[yym]; 1632 1.1 christos #if YYDEBUG 1633 1.1 christos if (yydebug) 1634 1.1 christos { 1635 1.1 christos fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 1636 1.1 christos #ifdef YYSTYPE_TOSTRING 1637 1.1 christos #if YYBTYACC 1638 1.1 christos if (!yytrial) 1639 1.1 christos #endif /* YYBTYACC */ 1640 1.1 christos fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); 1641 1.1 christos #endif 1642 1.1 christos fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); 1643 1.1 christos } 1644 1.1 christos #endif 1645 1.1 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1646 1.2 christos *++yystack.s_mark = (YYINT) yystate; 1647 1.1 christos *++yystack.l_mark = yyval; 1648 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1649 1.1 christos *++yystack.p_mark = yyloc; 1650 1.1 christos #endif 1651 1.1 christos goto yyloop; 1652 1.1 christos #if YYBTYACC 1653 1.1 christos 1654 1.1 christos /* Reduction declares that this path is valid. Set yypath and do a full parse */ 1655 1.1 christos yyvalid: 1656 1.1 christos if (yypath) YYABORT; 1657 1.1 christos while (yyps->save) 1658 1.1 christos { 1659 1.1 christos YYParseState *save = yyps->save; 1660 1.1 christos yyps->save = save->save; 1661 1.1 christos save->save = yypath; 1662 1.1 christos yypath = save; 1663 1.1 christos } 1664 1.1 christos #if YYDEBUG 1665 1.1 christos if (yydebug) 1666 1.1 christos fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", 1667 1.1 christos YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); 1668 1.1 christos #endif 1669 1.1 christos if (yyerrctx) 1670 1.1 christos { 1671 1.1 christos yyFreeState(yyerrctx); 1672 1.1 christos yyerrctx = NULL; 1673 1.1 christos } 1674 1.1 christos yylvp = yylvals + yypath->lexeme; 1675 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1676 1.1 christos yylpp = yylpsns + yypath->lexeme; 1677 1.1 christos #endif 1678 1.1 christos yylexp = yylexemes + yypath->lexeme; 1679 1.1 christos yychar = YYEMPTY; 1680 1.1 christos yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); 1681 1.2 christos memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 1682 1.1 christos yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); 1683 1.1 christos memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1684 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1685 1.1 christos yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); 1686 1.1 christos memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1687 1.1 christos #endif 1688 1.1 christos yystate = yypath->state; 1689 1.1 christos goto yyloop; 1690 1.1 christos #endif /* YYBTYACC */ 1691 1.1 christos 1692 1.1 christos yyoverflow: 1693 1.1 christos YYERROR_CALL("yacc stack overflow"); 1694 1.1 christos #if YYBTYACC 1695 1.1 christos goto yyabort_nomem; 1696 1.1 christos yyenomem: 1697 1.1 christos YYERROR_CALL("memory exhausted"); 1698 1.1 christos yyabort_nomem: 1699 1.1 christos #endif /* YYBTYACC */ 1700 1.1 christos yyresult = 2; 1701 1.1 christos goto yyreturn; 1702 1.1 christos 1703 1.1 christos yyabort: 1704 1.1 christos yyresult = 1; 1705 1.1 christos goto yyreturn; 1706 1.1 christos 1707 1.1 christos yyaccept: 1708 1.1 christos #if YYBTYACC 1709 1.1 christos if (yyps->save) goto yyvalid; 1710 1.1 christos #endif /* YYBTYACC */ 1711 1.1 christos yyresult = 0; 1712 1.1 christos 1713 1.1 christos yyreturn: 1714 1.1 christos #if defined(YYDESTRUCT_CALL) 1715 1.1 christos if (yychar != YYEOF && yychar != YYEMPTY) 1716 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1717 1.1 christos YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); 1718 1.1 christos #else 1719 1.1 christos YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); 1720 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1721 1.1 christos 1722 1.1 christos { 1723 1.1 christos YYSTYPE *pv; 1724 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1725 1.1 christos YYLTYPE *pp; 1726 1.1 christos 1727 1.1 christos for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) 1728 1.1 christos YYDESTRUCT_CALL("cleanup: discarding state", 1729 1.1 christos yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); 1730 1.1 christos #else 1731 1.1 christos for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) 1732 1.1 christos YYDESTRUCT_CALL("cleanup: discarding state", 1733 1.1 christos yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); 1734 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1735 1.1 christos } 1736 1.1 christos #endif /* defined(YYDESTRUCT_CALL) */ 1737 1.1 christos 1738 1.1 christos #if YYBTYACC 1739 1.1 christos if (yyerrctx) 1740 1.1 christos { 1741 1.1 christos yyFreeState(yyerrctx); 1742 1.1 christos yyerrctx = NULL; 1743 1.1 christos } 1744 1.1 christos while (yyps) 1745 1.1 christos { 1746 1.1 christos YYParseState *save = yyps; 1747 1.1 christos yyps = save->save; 1748 1.1 christos save->save = NULL; 1749 1.1 christos yyFreeState(save); 1750 1.1 christos } 1751 1.1 christos while (yypath) 1752 1.1 christos { 1753 1.1 christos YYParseState *save = yypath; 1754 1.1 christos yypath = save->save; 1755 1.1 christos save->save = NULL; 1756 1.1 christos yyFreeState(save); 1757 1.1 christos } 1758 1.1 christos #endif /* YYBTYACC */ 1759 1.1 christos yyfreestack(&yystack); 1760 1.1 christos return (yyresult); 1761 1.1 christos } 1762