From ab39f129049016c06333ee13fe778d964050a7a4 Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann Date: Fri, 17 May 2019 10:55:22 +0200 Subject: [PATCH] Consider unterminated strings as read-error --- lib/scheme/extras.scm | 2 +- tests/r7rs-tests.scm | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/scheme/extras.scm b/lib/scheme/extras.scm index b717ade2..fbbf6cba 100644 --- a/lib/scheme/extras.scm +++ b/lib/scheme/extras.scm @@ -24,7 +24,7 @@ (else (lp (cdr files) (append (read-sexps (car files) #t) res)))))))) (define (read-error? x) - (and (error-object? x) (eq? 'read (exception-kind x)))) + (and (error-object? x) (memq (exception-kind x) '(read read-incomplete)) #t)) (define (file-error? x) (and (error-object? x) (eq? 'file (exception-kind x)))) diff --git a/tests/r7rs-tests.scm b/tests/r7rs-tests.scm index 998abcc4..49cb5086 100644 --- a/tests/r7rs-tests.scm +++ b/tests/r7rs-tests.scm @@ -1778,6 +1778,8 @@ (read-error? (guard (exn (else exn)) (error "BOOM!")))) (test #t (read-error? (guard (exn (else exn)) (read (open-input-string ")"))))) +(test #t + (read-error? (guard (exn (else exn)) (read (open-input-string "\""))))) (define something-went-wrong #f) (define (test-exception-handler-1 v)