This commit is contained in:
Kartik K. Agaram 2021-06-21 22:02:47 -07:00
parent 6669133bcf
commit 74d6a4d382
3 changed files with 89 additions and 67 deletions

6
shell/infix.mu Normal file
View File

@ -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
}

View File

@ -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
}

View File

@ -1079,12 +1079,16 @@ fn test-run-preserves-trace-view-on-rerun {
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-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 => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre2-8"
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,6 +1102,10 @@ 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"
@ -1111,12 +1119,16 @@ fn test-run-preserves-trace-view-on-rerun {
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-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 => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre3-8"
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
@ -1134,10 +1146,14 @@ fn test-run-preserves-trace-view-on-rerun {
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-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, " 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-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"
}