mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-08 13:37:35 +02:00
adding support for #true and #false
This commit is contained in:
parent
e2f066044d
commit
5eb62cf716
1 changed files with 10 additions and 2 deletions
12
sexp.c
12
sexp.c
|
@ -2139,8 +2139,16 @@ sexp sexp_read_raw (sexp ctx, sexp in) {
|
||||||
res = (tolower(c1) == 't' ? SEXP_TRUE : SEXP_FALSE);
|
res = (tolower(c1) == 't' ? SEXP_TRUE : SEXP_FALSE);
|
||||||
sexp_push_char(ctx, c2, in);
|
sexp_push_char(ctx, c2, in);
|
||||||
} else {
|
} else {
|
||||||
tmp = sexp_list2(ctx, sexp_make_character(c1), sexp_make_character(c2));
|
sexp_push_char(ctx, c2, in);
|
||||||
res = sexp_read_error(ctx, "invalid syntax #%c%c", tmp, in);
|
res = sexp_read_symbol(ctx, in, c1, 0);
|
||||||
|
if (!sexp_exceptionp(res)) {
|
||||||
|
if (strcasecmp("true", sexp_string_data(res)) == 0)
|
||||||
|
res = SEXP_TRUE;
|
||||||
|
else if (strcasecmp("false", sexp_string_data(res)) == 0)
|
||||||
|
res = SEXP_FALSE;
|
||||||
|
else
|
||||||
|
res = sexp_read_error(ctx, "invalid # syntax", res, in);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#if SEXP_USE_BYTEVECTOR_LITERALS
|
#if SEXP_USE_BYTEVECTOR_LITERALS
|
||||||
|
|
Loading…
Add table
Reference in a new issue