summaryrefslogtreecommitdiff
path: root/lib/js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/js')
-rw-r--r--lib/js/urweb.js24
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 00a9cc1d..2ebb13c5 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -211,8 +211,6 @@ function flattenLocal(s) {
// Dynamic tree management
-var trace = "";
-
function populate(node) {
var s = node.signal;
var oldSources = node.sources;
@@ -271,7 +269,7 @@ function sb(x,y) {
cons({n:"data", v:{c:".", r:{c:"v", n:0}, f:"data"}}, null))}}}};
}
function scur(s) {
- return exec(s).data;
+ return execF(s, null)._data;
}
function lastParent() {
@@ -566,7 +564,7 @@ function uul(getToken, getData) {
var l = uul(getToken, getData);
return {_1:d, _2:l};
} else
- throw ("Can't unmarshal list (" + tok + ")");
+ whine("Can't unmarshal list (" + tok + ")");
}
function strcmp(str1, str2) {
@@ -592,7 +590,7 @@ function getXHR(uri)
try {
return new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
- throw "Your browser doesn't seem to support AJAX.";
+ whine("Your browser doesn't seem to support AJAX.");
}
}
}
@@ -819,7 +817,7 @@ function lookup(env, n) {
}
}
- throw "Out-of-bounds Ur variable reference";
+ whine("Out-of-bounds Ur variable reference");
}
function execP(env, p, v) {
@@ -851,7 +849,7 @@ function execP(env, p, v) {
}
return env;
default:
- throw ("Unknown Ur pattern kind" + p.c);
+ whine("Unknown Ur pattern kind" + p.c);
}
}
@@ -881,7 +879,6 @@ function exec0(env, e) {
e = {c: "c", v: fr.f.apply(null, fr.args)};
stack = stack.next;
} else {
- trace += "" + fr.pos;
e = fr.a.data;
fr.a = fr.a.next;
}
@@ -892,7 +889,7 @@ function exec0(env, e) {
break;
case "a2":
if (fr.f == null)
- throw "Ur: applying null function";
+ whine("Ur: applying null function");
else if (fr.f.body) {
stack = cons({c: "<", env: env}, stack.next);
env = cons(v, fr.f.env);
@@ -942,10 +939,10 @@ function exec0(env, e) {
}
}
if (ps == null)
- throw "Match failure in Ur interpretation";
+ whine("Match failure in Ur interpretation");
break;
default:
- throw ("Unknown Ur continuation kind " + fr.c);
+ whine("Unknown Ur continuation kind " + fr.c);
}
break;
@@ -969,6 +966,7 @@ function exec0(env, e) {
else {
var args = [];
stack = cons({c: "f", f: e.f, args: args, pos: 0, a: e.a.next}, stack);
+ if (!e.a.data.c) alert("[2] fr.f = " + e.f + "; 0 = " + e.a.data);
e = e.a.data;
}
break;
@@ -981,7 +979,7 @@ function exec0(env, e) {
break;
case "r":
if (e.l == null)
- throw "Empty Ur record in interpretation";
+ whine("Empty Ur record in interpretation");
var fs = {};
stack = cons({c: "r", n: e.l.data.n, fs: fs, l: e.l.next}, stack);
e = e.l.data.v;
@@ -1010,7 +1008,7 @@ function exec0(env, e) {
e = e.body;
break;
default:
- throw ("Unknown Ur expression kind " + e.c);
+ whine("Unknown Ur expression kind " + e.c);
}
}
}