#t and #f are case-insensitive tokens

This commit is contained in:
Alex Shinn 2009-12-27 16:08:27 +09:00
parent 461fec8e6d
commit 482e0d79a9

6
sexp.c
View file

@ -1464,11 +1464,11 @@ sexp sexp_read_raw (sexp ctx, sexp in) {
if (sexp_fixnump(res)) if (sexp_fixnump(res))
res = sexp_make_flonum(ctx, sexp_unbox_fixnum(res)); res = sexp_make_flonum(ctx, sexp_unbox_fixnum(res));
break; break;
case 'f': case 'f': case 'F':
case 't': case 't': case 'T':
c2 = sexp_read_char(ctx, in); c2 = sexp_read_char(ctx, in);
if (c2 == EOF || is_separator(c2)) { if (c2 == EOF || is_separator(c2)) {
res = (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)); tmp = sexp_list2(ctx, sexp_make_character(c1), sexp_make_character(c2));