fix eval bug
authorcrawshaw <crawshaw@ibex.org>
Thu, 25 Nov 2004 17:09:24 +0000 (17:09 +0000)
committercrawshaw <crawshaw@ibex.org>
Thu, 25 Nov 2004 17:09:24 +0000 (17:09 +0000)
darcs-hash:20041125170924-2eb37-7713192cbbd5e5fcc256bbe8c026858e2caaad4b.gz

src/java/org/ibex/xt/JSLeaf.java

index 63bffbd..048d475 100644 (file)
@@ -49,7 +49,7 @@ public class JSLeaf implements Tree.Leaf, Serializable {
         while ((exp = s.indexOf("${", pos)) >= 0) {
             ret.append(s.substring(pos, exp));
             pos = s.indexOf("}", exp);
-            Object app = exec("return (" + s.substring(exp + 2, pos) + ");");
+            Object app = exec("return (" + s.substring(exp + 2, pos) + ");\n");
             pos++;
 
             if (!(app == null || app instanceof String ||
@@ -73,9 +73,10 @@ public class JSLeaf implements Tree.Leaf, Serializable {
             pos = s.indexOf("}", exp);
             ret.append("return (");
             ret.append(s.substring(exp + 2, pos));
-            ret.append(");");
+            ret.append(");\n");
             pos++;
         }
+        if (pos < s.length()) ret.append(s.substring(pos));
 
         Reader r = new StringReader(ret.toString());
         try {