[Gridflow-cvs] [svn] commit: r6565 - in /trunk: src/expr.cxx tests/#expr-test.pd

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Mon Feb 7 15:46:21 EST 2011


Author: matju
Date: Mon Feb  7 15:46:19 2011
New Revision: 6565

Log:
fixed more parsing bugs : f(x)+c

Modified:
    trunk/src/expr.cxx
    trunk/tests/#expr-test.pd

Modified: trunk/src/expr.cxx
==============================================================================
--- trunk/src/expr.cxx (original)
+++ trunk/src/expr.cxx Mon Feb  7 15:46:19 2011
@@ -126,13 +126,14 @@
 				int n = parse(2)+1;
 				if (n!=e) RAISE("wrong number of arguments for '%s': got %d instead of %d",o->s_name,n,e);
 				code.push_back(Atom(e==1?A_OP1:e==2?A_OP:e==3?A_IF:A_CANT,o));
+				goto infix;
 			  } break;
 			  case A_CLOSE: {
 				if (int(tok.a_type)==A_CLOSE && context!=1 && context!=2) RAISE("can't close a parenthesis at this point");
 				if (prevop.a_type!=A_NULL) add(prevop);
 			  } break;
 			  case A_NULL: case A_SEMI: {
-				if (context!=0) RAISE("unexpected end of expression");
+				if (context!=0) RAISE("unexpected end of expression: context=%d",context);
 				if (prevop.a_type!=A_NULL) add(prevop);
 				if (tok.a_type==A_SEMI) {add(tok); /*int elems=*/parse(0); /*post("A_SEMI: elems=%d",elems);*/}
 			  } break;

Modified: trunk/tests/#expr-test.pd
==============================================================================
--- trunk/tests/#expr-test.pd (original)
+++ trunk/tests/#expr-test.pd Mon Feb  7 15:46:19 2011
@@ -24,7 +24,6 @@
 #X floatatom 750 277 5 0 0 0 - - -;
 #X obj 750 314 display;
 #X obj 750 295 #expr log($f1*3);
-#X obj 748 354 #expr weight($f1);
 #X floatatom 748 336 5 0 0 0 - - -;
 #X obj 748 373 display;
 #X floatatom 649 278 5 0 0 0 - - -;
@@ -35,27 +34,22 @@
 #X floatatom 652 336 5 0 0 0 - - -;
 #X obj 652 373 display;
 #X obj 652 354 #expr rand($f1);
-#X obj 431 350 expr a+b*c;
-#X obj 431 333 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X floatatom 431 369 5 0 0 0 - - -;
-#X obj 544 418 v a;
-#X obj 569 418 v b;
-#X obj 595 418 v c;
-#X floatatom 595 400 5 0 0 0 - - -;
-#X floatatom 569 382 5 0 0 0 - - -;
-#X floatatom 544 364 5 0 0 0 - - -;
+#X obj 734 138 v a;
+#X obj 759 138 v b;
+#X obj 785 138 v c;
+#X floatatom 785 120 5 0 0 0 - - -;
+#X floatatom 759 102 5 0 0 0 - - -;
+#X floatatom 734 84 5 0 0 0 - - -;
 #X floatatom 871 392 5 0 0 0 - - -;
 #X floatatom 748 392 5 0 0 0 - - -;
 #X obj 748 429 display;
 #X obj 541 71 #expr 1 \, 2 \, 3 \; 4 \; 5 \, 6 \; 7 \, 8 \, 9;
 #X obj 748 410 #expr atan2($f1 \, $f2);
-#X obj 544 319 #expr 37 \; 42 \; 69;
-#X obj 544 300 loadbang;
-#X obj 527 300 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X obj 447 387 #expr a+b*c;
-#X floatatom 447 406 5 0 0 0 - - -;
+#X obj 734 39 #expr 37 \; 42 \; 69;
+#X obj 734 20 loadbang;
+#X obj 717 20 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
+-1;
+#X obj 159 489 #expr a+b*c;
 #X obj 541 31 #expr (1 \, 2);
 #X obj 656 462 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
 -1 -1;
@@ -118,98 +112,102 @@
 #X obj 159 468 is 765;
 #X obj 159 428 is 765;
 #X obj 159 409 #expr max(-567 \, 765);
-#X connect 0 0 75 0;
-#X connect 1 0 78 0;
-#X connect 2 0 76 0;
-#X connect 3 0 79 0;
-#X connect 4 0 80 0;
-#X connect 5 0 81 0;
-#X connect 6 0 87 0;
-#X connect 7 0 88 0;
-#X connect 8 0 89 0;
-#X connect 9 0 73 0;
-#X connect 10 0 77 0;
-#X connect 11 0 90 0;
-#X connect 12 0 82 0;
-#X connect 13 0 83 0;
-#X connect 14 0 84 0;
-#X connect 15 0 85 0;
-#X connect 16 0 86 0;
+#X obj 159 508 is 2935;
+#X obj 159 546 is 101;
+#X obj 748 354 #expr weight($f1);
+#X obj 159 527 #expr cos(0)+100;
+#X connect 0 0 70 0;
+#X connect 1 0 73 0;
+#X connect 2 0 71 0;
+#X connect 3 0 74 0;
+#X connect 4 0 75 0;
+#X connect 5 0 76 0;
+#X connect 6 0 82 0;
+#X connect 7 0 83 0;
+#X connect 8 0 84 0;
+#X connect 9 0 68 0;
+#X connect 10 0 72 0;
+#X connect 11 0 85 0;
+#X connect 12 0 77 0;
+#X connect 13 0 78 0;
+#X connect 14 0 79 0;
+#X connect 15 0 80 0;
+#X connect 16 0 81 0;
 #X connect 17 0 18 0;
 #X connect 17 1 18 0;
 #X connect 17 2 18 0;
 #X connect 17 3 18 0;
 #X connect 19 0 17 0;
-#X connect 20 0 94 0;
+#X connect 20 0 89 0;
 #X connect 21 0 23 0;
 #X connect 23 0 22 0;
-#X connect 24 0 26 0;
-#X connect 25 0 24 0;
-#X connect 27 0 29 0;
-#X connect 29 0 28 0;
-#X connect 30 0 96 0;
-#X connect 31 0 107 0;
-#X connect 32 0 34 0;
-#X connect 34 0 33 0;
-#X connect 35 0 37 0;
-#X connect 36 0 35 0;
-#X connect 36 0 52 0;
-#X connect 41 0 40 0;
-#X connect 42 0 39 0;
-#X connect 43 0 38 0;
-#X connect 44 0 48 1;
-#X connect 45 0 48 0;
-#X connect 48 0 46 0;
-#X connect 49 0 43 0;
-#X connect 49 1 42 0;
-#X connect 49 2 41 0;
-#X connect 50 0 49 0;
-#X connect 51 0 49 0;
-#X connect 52 0 53 0;
-#X connect 55 0 61 0;
-#X connect 58 0 59 0;
-#X connect 59 0 60 0;
-#X connect 61 0 56 0;
+#X connect 24 0 109 0;
+#X connect 26 0 28 0;
+#X connect 28 0 27 0;
+#X connect 29 0 91 0;
+#X connect 30 0 102 0;
+#X connect 31 0 33 0;
+#X connect 33 0 32 0;
+#X connect 37 0 36 0;
+#X connect 38 0 35 0;
+#X connect 39 0 34 0;
+#X connect 40 0 44 1;
+#X connect 41 0 44 0;
+#X connect 44 0 42 0;
+#X connect 45 0 39 0;
+#X connect 45 1 38 0;
+#X connect 45 2 37 0;
+#X connect 46 0 45 0;
+#X connect 47 0 45 0;
+#X connect 48 0 107 0;
+#X connect 50 0 56 0;
+#X connect 53 0 54 0;
+#X connect 54 0 55 0;
+#X connect 56 0 51 0;
+#X connect 57 0 56 0;
+#X connect 60 0 62 0;
 #X connect 62 0 61 0;
-#X connect 65 0 67 0;
-#X connect 67 0 66 0;
-#X connect 68 0 71 0;
-#X connect 71 0 69 0;
-#X connect 72 0 101 0;
-#X connect 73 0 0 0;
-#X connect 74 0 9 0;
-#X connect 75 0 2 0;
-#X connect 76 0 10 0;
-#X connect 77 0 1 0;
-#X connect 78 0 3 0;
-#X connect 79 0 4 0;
-#X connect 80 0 5 0;
-#X connect 81 0 12 0;
-#X connect 82 0 6 0;
-#X connect 83 0 14 0;
-#X connect 84 0 91 0;
-#X connect 85 0 16 0;
-#X connect 86 0 103 0;
-#X connect 87 0 7 0;
-#X connect 88 0 8 0;
-#X connect 89 0 11 0;
-#X connect 90 0 13 0;
-#X connect 92 0 15 0;
-#X connect 93 0 97 0;
-#X connect 94 0 95 0;
-#X connect 95 0 30 0;
-#X connect 96 0 100 0;
-#X connect 97 0 20 0;
-#X connect 97 1 20 1;
-#X connect 97 2 20 2;
-#X connect 97 3 20 3;
-#X connect 97 4 20 4;
-#X connect 100 0 72 0;
-#X connect 101 0 106 0;
+#X connect 63 0 66 0;
+#X connect 66 0 64 0;
+#X connect 67 0 96 0;
+#X connect 68 0 0 0;
+#X connect 69 0 9 0;
+#X connect 70 0 2 0;
+#X connect 71 0 10 0;
+#X connect 72 0 1 0;
+#X connect 73 0 3 0;
+#X connect 74 0 4 0;
+#X connect 75 0 5 0;
+#X connect 76 0 12 0;
+#X connect 77 0 6 0;
+#X connect 78 0 14 0;
+#X connect 79 0 86 0;
+#X connect 80 0 16 0;
+#X connect 81 0 98 0;
+#X connect 82 0 7 0;
+#X connect 83 0 8 0;
+#X connect 84 0 11 0;
+#X connect 85 0 13 0;
+#X connect 87 0 15 0;
+#X connect 88 0 92 0;
+#X connect 89 0 90 0;
+#X connect 90 0 29 0;
+#X connect 91 0 95 0;
+#X connect 92 0 20 0;
+#X connect 92 1 20 1;
+#X connect 92 2 20 2;
+#X connect 92 3 20 3;
+#X connect 92 4 20 4;
+#X connect 95 0 67 0;
+#X connect 96 0 101 0;
+#X connect 98 0 99 0;
+#X connect 99 0 88 0;
+#X connect 101 0 30 0;
+#X connect 102 0 106 0;
 #X connect 103 0 104 0;
-#X connect 104 0 93 0;
-#X connect 106 0 31 0;
-#X connect 107 0 111 0;
-#X connect 108 0 109 0;
+#X connect 104 0 48 0;
+#X connect 105 0 103 0;
+#X connect 106 0 105 0;
+#X connect 107 0 110 0;
+#X connect 109 0 25 0;
 #X connect 110 0 108 0;
-#X connect 111 0 110 0;



More information about the Gridflow-cvs mailing list