mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
pipes should be escaped in symbols (fixes issue #571)
This commit is contained in:
parent
144581b834
commit
72971fd4f4
2 changed files with 6 additions and 3 deletions
6
sexp.c
6
sexp.c
|
@ -1457,7 +1457,7 @@ sexp sexp_intern(sexp ctx, const char *str, sexp_sint_t len) {
|
||||||
goto normal_intern;
|
goto normal_intern;
|
||||||
for ( ; i<len; i++, p++) {
|
for ( ; i<len; i++, p++) {
|
||||||
c = *p;
|
c = *p;
|
||||||
if ((unsigned char)c <= 32 || (unsigned char)c > 127 || c == '\\' || c == '.' || c =='#' || sexp_is_separator(c))
|
if ((unsigned char)c <= 32 || (unsigned char)c > 127 || c == '\\' || c == '|' || c == '.' || c =='#' || sexp_is_separator(c))
|
||||||
goto normal_intern;
|
goto normal_intern;
|
||||||
he = huff_table[(unsigned char)c];
|
he = huff_table[(unsigned char)c];
|
||||||
newbits = he.len;
|
newbits = he.len;
|
||||||
|
@ -2201,11 +2201,11 @@ sexp sexp_write_one (sexp ctx, sexp obj, sexp out, sexp_sint_t bound) {
|
||||||
sexp_tolower((unsigned char)str[3]) == 'n')))))
|
sexp_tolower((unsigned char)str[3]) == 'n')))))
|
||||||
? '|' : EOF;
|
? '|' : EOF;
|
||||||
for (i=sexp_lsymbol_length(obj)-1; i>=0; i--)
|
for (i=sexp_lsymbol_length(obj)-1; i>=0; i--)
|
||||||
if (str[i] <= ' ' || str[i] == '\\' || str[i] == '#' || sexp_is_separator(str[i]))
|
if (str[i] <= ' ' || str[i] == '\\' || str[i] == '|' || str[i] == '#' || sexp_is_separator(str[i]))
|
||||||
c = '|';
|
c = '|';
|
||||||
if (c!=EOF) sexp_write_char(ctx, c, out);
|
if (c!=EOF) sexp_write_char(ctx, c, out);
|
||||||
for (i=sexp_lsymbol_length(obj); i>0; str++, i--) {
|
for (i=sexp_lsymbol_length(obj); i>0; str++, i--) {
|
||||||
if (str[0] == '\\') sexp_write_char(ctx, '\\', out);
|
if (str[0] == '\\' || str[0] == '|') sexp_write_char(ctx, '\\', out);
|
||||||
sexp_write_char(ctx, str[0], out);
|
sexp_write_char(ctx, str[0], out);
|
||||||
}
|
}
|
||||||
if (c!=EOF) sexp_write_char(ctx, c, out);
|
if (c!=EOF) sexp_write_char(ctx, c, out);
|
||||||
|
|
|
@ -2232,6 +2232,9 @@
|
||||||
(test-write-syntax "|a b|" '|a b|)
|
(test-write-syntax "|a b|" '|a b|)
|
||||||
(test-write-syntax "|,a|" '|,a|)
|
(test-write-syntax "|,a|" '|,a|)
|
||||||
(test-write-syntax "|\"|" '|\"|)
|
(test-write-syntax "|\"|" '|\"|)
|
||||||
|
(test-write-syntax "|\\||" '|\||)
|
||||||
|
(test-write-syntax "||" '||)
|
||||||
|
(test-write-syntax "|\\\\123|" '|\\123|)
|
||||||
(test-write-syntax "a" '|a|)
|
(test-write-syntax "a" '|a|)
|
||||||
;; (test-write-syntax "a.b" '|a.b|)
|
;; (test-write-syntax "a.b" '|a.b|)
|
||||||
(test-write-syntax "|2|" '|2|)
|
(test-write-syntax "|2|" '|2|)
|
||||||
|
|
Loading…
Add table
Reference in a new issue