mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +02:00
Add R6RS backspace string escape
R6RS suggests that '\b' should be a string escape for the backspace character. * libguile/read.c (scm_read_string): parse backspace escape * test-suite/tests/strings.test (R6RS backslash escapes): new test (Guile extensions backslash escapes): remove R6RS escapes from test. * doc/ref/api-data.texi (Strings): document new string escape
This commit is contained in:
parent
15b6a6b284
commit
67a4a16d8e
3 changed files with 12 additions and 2 deletions
|
@ -2649,6 +2649,9 @@ Tab character (ASCII 9).
|
||||||
@item @nicode{\v}
|
@item @nicode{\v}
|
||||||
Vertical tab character (ASCII 11).
|
Vertical tab character (ASCII 11).
|
||||||
|
|
||||||
|
@item @nicode{\b}
|
||||||
|
Backspace character (ASCII 8).
|
||||||
|
|
||||||
@item @nicode{\xHH}
|
@item @nicode{\xHH}
|
||||||
Character code given by two hexadecimal digits. For example
|
Character code given by two hexadecimal digits. For example
|
||||||
@nicode{\x7f} for an ASCII DEL (127).
|
@nicode{\x7f} for an ASCII DEL (127).
|
||||||
|
|
|
@ -477,6 +477,9 @@ scm_read_string (int chr, SCM port)
|
||||||
case 'v':
|
case 'v':
|
||||||
c = '\v';
|
c = '\v';
|
||||||
break;
|
break;
|
||||||
|
case 'b':
|
||||||
|
c = '\010';
|
||||||
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
{
|
{
|
||||||
scm_t_wchar a, b;
|
scm_t_wchar a, b;
|
||||||
|
|
|
@ -221,9 +221,13 @@
|
||||||
(pass-if "R5RS backslash escapes"
|
(pass-if "R5RS backslash escapes"
|
||||||
(string=? "\"\\" (string #\" #\\)))
|
(string=? "\"\\" (string #\" #\\)))
|
||||||
|
|
||||||
|
(pass-if "R6RS backslash escapes"
|
||||||
|
(string=? "\a\b\t\n\v\f\r"
|
||||||
|
(string #\alarm #\backspace #\tab #\newline #\vtab
|
||||||
|
#\page #\return)))
|
||||||
|
|
||||||
(pass-if "Guile extensions backslash escapes"
|
(pass-if "Guile extensions backslash escapes"
|
||||||
(string=? "\0\a\f\n\r\t\v"
|
(string=? "\0" (string #\nul))))
|
||||||
(apply string (map integer->char '(0 7 12 10 13 9 11))))))
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; string?
|
;; string?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue