1/* A recursive-descent parser generated by peg 0.1.15 */ 2 3#include <stdio.h> 4#include <stdlib.h> 5#include <string.h> 6#define YYRULECOUNT 23 7#ifndef YY_MALLOC 8#define YY_MALLOC(C, N) malloc(N) 9#endif 10#ifndef YY_REALLOC 11#define YY_REALLOC(C, P, N) realloc(P, N) 12#endif 13#ifndef YY_FREE 14#define YY_FREE(C, P) free(P) 15#endif 16#ifndef YY_LOCAL 17#define YY_LOCAL(T) static T 18#endif 19#ifndef YY_ACTION 20#define YY_ACTION(T) static T 21#endif 22#ifndef YY_RULE 23#define YY_RULE(T) static T 24#endif 25#ifndef YY_PARSE 26#define YY_PARSE(T) T 27#endif 28#ifndef YYPARSE 29#define YYPARSE yyparse 30#endif 31#ifndef YYPARSEFROM 32#define YYPARSEFROM yyparsefrom 33#endif 34#ifndef YYRELEASE 35#define YYRELEASE yyrelease 36#endif 37#ifndef YY_BEGIN 38#define YY_BEGIN ( yy->__begin= yy->__pos, 1) 39#endif 40#ifndef YY_END 41#define YY_END ( yy->__end= yy->__pos, 1) 42#endif 43#ifdef YY_DEBUG 44# define yyprintf(args) fprintf args 45#else 46# define yyprintf(args) 47#endif 48#ifndef YYSTYPE 49#define YYSTYPE int 50#endif 51#ifndef YY_STACK_SIZE 52#define YY_STACK_SIZE 128 53#endif 54 55#ifndef YY_BUFFER_SIZE 56#define YY_BUFFER_SIZE 1024 57#endif 58 59#ifndef YY_PART 60 61typedef struct _yycontext yycontext; 62typedef void (*yyaction)(yycontext *yy, char *yytext, int yyleng); 63typedef struct _yythunk { int begin, end; yyaction action; struct _yythunk *next; } yythunk; 64 65struct _yycontext { 66 char *__buf; 67 int __buflen; 68 int __pos; 69 int __limit; 70 char *__text; 71 int __textlen; 72 int __begin; 73 int __end; 74 int __textmax; 75 yythunk *__thunks; 76 int __thunkslen; 77 int __thunkpos; 78 YYSTYPE __; 79 YYSTYPE *__val; 80 YYSTYPE *__vals; 81 int __valslen; 82#ifdef YY_CTX_MEMBERS 83 YY_CTX_MEMBERS 84#endif 85}; 86 87#ifdef YY_CTX_LOCAL 88#define YY_CTX_PARAM_ yycontext *yyctx, 89#define YY_CTX_PARAM yycontext *yyctx 90#define YY_CTX_ARG_ yyctx, 91#define YY_CTX_ARG yyctx 92#ifndef YY_INPUT 93#define YY_INPUT(yy, buf, result, max_size) \ 94 { \ 95 int yyc= getchar(); \ 96 result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1); \ 97 yyprintf((stderr, "<%c>", yyc)); \ 98 } 99#endif 100#else 101#define YY_CTX_PARAM_ 102#define YY_CTX_PARAM 103#define YY_CTX_ARG_ 104#define YY_CTX_ARG 105yycontext _yyctx= { 0, 0 }; 106yycontext *yyctx= &_yyctx; 107#ifndef YY_INPUT 108#define YY_INPUT(buf, result, max_size) \ 109 { \ 110 int yyc= getchar(); \ 111 result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1); \ 112 yyprintf((stderr, "<%c>", yyc)); \ 113 } 114#endif 115#endif 116 117YY_LOCAL(int) yyrefill(yycontext *yy) 118{ 119 int yyn; 120 while (yy->__buflen - yy->__pos < 512) 121 { 122 yy->__buflen *= 2; 123 yy->__buf= (char *)YY_REALLOC(yy, yy->__buf, yy->__buflen); 124 } 125#ifdef YY_CTX_LOCAL 126 YY_INPUT(yy, (yy->__buf + yy->__pos), yyn, (yy->__buflen - yy->__pos)); 127#else 128 YY_INPUT((yy->__buf + yy->__pos), yyn, (yy->__buflen - yy->__pos)); 129#endif 130 if (!yyn) return 0; 131 yy->__limit += yyn; 132 return 1; 133} 134 135YY_LOCAL(int) yymatchDot(yycontext *yy) 136{ 137 if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0; 138 ++yy->__pos; 139 return 1; 140} 141 142YY_LOCAL(int) yymatchChar(yycontext *yy, int c) 143{ 144 if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0; 145 if ((unsigned char)yy->__buf[yy->__pos] == c) 146 { 147 ++yy->__pos; 148 yyprintf((stderr, " ok yymatchChar(yy, %c) @ %s\n", c, yy->__buf+yy->__pos)); 149 return 1; 150 } 151 yyprintf((stderr, " fail yymatchChar(yy, %c) @ %s\n", c, yy->__buf+yy->__pos)); 152 return 0; 153} 154 155YY_LOCAL(int) yymatchString(yycontext *yy, const char *s) 156{ 157 int yysav= yy->__pos; 158 while (*s) 159 { 160 if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0; 161 if (yy->__buf[yy->__pos] != *s) 162 { 163 yy->__pos= yysav; 164 return 0; 165 } 166 ++s; 167 ++yy->__pos; 168 } 169 return 1; 170} 171 172YY_LOCAL(int) yymatchClass(yycontext *yy, unsigned char *bits) 173{ 174 int c; 175 if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0; 176 c= (unsigned char)yy->__buf[yy->__pos]; 177 if (bits[c >> 3] & (1 << (c & 7))) 178 { 179 ++yy->__pos; 180 yyprintf((stderr, " ok yymatchClass @ %s\n", yy->__buf+yy->__pos)); 181 return 1; 182 } 183 yyprintf((stderr, " fail yymatchClass @ %s\n", yy->__buf+yy->__pos)); 184 return 0; 185} 186 187YY_LOCAL(void) yyDo(yycontext *yy, yyaction action, int begin, int end) 188{ 189 while (yy->__thunkpos >= yy->__thunkslen) 190 { 191 yy->__thunkslen *= 2; 192 yy->__thunks= (yythunk *)YY_REALLOC(yy, yy->__thunks, sizeof(yythunk) * yy->__thunkslen); 193 } 194 yy->__thunks[yy->__thunkpos].begin= begin; 195 yy->__thunks[yy->__thunkpos].end= end; 196 yy->__thunks[yy->__thunkpos].action= action; 197 ++yy->__thunkpos; 198} 199 200YY_LOCAL(int) yyText(yycontext *yy, int begin, int end) 201{ 202 int yyleng= end - begin; 203 if (yyleng <= 0) 204 yyleng= 0; 205 else 206 { 207 while (yy->__textlen < (yyleng + 1)) 208 { 209 yy->__textlen *= 2; 210 yy->__text= (char *)YY_REALLOC(yy, yy->__text, yy->__textlen); 211 } 212 memcpy(yy->__text, yy->__buf + begin, yyleng); 213 } 214 yy->__text[yyleng]= '\0'; 215 return yyleng; 216} 217 218YY_LOCAL(void) yyDone(yycontext *yy) 219{ 220 int pos; 221 for (pos= 0; pos < yy->__thunkpos; ++pos) 222 { 223 yythunk *thunk= &yy->__thunks[pos]; 224 int yyleng= thunk->end ? yyText(yy, thunk->begin, thunk->end) : thunk->begin; 225 yyprintf((stderr, "DO [%d] %p %s\n", pos, thunk->action, yy->__text)); 226 thunk->action(yy, yy->__text, yyleng); 227 } 228 yy->__thunkpos= 0; 229} 230 231YY_LOCAL(void) yyCommit(yycontext *yy) 232{ 233 if ((yy->__limit -= yy->__pos)) 234 { 235 memmove(yy->__buf, yy->__buf + yy->__pos, yy->__limit); 236 } 237 yy->__begin -= yy->__pos; 238 yy->__end -= yy->__pos; 239 yy->__pos= yy->__thunkpos= 0; 240} 241 242YY_LOCAL(int) yyAccept(yycontext *yy, int tp0) 243{ 244 if (tp0) 245 { 246 fprintf(stderr, "accept denied at %d\n", tp0); 247 return 0; 248 } 249 else 250 { 251 yyDone(yy); 252 yyCommit(yy); 253 } 254 return 1; 255} 256 257YY_LOCAL(void) yyPush(yycontext *yy, char *text, int count) 258{ 259 yy->__val += count; 260 while (yy->__valslen <= yy->__val - yy->__vals) 261 { 262 long offset= yy->__val - yy->__vals; 263 yy->__valslen *= 2; 264 yy->__vals= (YYSTYPE *)YY_REALLOC(yy, yy->__vals, sizeof(YYSTYPE) * yy->__valslen); 265 yy->__val= yy->__vals + offset; 266 } 267} 268YY_LOCAL(void) yyPop(yycontext *yy, char *text, int count) { yy->__val -= count; } 269YY_LOCAL(void) yySet(yycontext *yy, char *text, int count) { yy->__val[count]= yy->__; } 270 271#endif /* YY_PART */ 272 273#define YYACCEPT yyAccept(yy, yythunkpos0) 274 275YY_RULE(int) yy_Fname(yycontext *yy); /* 23 */ 276YY_RULE(int) yy_CLOSE(yycontext *yy); /* 22 */ 277YY_RULE(int) yy_OPEN(yycontext *yy); /* 21 */ 278YY_RULE(int) yy_Funcall(yycontext *yy); /* 20 */ 279YY_RULE(int) yy_Constant(yycontext *yy); /* 19 */ 280YY_RULE(int) yy_SI_Unit(yycontext *yy); /* 18 */ 281YY_RULE(int) yy_F_NUMBER(yycontext *yy); /* 17 */ 282YY_RULE(int) yy_MOD(yycontext *yy); /* 16 */ 283YY_RULE(int) yy_DIVIDE(yycontext *yy); /* 15 */ 284YY_RULE(int) yy_TIMES(yycontext *yy); /* 14 */ 285YY_RULE(int) yy_POW(yycontext *yy); /* 13 */ 286YY_RULE(int) yy_Value(yycontext *yy); /* 12 */ 287YY_RULE(int) yy_GREATER_THAN(yycontext *yy); /* 11 */ 288YY_RULE(int) yy_GREATEREQ_THAN(yycontext *yy); /* 10 */ 289YY_RULE(int) yy_LESS_THAN(yycontext *yy); /* 9 */ 290YY_RULE(int) yy_LESSEQ_THAN(yycontext *yy); /* 8 */ 291YY_RULE(int) yy_CLOSE_ENOUGH(yycontext *yy); /* 7 */ 292YY_RULE(int) yy_MINUS(yycontext *yy); /* 6 */ 293YY_RULE(int) yy_PLUS(yycontext *yy); /* 5 */ 294YY_RULE(int) yy_Product(yycontext *yy); /* 4 */ 295YY_RULE(int) yy_Sum(yycontext *yy); /* 3 */ 296YY_RULE(int) yy_SPACE(yycontext *yy); /* 2 */ 297YY_RULE(int) yy_Expr(yycontext *yy); /* 1 */ 298 299YY_ACTION(void) yy_5_SI_Unit(yycontext *yy, char *yytext, int yyleng) 300{ 301#define __ yy->__ 302#define yypos yy->__pos 303#define yythunkpos yy->__thunkpos 304 yyprintf((stderr, "do yy_5_SI_Unit\n")); 305 { 306 math_eval_push(1000000000000000, yy->stack, &(yy->stackp)); ; 307 } 308#undef yythunkpos 309#undef yypos 310#undef yy 311} 312YY_ACTION(void) yy_4_SI_Unit(yycontext *yy, char *yytext, int yyleng) 313{ 314#define __ yy->__ 315#define yypos yy->__pos 316#define yythunkpos yy->__thunkpos 317 yyprintf((stderr, "do yy_4_SI_Unit\n")); 318 { 319 math_eval_push(1000000000000, yy->stack, &(yy->stackp)); ; 320 } 321#undef yythunkpos 322#undef yypos 323#undef yy 324} 325YY_ACTION(void) yy_3_SI_Unit(yycontext *yy, char *yytext, int yyleng) 326{ 327#define __ yy->__ 328#define yypos yy->__pos 329#define yythunkpos yy->__thunkpos 330 yyprintf((stderr, "do yy_3_SI_Unit\n")); 331 { 332 math_eval_push(1000000000, yy->stack, &(yy->stackp)); ; 333 } 334#undef yythunkpos 335#undef yypos 336#undef yy 337} 338YY_ACTION(void) yy_2_SI_Unit(yycontext *yy, char *yytext, int yyleng) 339{ 340#define __ yy->__ 341#define yypos yy->__pos 342#define yythunkpos yy->__thunkpos 343 yyprintf((stderr, "do yy_2_SI_Unit\n")); 344 { 345 math_eval_push(1000000, yy->stack, &(yy->stackp)); ; 346 } 347#undef yythunkpos 348#undef yypos 349#undef yy 350} 351YY_ACTION(void) yy_1_SI_Unit(yycontext *yy, char *yytext, int yyleng) 352{ 353#define __ yy->__ 354#define yypos yy->__pos 355#define yythunkpos yy->__thunkpos 356 yyprintf((stderr, "do yy_1_SI_Unit\n")); 357 { 358 math_eval_push(1000, yy->stack, &(yy->stackp)); ; 359 } 360#undef yythunkpos 361#undef yypos 362#undef yy 363} 364YY_ACTION(void) yy_13_Constant(yycontext *yy, char *yytext, int yyleng) 365{ 366#define __ yy->__ 367#define yypos yy->__pos 368#define yythunkpos yy->__thunkpos 369 yyprintf((stderr, "do yy_13_Constant\n")); 370 { 371 math_eval_push(0.70710678118654752440, yy->stack, &(yy->stackp)); ; 372 } 373#undef yythunkpos 374#undef yypos 375#undef yy 376} 377YY_ACTION(void) yy_12_Constant(yycontext *yy, char *yytext, int yyleng) 378{ 379#define __ yy->__ 380#define yypos yy->__pos 381#define yythunkpos yy->__thunkpos 382 yyprintf((stderr, "do yy_12_Constant\n")); 383 { 384 math_eval_push(1.41421356237309504880, yy->stack, &(yy->stackp)); ; 385 } 386#undef yythunkpos 387#undef yypos 388#undef yy 389} 390YY_ACTION(void) yy_11_Constant(yycontext *yy, char *yytext, int yyleng) 391{ 392#define __ yy->__ 393#define yypos yy->__pos 394#define yythunkpos yy->__thunkpos 395 yyprintf((stderr, "do yy_11_Constant\n")); 396 { 397 math_eval_push(1.12837916709551257390, yy->stack, &(yy->stackp)); ; 398 } 399#undef yythunkpos 400#undef yypos 401#undef yy 402} 403YY_ACTION(void) yy_10_Constant(yycontext *yy, char *yytext, int yyleng) 404{ 405#define __ yy->__ 406#define yypos yy->__pos 407#define yythunkpos yy->__thunkpos 408 yyprintf((stderr, "do yy_10_Constant\n")); 409 { 410 math_eval_push(0.63661977236758134308, yy->stack, &(yy->stackp)); ; 411 } 412#undef yythunkpos 413#undef yypos 414#undef yy 415} 416YY_ACTION(void) yy_9_Constant(yycontext *yy, char *yytext, int yyleng) 417{ 418#define __ yy->__ 419#define yypos yy->__pos 420#define yythunkpos yy->__thunkpos 421 yyprintf((stderr, "do yy_9_Constant\n")); 422 { 423 math_eval_push(0.31830988618379067154, yy->stack, &(yy->stackp)); ; 424 } 425#undef yythunkpos 426#undef yypos 427#undef yy 428} 429YY_ACTION(void) yy_8_Constant(yycontext *yy, char *yytext, int yyleng) 430{ 431#define __ yy->__ 432#define yypos yy->__pos 433#define yythunkpos yy->__thunkpos 434 yyprintf((stderr, "do yy_8_Constant\n")); 435 { 436 math_eval_push(0.78539816339744830962, yy->stack, &(yy->stackp)); ; 437 } 438#undef yythunkpos 439#undef yypos 440#undef yy 441} 442YY_ACTION(void) yy_7_Constant(yycontext *yy, char *yytext, int yyleng) 443{ 444#define __ yy->__ 445#define yypos yy->__pos 446#define yythunkpos yy->__thunkpos 447 yyprintf((stderr, "do yy_7_Constant\n")); 448 { 449 math_eval_push(1.57079632679489661923, yy->stack, &(yy->stackp)); ; 450 } 451#undef yythunkpos 452#undef yypos 453#undef yy 454} 455YY_ACTION(void) yy_6_Constant(yycontext *yy, char *yytext, int yyleng) 456{ 457#define __ yy->__ 458#define yypos yy->__pos 459#define yythunkpos yy->__thunkpos 460 yyprintf((stderr, "do yy_6_Constant\n")); 461 { 462 math_eval_push(3.14159265358979323846, yy->stack, &(yy->stackp)); ; 463 } 464#undef yythunkpos 465#undef yypos 466#undef yy 467} 468YY_ACTION(void) yy_5_Constant(yycontext *yy, char *yytext, int yyleng) 469{ 470#define __ yy->__ 471#define yypos yy->__pos 472#define yythunkpos yy->__thunkpos 473 yyprintf((stderr, "do yy_5_Constant\n")); 474 { 475 math_eval_push(2.30258509299404568402, yy->stack, &(yy->stackp)); ; 476 } 477#undef yythunkpos 478#undef yypos 479#undef yy 480} 481YY_ACTION(void) yy_4_Constant(yycontext *yy, char *yytext, int yyleng) 482{ 483#define __ yy->__ 484#define yypos yy->__pos 485#define yythunkpos yy->__thunkpos 486 yyprintf((stderr, "do yy_4_Constant\n")); 487 { 488 math_eval_push(0.69314718055994530942, yy->stack, &(yy->stackp)); ; 489 } 490#undef yythunkpos 491#undef yypos 492#undef yy 493} 494YY_ACTION(void) yy_3_Constant(yycontext *yy, char *yytext, int yyleng) 495{ 496#define __ yy->__ 497#define yypos yy->__pos 498#define yythunkpos yy->__thunkpos 499 yyprintf((stderr, "do yy_3_Constant\n")); 500 { 501 math_eval_push(0.43429448190325182765, yy->stack, &(yy->stackp)); ; 502 } 503#undef yythunkpos 504#undef yypos 505#undef yy 506} 507YY_ACTION(void) yy_2_Constant(yycontext *yy, char *yytext, int yyleng) 508{ 509#define __ yy->__ 510#define yypos yy->__pos 511#define yythunkpos yy->__thunkpos 512 yyprintf((stderr, "do yy_2_Constant\n")); 513 { 514 math_eval_push(1.4426950408889634074, yy->stack, &(yy->stackp)); ; 515 } 516#undef yythunkpos 517#undef yypos 518#undef yy 519} 520YY_ACTION(void) yy_1_Constant(yycontext *yy, char *yytext, int yyleng) 521{ 522#define __ yy->__ 523#define yypos yy->__pos 524#define yythunkpos yy->__thunkpos 525 yyprintf((stderr, "do yy_1_Constant\n")); 526 { 527 math_eval_push(2.7182818284590452354, yy->stack, &(yy->stackp)); ; 528 } 529#undef yythunkpos 530#undef yypos 531#undef yy 532} 533YY_ACTION(void) yy_1_Fname(yycontext *yy, char *yytext, int yyleng) 534{ 535#define __ yy->__ 536#define yypos yy->__pos 537#define yythunkpos yy->__thunkpos 538 yyprintf((stderr, "do yy_1_Fname\n")); 539 { 540 strcpy(yy->fname, yytext); ; 541 } 542#undef yythunkpos 543#undef yypos 544#undef yy 545} 546YY_ACTION(void) yy_1_Funcall(yycontext *yy, char *yytext, int yyleng) 547{ 548#define __ yy->__ 549#define yypos yy->__pos 550#define yythunkpos yy->__thunkpos 551 yyprintf((stderr, "do yy_1_Funcall\n")); 552 { 553 math_eval_push(EvaluateMathFunction(yy->fname, math_eval_pop(yy->stack, &(yy->stackp))), yy->stack, &(yy->stackp)); ; 554 } 555#undef yythunkpos 556#undef yypos 557#undef yy 558} 559YY_ACTION(void) yy_2_Value(yycontext *yy, char *yytext, int yyleng) 560{ 561#define __ yy->__ 562#define yypos yy->__pos 563#define yythunkpos yy->__thunkpos 564 yyprintf((stderr, "do yy_2_Value\n")); 565 { 566 double scanned = 0; sscanf(yytext, "%lf", &scanned); math_eval_push(scanned, yy->stack, &(yy->stackp)); /*Log(LOG_LEVEL_ERR, "YY: read FP %lf", scanned);*/ ; 567 } 568#undef yythunkpos 569#undef yypos 570#undef yy 571} 572YY_ACTION(void) yy_1_Value(yycontext *yy, char *yytext, int yyleng) 573{ 574#define __ yy->__ 575#define yypos yy->__pos 576#define yythunkpos yy->__thunkpos 577 yyprintf((stderr, "do yy_1_Value\n")); 578 { 579 double scanned = 0; sscanf(yytext, "%lf", &scanned); math_eval_push(math_eval_pop(yy->stack, &(yy->stackp)) * scanned, yy->stack, &(yy->stackp)); /* Log(LOG_LEVEL_ERR, "YY: read FP %lf", scanned); */ ; 580 } 581#undef yythunkpos 582#undef yypos 583#undef yy 584} 585YY_ACTION(void) yy_4_Product(yycontext *yy, char *yytext, int yyleng) 586{ 587#define __ yy->__ 588#define yypos yy->__pos 589#define yythunkpos yy->__thunkpos 590 yyprintf((stderr, "do yy_4_Product\n")); 591 { 592 double r= math_eval_pop(yy->stack, &(yy->stackp)), l= math_eval_pop(yy->stack, &(yy->stackp)); math_eval_push((long)l % (long)r, yy->stack, &(yy->stackp)); ; 593 } 594#undef yythunkpos 595#undef yypos 596#undef yy 597} 598YY_ACTION(void) yy_3_Product(yycontext *yy, char *yytext, int yyleng) 599{ 600#define __ yy->__ 601#define yypos yy->__pos 602#define yythunkpos yy->__thunkpos 603 yyprintf((stderr, "do yy_3_Product\n")); 604 { 605 double r= math_eval_pop(yy->stack, &(yy->stackp)), l= math_eval_pop(yy->stack, &(yy->stackp)); math_eval_push(l / r, yy->stack, &(yy->stackp)); ; 606 } 607#undef yythunkpos 608#undef yypos 609#undef yy 610} 611YY_ACTION(void) yy_2_Product(yycontext *yy, char *yytext, int yyleng) 612{ 613#define __ yy->__ 614#define yypos yy->__pos 615#define yythunkpos yy->__thunkpos 616 yyprintf((stderr, "do yy_2_Product\n")); 617 { 618 double r= math_eval_pop(yy->stack, &(yy->stackp)), l= math_eval_pop(yy->stack, &(yy->stackp)); math_eval_push(l * r, yy->stack, &(yy->stackp)); ; 619 } 620#undef yythunkpos 621#undef yypos 622#undef yy 623} 624YY_ACTION(void) yy_1_Product(yycontext *yy, char *yytext, int yyleng) 625{ 626#define __ yy->__ 627#define yypos yy->__pos 628#define yythunkpos yy->__thunkpos 629 yyprintf((stderr, "do yy_1_Product\n")); 630 { 631 double r= math_eval_pop(yy->stack, &(yy->stackp)), l= math_eval_pop(yy->stack, &(yy->stackp)); math_eval_push(pow(l, r), yy->stack, &(yy->stackp)); ; 632 } 633#undef yythunkpos 634#undef yypos 635#undef yy 636} 637YY_ACTION(void) yy_7_Sum(yycontext *yy, char *yytext, int yyleng) 638{ 639#define __ yy->__ 640#define yypos yy->__pos 641#define yythunkpos yy->__thunkpos 642 yyprintf((stderr, "do yy_7_Sum\n")); 643 { 644 double r= math_eval_pop(yy->stack, &(yy->stackp)), l= math_eval_pop(yy->stack, &(yy->stackp)); math_eval_push(l > r, yy->stack, &(yy->stackp)); ; 645 } 646#undef yythunkpos 647#undef yypos 648#undef yy 649} 650YY_ACTION(void) yy_6_Sum(yycontext *yy, char *yytext, int yyleng) 651{ 652#define __ yy->__ 653#define yypos yy->__pos 654#define yythunkpos yy->__thunkpos 655 yyprintf((stderr, "do yy_6_Sum\n")); 656 { 657 double r= math_eval_pop(yy->stack, &(yy->stackp)), l= math_eval_pop(yy->stack, &(yy->stackp)); math_eval_push((l > r || fabs(l - r) < 0.00000000000000001), yy->stack, &(yy->stackp)); ; 658 } 659#undef yythunkpos 660#undef yypos 661#undef yy 662} 663YY_ACTION(void) yy_5_Sum(yycontext *yy, char *yytext, int yyleng) 664{ 665#define __ yy->__ 666#define yypos yy->__pos 667#define yythunkpos yy->__thunkpos 668 yyprintf((stderr, "do yy_5_Sum\n")); 669 { 670 double r= math_eval_pop(yy->stack, &(yy->stackp)), l= math_eval_pop(yy->stack, &(yy->stackp)); math_eval_push(l < r, yy->stack, &(yy->stackp)); ; 671 } 672#undef yythunkpos 673#undef yypos 674#undef yy 675} 676YY_ACTION(void) yy_4_Sum(yycontext *yy, char *yytext, int yyleng) 677{ 678#define __ yy->__ 679#define yypos yy->__pos 680#define yythunkpos yy->__thunkpos 681 yyprintf((stderr, "do yy_4_Sum\n")); 682 { 683 double r= math_eval_pop(yy->stack, &(yy->stackp)), l= math_eval_pop(yy->stack, &(yy->stackp)); math_eval_push((l < r || fabs(l - r) < 0.00000000000000001), yy->stack, &(yy->stackp)); ; 684 } 685#undef yythunkpos 686#undef yypos 687#undef yy 688} 689YY_ACTION(void) yy_3_Sum(yycontext *yy, char *yytext, int yyleng) 690{ 691#define __ yy->__ 692#define yypos yy->__pos 693#define yythunkpos yy->__thunkpos 694 yyprintf((stderr, "do yy_3_Sum\n")); 695 { 696 double r= math_eval_pop(yy->stack, &(yy->stackp)), l= math_eval_pop(yy->stack, &(yy->stackp)); math_eval_push(fabs(l - r) < 0.00000000000000001, yy->stack, &(yy->stackp)); ; 697 } 698#undef yythunkpos 699#undef yypos 700#undef yy 701} 702YY_ACTION(void) yy_2_Sum(yycontext *yy, char *yytext, int yyleng) 703{ 704#define __ yy->__ 705#define yypos yy->__pos 706#define yythunkpos yy->__thunkpos 707 yyprintf((stderr, "do yy_2_Sum\n")); 708 { 709 double r= math_eval_pop(yy->stack, &(yy->stackp)), l= math_eval_pop(yy->stack, &(yy->stackp)); math_eval_push(l - r, yy->stack, &(yy->stackp)); ; 710 } 711#undef yythunkpos 712#undef yypos 713#undef yy 714} 715YY_ACTION(void) yy_1_Sum(yycontext *yy, char *yytext, int yyleng) 716{ 717#define __ yy->__ 718#define yypos yy->__pos 719#define yythunkpos yy->__thunkpos 720 yyprintf((stderr, "do yy_1_Sum\n")); 721 { 722 double r= math_eval_pop(yy->stack, &(yy->stackp)), l= math_eval_pop(yy->stack, &(yy->stackp)); math_eval_push(l + r, yy->stack, &(yy->stackp)); ; 723 } 724#undef yythunkpos 725#undef yypos 726#undef yy 727} 728YY_ACTION(void) yy_2_Expr(yycontext *yy, char *yytext, int yyleng) 729{ 730#define __ yy->__ 731#define yypos yy->__pos 732#define yythunkpos yy->__thunkpos 733 yyprintf((stderr, "do yy_2_Expr\n")); 734 { 735 strcpy(yy->failure, "expression could not be parsed"); ; 736 } 737#undef yythunkpos 738#undef yypos 739#undef yy 740} 741YY_ACTION(void) yy_1_Expr(yycontext *yy, char *yytext, int yyleng) 742{ 743#define __ yy->__ 744#define yypos yy->__pos 745#define yythunkpos yy->__thunkpos 746 yyprintf((stderr, "do yy_1_Expr\n")); 747 { 748 yy->result = math_eval_pop(yy->stack, &(yy->stackp)); ; 749 } 750#undef yythunkpos 751#undef yypos 752#undef yy 753} 754 755YY_RULE(int) yy_Fname(yycontext *yy) 756{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 757 yyprintf((stderr, "%s\n", "Fname")); yyText(yy, yy->__begin, yy->__end); { 758#define yytext yy->__text 759#define yyleng yy->__textlen 760if (!(YY_BEGIN)) goto l1; 761#undef yytext 762#undef yyleng 763 } 764 { int yypos2= yy->__pos, yythunkpos2= yy->__thunkpos; if (!yymatchString(yy, "ceil")) goto l3; goto l2; 765 l3:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "floor")) goto l4; goto l2; 766 l4:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "log10")) goto l5; goto l2; 767 l5:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "log2")) goto l6; goto l2; 768 l6:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "log")) goto l7; goto l2; 769 l7:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "sqrt")) goto l8; goto l2; 770 l8:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "sin")) goto l9; goto l2; 771 l9:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "cos")) goto l10; goto l2; 772 l10:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "tan")) goto l11; goto l2; 773 l11:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "asin")) goto l12; goto l2; 774 l12:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "acos")) goto l13; goto l2; 775 l13:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "atan")) goto l14; goto l2; 776 l14:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "abs")) goto l15; goto l2; 777 l15:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchString(yy, "step")) goto l1; 778 } 779 l2:; yyText(yy, yy->__begin, yy->__end); { 780#define yytext yy->__text 781#define yyleng yy->__textlen 782if (!(YY_END)) goto l1; 783#undef yytext 784#undef yyleng 785 } yyDo(yy, yy_1_Fname, yy->__begin, yy->__end); 786 yyprintf((stderr, " ok %s @ %s\n", "Fname", yy->__buf+yy->__pos)); 787 return 1; 788 l1:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 789 yyprintf((stderr, " fail %s @ %s\n", "Fname", yy->__buf+yy->__pos)); 790 return 0; 791} 792YY_RULE(int) yy_CLOSE(yycontext *yy) 793{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 794 yyprintf((stderr, "%s\n", "CLOSE")); if (!yymatchChar(yy, ')')) goto l16; if (!yy_SPACE(yy)) goto l16; 795 yyprintf((stderr, " ok %s @ %s\n", "CLOSE", yy->__buf+yy->__pos)); 796 return 1; 797 l16:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 798 yyprintf((stderr, " fail %s @ %s\n", "CLOSE", yy->__buf+yy->__pos)); 799 return 0; 800} 801YY_RULE(int) yy_OPEN(yycontext *yy) 802{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 803 yyprintf((stderr, "%s\n", "OPEN")); if (!yymatchChar(yy, '(')) goto l17; if (!yy_SPACE(yy)) goto l17; 804 yyprintf((stderr, " ok %s @ %s\n", "OPEN", yy->__buf+yy->__pos)); 805 return 1; 806 l17:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 807 yyprintf((stderr, " fail %s @ %s\n", "OPEN", yy->__buf+yy->__pos)); 808 return 0; 809} 810YY_RULE(int) yy_Funcall(yycontext *yy) 811{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 812 yyprintf((stderr, "%s\n", "Funcall")); if (!yy_Fname(yy)) goto l18; if (!yy_OPEN(yy)) goto l18; if (!yy_Value(yy)) goto l18; if (!yy_CLOSE(yy)) goto l18; yyDo(yy, yy_1_Funcall, yy->__begin, yy->__end); 813 yyprintf((stderr, " ok %s @ %s\n", "Funcall", yy->__buf+yy->__pos)); 814 return 1; 815 l18:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 816 yyprintf((stderr, " fail %s @ %s\n", "Funcall", yy->__buf+yy->__pos)); 817 return 0; 818} 819YY_RULE(int) yy_Constant(yycontext *yy) 820{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 821 yyprintf((stderr, "%s\n", "Constant")); 822 { int yypos20= yy->__pos, yythunkpos20= yy->__thunkpos; if (!yymatchChar(yy, 'e')) goto l21; yyDo(yy, yy_1_Constant, yy->__begin, yy->__end); goto l20; 823 l21:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchString(yy, "log2e")) goto l22; yyDo(yy, yy_2_Constant, yy->__begin, yy->__end); goto l20; 824 l22:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchString(yy, "log10e")) goto l23; yyDo(yy, yy_3_Constant, yy->__begin, yy->__end); goto l20; 825 l23:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchString(yy, "ln2")) goto l24; yyDo(yy, yy_4_Constant, yy->__begin, yy->__end); goto l20; 826 l24:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchString(yy, "ln10")) goto l25; yyDo(yy, yy_5_Constant, yy->__begin, yy->__end); goto l20; 827 l25:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchString(yy, "pi")) goto l26; yyDo(yy, yy_6_Constant, yy->__begin, yy->__end); goto l20; 828 l26:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchString(yy, "pi_2")) goto l27; yyDo(yy, yy_7_Constant, yy->__begin, yy->__end); goto l20; 829 l27:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchString(yy, "pi_4")) goto l28; yyDo(yy, yy_8_Constant, yy->__begin, yy->__end); goto l20; 830 l28:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchString(yy, "1_pi")) goto l29; yyDo(yy, yy_9_Constant, yy->__begin, yy->__end); goto l20; 831 l29:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchString(yy, "2_pi")) goto l30; yyDo(yy, yy_10_Constant, yy->__begin, yy->__end); goto l20; 832 l30:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchString(yy, "2_sqrtpi")) goto l31; yyDo(yy, yy_11_Constant, yy->__begin, yy->__end); goto l20; 833 l31:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchString(yy, "sqrt2")) goto l32; yyDo(yy, yy_12_Constant, yy->__begin, yy->__end); goto l20; 834 l32:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchString(yy, "sqrt1_2")) goto l19; yyDo(yy, yy_13_Constant, yy->__begin, yy->__end); 835 } 836 l20:; 837 yyprintf((stderr, " ok %s @ %s\n", "Constant", yy->__buf+yy->__pos)); 838 return 1; 839 l19:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 840 yyprintf((stderr, " fail %s @ %s\n", "Constant", yy->__buf+yy->__pos)); 841 return 0; 842} 843YY_RULE(int) yy_SI_Unit(yycontext *yy) 844{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 845 yyprintf((stderr, "%s\n", "SI_Unit")); 846 { int yypos34= yy->__pos, yythunkpos34= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\000\000\000\010\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l35; if (!yy_SPACE(yy)) goto l35; yyDo(yy, yy_1_SI_Unit, yy->__begin, yy->__end); goto l34; 847 l35:; yy->__pos= yypos34; yy->__thunkpos= yythunkpos34; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\000\000\000\040\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l36; if (!yy_SPACE(yy)) goto l36; yyDo(yy, yy_2_SI_Unit, yy->__begin, yy->__end); goto l34; 848 l36:; yy->__pos= yypos34; yy->__thunkpos= yythunkpos34; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\000\000\200\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l37; if (!yy_SPACE(yy)) goto l37; yyDo(yy, yy_3_SI_Unit, yy->__begin, yy->__end); goto l34; 849 l37:; yy->__pos= yypos34; yy->__thunkpos= yythunkpos34; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\000\000\000\000\020\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l38; if (!yy_SPACE(yy)) goto l38; yyDo(yy, yy_4_SI_Unit, yy->__begin, yy->__end); goto l34; 850 l38:; yy->__pos= yypos34; yy->__thunkpos= yythunkpos34; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\000\000\000\000\001\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l33; if (!yy_SPACE(yy)) goto l33; yyDo(yy, yy_5_SI_Unit, yy->__begin, yy->__end); 851 } 852 l34:; 853 yyprintf((stderr, " ok %s @ %s\n", "SI_Unit", yy->__buf+yy->__pos)); 854 return 1; 855 l33:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 856 yyprintf((stderr, " fail %s @ %s\n", "SI_Unit", yy->__buf+yy->__pos)); 857 return 0; 858} 859YY_RULE(int) yy_F_NUMBER(yycontext *yy) 860{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 861 yyprintf((stderr, "%s\n", "F_NUMBER")); yyText(yy, yy->__begin, yy->__end); { 862#define yytext yy->__text 863#define yyleng yy->__textlen 864if (!(YY_BEGIN)) goto l39; 865#undef yytext 866#undef yyleng 867 } 868 { int yypos40= yy->__pos, yythunkpos40= yy->__thunkpos; 869 { int yypos42= yy->__pos, yythunkpos42= yy->__thunkpos; if (!yymatchChar(yy, '-')) goto l42; goto l43; 870 l42:; yy->__pos= yypos42; yy->__thunkpos= yythunkpos42; 871 } 872 l43:; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l41; 873 l44:; 874 { int yypos45= yy->__pos, yythunkpos45= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l45; goto l44; 875 l45:; yy->__pos= yypos45; yy->__thunkpos= yythunkpos45; 876 } 877 { int yypos46= yy->__pos, yythunkpos46= yy->__thunkpos; if (!yymatchChar(yy, '.')) goto l46; goto l47; 878 l46:; yy->__pos= yypos46; yy->__thunkpos= yythunkpos46; 879 } 880 l47:; 881 l48:; 882 { int yypos49= yy->__pos, yythunkpos49= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l49; goto l48; 883 l49:; yy->__pos= yypos49; yy->__thunkpos= yythunkpos49; 884 } goto l40; 885 l41:; yy->__pos= yypos40; yy->__thunkpos= yythunkpos40; 886 { int yypos50= yy->__pos, yythunkpos50= yy->__thunkpos; if (!yymatchChar(yy, '-')) goto l50; goto l51; 887 l50:; yy->__pos= yypos50; yy->__thunkpos= yythunkpos50; 888 } 889 l51:; if (!yymatchChar(yy, '.')) goto l39; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l39; 890 l52:; 891 { int yypos53= yy->__pos, yythunkpos53= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l53; goto l52; 892 l53:; yy->__pos= yypos53; yy->__thunkpos= yythunkpos53; 893 } 894 } 895 l40:; yyText(yy, yy->__begin, yy->__end); { 896#define yytext yy->__text 897#define yyleng yy->__textlen 898if (!(YY_END)) goto l39; 899#undef yytext 900#undef yyleng 901 } if (!yy_SPACE(yy)) goto l39; 902 yyprintf((stderr, " ok %s @ %s\n", "F_NUMBER", yy->__buf+yy->__pos)); 903 return 1; 904 l39:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 905 yyprintf((stderr, " fail %s @ %s\n", "F_NUMBER", yy->__buf+yy->__pos)); 906 return 0; 907} 908YY_RULE(int) yy_MOD(yycontext *yy) 909{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 910 yyprintf((stderr, "%s\n", "MOD")); if (!yymatchChar(yy, '%')) goto l54; if (!yy_SPACE(yy)) goto l54; 911 yyprintf((stderr, " ok %s @ %s\n", "MOD", yy->__buf+yy->__pos)); 912 return 1; 913 l54:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 914 yyprintf((stderr, " fail %s @ %s\n", "MOD", yy->__buf+yy->__pos)); 915 return 0; 916} 917YY_RULE(int) yy_DIVIDE(yycontext *yy) 918{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 919 yyprintf((stderr, "%s\n", "DIVIDE")); if (!yymatchChar(yy, '/')) goto l55; if (!yy_SPACE(yy)) goto l55; 920 yyprintf((stderr, " ok %s @ %s\n", "DIVIDE", yy->__buf+yy->__pos)); 921 return 1; 922 l55:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 923 yyprintf((stderr, " fail %s @ %s\n", "DIVIDE", yy->__buf+yy->__pos)); 924 return 0; 925} 926YY_RULE(int) yy_TIMES(yycontext *yy) 927{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 928 yyprintf((stderr, "%s\n", "TIMES")); if (!yymatchChar(yy, '*')) goto l56; if (!yy_SPACE(yy)) goto l56; 929 yyprintf((stderr, " ok %s @ %s\n", "TIMES", yy->__buf+yy->__pos)); 930 return 1; 931 l56:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 932 yyprintf((stderr, " fail %s @ %s\n", "TIMES", yy->__buf+yy->__pos)); 933 return 0; 934} 935YY_RULE(int) yy_POW(yycontext *yy) 936{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 937 yyprintf((stderr, "%s\n", "POW")); 938 { int yypos58= yy->__pos, yythunkpos58= yy->__thunkpos; if (!yymatchChar(yy, '^')) goto l59; if (!yy_SPACE(yy)) goto l59; goto l58; 939 l59:; yy->__pos= yypos58; yy->__thunkpos= yythunkpos58; if (!yymatchString(yy, "**")) goto l57; if (!yy_SPACE(yy)) goto l57; 940 } 941 l58:; 942 yyprintf((stderr, " ok %s @ %s\n", "POW", yy->__buf+yy->__pos)); 943 return 1; 944 l57:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 945 yyprintf((stderr, " fail %s @ %s\n", "POW", yy->__buf+yy->__pos)); 946 return 0; 947} 948YY_RULE(int) yy_Value(yycontext *yy) 949{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 950 yyprintf((stderr, "%s\n", "Value")); 951 { int yypos61= yy->__pos, yythunkpos61= yy->__thunkpos; if (!yy_F_NUMBER(yy)) goto l62; if (!yy_SI_Unit(yy)) goto l62; yyDo(yy, yy_1_Value, yy->__begin, yy->__end); goto l61; 952 l62:; yy->__pos= yypos61; yy->__thunkpos= yythunkpos61; if (!yy_F_NUMBER(yy)) goto l63; yyDo(yy, yy_2_Value, yy->__begin, yy->__end); goto l61; 953 l63:; yy->__pos= yypos61; yy->__thunkpos= yythunkpos61; if (!yy_Constant(yy)) goto l64; goto l61; 954 l64:; yy->__pos= yypos61; yy->__thunkpos= yythunkpos61; if (!yy_Funcall(yy)) goto l65; goto l61; 955 l65:; yy->__pos= yypos61; yy->__thunkpos= yythunkpos61; if (!yy_OPEN(yy)) goto l60; if (!yy_Sum(yy)) goto l60; if (!yy_CLOSE(yy)) goto l60; 956 } 957 l61:; 958 yyprintf((stderr, " ok %s @ %s\n", "Value", yy->__buf+yy->__pos)); 959 return 1; 960 l60:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 961 yyprintf((stderr, " fail %s @ %s\n", "Value", yy->__buf+yy->__pos)); 962 return 0; 963} 964YY_RULE(int) yy_GREATER_THAN(yycontext *yy) 965{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 966 yyprintf((stderr, "%s\n", "GREATER_THAN")); if (!yymatchChar(yy, '>')) goto l66; if (!yy_SPACE(yy)) goto l66; 967 yyprintf((stderr, " ok %s @ %s\n", "GREATER_THAN", yy->__buf+yy->__pos)); 968 return 1; 969 l66:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 970 yyprintf((stderr, " fail %s @ %s\n", "GREATER_THAN", yy->__buf+yy->__pos)); 971 return 0; 972} 973YY_RULE(int) yy_GREATEREQ_THAN(yycontext *yy) 974{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 975 yyprintf((stderr, "%s\n", "GREATEREQ_THAN")); if (!yymatchString(yy, ">=")) goto l67; if (!yy_SPACE(yy)) goto l67; 976 yyprintf((stderr, " ok %s @ %s\n", "GREATEREQ_THAN", yy->__buf+yy->__pos)); 977 return 1; 978 l67:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 979 yyprintf((stderr, " fail %s @ %s\n", "GREATEREQ_THAN", yy->__buf+yy->__pos)); 980 return 0; 981} 982YY_RULE(int) yy_LESS_THAN(yycontext *yy) 983{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 984 yyprintf((stderr, "%s\n", "LESS_THAN")); if (!yymatchChar(yy, '<')) goto l68; if (!yy_SPACE(yy)) goto l68; 985 yyprintf((stderr, " ok %s @ %s\n", "LESS_THAN", yy->__buf+yy->__pos)); 986 return 1; 987 l68:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 988 yyprintf((stderr, " fail %s @ %s\n", "LESS_THAN", yy->__buf+yy->__pos)); 989 return 0; 990} 991YY_RULE(int) yy_LESSEQ_THAN(yycontext *yy) 992{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 993 yyprintf((stderr, "%s\n", "LESSEQ_THAN")); if (!yymatchString(yy, "<=")) goto l69; if (!yy_SPACE(yy)) goto l69; 994 yyprintf((stderr, " ok %s @ %s\n", "LESSEQ_THAN", yy->__buf+yy->__pos)); 995 return 1; 996 l69:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 997 yyprintf((stderr, " fail %s @ %s\n", "LESSEQ_THAN", yy->__buf+yy->__pos)); 998 return 0; 999} 1000YY_RULE(int) yy_CLOSE_ENOUGH(yycontext *yy) 1001{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 1002 yyprintf((stderr, "%s\n", "CLOSE_ENOUGH")); if (!yymatchString(yy, "==")) goto l70; if (!yy_SPACE(yy)) goto l70; 1003 yyprintf((stderr, " ok %s @ %s\n", "CLOSE_ENOUGH", yy->__buf+yy->__pos)); 1004 return 1; 1005 l70:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 1006 yyprintf((stderr, " fail %s @ %s\n", "CLOSE_ENOUGH", yy->__buf+yy->__pos)); 1007 return 0; 1008} 1009YY_RULE(int) yy_MINUS(yycontext *yy) 1010{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 1011 yyprintf((stderr, "%s\n", "MINUS")); if (!yymatchChar(yy, '-')) goto l71; if (!yy_SPACE(yy)) goto l71; 1012 yyprintf((stderr, " ok %s @ %s\n", "MINUS", yy->__buf+yy->__pos)); 1013 return 1; 1014 l71:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 1015 yyprintf((stderr, " fail %s @ %s\n", "MINUS", yy->__buf+yy->__pos)); 1016 return 0; 1017} 1018YY_RULE(int) yy_PLUS(yycontext *yy) 1019{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 1020 yyprintf((stderr, "%s\n", "PLUS")); if (!yymatchChar(yy, '+')) goto l72; if (!yy_SPACE(yy)) goto l72; 1021 yyprintf((stderr, " ok %s @ %s\n", "PLUS", yy->__buf+yy->__pos)); 1022 return 1; 1023 l72:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 1024 yyprintf((stderr, " fail %s @ %s\n", "PLUS", yy->__buf+yy->__pos)); 1025 return 0; 1026} 1027YY_RULE(int) yy_Product(yycontext *yy) 1028{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 1029 yyprintf((stderr, "%s\n", "Product")); if (!yy_Value(yy)) goto l73; 1030 l74:; 1031 { int yypos75= yy->__pos, yythunkpos75= yy->__thunkpos; 1032 { int yypos76= yy->__pos, yythunkpos76= yy->__thunkpos; if (!yy_POW(yy)) goto l77; if (!yy_Value(yy)) goto l77; yyDo(yy, yy_1_Product, yy->__begin, yy->__end); goto l76; 1033 l77:; yy->__pos= yypos76; yy->__thunkpos= yythunkpos76; if (!yy_TIMES(yy)) goto l78; if (!yy_Value(yy)) goto l78; yyDo(yy, yy_2_Product, yy->__begin, yy->__end); goto l76; 1034 l78:; yy->__pos= yypos76; yy->__thunkpos= yythunkpos76; if (!yy_DIVIDE(yy)) goto l79; if (!yy_Value(yy)) goto l79; yyDo(yy, yy_3_Product, yy->__begin, yy->__end); goto l76; 1035 l79:; yy->__pos= yypos76; yy->__thunkpos= yythunkpos76; if (!yy_MOD(yy)) goto l75; if (!yy_Value(yy)) goto l75; yyDo(yy, yy_4_Product, yy->__begin, yy->__end); 1036 } 1037 l76:; goto l74; 1038 l75:; yy->__pos= yypos75; yy->__thunkpos= yythunkpos75; 1039 } 1040 yyprintf((stderr, " ok %s @ %s\n", "Product", yy->__buf+yy->__pos)); 1041 return 1; 1042 l73:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 1043 yyprintf((stderr, " fail %s @ %s\n", "Product", yy->__buf+yy->__pos)); 1044 return 0; 1045} 1046YY_RULE(int) yy_Sum(yycontext *yy) 1047{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 1048 yyprintf((stderr, "%s\n", "Sum")); if (!yy_Product(yy)) goto l80; 1049 l81:; 1050 { int yypos82= yy->__pos, yythunkpos82= yy->__thunkpos; 1051 { int yypos83= yy->__pos, yythunkpos83= yy->__thunkpos; if (!yy_PLUS(yy)) goto l84; if (!yy_Product(yy)) goto l84; yyDo(yy, yy_1_Sum, yy->__begin, yy->__end); goto l83; 1052 l84:; yy->__pos= yypos83; yy->__thunkpos= yythunkpos83; if (!yy_MINUS(yy)) goto l85; if (!yy_Product(yy)) goto l85; yyDo(yy, yy_2_Sum, yy->__begin, yy->__end); goto l83; 1053 l85:; yy->__pos= yypos83; yy->__thunkpos= yythunkpos83; if (!yy_CLOSE_ENOUGH(yy)) goto l86; if (!yy_Product(yy)) goto l86; yyDo(yy, yy_3_Sum, yy->__begin, yy->__end); goto l83; 1054 l86:; yy->__pos= yypos83; yy->__thunkpos= yythunkpos83; if (!yy_LESSEQ_THAN(yy)) goto l87; if (!yy_Product(yy)) goto l87; yyDo(yy, yy_4_Sum, yy->__begin, yy->__end); goto l83; 1055 l87:; yy->__pos= yypos83; yy->__thunkpos= yythunkpos83; if (!yy_LESS_THAN(yy)) goto l88; if (!yy_Product(yy)) goto l88; yyDo(yy, yy_5_Sum, yy->__begin, yy->__end); goto l83; 1056 l88:; yy->__pos= yypos83; yy->__thunkpos= yythunkpos83; if (!yy_GREATEREQ_THAN(yy)) goto l89; if (!yy_Product(yy)) goto l89; yyDo(yy, yy_6_Sum, yy->__begin, yy->__end); goto l83; 1057 l89:; yy->__pos= yypos83; yy->__thunkpos= yythunkpos83; if (!yy_GREATER_THAN(yy)) goto l82; if (!yy_Product(yy)) goto l82; yyDo(yy, yy_7_Sum, yy->__begin, yy->__end); 1058 } 1059 l83:; goto l81; 1060 l82:; yy->__pos= yypos82; yy->__thunkpos= yythunkpos82; 1061 } 1062 yyprintf((stderr, " ok %s @ %s\n", "Sum", yy->__buf+yy->__pos)); 1063 return 1; 1064 l80:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 1065 yyprintf((stderr, " fail %s @ %s\n", "Sum", yy->__buf+yy->__pos)); 1066 return 0; 1067} 1068YY_RULE(int) yy_SPACE(yycontext *yy) 1069{ 1070 yyprintf((stderr, "%s\n", "SPACE")); 1071 l91:; 1072 { int yypos92= yy->__pos, yythunkpos92= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\002\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l92; goto l91; 1073 l92:; yy->__pos= yypos92; yy->__thunkpos= yythunkpos92; 1074 } 1075 yyprintf((stderr, " ok %s @ %s\n", "SPACE", yy->__buf+yy->__pos)); 1076 return 1; 1077} 1078YY_RULE(int) yy_Expr(yycontext *yy) 1079{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; 1080 yyprintf((stderr, "%s\n", "Expr")); 1081 { int yypos94= yy->__pos, yythunkpos94= yy->__thunkpos; if (!yy_SPACE(yy)) goto l95; if (!yy_Sum(yy)) goto l95; yyDo(yy, yy_1_Expr, yy->__begin, yy->__end); goto l94; 1082 l95:; yy->__pos= yypos94; yy->__thunkpos= yythunkpos94; if (!yymatchDot(yy)) goto l93; yyDo(yy, yy_2_Expr, yy->__begin, yy->__end); 1083 } 1084 l94:; 1085 yyprintf((stderr, " ok %s @ %s\n", "Expr", yy->__buf+yy->__pos)); 1086 return 1; 1087 l93:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; 1088 yyprintf((stderr, " fail %s @ %s\n", "Expr", yy->__buf+yy->__pos)); 1089 return 0; 1090} 1091 1092#ifndef YY_PART 1093 1094typedef int (*yyrule)(yycontext *yy); 1095 1096YY_PARSE(int) YYPARSEFROM(YY_CTX_PARAM_ yyrule yystart) 1097{ 1098 int yyok; 1099 if (!yyctx->__buflen) 1100 { 1101 yyctx->__buflen= YY_BUFFER_SIZE; 1102 yyctx->__buf= (char *)YY_MALLOC(yyctx, yyctx->__buflen); 1103 yyctx->__textlen= YY_BUFFER_SIZE; 1104 yyctx->__text= (char *)YY_MALLOC(yyctx, yyctx->__textlen); 1105 yyctx->__thunkslen= YY_STACK_SIZE; 1106 yyctx->__thunks= (yythunk *)YY_MALLOC(yyctx, sizeof(yythunk) * yyctx->__thunkslen); 1107 yyctx->__valslen= YY_STACK_SIZE; 1108 yyctx->__vals= (YYSTYPE *)YY_MALLOC(yyctx, sizeof(YYSTYPE) * yyctx->__valslen); 1109 yyctx->__begin= yyctx->__end= yyctx->__pos= yyctx->__limit= yyctx->__thunkpos= 0; 1110 } 1111 yyctx->__begin= yyctx->__end= yyctx->__pos; 1112 yyctx->__thunkpos= 0; 1113 yyctx->__val= yyctx->__vals; 1114 yyok= yystart(yyctx); 1115 if (yyok) yyDone(yyctx); 1116 yyCommit(yyctx); 1117 return yyok; 1118} 1119 1120YY_PARSE(int) YYPARSE(YY_CTX_PARAM) 1121{ 1122 return YYPARSEFROM(YY_CTX_ARG_ yy_Expr); 1123} 1124 1125YY_PARSE(yycontext *) YYRELEASE(yycontext *yyctx) 1126{ 1127 if (yyctx->__buflen) 1128 { 1129 yyctx->__buflen= 0; 1130 YY_FREE(yyctx, yyctx->__buf); 1131 YY_FREE(yyctx, yyctx->__text); 1132 YY_FREE(yyctx, yyctx->__thunks); 1133 YY_FREE(yyctx, yyctx->__vals); 1134 } 1135 return yyctx; 1136} 1137 1138#endif 1139