1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

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 ']'.
This commit is contained in:
Mark H Weaver 2012-10-22 23:28:56 -04:00
parent 493ceb99e5
commit 603234c611

View file

@ -185,10 +185,11 @@ scm_i_read_hash_procedures_set_x (SCM value)
structure''). */ structure''). */
#define CHAR_IS_R5RS_DELIMITER(c) \ #define CHAR_IS_R5RS_DELIMITER(c) \
(CHAR_IS_BLANK (c) \ (CHAR_IS_BLANK (c) \
|| (c == ')') || (c == '(') || (c == ';') || (c == '"') \ || (c) == ')' || (c) == '(' || (c) == ';' || (c) == '"')
|| (SCM_SQUARE_BRACKETS_P && ((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 /* Exponent markers, as defined in section 7.1.1 of R5RS, ``Lexical
Structure''. */ Structure''. */
@ -405,7 +406,7 @@ scm_read_sexp (scm_t_wchar chr, SCM port)
{ {
SCM new_tail; SCM new_tail;
if (c == ')' || (SCM_SQUARE_BRACKETS_P && c == ']')) if (c == ')' || (c == ']' && SCM_SQUARE_BRACKETS_P))
scm_i_input_error (FUNC_NAME, port, scm_i_input_error (FUNC_NAME, port,
"in pair: mismatched close paren: ~A", "in pair: mismatched close paren: ~A",
scm_list_1 (SCM_MAKE_CHAR (c))); scm_list_1 (SCM_MAKE_CHAR (c)));