[slime-cvs] CVS update: slime/swank-source-path-parser.lisp
Helmut Eller
heller at common-lisp.net
Mon Nov 7 08:24:34 UTC 2005
Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv5034
Modified Files:
swank-source-path-parser.lisp
Log Message:
(make-source-recording-readtable): Suppress the #. reader-macro.
(suppress-sharp-dot): New function.
(read-source-form): Disable *read-eval*.
(*source-map*): Deleted. We can do everything with a lexical variable.
Date: Mon Nov 7 09:24:33 2005
Author: heller
Index: slime/swank-source-path-parser.lisp
diff -u slime/swank-source-path-parser.lisp:1.15 slime/swank-source-path-parser.lisp:1.16
--- slime/swank-source-path-parser.lisp:1.15 Mon Aug 29 22:02:58 2005
+++ slime/swank-source-path-parser.lisp Mon Nov 7 09:24:32 2005
@@ -56,25 +56,30 @@
(when fn
(set-macro-character char (make-source-recorder fn source-map)
term tab)))))
+ (suppress-sharp-dot tab)
tab))
-(defvar *source-map* nil
- "The hashtable table used for source position recording.")
+(defun suppress-sharp-dot (readtable)
+ (when (get-macro-character #\# readtable)
+ (let ((sharp-dot (get-dispatch-macro-character #\# #\. readtable)))
+ (set-dispatch-macro-character #\# #\. (lambda (&rest args)
+ (let ((*read-suppress* t))
+ (apply sharp-dot args)))
+ readtable))))
(defun read-and-record-source-map (stream)
"Read the next object from STREAM.
Return the object together with a hashtable that maps
subexpressions of the object to stream positions."
- (let* ((*source-map* (make-hash-table :test #'eq))
- (*readtable* (make-source-recording-readtable *readtable*
- *source-map*))
+ (let* ((source-map (make-hash-table :test #'eq))
+ (*readtable* (make-source-recording-readtable *readtable* source-map))
(start (file-position stream))
(form (read stream))
(end (file-position stream)))
;; ensure that at least FORM is in the source-map
- (unless (gethash form *source-map*)
- (push (cons start end) (gethash form *source-map*)))
- (values form *source-map*)))
+ (unless (gethash form source-map)
+ (push (cons start end) (gethash form source-map)))
+ (values form source-map)))
(defun read-source-form (n stream)
"Read the Nth toplevel form number with source location recording.
@@ -82,7 +87,8 @@
(let ((*read-suppress* t))
(dotimes (i n)
(read stream)))
- (let ((*read-suppress* nil))
+ (let ((*read-suppress* nil)
+ (*read-eval* nil))
(read-and-record-source-map stream)))
(defun source-path-stream-position (path stream)
More information about the slime-cvs
mailing list