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