|
@@ -351,10 +351,13 @@ class CodeBox {
|
|
case "o":
|
|
case "o":
|
|
output = String.fromCharCode(this.stacks[this.curr_stack].Pop());
|
|
output = String.fromCharCode(this.stacks[this.curr_stack].Pop());
|
|
break;
|
|
break;
|
|
- // Misc
|
|
|
|
|
|
+ // Code box manipulation
|
|
case "g":
|
|
case "g":
|
|
this.PushFromCodeBox();
|
|
this.PushFromCodeBox();
|
|
break;
|
|
break;
|
|
|
|
+ case "p":
|
|
|
|
+ this.PlaceIntoCodeBox();
|
|
|
|
+ break;
|
|
// End execution
|
|
// End execution
|
|
case ";":
|
|
case ";":
|
|
output = true;
|
|
output = true;
|
|
@@ -624,6 +627,28 @@ class CodeBox {
|
|
|
|
|
|
this.stacks[this.curr_stack].Push(valParsed);
|
|
this.stacks[this.curr_stack].Push(valParsed);
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Implement p
|
|
|
|
+ *
|
|
|
|
+ * Pops `y`, `x`, and `v` off of the stack, and then places the string
|
|
|
|
+ * representation of that value at `[x, y]` in the code box.
|
|
|
|
+ */
|
|
|
|
+ PlaceIntoCodeBox() {
|
|
|
|
+ const y = this.stacks[this.curr_stack].Pop();
|
|
|
|
+ const x = this.stacks[this.curr_stack].Pop();
|
|
|
|
+ const v = this.stacks[this.curr_stack].Pop();
|
|
|
|
+
|
|
|
|
+ while(y >= this.box.length) {
|
|
|
|
+ this.box.push([]);
|
|
|
|
+ }
|
|
|
|
+ while(x >= this.box[y].length) {
|
|
|
|
+ this.box[y].push(" ");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.EqualizeBoxWidth();
|
|
|
|
+
|
|
|
|
+ this.box[y][x] = String.fromCharCode(v);
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* Implement `
|
|
* Implement `
|