diff --git a/lib/srfi/38/test.sld b/lib/srfi/38/test.sld index 1de30b5e..64427949 100644 --- a/lib/srfi/38/test.sld +++ b/lib/srfi/38/test.sld @@ -73,6 +73,8 @@ (vector-set! x 2 x) x)) + (test '+.! (read-from-string "+.!")) + (test 255 (read-from-string "#xff")) (test 99 (read-from-string "#d99")) (test 63 (read-from-string "#o77")) diff --git a/sexp.c b/sexp.c index 0017ad9d..866e2ca0 100644 --- a/sexp.c +++ b/sexp.c @@ -2613,6 +2613,12 @@ static sexp sexp_fill_reader_labels(sexp ctx, sexp x, sexp shares, int state) { } #endif +static int sexp_peek_char(sexp ctx, sexp in) { + int c = sexp_read_char(ctx, in); + if (c != EOF) sexp_push_char(ctx, c, in); + return c; +} + sexp sexp_read_raw (sexp ctx, sexp in, sexp *shares) { char *str; int c1, c2, line; @@ -3030,7 +3036,8 @@ sexp sexp_read_raw (sexp ctx, sexp in, sexp *shares) { case '+': case '-': c2 = sexp_read_char(ctx, in); - if (c2 == '.' || sexp_isdigit(c2)) { + if ((c2 == '.' && sexp_isdigit(sexp_peek_char(ctx, in))) + || sexp_isdigit(c2)) { sexp_push_char(ctx, c2, in); res = sexp_read_number(ctx, in, 10, 0); if ((c1 == '-') && ! sexp_exceptionp(res)) {