aboutsummaryrefslogtreecommitdiff
path: root/chunk.d
diff options
context:
space:
mode:
authormryouse2023-06-01 22:47:43 -0400
committermryouse2023-06-01 22:47:43 -0400
commitb66702e49ab7f90a348bb2bea015fd5901c457d8 (patch)
treed87ed09ea6446f50964bf23bf5b810638ad3efc4 /chunk.d
parentaf07e3fba55ef98aabd54057c6e3433734b81111 (diff)
add print (no escape sequences) and REPL returns
Diffstat (limited to 'chunk.d')
-rw-r--r--chunk.d7
1 files changed, 6 insertions, 1 deletions
diff --git a/chunk.d b/chunk.d
index 47a2d7e..55772dc 100644
--- a/chunk.d
+++ b/chunk.d
@@ -160,7 +160,11 @@ class List : Seq {
if (this.inner.length == 0) {
return "nil";
} else {
- return format("list ('%s' + %d)", printableValue(this.inner[0]), this.inner.length - 1);
+ string[] ret;
+ foreach (Value val ; this.inner) {
+ ret ~= printableValue(val);
+ }
+ return format("(%s)", join(ret, " "));
}
}
}
@@ -219,6 +223,7 @@ enum OpCode {
// RANDOM
OP_NIL,
+ OP_PRINT,
// FUNCTIONS
OP_CALL,