diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-01-30 13:19:58 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-01-30 13:19:58 -0800 |
commit | 901efe360c151e128098154399960cbceb5174e1 (patch) | |
tree | 46f3cedbc8149dbf0934689a68cba9c3623f1bda | |
parent | 526e9b70d72c1674d8ccd3dc042f04491188e69a (diff) | |
download | mu-901efe360c151e128098154399960cbceb5174e1.tar.gz |
683
-rw-r--r-- | color-repl.mu | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/color-repl.mu b/color-repl.mu index c5686484..a9770073 100644 --- a/color-repl.mu +++ b/color-repl.mu @@ -87,8 +87,22 @@ } (continue-from next-key:continuation) } + ; if it's a newline, decide whether to return + ; test: <enter>34<enter> + { begin + (newline?:boolean <- equal c:character ((#\newline literal))) + (break-unless newline?:boolean) + ($print-key-to-host c:character) + (at-top-level?:boolean <- lesser-or-equal open-parens:integer 0:literal) + (end-expression?:boolean <- and at-top-level?:boolean not-empty?:boolean) + { begin + (break-if end-expression?:boolean) + (continue-from next-key:continuation) + } + (reply nil:literal) ; wait for more keys + } ;? (print-primitive-to-host 4:literal) ;? 2 - ; not a backspace; save character + ; printable character; save ;? (print-primitive-to-host (("append\n" literal))) ;? 2 (result:buffer-address <- append result:buffer-address c:character) ;? (print-primitive-to-host (("done\n" literal))) ;? 2 @@ -175,21 +189,6 @@ (continue-from next-key:continuation) } ;? (print-primitive-to-host 11:literal) ;? 2 - ; if it's a newline, decide whether to return - ; test: <enter>34<enter> - { begin - (newline?:boolean <- equal c:character ((#\newline literal))) - (break-unless newline?:boolean) - ($print-key-to-host c:character) - (at-top-level?:boolean <- lesser-or-equal open-parens:integer 0:literal) - (end-expression?:boolean <- and at-top-level?:boolean not-empty?:boolean) - { begin - (break-if end-expression?:boolean) - (continue-from next-key:continuation) - } - (reply nil:literal) ; wait for more keys - } -;? (print-primitive-to-host 12:literal) ;? 2 ; if all else fails, print the character without color ($print-key-to-host c:character) ; todo: error on space outside parens, like python |