mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 14:49:18 +02:00
fixing error checks on first digit for numbers with #r prefix (issue #27)
This commit is contained in:
parent
ad1be9cbcd
commit
add39db40b
1 changed files with 4 additions and 4 deletions
8
sexp.c
8
sexp.c
|
@ -1328,12 +1328,12 @@ sexp sexp_read_number(sexp ctx, sexp in, int base) {
|
||||||
int c, digit, negativep = 0;
|
int c, digit, negativep = 0;
|
||||||
|
|
||||||
c = sexp_read_char(ctx, in);
|
c = sexp_read_char(ctx, in);
|
||||||
if (c == '-')
|
if (c == '-') {
|
||||||
negativep = 1;
|
negativep = 1;
|
||||||
else if (isdigit(c))
|
c = sexp_read_char(ctx, in);
|
||||||
res = digit_value(c);
|
}
|
||||||
|
|
||||||
for (c=sexp_read_char(ctx, in); isxdigit(c); c=sexp_read_char(ctx, in)) {
|
for ( ; isxdigit(c); c=sexp_read_char(ctx, in)) {
|
||||||
digit = digit_value(c);
|
digit = digit_value(c);
|
||||||
if ((digit < 0) || (digit >= base))
|
if ((digit < 0) || (digit >= base))
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue