X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=doc%2Fmanual%2Fdocstrings.lisp;h=06482302c7455c5f1b62acf15505642fbaa2d75c;hb=c0f9314af1b6f7aa67e6c5db523d6ddef735986c;hp=958895bfb4c7e080fee5d79d429349532ff8fcba;hpb=74cfbf6d0572b7df1b3492563408a7cb3ae103cf;p=sbcl.git diff --git a/doc/manual/docstrings.lisp b/doc/manual/docstrings.lisp index 958895b..0648230 100644 --- a/doc/manual/docstrings.lisp +++ b/doc/manual/docstrings.lisp @@ -444,19 +444,25 @@ with #\@. Optionally downcase the result." ;;; line markups -(defvar *not-symbols* '("ANSI" "CLHS")) +(defvar *not-symbols* '("ANSI" "CLHS" "UNIX")) (defun locate-symbols (line) "Return a list of index pairs of symbol-like parts of LINE." ;; This would be a good application for a regex ... (let (result) (flet ((grab (start end) - (unless (member (subseq line start end) '("ANSI" "CLHS")) - (push (list start end) result)))) + (unless (member (subseq line start end) *not-symbols*) + (push (list start end) result))) + (got-symbol-p (start) + (let ((end (when (< start (length line)) + (position #\space line :start start)))) + (when end + (every (lambda (char) (find char *symbol-characters*)) + (subseq line start end)))))) (do ((begin nil) (maybe-begin t) (i 0 (1+ i))) - ((= i (length line)) + ((>= i (length line)) ;; symbol at end of line (when (and begin (or (> i (1+ begin)) (not (member (char line begin) '(#\A #\I))))) @@ -479,6 +485,16 @@ with #\@. Optionally downcase the result." ((find (char line i) *symbol-delimiters*) ;; potential symbol begin after this position (setf maybe-begin t)) + ((and (eql #\( (char line i)) (got-symbol-p (1+ i))) + ;; a type designator, or a function call as part of the text? + (multiple-value-bind (exp end) + (let ((*package* (find-package :cl-user))) + (ignore-errors (read-from-string line nil nil :start i))) + (when exp + (grab i end) + (setf begin nil + maybe-begin nil + i end)))) (t ;; Not reading a symbol, not at potential start of symbol (setf maybe-begin nil))))))) @@ -727,10 +743,10 @@ followed another tabulation label or a tabulation body." (title-name doc) ;; &foo would be amusingly bold in the pdf thanks to TeX/Texinfo ;; interactions,so we escape the ampersand -- amusingly for TeX. - ;; sbcl.texinfo defines macros that expand @&key and friends to &key. + ;; sbcl.texinfo defines macros that expand @andkey and friends to &key. (mapcar (lambda (name) (if (member name lambda-list-keywords) - (format nil "@~A" name) + (format nil "@and~A{}" (remove #\- (subseq (string name) 1))) name)) (lambda-list doc))))) @@ -831,6 +847,10 @@ package, as well as for the package itself." (defun write-package-macro (package) (let* ((package-name (package-shortest-name package)) (macro-name (package-macro-name package))) + ;; KLUDGE: SB-SEQUENCE has a shorter nickname SEQUENCE, but we + ;; want to document the SB- variant. + (when (eql (find-package "SB-SEQUENCE") (find-package package)) + (setf package-name "SB-SEQUENCE")) (write-packageish-macro package-name macro-name))) (defun write-packageish-macro (package-name macro-name)