mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
ice-9/read: Parse #{}}# properly.
This is a regression since Guile 3.0.2 and breaks compilation of a Guile library. * module/ice-9/read.scm (%read)[read-parenthesized]: When SAW-BRACE? is #t but CH isn't #\#, don't eat CH. * test-suite/tests/reader.test ("#{}#): Add four test cases.
This commit is contained in:
parent
d79a226359
commit
c78c130b1d
2 changed files with 10 additions and 2 deletions
|
@ -556,12 +556,15 @@
|
||||||
(string->symbol
|
(string->symbol
|
||||||
(list->string
|
(list->string
|
||||||
(let lp ((saw-brace? #f))
|
(let lp ((saw-brace? #f))
|
||||||
(let ((ch (next-not-eof)))
|
(let lp/inner ((ch (next-not-eof))
|
||||||
|
(saw-brace? saw-brace?))
|
||||||
(cond
|
(cond
|
||||||
(saw-brace?
|
(saw-brace?
|
||||||
(if (eqv? ch #\#)
|
(if (eqv? ch #\#)
|
||||||
'()
|
'()
|
||||||
(cons #\} (lp #f))))
|
;; Don't eat CH, see
|
||||||
|
;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49623>.
|
||||||
|
(cons #\} (lp/inner ch #f))))
|
||||||
((eqv? ch #\})
|
((eqv? ch #\})
|
||||||
(lp #t))
|
(lp #t))
|
||||||
((eqv? ch #\\)
|
((eqv? ch #\\)
|
||||||
|
|
|
@ -536,6 +536,11 @@
|
||||||
|
|
||||||
(with-test-prefix "#{}#"
|
(with-test-prefix "#{}#"
|
||||||
(pass-if (equal? (read-string "#{}#") '#{}#))
|
(pass-if (equal? (read-string "#{}#") '#{}#))
|
||||||
|
;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49623>
|
||||||
|
(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 (not (equal? (read-string "(a #{.}# b)") '(a . b))))
|
||||||
(pass-if (equal? (read-string "#{a}#") 'a))
|
(pass-if (equal? (read-string "#{a}#") 'a))
|
||||||
(pass-if (equal? (read-string "#{a b}#") '#{a b}#))
|
(pass-if (equal? (read-string "#{a b}#") '#{a b}#))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue