guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.1-146-g1f794


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.1-146-g1f7945a
Date: Fri, 01 Jul 2011 11:17:29 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=1f7945a768a8df06ad208ed2846dfe4f92e1515a

The branch, stable-2.0 has been updated
       via  1f7945a768a8df06ad208ed2846dfe4f92e1515a (commit)
      from  b8441577f9954053a90981a5c134aa43f341f712 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1f7945a768a8df06ad208ed2846dfe4f92e1515a
Author: Andy Wingo <address@hidden>
Date:   Fri Jul 1 12:20:52 2011 +0200

    fix '(a #{.} b)
    
    * libguile/read.c (scm_read_sexp): Don't confuse `#{.}#' with `.' for
      the purpose of reading dotted pairs.  Thanks to CRLF0710 for the
      report.
    
    * test-suite/tests/reader.test ("#{}#"): Add test.

-----------------------------------------------------------------------

Summary of changes:
 libguile/read.c              |   11 ++++++++---
 test-suite/tests/reader.test |    1 +
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/libguile/read.c b/libguile/read.c
index 4d22ead..ee50fb4 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -376,8 +376,12 @@ scm_read_sexp (scm_t_wchar chr, SCM port)
     return SCM_EOL;
 
   scm_ungetc (c, port);
-  if (scm_is_eq (scm_sym_dot,
-                (tmp = scm_read_expression (port))))
+  tmp = scm_read_expression (port);
+
+  /* Note that it is possible for scm_read_expression to return
+     scm_sym_dot, but not as part of a dotted pair: as in #{.}#.  So
+     check that it's a real dot by checking `c'.  */
+  if (c == '.' && scm_is_eq (scm_sym_dot, tmp))
     {
       ans = scm_read_expression (port);
       if (terminating_char != (c = flush_ws (port, FUNC_NAME)))
@@ -401,7 +405,8 @@ scm_read_sexp (scm_t_wchar chr, SCM port)
       scm_ungetc (c, port);
       tmp = scm_read_expression (port);
 
-      if (scm_is_eq (scm_sym_dot, tmp))
+      /* See above note about scm_sym_dot.  */
+      if (c == '.' && scm_is_eq (scm_sym_dot, tmp))
        {
          SCM_SETCDR (tl, tmp = scm_read_expression (port));
 
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index f350e73..437706b 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -428,6 +428,7 @@
 
 (with-test-prefix "#{}#"
   (pass-if (equal? (read-string "#{}#") '#{}#))
+  (pass-if (not (equal? (read-string "(a #{.}# b)") '(a . b))))
   (pass-if (equal? (read-string "#{a}#") 'a))
   (pass-if (equal? (read-string "#{a b}#") '#{a b}#))
   (pass-if-exception "#{" exception:eof-in-symbol


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]