From 5eb62cf7169d4fa86606f697b8f8948af9270838 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Mon, 19 Sep 2011 15:15:00 +0900 Subject: [PATCH] adding support for #true and #false --- sexp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sexp.c b/sexp.c index e2d04a5c..a52703c3 100644 --- a/sexp.c +++ b/sexp.c @@ -2139,8 +2139,16 @@ sexp sexp_read_raw (sexp ctx, sexp in) { res = (tolower(c1) == 't' ? SEXP_TRUE : SEXP_FALSE); sexp_push_char(ctx, c2, in); } else { - tmp = sexp_list2(ctx, sexp_make_character(c1), sexp_make_character(c2)); - res = sexp_read_error(ctx, "invalid syntax #%c%c", tmp, in); + sexp_push_char(ctx, c2, 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; #if SEXP_USE_BYTEVECTOR_LITERALS