[Swift-commit] r2682 - in trunk: resources src/org/griphyn/vdl/engine

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Fri Mar 13 07:52:39 CDT 2009


Author: benc
Date: 2009-03-13 07:52:37 -0500 (Fri, 13 Mar 2009)
New Revision: 2682

Modified:
   trunk/resources/Karajan.stg
   trunk/src/org/griphyn/vdl/engine/Karajan.java
Log:
get rid of explicit and/or templates and use general binary operator template for these

Modified: trunk/resources/Karajan.stg
===================================================================
--- trunk/resources/Karajan.stg	2009-03-11 15:16:44 UTC (rev 2681)
+++ trunk/resources/Karajan.stg	2009-03-13 12:52:37 UTC (rev 2682)
@@ -407,7 +407,9 @@
   ">=":"vdlop:ge",
   ">":"vdlop:gt",
   "<":"vdlop:lt",
-  "==":"vdlop:eq"
+  "==":"vdlop:eq",
+  "&&":"vdlop:and",
+  "||":"vdlop:or"
 ]
 
 unaryNegation(exp, datatype) ::= <<
@@ -424,21 +426,6 @@
 </$operator.(op)$>
 >>
 
-
-and(left,right,datatype) ::= <<
-<vdlop:and>
-  $left$
-  $right$
-</vdlop:and>
->>
-
-or(left, right, datatype) ::= <<
-<vdlop:or>
-  $left$
-  $right$
-</vdlop:or>
->>
-
 not(exp, datatype) ::= <<
 <vdlop:not>
   $exp$

Modified: trunk/src/org/griphyn/vdl/engine/Karajan.java
===================================================================
--- trunk/src/org/griphyn/vdl/engine/Karajan.java	2009-03-11 15:16:44 UTC (rev 2681)
+++ trunk/src/org/griphyn/vdl/engine/Karajan.java	2009-03-13 12:52:37 UTC (rev 2682)
@@ -844,10 +844,11 @@
 		QName expressionQName = new QName(namespaceURI, localName);
 
 		if(expressionQName.equals(OR_EXPR))	{
-			StringTemplate st = template("or");
+			StringTemplate st = template("binaryop");
 			BinaryOperator o = (BinaryOperator)expression;
 			StringTemplate leftST = expressionToKarajan(o.getAbstractExpressionArray(0), scope);
 			StringTemplate rightST = expressionToKarajan(o.getAbstractExpressionArray(1), scope);
+			st.setAttribute("op","||");
 			st.setAttribute("left", leftST);
 			st.setAttribute("right", rightST);
 			if (datatype(leftST).equals("boolean") && datatype(rightST).equals("boolean"))
@@ -856,10 +857,11 @@
 				throw new CompilationException("Or operation can only be applied to parameters of type boolean.");
 			return st;
 		} else if (expressionQName.equals(AND_EXPR)) {
-			StringTemplate st = template("and");
+			StringTemplate st = template("binaryop");
 			BinaryOperator o = (BinaryOperator)expression;
 			StringTemplate leftST = expressionToKarajan(o.getAbstractExpressionArray(0), scope);
 			StringTemplate rightST = expressionToKarajan(o.getAbstractExpressionArray(1), scope);
+			st.setAttribute("op","&&");
 			st.setAttribute("left", leftST);
 			st.setAttribute("right", rightST);
 			if (datatype(leftST).equals("boolean") && datatype(rightST).equals("boolean"))




More information about the Swift-commit mailing list