From b66702e49ab7f90a348bb2bea015fd5901c457d8 Mon Sep 17 00:00:00 2001 From: mryouse Date: Thu, 1 Jun 2023 22:47:43 -0400 Subject: add print (no escape sequences) and REPL returns --- chunk.d | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'chunk.d') 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, -- cgit v1.2.3