/[slime]/slime/swank-source-path-parser.lisp
ViewVC logotype

Diff of /slime/swank-source-path-parser.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by heller, Tue Mar 9 13:55:43 2004 UTC revision 1.4 by heller, Mon Mar 29 16:50:07 2004 UTC
# Line 36  before and after of calling FN in the ha Line 36  before and after of calling FN in the ha
36          (push (cons start end) (gethash (car values) source-map)))          (push (cons start end) (gethash (car values) source-map)))
37        (values-list values))))        (values-list values))))
38    
39    #+sbcl
40    ;; not sure why this should be the case, but SBCL 0.8.6 returns
41    ;; #<FUNCTION "top level local call SB!IMPL::UNDEFINED-MACRO-CHAR">
42    ;; for (get-macro-character) on characters that aren't macros.
43    ;; As there's no way to detect the syntax of a character (only
44    ;; to set it from another character) we have to compare against
45    ;; this undefined-macro function to avoid turning everything into
46    ;; a macro  -- Dan Barlow
47    ;;
48    ;; Just copy CMUCL's implementation, to get identical behavior.  The
49    ;; SBCL implementation uses GET-RAW-CMT-ENTRY; we use
50    ;; GET-COERCED-CMT-ENTRY, which seems to be what SET-MACRO-CHARACTER
51    ;; expects. -- Helmut Eller
52    (defun cmucl-style-get-macro-character (char table)
53      (let ((rt (or table sb-impl::*standard-readtable*)))
54        (cond ((sb-impl::constituentp char)
55               (values (sb-impl::get-coerced-cmt-entry char rt) t))
56              ((sb-impl::terminating-macrop char)
57               (values (sb-impl::get-coerced-cmt-entry char rt) nil))
58              (t nil))))
59    
60    #+cmucl
61    (defun cmucl-style-get-macro-character (char table)
62      (get-macro-character char table))
63    
64  (defun make-source-recording-readtable (readtable source-map)  (defun make-source-recording-readtable (readtable source-map)
65    "Return a source position recording copy of READTABLE.    "Return a source position recording copy of READTABLE.
66  The source locations are stored in SOURCE-MAP."  The source locations are stored in SOURCE-MAP."
67    (let* ((tab (copy-readtable readtable))    (let* ((tab (copy-readtable readtable))
68           (*readtable* tab)           (*readtable* tab))
          (undefined-macro (get-macro-character #\Space tab)))  
     ;; not sure why this should be the case, but SBCL 0.8.6 returns  
     ;; #<FUNCTION "top level local call SB!IMPL::UNDEFINED-MACRO-CHAR">  
     ;; for (get-macro-character) on characters that aren't macros.  
     ;; As there's no way to detect the syntax of a character (only  
     ;; to set it from another character) we have to compare against  
     ;; this undefined-macro function to avoid turning everything into  
     ;;  a macro  
69      (dotimes (code char-code-limit)      (dotimes (code char-code-limit)
70        (let ((char (code-char code)))        (let ((char (code-char code)))
71          (multiple-value-bind (fn term) (get-macro-character char tab)          (multiple-value-bind (fn term)
72            (when (and fn (not (eq fn undefined-macro)))              (cmucl-style-get-macro-character char tab)
73              (when fn
74              (set-macro-character char (make-source-recorder fn source-map)              (set-macro-character char (make-source-recorder fn source-map)
75                                   term tab)))))                                   term tab)))))
76      tab))      tab))

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.5