diff --git a/module/ice-9/read.scm b/module/ice-9/read.scm index ac407739f..283933064 100644 --- a/module/ice-9/read.scm +++ b/module/ice-9/read.scm @@ -556,12 +556,15 @@ (string->symbol (list->string (let lp ((saw-brace? #f)) - (let ((ch (next-not-eof))) + (let lp/inner ((ch (next-not-eof)) + (saw-brace? saw-brace?)) (cond (saw-brace? (if (eqv? ch #\#) '() - (cons #\} (lp #f)))) + ;; Don't eat CH, see + ;; . + (cons #\} (lp/inner ch #f)))) ((eqv? ch #\}) (lp #t)) ((eqv? ch #\\) diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test index 1481a0a5d..ad7c6d575 100644 --- a/test-suite/tests/reader.test +++ b/test-suite/tests/reader.test @@ -536,6 +536,11 @@ (with-test-prefix "#{}#" (pass-if (equal? (read-string "#{}#") '#{}#)) + ;; See + (pass-if (equal? (read-string "#{}}#") (string->symbol "}"))) + (pass-if (equal? (read-string "#{}}}#") (string->symbol "}}"))) + (pass-if (equal? (read-string "#{{}}#") (string->symbol "{}"))) + (pass-if (equal? (read-string "#{{}b}#") (string->symbol "{}b"))) (pass-if (not (equal? (read-string "(a #{.}# b)") '(a . b)))) (pass-if (equal? (read-string "#{a}#") 'a)) (pass-if (equal? (read-string "#{a b}#") '#{a b}#))