diff options
-rw-r--r-- | shell/infix.mu | 6 | ||||
-rw-r--r-- | shell/read.mu | 2 | ||||
-rw-r--r-- | shell/sandbox.mu | 148 |
3 files changed, 89 insertions, 67 deletions
diff --git a/shell/infix.mu b/shell/infix.mu new file mode 100644 index 00000000..0d23b3f4 --- /dev/null +++ b/shell/infix.mu @@ -0,0 +1,6 @@ +fn transform-infix _x-ah: (addr handle cell), trace: (addr trace) { + trace-text trace, "infix", "transform infix" + trace-lower trace + trace-text trace, "infix", "todo" + trace-higher trace +} diff --git a/shell/read.mu b/shell/read.mu index e5eea010..1066d215 100644 --- a/shell/read.mu +++ b/shell/read.mu @@ -19,6 +19,6 @@ fn read-cell in: (addr gap-buffer), out: (addr handle cell), trace: (addr trace) break-if-= return } - # TODO: transform infix parse-input parenthesized-tokens, out, trace + transform-infix out, trace } diff --git a/shell/sandbox.mu b/shell/sandbox.mu index d4926bff..5115eca2 100644 --- a/shell/sandbox.mu +++ b/shell/sandbox.mu @@ -1046,45 +1046,49 @@ fn test-run-preserves-trace-view-on-rerun { # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # skip one line of padding - check-screen-row screen, 1/y, " 7 ", "F - test-run-preserves-trace-view-on-rerun/pre0-0" - check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " | ", "F - test-run-preserves-trace-view-on-rerun/pre0-0/cursor" - check-screen-row screen, 2/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre0-1" - check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre0-1/cursor" - check-screen-row screen, 3/y, " => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre0-2" - check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre0-2/cursor" + check-screen-row screen, 1/y, " 7 ", "F - test-run-preserves-trace-view-on-rerun/pre0-0" + check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " | ", "F - test-run-preserves-trace-view-on-rerun/pre0-0/cursor" + check-screen-row screen, 2/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre0-1" + check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre0-1/cursor" + check-screen-row screen, 3/y, " => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre0-2" + check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre0-2/cursor" # move cursor into trace edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # - check-screen-row screen, 1/y, " 7 ", "F - test-run-preserves-trace-view-on-rerun/pre1-0" - check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre1-0/cursor" - check-screen-row screen, 2/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre1-1" - check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ||| ", "F - test-run-preserves-trace-view-on-rerun/pre1-1/cursor" - check-screen-row screen, 3/y, " => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre1-2" - check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre1-2/cursor" + check-screen-row screen, 1/y, " 7 ", "F - test-run-preserves-trace-view-on-rerun/pre1-0" + check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre1-0/cursor" + check-screen-row screen, 2/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre1-1" + check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ||| ", "F - test-run-preserves-trace-view-on-rerun/pre1-1/cursor" + check-screen-row screen, 3/y, " => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre1-2" + check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre1-2/cursor" # expand edit-sandbox sandbox, 0xa/newline, 0/no-globals, 0/no-disk clear-screen screen render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # - check-screen-row screen, 1/y, " 7 ", "F - test-run-preserves-trace-view-on-rerun/pre2-0" - check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-0/cursor" - check-screen-row screen, 2/y, " 1 tokenize ", "F - test-run-preserves-trace-view-on-rerun/pre2-1" - check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " |||||||||| ", "F - test-run-preserves-trace-view-on-rerun/pre2-1/cursor" - check-screen-row screen, 3/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre2-2" - check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-2/cursor" - check-screen-row screen, 4/y, " 1 insert parens ", "F - test-run-preserves-trace-view-on-rerun/pre2-3" - check-background-color-in-screen-row screen, 7/bg=cursor, 4/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-3/cursor" - check-screen-row screen, 5/y, " 1 parse ", "F - test-run-preserves-trace-view-on-rerun/pre2-4" - check-background-color-in-screen-row screen, 7/bg=cursor, 5/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-4/cursor" - check-screen-row screen, 6/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre2-5" - check-background-color-in-screen-row screen, 7/bg=cursor, 6/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-5/cursor" - check-screen-row screen, 7/y, " 1 macroexpand 7 ", "F - test-run-preserves-trace-view-on-rerun/pre2-6" - check-background-color-in-screen-row screen, 7/bg=cursor, 7/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-6/cursor" - check-screen-row screen, 8/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre2-7" - check-background-color-in-screen-row screen, 7/bg=cursor, 8/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-7/cursor" - check-screen-row screen, 9/y, " 1 => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre2-8" - check-background-color-in-screen-row screen, 7/bg=cursor, 9/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-8/cursor" + check-screen-row screen, 1/y, " 7 ", "F - test-run-preserves-trace-view-on-rerun/pre2-0" + check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-0/cursor" + check-screen-row screen, 2/y, " 1 tokenize ", "F - test-run-preserves-trace-view-on-rerun/pre2-1" + check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " |||||||||| ", "F - test-run-preserves-trace-view-on-rerun/pre2-1/cursor" + check-screen-row screen, 3/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre2-2" + check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-2/cursor" + check-screen-row screen, 4/y, " 1 insert parens ", "F - test-run-preserves-trace-view-on-rerun/pre2-3" + check-background-color-in-screen-row screen, 7/bg=cursor, 4/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-3/cursor" + check-screen-row screen, 5/y, " 1 parse ", "F - test-run-preserves-trace-view-on-rerun/pre2-4" + check-background-color-in-screen-row screen, 7/bg=cursor, 5/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-4/cursor" + check-screen-row screen, 6/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre2-5" + check-background-color-in-screen-row screen, 7/bg=cursor, 6/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-5/cursor" + check-screen-row screen, 7/y, " 1 transform infix ", "F - test-run-preserves-trace-view-on-rerun/pre2-6" + check-background-color-in-screen-row screen, 7/bg=cursor, 7/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-6/cursor" + check-screen-row screen, 8/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre2-7" + check-background-color-in-screen-row screen, 7/bg=cursor, 8/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-7/cursor" + check-screen-row screen, 9/y, " 1 macroexpand 7 ", "F - test-run-preserves-trace-view-on-rerun/pre2-8" + check-background-color-in-screen-row screen, 7/bg=cursor, 9/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-8/cursor" + check-screen-row screen, 0xa/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre2-9" + check-background-color-in-screen-row screen, 7/bg=cursor, 0xa/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-9/cursor" + check-screen-row screen, 0xb/y, " 1 => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre2-10" + check-background-color-in-screen-row screen, 7/bg=cursor, 0xb/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-10/cursor" # move cursor down below the macroexpand line and expand edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor @@ -1098,46 +1102,58 @@ fn test-run-preserves-trace-view-on-rerun { render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor + edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk + render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor + edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk + render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # - check-screen-row screen, 1/y, " 7 ", "F - test-run-preserves-trace-view-on-rerun/pre3-0" - check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-0/cursor" - check-screen-row screen, 2/y, " 1 tokenize ", "F - test-run-preserves-trace-view-on-rerun/pre3-1" - check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-1/cursor" - check-screen-row screen, 3/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre3-2" - check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-2/cursor" - check-screen-row screen, 4/y, " 1 insert parens ", "F - test-run-preserves-trace-view-on-rerun/pre3-3" - check-background-color-in-screen-row screen, 7/bg=cursor, 4/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-3/cursor" - check-screen-row screen, 5/y, " 1 parse ", "F - test-run-preserves-trace-view-on-rerun/pre3-4" - check-background-color-in-screen-row screen, 7/bg=cursor, 5/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-4/cursor" - check-screen-row screen, 6/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre3-5" - check-background-color-in-screen-row screen, 7/bg=cursor, 6/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-5/cursor" - check-screen-row screen, 7/y, " 1 macroexpand 7 ", "F - test-run-preserves-trace-view-on-rerun/pre3-6" - check-background-color-in-screen-row screen, 7/bg=cursor, 7/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-6/cursor" - check-screen-row screen, 8/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre3-7" - check-background-color-in-screen-row screen, 7/bg=cursor, 8/y, " ||| ", "F - test-run-preserves-trace-view-on-rerun/pre3-7/cursor" - check-screen-row screen, 9/y, " 1 => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre3-8" - check-background-color-in-screen-row screen, 7/bg=cursor, 9/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-8/cursor" + check-screen-row screen, 1/y, " 7 ", "F - test-run-preserves-trace-view-on-rerun/pre3-0" + check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-0/cursor" + check-screen-row screen, 2/y, " 1 tokenize ", "F - test-run-preserves-trace-view-on-rerun/pre3-1" + check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-1/cursor" + check-screen-row screen, 3/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre3-2" + check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-2/cursor" + check-screen-row screen, 4/y, " 1 insert parens ", "F - test-run-preserves-trace-view-on-rerun/pre3-3" + check-background-color-in-screen-row screen, 7/bg=cursor, 4/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-3/cursor" + check-screen-row screen, 5/y, " 1 parse ", "F - test-run-preserves-trace-view-on-rerun/pre3-4" + check-background-color-in-screen-row screen, 7/bg=cursor, 5/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-4/cursor" + check-screen-row screen, 6/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre3-5" + check-background-color-in-screen-row screen, 7/bg=cursor, 6/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-5/cursor" + check-screen-row screen, 7/y, " 1 transform infix ", "F - test-run-preserves-trace-view-on-rerun/pre3-6" + check-background-color-in-screen-row screen, 7/bg=cursor, 7/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-6/cursor" + check-screen-row screen, 8/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre3-7" + check-background-color-in-screen-row screen, 7/bg=cursor, 8/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-7/cursor" + check-screen-row screen, 9/y, " 1 macroexpand 7 ", "F - test-run-preserves-trace-view-on-rerun/pre3-8" + check-background-color-in-screen-row screen, 7/bg=cursor, 9/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-8/cursor" + check-screen-row screen, 0xa/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/pre3-9" + check-background-color-in-screen-row screen, 7/bg=cursor, 0xa/y, " ||| ", "F - test-run-preserves-trace-view-on-rerun/pre3-9/cursor" + check-screen-row screen, 0xb/y, " 1 => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre3-10" + check-background-color-in-screen-row screen, 7/bg=cursor, 0xb/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-10/cursor" # expand edit-sandbox sandbox, 0xa/newline, 0/no-globals, 0/no-disk clear-screen screen render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # cursor line is expanded - check-screen-row screen, 1/y, " 7 ", "F - test-run-preserves-trace-view-on-rerun/expand-0" - check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-0/cursor" - check-screen-row screen, 2/y, " 1 tokenize ", "F - test-run-preserves-trace-view-on-rerun/expand-1" - check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-1/cursor" - check-screen-row screen, 3/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/expand-2" - check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-2/cursor" - check-screen-row screen, 4/y, " 1 insert parens ", "F - test-run-preserves-trace-view-on-rerun/expand-3" - check-background-color-in-screen-row screen, 7/bg=cursor, 4/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-3/cursor" - check-screen-row screen, 5/y, " 1 parse ", "F - test-run-preserves-trace-view-on-rerun/expand-4" - check-background-color-in-screen-row screen, 7/bg=cursor, 5/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-4/cursor" - check-screen-row screen, 6/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/expand-5" - check-background-color-in-screen-row screen, 7/bg=cursor, 6/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-5/cursor" - check-screen-row screen, 7/y, " 1 macroexpand 7 ", "F - test-run-preserves-trace-view-on-rerun/expand-6" - check-background-color-in-screen-row screen, 7/bg=cursor, 7/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-6/cursor" - check-screen-row screen, 8/y, " 2 macroexpand-iter 7 ", "F - test-run-preserves-trace-view-on-rerun/expand-7" - check-background-color-in-screen-row screen, 7/bg=cursor, 8/y, " |||||||||||||||||||| ", "F - test-run-preserves-trace-view-on-rerun/expand-7/cursor" - check-screen-row screen, 9/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/expand-8" - check-background-color-in-screen-row screen, 7/bg=cursor, 9/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-8/cursor" + check-screen-row screen, 1/y, " 7 ", "F - test-run-preserves-trace-view-on-rerun/expand-0" + check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-0/cursor" + check-screen-row screen, 2/y, " 1 tokenize ", "F - test-run-preserves-trace-view-on-rerun/expand-1" + check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-1/cursor" + check-screen-row screen, 3/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/expand-2" + check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-2/cursor" + check-screen-row screen, 4/y, " 1 insert parens ", "F - test-run-preserves-trace-view-on-rerun/expand-3" + check-background-color-in-screen-row screen, 7/bg=cursor, 4/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-3/cursor" + check-screen-row screen, 5/y, " 1 parse ", "F - test-run-preserves-trace-view-on-rerun/expand-4" + check-background-color-in-screen-row screen, 7/bg=cursor, 5/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-4/cursor" + check-screen-row screen, 6/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/expand-5" + check-background-color-in-screen-row screen, 7/bg=cursor, 6/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-5/cursor" + check-screen-row screen, 7/y, " 1 transform infix ", "F - test-run-preserves-trace-view-on-rerun/expand-6" + check-background-color-in-screen-row screen, 7/bg=cursor, 7/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-6/cursor" + check-screen-row screen, 8/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/expand-7" + check-background-color-in-screen-row screen, 7/bg=cursor, 8/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-7/cursor" + check-screen-row screen, 9/y, " 1 macroexpand 7 ", "F - test-run-preserves-trace-view-on-rerun/expand-8" + check-background-color-in-screen-row screen, 7/bg=cursor, 9/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-8/cursor" + check-screen-row screen, 0xa/y, " 2 macroexpand-iter 7 ", "F - test-run-preserves-trace-view-on-rerun/expand-9" + check-background-color-in-screen-row screen, 7/bg=cursor, 0xa/y, " |||||||||||||||||||| ", "F - test-run-preserves-trace-view-on-rerun/expand-9/cursor" + check-screen-row screen, 0xb/y, " ... ", "F - test-run-preserves-trace-view-on-rerun/expand-10" + check-background-color-in-screen-row screen, 7/bg=cursor, 0xb/y, " ", "F - test-run-preserves-trace-view-on-rerun/expand-10/cursor" } |