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 "'|\uFEFF_|" (string->symbol "\uFEFF_"))
|
||||
(ptest "'#:apple" '#:apple)
|
||||
(ptest "'#:|apple pie|" '#:|apple pie|)
|
||||
(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 */
|
||||
} else
|
||||
has_space = 1;
|
||||
} else if (isSpecial(ch))
|
||||
} else if (isSpecial(ch)
|
||||
|| (ch == 0xFEFF)) /* BOM, treated as whitespace by the reader */
|
||||
has_special = 1;
|
||||
else if (ch == '|')
|
||||
has_pipe = 1;
|
||||
|
|
|
@ -20908,94 +20908,100 @@
|
|||
(if or-part_11
|
||||
or-part_11
|
||||
(let ((or-part_12
|
||||
(if (char=?
|
||||
ch_0
|
||||
'#\x7c)
|
||||
(let ((or-part_12
|
||||
(not
|
||||
config8_0)))
|
||||
(if or-part_12
|
||||
or-part_12
|
||||
(config-get
|
||||
config8_0
|
||||
1/read-accept-bar-quote)))
|
||||
#f)))
|
||||
(char=?
|
||||
ch_0
|
||||
'#\xfeff)))
|
||||
(if or-part_12
|
||||
or-part_12
|
||||
(let ((or-part_13
|
||||
(if for-type?9_0
|
||||
(if (char=?
|
||||
ch_0
|
||||
'#\x7c)
|
||||
(let ((or-part_13
|
||||
(char=?
|
||||
ch_0
|
||||
'#\x3c)))
|
||||
(not
|
||||
config8_0)))
|
||||
(if or-part_13
|
||||
or-part_13
|
||||
(char=?
|
||||
ch_0
|
||||
'#\x3e)))
|
||||
(config-get
|
||||
config8_0
|
||||
1/read-accept-bar-quote)))
|
||||
#f)))
|
||||
(if or-part_13
|
||||
or-part_13
|
||||
(let ((or-part_14
|
||||
(if (char-whitespace?
|
||||
ch_0)
|
||||
(if for-type?9_0
|
||||
(let ((or-part_14
|
||||
(not
|
||||
for-type?9_0)))
|
||||
(char=?
|
||||
ch_0
|
||||
'#\x3c)))
|
||||
(if or-part_14
|
||||
or-part_14
|
||||
(not
|
||||
(char=?
|
||||
ch_0
|
||||
'#\x20))))
|
||||
(char=?
|
||||
ch_0
|
||||
'#\x3e)))
|
||||
#f)))
|
||||
(if or-part_14
|
||||
or-part_14
|
||||
(let ((or-part_15
|
||||
(if (char=?
|
||||
ch_0
|
||||
'#\x23)
|
||||
(if (zero?
|
||||
i_0)
|
||||
(let ((or-part_15
|
||||
(<
|
||||
(string-length
|
||||
str_0)
|
||||
2)))
|
||||
(if or-part_15
|
||||
or-part_15
|
||||
(not
|
||||
(char=?
|
||||
(string-ref
|
||||
str_0
|
||||
1)
|
||||
'#\x25))))
|
||||
#f)
|
||||
(if (char-whitespace?
|
||||
ch_0)
|
||||
(let ((or-part_15
|
||||
(not
|
||||
for-type?9_0)))
|
||||
(if or-part_15
|
||||
or-part_15
|
||||
(not
|
||||
(char=?
|
||||
ch_0
|
||||
'#\x20))))
|
||||
#f)))
|
||||
(if or-part_15
|
||||
or-part_15
|
||||
(let ((or-part_16
|
||||
(if (char=?
|
||||
ch_0
|
||||
'#\x2e)
|
||||
'#\x23)
|
||||
(if (zero?
|
||||
i_0)
|
||||
(=
|
||||
(string-length
|
||||
str_0)
|
||||
1)
|
||||
(let ((or-part_16
|
||||
(<
|
||||
(string-length
|
||||
str_0)
|
||||
2)))
|
||||
(if or-part_16
|
||||
or-part_16
|
||||
(not
|
||||
(char=?
|
||||
(string-ref
|
||||
str_0
|
||||
1)
|
||||
'#\x25))))
|
||||
#f)
|
||||
#f)))
|
||||
(if or-part_16
|
||||
or-part_16
|
||||
(if (not
|
||||
case-sensitive?_0)
|
||||
(not
|
||||
(char=?
|
||||
ch_0
|
||||
(char-foldcase
|
||||
ch_0)))
|
||||
#f))))))))))))))))))))))))))))))))))))))))
|
||||
(let ((or-part_17
|
||||
(if (char=?
|
||||
ch_0
|
||||
'#\x2e)
|
||||
(if (zero?
|
||||
i_0)
|
||||
(=
|
||||
(string-length
|
||||
str_0)
|
||||
1)
|
||||
#f)
|
||||
#f)))
|
||||
(if or-part_17
|
||||
or-part_17
|
||||
(if (not
|
||||
case-sensitive?_0)
|
||||
(not
|
||||
(char=?
|
||||
ch_0
|
||||
(char-foldcase
|
||||
ch_0)))
|
||||
#f))))))))))))))))))))))))))))))))))))))))))
|
||||
(loop_0
|
||||
(|#%name|
|
||||
loop
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
(char=? ch #\,)
|
||||
(char=? ch #\;)
|
||||
(char=? ch #\`)
|
||||
(char=? ch #\uFEFF) ; BOM, treated as whitespace by the reader
|
||||
(and (char=? ch #\|)
|
||||
(or (not config) (config-get config read-accept-bar-quote)))
|
||||
(and for-type?
|
||||
|
|
Loading…
Reference in New Issue
Block a user