From 603234c611b50cdc8770b2a822cd333812eed98d Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Mon, 22 Oct 2012 23:28:56 -0400 Subject: [PATCH] Minor tweaks to delimiter handling in read.c * libguile/read.c (CHAR_IS_R5RS_DELIMITER, CHAR_IS_DELIMITER): Move the '[' and ']' delimiters from CHAR_IS_R5RS_DELIMITER to CHAR_IS_DELIMITER. Parenthesize all references to the macro parameter. Don't check the global square-brackets read option until after we know the character is '[' or ']'. (scm_read_sexp): Don't check the global square-brackets read option until after we know the character is ']'. --- libguile/read.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libguile/read.c b/libguile/read.c index 7fb1c21bc..d112e3d2e 100644 --- a/libguile/read.c +++ b/libguile/read.c @@ -185,10 +185,11 @@ scm_i_read_hash_procedures_set_x (SCM value) structure''). */ #define CHAR_IS_R5RS_DELIMITER(c) \ (CHAR_IS_BLANK (c) \ - || (c == ')') || (c == '(') || (c == ';') || (c == '"') \ - || (SCM_SQUARE_BRACKETS_P && ((c == '[') || (c == ']')))) + || (c) == ')' || (c) == '(' || (c) == ';' || (c) == '"') -#define CHAR_IS_DELIMITER CHAR_IS_R5RS_DELIMITER +#define CHAR_IS_DELIMITER(c) \ + (CHAR_IS_R5RS_DELIMITER (c) \ + || (((c) == ']' || (c) == '[') && SCM_SQUARE_BRACKETS_P)) /* Exponent markers, as defined in section 7.1.1 of R5RS, ``Lexical Structure''. */ @@ -405,7 +406,7 @@ scm_read_sexp (scm_t_wchar chr, SCM port) { SCM new_tail; - if (c == ')' || (SCM_SQUARE_BRACKETS_P && c == ']')) + if (c == ')' || (c == ']' && SCM_SQUARE_BRACKETS_P)) scm_i_input_error (FUNC_NAME, port, "in pair: mismatched close paren: ~A", scm_list_1 (SCM_MAKE_CHAR (c)));