diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-01-29 11:51:42 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-01-29 11:54:30 -0800 |
commit | 63b19862f0d665d41679ff4630541054e21fd556 (patch) | |
tree | 8fa7ac07a72b4dc2731bd74028882372c815d5b8 | |
parent | a1426be5a64e2aebd110512505c210b7a3f3415a (diff) | |
download | mu-63b19862f0d665d41679ff4630541054e21fd556.tar.gz |
674 - eliminate the other label
Jumps forward are harder than jumps back. You can't create a continuation until you get to it. And we don't have a way to return things from a continuation yet. That's a flaw. Maybe we need a 'reply-from' operator. But for now, this small bit of code we can just inline and duplicate.
-rw-r--r-- | color-repl.mu | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/color-repl.mu b/color-repl.mu index caf3f8eb..fa2b3df1 100644 --- a/color-repl.mu +++ b/color-repl.mu @@ -112,7 +112,8 @@ (break-if end-sexp?:boolean) (continue-from next-key:continuation) } - (jump end:offset) + (s:string-address <- get result:buffer-address/deref data:offset) + (reply s:string-address) } ;? (print-primitive-to-host 7:literal) ;? 1 ; if it's not whitespace, set not-empty? and continue @@ -169,8 +170,12 @@ ($print-key-to-host c:character) (at-top-level?:boolean <- lesser-or-equal open-parens:integer 0:literal) (end-sexp?:boolean <- and at-top-level?:boolean not-empty?:boolean) - (jump-if end-sexp?:boolean end:offset) - (continue-from next-key:continuation) + { begin + (break-if end-sexp?:boolean) + (continue-from next-key:continuation) + } + (s:string-address <- get result:buffer-address/deref data:offset) + (reply s:string-address) } ;? (print-primitive-to-host 12:literal) ;? 1 ; if all else fails, print the character without color @@ -181,7 +186,6 @@ ; todo: don't return if there's no non-whitespace in result (continue-from next-key:continuation) } - end (s:string-address <- get result:buffer-address/deref data:offset) (reply s:string-address) ]) |