Changes from arch/CVS synchronization
authorLudovic Courtès <ludo@gnu.org>
Mon, 3 Sep 2007 16:58:20 +0000 (16:58 +0000)
committerLudovic Courtès <ludo@gnu.org>
Mon, 3 Sep 2007 16:58:20 +0000 (16:58 +0000)
libguile/ChangeLog
libguile/read.c
test-suite/ChangeLog
test-suite/tests/reader.test

index a896b1b..ae6ed7c 100644 (file)
@@ -1,3 +1,7 @@
+2007-09-03  Ludovic Courtès  <ludo@gnu.org>
+
+       * read.c (flush_ws): Handle SCSH block comments.
+
 2007-09-03  Ludovic Courtès  <ludo@gnu.org>
 
        Fix alignment issues which showed up at least on SPARC.
index e4211c5..d1013c5 100644 (file)
@@ -179,6 +179,9 @@ static SCM *scm_read_hash_procedures;
   (((_chr) <= UCHAR_MAX) ? tolower (_chr) : (_chr))
 
 
+/* Read an SCSH block comment.  */
+static inline SCM scm_read_scsh_block_comment (int chr, SCM port);
+
 /* Helper function similar to `scm_read_token ()'.  Read from PORT until a
    whitespace is read.  Return zero if the whole token could fit in BUF,
    non-zero otherwise.  */
@@ -245,6 +248,21 @@ flush_ws (SCM port, const char *eoferr)
          }
        break;
 
+      case '#':
+       switch (c = scm_getc (port))
+         {
+         case EOF:
+           eoferr = "read_sharp";
+           goto goteof;
+         case '!':
+           scm_read_scsh_block_comment (c, port);
+           break;
+         default:
+           scm_ungetc (c, port);
+           return '#';
+         }
+       break;
+
       case SCM_LINE_INCREMENTORS:
       case SCM_SINGLE_SPACES:
       case '\t':
index 55c3795..f40adfa 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-03  Ludovic Courtès  <ludo@gnu.org>
+
+       * tests/reader.test (reading)[block comment finishing sexp]: New
+       test.
+
 2007-08-26  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
        * tests/ports.test ("port-for-each"): remove unresolved for
index 3d37c1f..7f24aa6 100644 (file)
     (equal? '(+ 1 2 3)
             (read-string "(+ 1 #! this is a\ncomment !# 2 3)")))
 
+  (pass-if "block comment finishing s-exp"
+    (equal? '(+ 2)
+            (read-string "(+ 2 #! a comment\n!#\n) ")))
+
   (pass-if "unprintable symbol"
     ;; The reader tolerates unprintable characters for symbols.
     (equal? (string->symbol "\001\002\003")