From add0c3500e71df849ee7d3abf0e7670f742e8397 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 27 May 2015 22:28:28 -0700 Subject: 1495 --- repl.mu | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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 . + . . + ] +] -- cgit 1.4.1-2-gfad0