mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Fixing #e1e100 for (srfi 38).
This commit is contained in:
parent
636a74d044
commit
2fbc5e1ba2
3 changed files with 15 additions and 1 deletions
|
@ -328,7 +328,7 @@
|
||||||
((#\o) (read-char in) (read-number 8))
|
((#\o) (read-char in) (read-number 8))
|
||||||
((#\b) (read-char in) (read-number 2))
|
((#\b) (read-char in) (read-number 2))
|
||||||
((#\i) (read-char in) (exact->inexact (read-one)))
|
((#\i) (read-char in) (exact->inexact (read-one)))
|
||||||
((#\e) (read-char in) (inexact->exact (read-one)))
|
((#\e) (string->number (read-name #\# in)))
|
||||||
((#\u #\v)
|
((#\u #\v)
|
||||||
(if (eqv? #\v (peek-char in))
|
(if (eqv? #\v (peek-char in))
|
||||||
(read-char in))
|
(read-char in))
|
||||||
|
|
9
sexp.c
9
sexp.c
|
@ -2614,6 +2614,15 @@ sexp sexp_read_number (sexp ctx, sexp in, int base, int exactp) {
|
||||||
sexp_gc_var2(res, den);
|
sexp_gc_var2(res, den);
|
||||||
|
|
||||||
c = sexp_read_char(ctx, in);
|
c = sexp_read_char(ctx, in);
|
||||||
|
if (c == '#') {
|
||||||
|
switch ((c = sexp_tolower(sexp_read_char(ctx, in)))) {
|
||||||
|
case 'b': base = 2; break; case 'o': base = 8; break;
|
||||||
|
case 'd': base = 10; break; case 'x': base = 16; break;
|
||||||
|
case 'i': exactp = 0; break; case 'e': exactp = 1; break;
|
||||||
|
default: return sexp_read_error(ctx, "unexpected numeric # code", sexp_make_character(c), in);
|
||||||
|
}
|
||||||
|
c = sexp_read_char(ctx, in);
|
||||||
|
}
|
||||||
if (c == '-') {
|
if (c == '-') {
|
||||||
negativep = 1;
|
negativep = 1;
|
||||||
c = sexp_read_char(ctx, in);
|
c = sexp_read_char(ctx, in);
|
||||||
|
|
|
@ -77,6 +77,11 @@
|
||||||
(test 99 (read-from-string "#d99"))
|
(test 99 (read-from-string "#d99"))
|
||||||
(test 63 (read-from-string "#o77"))
|
(test 63 (read-from-string "#o77"))
|
||||||
(test 3 (read-from-string "#b11"))
|
(test 3 (read-from-string "#b11"))
|
||||||
|
(test 5 (read-from-string "#e5.0"))
|
||||||
|
(test 5.0 (read-from-string "#i5"))
|
||||||
|
(test 15 (read-from-string "#e#xf"))
|
||||||
|
(test 15.0 (read-from-string "#i#xf"))
|
||||||
|
(test (expt 10 100) (read-from-string "#e1e100"))
|
||||||
|
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(chicken
|
(chicken
|
||||||
|
|
Loading…
Add table
Reference in a new issue