[slime-cvs] CVS update: slime/swank-source-file-cache.lisp

Luke Gorrie lgorrie at common-lisp.net
Sun Mar 13 03:01:31 UTC 2005


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv25092

Modified Files:
	swank-source-file-cache.lisp 
Log Message:
(read-snippet): Skip comments and whitespace in SBCL. The
source-positions reported by SBCL are not adjusted to skip over
whitespace before the definition.

Date: Sun Mar 13 04:01:31 2005
Author: lgorrie

Index: slime/swank-source-file-cache.lisp
diff -u slime/swank-source-file-cache.lisp:1.1 slime/swank-source-file-cache.lisp:1.2
--- slime/swank-source-file-cache.lisp:1.1	Sat Mar 12 02:50:46 2005
+++ slime/swank-source-file-cache.lisp	Sun Mar 13 04:01:30 2005
@@ -86,12 +86,18 @@
 text search.")
 
 (defun read-snippet (stream)
-  "Read a string of upto *SOURCE-SNIPPET-SIZE* characters from STREAM.
-Skip leading whitespace."
-  (loop while (member (peek-char nil stream)
-                      '(#\Space #\Tab #\Newline #\Linefeed))
-        do (read-char stream))
+  "Read a string of upto *SOURCE-SNIPPET-SIZE* characters from STREAM."
+  #+SBCL (skip-comments-and-whitespace stream)
   (read-upto-n-chars stream *source-snippet-size*))
+
+(defun skip-comments-and-whitespace (stream)
+  (case (peek-char nil stream)
+    ((#\Space #\Tab #\Newline #\Linefeed)
+     (read-char stream)
+     (skip-comments-and-whitespace stream))
+    (#\;
+     (read-line stream)
+     (skip-comments-and-whitespace stream))))
 
 (defun read-upto-n-chars (stream n)
   "Return a string of upto N chars from STREAM."




More information about the slime-cvs mailing list