[Gridflow-cvs] [svn] commit: r6340 - /trunk/src/expr.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Fri Sep 24 12:30:49 EDT 2010


Author: matju
Date: Fri Sep 24 12:30:38 2010
New Revision: 6340

Log:
semicolon support

Modified:
    trunk/src/expr.cxx

Modified: trunk/src/expr.cxx
==============================================================================
--- trunk/src/expr.cxx (original)
+++ trunk/src/expr.cxx Fri Sep 24 12:30:38 2010
@@ -59,6 +59,7 @@
 		toks.push_back(tok);
 	}
 	void add (const t_atom2 &a) {
+		if (a.a_type==A_SEMI) {noutlets_set(noutlets+1); return;}
 		if (a.a_type==A_OP1 && a.a_symbol==gensym("~")) {
 			code.push_back(-1);
 			code.push_back(t_atom2(A_OP,gensym("^")));
@@ -98,8 +99,8 @@
 				case A_CLOSE: case A_NULL: case A_SEMI: {
 					if (level && int(tok.a_type)!=A_CLOSE) RAISE("missing ')' %d times",level);
 					if (prevop.a_type!=A_NULL) add(prevop);
-					if (tok.a_type==A_SEMI) add(t_atom2(A_SEMI,0));
-					return;
+					if (tok.a_type==A_SEMI) {add(tok); parse(s,level);}
+					break;
 				}
 				default: {
 					string z=tok.to_s(), zt=atomtype_to_s(tok.a_type);
@@ -157,7 +158,9 @@
 			  }
 			}
 		}
-		if (stack.size()) out[0](stack.back()); else RAISE("no result");
+		for (int i=noutlets-1; i>=0; i--) {
+			if (stack.size()) {out[i](stack.back()); stack.pop_back();} else RAISE("no result");
+		}
 	}
 };
 \end class {install("#expr",1,1,CLASS_NOPARENS);}
@@ -165,7 +168,7 @@
 void startup_classes4 () {
 	#define PR1(SYM) priorities[t_atom2(A_OP1,gensym(#SYM))]
 	#define PR(SYM)  priorities[t_atom2(A_OP ,gensym(#SYM))]
-	PR1(-) = PR(==) = 3; // unary "==" is "!"
+	PR1(+) = PR1(-) = PR(~) = PR(==) = 3; // unary "==" is "!"
 	PR(*) = PR(/) = PR(%) = 5;
 	PR(+) = PR(-) = 6;
 	PR(<<) = PR(>>) = 7;



More information about the Gridflow-cvs mailing list