1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

read-print: Define forms for which \n, \t, etc. are not escaped.

Previously, the pretty-printer would unconditionally leave everything
but double-quotes and backslashes unescaped when rendering a string.
With this change, the previous behavior only applies to forms listed in
%NATURAL-WHITESPACE-STRING-FORMS.

* guix/read-print.scm (%natural-whitespace-string-forms): New variable.
(printed-string): New procedure.
(pretty-print-with-comments): Use it instead of 'escaped-string'.
* tests/read-print.scm: Add test.
This commit is contained in:
Ludovic Courtès
2022-09-01 22:08:12 +02:00
parent ac9a7f6be9
commit 82968362ea
2 changed files with 19 additions and 1 deletions

View File

@@ -186,6 +186,9 @@ expressions."
(lambda _
xyz))))")
(test-pretty-print "\
(string-append \"a\\tb\" \"\\n\")")
(test-pretty-print "\
(description \"abcdefghijkl
mnopqrstuvwxyz.\")"