summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sotoudeh <matthewsot@outlook.com>2017-07-30 00:59:32 -0700
committerMatthew Sotoudeh <matthewsot@outlook.com>2017-07-30 00:59:32 -0700
commit173c79c5a11126240c3377493ee74386839bb05c (patch)
treefa830aba496debebd744b8fb0cfcfc129e31e1ab
parent59d92d38a3a575c59d9b001a7b9a05cf72a1a088 (diff)
fixed loops
-rw-r--r--editor/.editor.html.swobin0 -> 12288 bytes
-rw-r--r--interpreter/interpreter.js12
2 files changed, 10 insertions, 2 deletions
diff --git a/editor/.editor.html.swo b/editor/.editor.html.swo
new file mode 100644
index 0000000..44c9a44
--- /dev/null
+++ b/editor/.editor.html.swo
Binary files differ
diff --git a/interpreter/interpreter.js b/interpreter/interpreter.js
index 086fd0f..fe3daed 100644
--- a/interpreter/interpreter.js
+++ b/interpreter/interpreter.js
@@ -42,9 +42,17 @@ Yaepl.prototype.globalScope = {
"or": function (a, b) { return (a || b); },
"and": function (a, b) { return (a && b); },
"jump-bwd": function (b) {
- for (var i = b.targetIndex; i < this.fullText.length; i++) {
- this.interpretLine(this.fullText[i], function () {}, false);
+ var lines = this.fullText;
+ var yaepl = this;
+ function interpretLine(l) {
+ yaepl.interpretLine(lines[l], function () {
+ l++;
+ if (l < lines.length) {
+ interpretLine(l);
+ }
+ }, false);
}
+ interpretLine(b.targetIndex);
},
"jump-bwd-if": function (a, b) {
if (!a) return;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback