about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-27 22:28:28 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-27 22:32:11 -0700
commitadd0c3500e71df849ee7d3abf0e7670f742e8397 (patch)
tree964fa436954d07cfa1482287495ef62b910675ce
parent036ec49c606ab792f1705c024a176e47e1433488 (diff)
downloadmu-add0c3500e71df849ee7d3abf0e7670f742e8397.tar.gz
1495
-rw-r--r--repl.mu30
1 files changed, 30 insertions, 0 deletions
diff --git a/repl.mu b/repl.mu
index ddb7e6a2..bea5c643 100644
--- a/repl.mu
+++ b/repl.mu
@@ -166,6 +166,15 @@ recipe slurp-string [
       break-unless null?:boolean
       reply 0:literal, 0:literal, k:address:keyboard/same-as-ingredient:1, x:address:screen/same-as-ingredient:2
     }
+    # string
+    {
+      string?:boolean <- equal c:character, 91:literal/open-bracket
+      break-unless string?:boolean
+      print-character x:address:screen, c:character, 6:literal/cyan
+      result:address:buffer <- buffer-append result:address:buffer, c:character
+      result:address:buffer, tmp:number, k:address:keyboard, x:address:screen <- slurp-string result:address:buffer, k:address:keyboard, x:address:screen
+      loop +next-character:label
+    }
     # print
     print-character x:address:screen, c:character, 6:literal/cyan
     # append
@@ -405,3 +414,24 @@ scenario read-instruction-ignore-string-inside-comment [
     .                              .
   ]
 ]
+
+scenario read-instruction-color-string-inside-string [
+  assume-screen 30:literal/width, 5:literal/height
+  assume-keyboard [abc [string [inner string]]
+]
+  run [
+    read-instruction keyboard:address, screen:address
+  ]
+  screen-should-contain [
+    .abc [string [inner string]]   .
+    .                              .
+  ]
+  screen-should-contain-in-color 6:literal/cyan, [
+    .    [string [inner string]]   .
+    .                              .
+  ]
+  screen-should-contain-in-color 7:literal/white, [
+    .abc                           .
+    .                              .
+  ]
+]