From 901efe360c151e128098154399960cbceb5174e1 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 30 Jan 2015 13:19:58 -0800 Subject: 683 --- color-repl.mu | 31 +++++++++++++++---------------- 1 file 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: 34 + { 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: 34 - { 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 -- cgit 1.4.1-2-gfad0