bc: fix printing of #:|.| and #:|#|.

Closes #3477

Thanks, Xsmith!
This commit is contained in:
Matthew Flatt 2020-11-01 05:53:00 -07:00
parent f6a598a116
commit 0a7c4e2613
2 changed files with 14 additions and 11 deletions

View File

@ -69,6 +69,11 @@
(ptest "'|`|" '|`|)
(ptest "'#:apple" '#:apple)
(ptest "'#:|apple pie|" '#:|apple pie|)
(ptest "'#:|.|" '#:|.|)
(ptest "'#:|#|" '#:|#|)
(ptest "'#:|#q|" '#:|#q|)
(ptest "'#:#%" '#:#%)
(ptest "'#:101" '#:101)
(ptest "'#%apple" '#%apple)
(ptest "\"apple\"" "apple")
(ptest "#\"apple\"" #"apple")

View File

@ -613,17 +613,15 @@ const char *scheme_symbol_name_and_size(Scheme_Object *sym, uintptr_t *length, i
&& (flags & SCHEME_SNF_FOR_TS)))
if (len) {
if (flags & SCHEME_SNF_KEYWORD) {
digit_start = 0;
} else {
int ch = ((unsigned char *)s)[0];
digit_start = (((ch < 128) && isdigit(ch)) || (ch == '.')
|| (ch == '+') || (ch == '-'));
if (ch == '#' && (len == 1 || s[1] != '%'))
has_special = 1;
if (ch == '.' && len == 1)
has_special = 1;
}
int ch = ((unsigned char *)s)[0];
digit_start = ((flags & SCHEME_SNF_KEYWORD)
? 0
: (((ch < 128) && isdigit(ch)) || (ch == '.')
|| (ch == '+') || (ch == '-')));
if (ch == '#' && (len == 1 || s[1] != '%'))
has_special = 1;
if (ch == '.' && len == 1)
has_special = 1;
} else {
digit_start = 0;
if (!(flags & SCHEME_SNF_KEYWORD))