Changes from arch/CVS synchronization
authorLudovic Courtès <ludo@gnu.org>
Thu, 23 Aug 2007 21:17:24 +0000 (21:17 +0000)
committerLudovic Courtès <ludo@gnu.org>
Thu, 23 Aug 2007 21:17:24 +0000 (21:17 +0000)
libguile/ChangeLog
libguile/read.c
test-suite/ChangeLog
test-suite/tests/reader.test

index 09378ff..a356c41 100644 (file)
@@ -1,5 +1,8 @@
 2007-08-23  Ludovic Courtès  <ludo@gnu.org>
 
+       * read.c (scm_read_quote): Record position and copy source
+       expression when asked to.  Reported by Kevin Ryde.
+
        * stime.c: Define `_REENTRANT' only if not already defined.
 
 2007-08-21  Kevin Ryde  <user42@zip.com.au>
index d61723e..e4211c5 100644 (file)
@@ -610,6 +610,8 @@ static SCM
 scm_read_quote (int chr, SCM port)
 {
   SCM p;
+  long line = SCM_LINUM (port);
+  int column = SCM_COL (port) - 1;
 
   switch (chr)
     {
@@ -643,6 +645,17 @@ scm_read_quote (int chr, SCM port)
     }
 
   p = scm_cons2 (p, scm_read_expression (port), SCM_EOL);
+  if (SCM_RECORD_POSITIONS_P)
+    scm_whash_insert (scm_source_whash, p,
+                     scm_make_srcprops (line, column,
+                                        SCM_FILENAME (port),
+                                        SCM_COPY_SOURCE_P
+                                        ? (scm_cons2 (SCM_CAR (p),
+                                                      SCM_CAR (SCM_CDR (p)),
+                                                      SCM_EOL))
+                                        : SCM_UNDEFINED,
+                                        SCM_EOL));
+
 
   return p;
 }
index cee19d7..bb6d442 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-23  Ludovic Courtès  <ludo@gnu.org>
+
+       * tests/reader.test (read-options)[positions on quote]: New
+       test, proposed by Kevin Ryde.
+
 2007-08-23  Kevin Ryde  <user42@zip.com.au>
 
        * tests/ports.test (port-for-each): New test for passing freed cell,
index 2d91718..3d37c1f 100644 (file)
     (let ((sexp (with-read-options '(positions)
                   (lambda ()
                     (read-string "(+ 1 2 3)")))))
+      (and (equal? (source-property sexp 'line) 0)
+           (equal? (source-property sexp 'column) 0))))
+  (pass-if "positions on quote"
+    (let ((sexp (with-read-options '(positions)
+                  (lambda ()
+                    (read-string "'abcde")))))
       (and (equal? (source-property sexp 'line) 0)
            (equal? (source-property sexp 'column) 0)))))