From d975aac7ed930dca93dc4ded0b3ebf051a833f8d Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sun, 5 Jun 2016 22:34:39 +0900 Subject: [PATCH] Hashes in symbol names need to be escaped with |...|. Fixes issue #348. --- sexp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sexp.c b/sexp.c index e86d8ebe..7f2bb666 100644 --- a/sexp.c +++ b/sexp.c @@ -1208,7 +1208,7 @@ sexp sexp_intern(sexp ctx, const char *str, sexp_sint_t len) { goto normal_intern; for ( ; i 127 || c == '\\' || c == '.' || sexp_is_separator(c)) + if ((unsigned char)c <= 32 || (unsigned char)c > 127 || c == '\\' || c == '.' || c =='#' || sexp_is_separator(c)) goto normal_intern; he = huff_table[(unsigned char)c]; newbits = he.len; @@ -1940,7 +1940,7 @@ sexp sexp_write_one (sexp ctx, sexp obj, sexp out) { sexp_tolower(str[3]) == 'n'))))) ? '|' : EOF; for (i=sexp_lsymbol_length(obj)-1; i>=0; i--) - if (str[i] <= ' ' || str[i] == '\\' || sexp_is_separator(str[i])) + if (str[i] <= ' ' || str[i] == '\\' || str[i] == '#' || sexp_is_separator(str[i])) c = '|'; if (c!=EOF) sexp_write_char(ctx, c, out); for (i=sexp_lsymbol_length(obj); i>0; str++, i--) {