2023-03-06 17:06:01 +01:00
|
|
|
|
|
|
|
func main { mega | with args ;
|
2023-03-06 17:09:01 +01:00
|
|
|
"Welcome to the SPL REPL!" println
|
|
|
|
"Enter any code after the cursor to execute it.\n" println
|
|
|
|
|
2023-03-06 17:06:01 +01:00
|
|
|
"REPL" =program-name
|
|
|
|
while { 1 } {
|
|
|
|
catch {
|
|
|
|
" > " print readln dyn-read exec2 "\n" print
|
|
|
|
}
|
2024-08-29 09:36:53 +02:00
|
|
|
{ with err ;
|
2023-03-06 17:06:01 +01:00
|
|
|
err:message dup null eq if {
|
|
|
|
pop
|
|
|
|
"Uncaught error."
|
|
|
|
} err:trace
|
|
|
|
|
|
|
|
with msg trace ;
|
|
|
|
program-name dup if {
|
|
|
|
program-name print " panicked at:" println
|
|
|
|
} not if {
|
|
|
|
"Program panicked at:" println
|
|
|
|
}
|
|
|
|
&println trace:foreach
|
|
|
|
"\nPanic message:" println
|
|
|
|
" " print msg println
|
|
|
|
"\nRecovering." println
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|