fix symbol prining with #\uFEFF characters
Since the reader now treats #\uFEFF as whitespace, adjust the printer to escape \uFEFFa. Thanks, Xsmith! Writing an actual #\uFEFF character seems bad, even escaped, but Racket's symbol syntax doesn't have a kind of escaping that uses different characters than the one to be represented. Closes #3486
This commit is contained in:
parent
6b7a184297
commit
128174594e
|
@ -67,6 +67,7 @@
|
||||||
(ptest "'||" '||)
|
(ptest "'||" '||)
|
||||||
(ptest "'|;|" '|;|)
|
(ptest "'|;|" '|;|)
|
||||||
(ptest "'|`|" '|`|)
|
(ptest "'|`|" '|`|)
|
||||||
|
(ptest "'|\uFEFF_|" (string->symbol "\uFEFF_"))
|
||||||
(ptest "'#:apple" '#:apple)
|
(ptest "'#:apple" '#:apple)
|
||||||
(ptest "'#:|apple pie|" '#:|apple pie|)
|
(ptest "'#:|apple pie|" '#:|apple pie|)
|
||||||
(ptest "'#:|.|" '#:|.|)
|
(ptest "'#:|.|" '#:|.|)
|
||||||
|
|
|
@ -659,7 +659,8 @@ const char *scheme_symbol_name_and_size(Scheme_Object *sym, uintptr_t *length, i
|
||||||
/* space is OK in type symbols */
|
/* space is OK in type symbols */
|
||||||
} else
|
} else
|
||||||
has_space = 1;
|
has_space = 1;
|
||||||
} else if (isSpecial(ch))
|
} else if (isSpecial(ch)
|
||||||
|
|| (ch == 0xFEFF)) /* BOM, treated as whitespace by the reader */
|
||||||
has_special = 1;
|
has_special = 1;
|
||||||
else if (ch == '|')
|
else if (ch == '|')
|
||||||
has_pipe = 1;
|
has_pipe = 1;
|
||||||
|
|
|
@ -20908,62 +20908,68 @@
|
||||||
(if or-part_11
|
(if or-part_11
|
||||||
or-part_11
|
or-part_11
|
||||||
(let ((or-part_12
|
(let ((or-part_12
|
||||||
|
(char=?
|
||||||
|
ch_0
|
||||||
|
'#\xfeff)))
|
||||||
|
(if or-part_12
|
||||||
|
or-part_12
|
||||||
|
(let ((or-part_13
|
||||||
(if (char=?
|
(if (char=?
|
||||||
ch_0
|
ch_0
|
||||||
'#\x7c)
|
'#\x7c)
|
||||||
(let ((or-part_12
|
(let ((or-part_13
|
||||||
(not
|
(not
|
||||||
config8_0)))
|
config8_0)))
|
||||||
(if or-part_12
|
(if or-part_13
|
||||||
or-part_12
|
or-part_13
|
||||||
(config-get
|
(config-get
|
||||||
config8_0
|
config8_0
|
||||||
1/read-accept-bar-quote)))
|
1/read-accept-bar-quote)))
|
||||||
#f)))
|
#f)))
|
||||||
(if or-part_12
|
(if or-part_13
|
||||||
or-part_12
|
or-part_13
|
||||||
(let ((or-part_13
|
(let ((or-part_14
|
||||||
(if for-type?9_0
|
(if for-type?9_0
|
||||||
(let ((or-part_13
|
(let ((or-part_14
|
||||||
(char=?
|
(char=?
|
||||||
ch_0
|
ch_0
|
||||||
'#\x3c)))
|
'#\x3c)))
|
||||||
(if or-part_13
|
(if or-part_14
|
||||||
or-part_13
|
or-part_14
|
||||||
(char=?
|
(char=?
|
||||||
ch_0
|
ch_0
|
||||||
'#\x3e)))
|
'#\x3e)))
|
||||||
#f)))
|
#f)))
|
||||||
(if or-part_13
|
|
||||||
or-part_13
|
|
||||||
(let ((or-part_14
|
|
||||||
(if (char-whitespace?
|
|
||||||
ch_0)
|
|
||||||
(let ((or-part_14
|
|
||||||
(not
|
|
||||||
for-type?9_0)))
|
|
||||||
(if or-part_14
|
(if or-part_14
|
||||||
or-part_14
|
or-part_14
|
||||||
|
(let ((or-part_15
|
||||||
|
(if (char-whitespace?
|
||||||
|
ch_0)
|
||||||
|
(let ((or-part_15
|
||||||
|
(not
|
||||||
|
for-type?9_0)))
|
||||||
|
(if or-part_15
|
||||||
|
or-part_15
|
||||||
(not
|
(not
|
||||||
(char=?
|
(char=?
|
||||||
ch_0
|
ch_0
|
||||||
'#\x20))))
|
'#\x20))))
|
||||||
#f)))
|
#f)))
|
||||||
(if or-part_14
|
(if or-part_15
|
||||||
or-part_14
|
or-part_15
|
||||||
(let ((or-part_15
|
(let ((or-part_16
|
||||||
(if (char=?
|
(if (char=?
|
||||||
ch_0
|
ch_0
|
||||||
'#\x23)
|
'#\x23)
|
||||||
(if (zero?
|
(if (zero?
|
||||||
i_0)
|
i_0)
|
||||||
(let ((or-part_15
|
(let ((or-part_16
|
||||||
(<
|
(<
|
||||||
(string-length
|
(string-length
|
||||||
str_0)
|
str_0)
|
||||||
2)))
|
2)))
|
||||||
(if or-part_15
|
(if or-part_16
|
||||||
or-part_15
|
or-part_16
|
||||||
(not
|
(not
|
||||||
(char=?
|
(char=?
|
||||||
(string-ref
|
(string-ref
|
||||||
|
@ -20972,9 +20978,9 @@
|
||||||
'#\x25))))
|
'#\x25))))
|
||||||
#f)
|
#f)
|
||||||
#f)))
|
#f)))
|
||||||
(if or-part_15
|
(if or-part_16
|
||||||
or-part_15
|
or-part_16
|
||||||
(let ((or-part_16
|
(let ((or-part_17
|
||||||
(if (char=?
|
(if (char=?
|
||||||
ch_0
|
ch_0
|
||||||
'#\x2e)
|
'#\x2e)
|
||||||
|
@ -20986,8 +20992,8 @@
|
||||||
1)
|
1)
|
||||||
#f)
|
#f)
|
||||||
#f)))
|
#f)))
|
||||||
(if or-part_16
|
(if or-part_17
|
||||||
or-part_16
|
or-part_17
|
||||||
(if (not
|
(if (not
|
||||||
case-sensitive?_0)
|
case-sensitive?_0)
|
||||||
(not
|
(not
|
||||||
|
@ -20995,7 +21001,7 @@
|
||||||
ch_0
|
ch_0
|
||||||
(char-foldcase
|
(char-foldcase
|
||||||
ch_0)))
|
ch_0)))
|
||||||
#f))))))))))))))))))))))))))))))))))))))))
|
#f))))))))))))))))))))))))))))))))))))))))))
|
||||||
(loop_0
|
(loop_0
|
||||||
(|#%name|
|
(|#%name|
|
||||||
loop
|
loop
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
(char=? ch #\,)
|
(char=? ch #\,)
|
||||||
(char=? ch #\;)
|
(char=? ch #\;)
|
||||||
(char=? ch #\`)
|
(char=? ch #\`)
|
||||||
|
(char=? ch #\uFEFF) ; BOM, treated as whitespace by the reader
|
||||||
(and (char=? ch #\|)
|
(and (char=? ch #\|)
|
||||||
(or (not config) (config-get config read-accept-bar-quote)))
|
(or (not config) (config-get config read-accept-bar-quote)))
|
||||||
(and for-type?
|
(and for-type?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user