diff lib/js/urweb.js @ 905:7a4b026e45dd

Library improvements; proper list [un]urlification; remove server-side ServerCalls; eta reduction in type inference
author Adam Chlipala <adamc@hcoop.net>
date Sun, 09 Aug 2009 16:13:27 -0400
parents 63114a2e5075
children 771449d8b411
line wrap: on
line diff
--- a/lib/js/urweb.js	Thu Aug 06 15:23:04 2009 -0400
+++ b/lib/js/urweb.js	Sun Aug 09 16:13:27 2009 -0400
@@ -306,7 +306,7 @@
 
       var arr = dummy.getElementsByTagName("tbody");
       firstChild = null;
-      if (arr.length > 0) {
+      if (arr.length > 0 && table != null) {
         var tbody = arr[0], next;
         firstChild = document.createElement("script");
         table.insertBefore(firstChild, x);
@@ -323,7 +323,7 @@
 
       var arr = dummy.getElementsByTagName("tr");
       firstChild = null;
-      if (arr.length > 0) {
+      if (arr.length > 0 && table != null) {
         var tbody = arr[0], next;
         firstChild = document.createElement("script");
         table.insertBefore(firstChild, x);
@@ -468,7 +468,19 @@
 }
 
 function uu(s) {
-  return unescape(s);
+  return unescape(s.replace(new RegExp ("\\+", "g"), " "));
+}
+
+function uul(getToken, getData) {
+  var tok = getToken();
+  if (tok == "Nil") {
+    return null;
+  } else if (tok == "Cons") {
+    var d = getData();
+    var l = uul(getToken, getData);
+    return {_1:d, _2:l};
+  } else
+    throw ("Can't unmarshal list (" + tok + ")");
 }