cs & io: fix ~s formatting of keywords

This commit is contained in:
Matthew Flatt 2020-10-21 17:24:03 -06:00
parent 3ce134866b
commit d3ef0a0a35
3 changed files with 6 additions and 5 deletions

View File

@ -68,6 +68,7 @@
(ptest "'|;|" '|;|)
(ptest "'|`|" '|`|)
(ptest "'#:apple" '#:apple)
(ptest "'#:|apple pie|" '#:|apple pie|)
(ptest "'#%apple" '#%apple)
(ptest "\"apple\"" "apple")
(ptest "#\"apple\"" #"apple")

View File

@ -24340,9 +24340,7 @@
(if (1/print-boolean-long-form)
(if a_0 "#true" "#false")
(if a_0 "#t" "#f")))
(if (number? a_0)
(number->string a_0)
(if (keyword? a_0) (string-append "#:" (keyword->string a_0)) #f)))))
(if (number? a_0) (number->string a_0) #f))))
(define 1/format
(|#%name|
format
@ -24360,7 +24358,9 @@
(string-copy a_0)
(if (symbol? a_0)
(symbol->string a_0)
(general-format fmt_0 (list a_0)))))))
(if (keyword? a_0)
(string-append "#:" (keyword->string a_0))
(general-format fmt_0 (list a_0))))))))
(if (let ((or-part_0 (equal? fmt_0 "~s")))
(if or-part_0 or-part_0 (equal? fmt_0 "~S")))
(let ((or-part_0 (simple-format a_0)))

View File

@ -39,7 +39,6 @@
(if a "#true" "#false")
(if a "#t" "#f")))]
[(number? a) (number->string a)]
[(keyword? a) (string-append "#:" (keyword->string a))]
[else #f]))
(define format
@ -52,6 +51,7 @@
[(bytes? a) (bytes->string/utf-8 a #\?)]
[(string? a) (string-copy a)]
[(symbol? a) (symbol->string a)]
[(keyword? a) (string-append "#:" (keyword->string a))]
[else (general-format fmt (list a))]))]
[(or (equal? fmt "~s") (equal? fmt "~S"))
(or (simple-format a)