about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--shell/print.mu14
1 files changed, 14 insertions, 0 deletions
diff --git a/shell/print.mu b/shell/print.mu
index ca3225d5..b1d0e158 100644
--- a/shell/print.mu
+++ b/shell/print.mu
@@ -153,6 +153,20 @@ fn print-number _in: (addr cell), out: (addr stream byte), trace: (addr trace) {
 }
 
 fn print-pair _in: (addr cell), out: (addr stream byte), trace: (addr trace) {
+  # if in starts with a quote, print the quote outside the expression
+  var in/esi: (addr cell) <- copy _in
+  var left-ah/eax: (addr handle cell) <- get in, left
+  var left/eax: (addr cell) <- lookup *left-ah
+  var is-quote?/eax: boolean <- symbol-equal? left, "'"
+  compare is-quote?, 0/false
+  {
+    break-if-=
+    write out, "'"
+    var right-ah/eax: (addr handle cell) <- get in, right
+    print-cell right-ah, out, trace
+    return
+  }
+  #
   var curr/esi: (addr cell) <- copy _in
   write out, "("
   $print-pair:loop: {