Make the REPL read multi-line forms and render real error messages
The REPL evaluated one line at a time, so a form split across lines (e.g. `(+` then `1 2)`) raised instead of waiting. The read loop now accumulates lines until delimiters are balanced — skipping string, char, regex and comment context — printing a `... ` continuation prompt for each extra line. Reader/runtime errors rendered as Chez's "attempt to apply non-procedure #[chez-pmap...]" instead of their real message. Two causes: jolt-throw raised the thrown value raw. When a throw crossed the host `eval` boundary, Chez re-wrapped the non-condition into a compound condition whose message extraction applies the value, losing the message and crashing on ex-info's empty-map :data. jolt-throw now raises a &jolt-throw condition wrapping the value; catch (lowered to `guard`), jolt-report-uncaught and jolt-render-throwable unwrap it back via jolt-unwrap-throw, so ex-data/ex-message and the backtrace tag survive. Every reader/post-prelude EOF-throw site used `(empty-pmap)` (with parens), applying the empty-map value as a procedure and crashing during ex-info construction before jolt-throw ran. Fixed to `empty-pmap`. Re-minted the seed; smoke 23/23, unit 574/574.
This commit is contained in:
parent
a58bca3bee
commit
240458d994
10 changed files with 225 additions and 132 deletions
|
|
@ -35,8 +35,9 @@
|
|||
;; and exit non-zero, instead of Chez's opaque "non-condition value" dump. The
|
||||
;; message/ex-data/cause + a mapped Clojure backtrace come from the shared
|
||||
;; renderer (source-registry.ss); the cli adds the top-level source location.
|
||||
(define (jolt-report-uncaught v)
|
||||
(let ((port (current-error-port)))
|
||||
(define (jolt-report-uncaught raw)
|
||||
(let ((v (jolt-unwrap-throw raw))
|
||||
(port (current-error-port)))
|
||||
(jolt-render-throwable v port)
|
||||
;; The top-level form that was evaluating when this propagated (file:line:col).
|
||||
(let ((loc (jolt-current-source-string)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue