Renamed all-macro-characters -> list-all-macro-characters.

Pascal J. Bourguignon [2015-07-21 06:36]
Renamed all-macro-characters -> list-all-macro-characters.
Changed the tag symbols into keywords.
Synchronized with the version in the reader package.
Filename
common-lisp/lisp-reader/com.informatimago.common-lisp.lisp-reader.asd
common-lisp/lisp-reader/reader.lisp
tools/com.informatimago.tools.asd
tools/com.informatimago.tools.reader-macro.asd
tools/reader-macro.lisp
diff --git a/common-lisp/lisp-reader/com.informatimago.common-lisp.lisp-reader.asd b/common-lisp/lisp-reader/com.informatimago.common-lisp.lisp-reader.asd
index 90cf2f1..a196ac9 100644
--- a/common-lisp/lisp-reader/com.informatimago.common-lisp.lisp-reader.asd
+++ b/common-lisp/lisp-reader/com.informatimago.common-lisp.lisp-reader.asd
@@ -46,7 +46,7 @@ Beane's zpack.lisp).
   :maintainer "Pascal J. Bourguignon <pjb@informatimago.com>"
   :licence "AGPL3"
   ;; component attributes
-  :version "1.2.4"
+  :version "1.2.5"
   :properties ((#:author-email                   . "pjb@informatimago.com")
                (#:date                           . "Spring 2012")
                ((#:albert #:output-dir)          . "/tmp/documentation/com.informatimago.common-lisp.lisp-reader/")
diff --git a/common-lisp/lisp-reader/reader.lisp b/common-lisp/lisp-reader/reader.lisp
index e02face..a0b577a 100644
--- a/common-lisp/lisp-reader/reader.lisp
+++ b/common-lisp/lisp-reader/reader.lisp
@@ -10,6 +10,7 @@
 ;;;;AUTHORS
 ;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
 ;;;;MODIFICATIONS
+;;;;    2015-07-21 <PJB> Synchronized list-all-macro-characters with the one in com.informatimago.tools.
 ;;;;    2012-05-14 <PJB> Corrected set-syntax-from-char.
 ;;;;    2011-04-29 <PJB> Added potential-number-p.
 ;;;;    2009-08-26 <PJB> Corrected bugs reading "||", "( ;comment )" and "#C(123 456)".
@@ -1992,32 +1993,34 @@ NOTE:   terminates with any kind of list, dotted, circular, etc.
       *readtable*          (copy-readtable nil))


-
-;; or could go to UTILITIES, but this version will run on our own readtables...
 (defun list-all-macro-characters (&optional (*readtable* *readtable*))
   "
 RETURN: A list of all the macro and dispatch-macro characters in the readtable.
+NOTE:   We have the same function in the com.informatimago.tools.reader-macro
+        package, working on cl:readtable
+        instead of com.informatimago.common-lisp.lisp-reader.reader:readtable.
 "
+  (check-type *readtable* readtable)
   (loop
-    :with results = '()
-    :for code :from 0 :below char-code-limit
+    :with result = '()
+    :for code :below char-code-limit
     :for ch = (code-char code)
-    :do (multiple-value-bind (fun ntp) (get-macro-character ch)
-          (when (or fun ntp)
-            (push (list ch fun ntp
-                        (when (handler-case
-                                  (progn (get-dispatch-macro-character ch #\a)
-                                         t)
-                                (error () nil))
-                          (loop
-                            :for code :from 0 :below char-code-limit
-                            :for sub = (code-char code)
-                            :for fun = (get-dispatch-macro-character ch sub)
-                            :when fun
-                              :collect (list sub fun)))) results)))
-    :finally (return results)))
-
-
+    :when ch
+      :do (multiple-value-bind (mc nt) (get-macro-character ch)
+            (when mc
+              (if (ignore-errors (progn (get-dispatch-macro-character ch #\a) t))
+                  (loop :for code :below char-code-limit
+                        :for sub = (code-char code)
+                        :when (and sub
+                                   (not (and (alpha-char-p sub) (lower-case-p sub)))
+                                   (get-dispatch-macro-character ch sub))
+                          :do (push (list :dispatch-macro-character nt ch sub
+                                          #-(and) (format nil "~C~C" ch sub))
+                                    result))
+                  (push (list :macro-character nt ch
+                              #-(and) (string ch))
+                        result))))
+    :finally (return (nreverse result))))


 (defun potential-number-p (token
diff --git a/tools/com.informatimago.tools.asd b/tools/com.informatimago.tools.asd
index d5621c9..bb58ead 100644
--- a/tools/com.informatimago.tools.asd
+++ b/tools/com.informatimago.tools.asd
@@ -39,7 +39,7 @@
   :maintainer "Pascal J. Bourguignon <pjb@informatimago.com>"
   :licence "AGPL3"
   ;; component attributes:
-  :version "1.0.6"
+  :version "1.0.7"
   :properties ((#:author-email                   . "pjb@informatimago.com")
                (#:date                           . "Spring 2014")
                ((#:albert #:output-dir)          . "/tmp/documentation/com.informatimago.tools/")
@@ -48,15 +48,21 @@
                ((#:albert #:docbook #:bgcolor)   . "white")
                ((#:albert #:docbook #:textcolor) . "black"))
   #+asdf-unicode :encoding #+asdf-unicode :utf-8
-  :depends-on #-mocl ("com.informatimago.tools.pathname"
+  :depends-on #-mocl ("com.informatimago.tools.check-asdf"
+                      "com.informatimago.tools.make-depends"
                       "com.informatimago.tools.manifest"
-                      "com.informatimago.tools.symbol"
-                      "com.informatimago.tools.source"
-                      "com.informatimago.tools.summary"
+                      "com.informatimago.tools.pathname"
                       "com.informatimago.tools.quicklisp"
-                      "com.informatimago.tools.make-depends"
+                      "com.informatimago.tools.reader-macro"
                       "com.informatimago.tools.script"
-                      "com.informatimago.tools.check-asdf")
+                      "com.informatimago.tools.source"
+                      "com.informatimago.tools.summary"
+                      "com.informatimago.tools.symbol"
+                      "com.informatimago.tools.thread"
+                      "com.informatimago.tools.try-systems"
+                      "com.informatimago.tools.undefmethod")
+
+
   #+mocl ("com.informatimago.tools.manifest"
           "com.informatimago.tools.pathname"
           "com.informatimago.tools.symbol")
@@ -108,4 +114,5 @@
   (use-package :com.informatimago.tools.quicklisp)
   (values))

+
 ;;;; THE END ;;;;
diff --git a/tools/com.informatimago.tools.reader-macro.asd b/tools/com.informatimago.tools.reader-macro.asd
index 9636a93..b9cbbac 100644
--- a/tools/com.informatimago.tools.reader-macro.asd
+++ b/tools/com.informatimago.tools.reader-macro.asd
@@ -35,7 +35,7 @@
 (asdf:defsystem "com.informatimago.tools.reader-macro"
   :description "Reader-macro tools."
   :author "Pascal J. Bourguignon"
-  :version "1.0.1"
+  :version "1.0.2"
   :license "GPL3"
   :depends-on ()
   :components ((:file "reader-macro"))
diff --git a/tools/reader-macro.lisp b/tools/reader-macro.lisp
index 4123ab7..1894006 100644
--- a/tools/reader-macro.lisp
+++ b/tools/reader-macro.lisp
@@ -11,6 +11,8 @@
 ;;;;AUTHORS
 ;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
 ;;;;MODIFICATIONS
+;;;;    2015-07-21 <PJB> Renamed all-macro-characters -> list-all-macro-characters.
+;;;;                     changed the tag symbols into keywords.
 ;;;;    2015-04-03 <PJB> Created.
 ;;;;BUGS
 ;;;;LEGAL
@@ -33,7 +35,7 @@
 ;;;;**************************************************************************
 (defpackage "COM.INFORMATIMAGO.TOOLS.READER-MACRO"
   (:use "COMMON-LISP")
-  (:export "ALL-MACRO-CHARACTERS"
+  (:export "LIST-ALL-MACRO-CHARACTERS"
            "REMOVE-ALL-MACRO-CHARACTERS"))
 (in-package "COM.INFORMATIMAGO.TOOLS.READER-MACRO")

@@ -48,7 +50,14 @@ RETURN: READTABLE."
           (set-syntax-from-char ch #\a   readtable))
   readtable)

-(defun all-macro-characters (&optional (*readtable* *readtable*))
+(defun list-all-macro-characters (&optional (*readtable* *readtable*))
+  "
+RETURN: A list of all the macro and dispatch-macro characters in the readtable.
+NOTE:   We have the same function in the com.informatimago.common-lisp.lisp-reader.reader
+        package, working on com.informatimago.common-lisp.lisp-reader.reader:readtable
+        instead of cl:readtable.
+"
+  (check-type *readtable* readtable)
   (loop
     :with result = '()
     :for code :below char-code-limit
@@ -59,59 +68,63 @@ RETURN: READTABLE."
               (if (ignore-errors (progn (get-dispatch-macro-character ch #\a) t))
                   (loop :for code :below char-code-limit
                         :for sub = (code-char code)
-                        :when (and sub (not (and (alpha-char-p sub) (lower-case-p sub))))
-                          :do (when (get-dispatch-macro-character ch sub)
-                                (push (list 'dispatch-macro-character nt ch sub #-(and) (format nil "~C~C" ch sub)) result)))
-                  (push (list 'macro-character nt ch #-(and) (string ch)) result))))
+                        :when (and sub
+                                   (not (and (alpha-char-p sub) (lower-case-p sub)))
+                                   (get-dispatch-macro-character ch sub))
+                          :do (push (list :dispatch-macro-character nt ch sub
+                                          #-(and) (format nil "~C~C" ch sub))
+                                    result))
+                  (push (list :macro-character nt ch
+                              #-(and) (string ch))
+                        result))))
     :finally (return (nreverse result))))


-
 #-(and) (

          ;; (length (all-macro-characters)

-         (map nil 'print (all-macro-characters))
+         (map nil 'print (list-all-macro-characters))

-         (macro-character nil #\")
-         (dispatch-macro-character t #\# #\Null)
-         (dispatch-macro-character t #\# #\Tab)
-         (dispatch-macro-character t #\# #\Newline)
-         (dispatch-macro-character t #\# #\Page)
-         (dispatch-macro-character t #\# #\Return)
-         (dispatch-macro-character t #\# #\ )
-         (dispatch-macro-character t #\# #\#)
-         (dispatch-macro-character t #\# #\$)
-         (dispatch-macro-character t #\# #\&)
-         (dispatch-macro-character t #\# #\')
-         (dispatch-macro-character t #\# #\()
-         (dispatch-macro-character t #\# #\))
-         (dispatch-macro-character t #\# #\*)
-         (dispatch-macro-character t #\# #\+)
-         (dispatch-macro-character t #\# #\-)
-         (dispatch-macro-character t #\# #\.)
-         (dispatch-macro-character t #\# #\:)
-         (dispatch-macro-character t #\# #\<)
-         (dispatch-macro-character t #\# #\=)
-         (dispatch-macro-character t #\# #\>)
-         (dispatch-macro-character t #\# #\A)
-         (dispatch-macro-character t #\# #\B)
-         (dispatch-macro-character t #\# #\C)
-         (dispatch-macro-character t #\# #\O)
-         (dispatch-macro-character t #\# #\P)
-         (dispatch-macro-character t #\# #\R)
-         (dispatch-macro-character t #\# #\S)
-         (dispatch-macro-character t #\# #\X)
-         (dispatch-macro-character t #\# #\\)
-         (dispatch-macro-character t #\# #\_)
-         (dispatch-macro-character t #\# #\|)
-         (dispatch-macro-character t #\# #\Latin_Capital_Letter_E_With_Circumflex)
-         (macro-character nil #\')
-         (macro-character nil #\()
-         (macro-character nil #\))
-         (macro-character nil #\,)
-         (macro-character nil #\;)
-         (macro-character nil #\`)
+         (:macro-character nil #\")
+         (:dispatch-macro-character t #\# #\Null)
+         (:dispatch-macro-character t #\# #\Tab)
+         (:dispatch-macro-character t #\# #\Newline)
+         (:dispatch-macro-character t #\# #\Page)
+         (:dispatch-macro-character t #\# #\Return)
+         (:dispatch-macro-character t #\# #\ )
+         (:dispatch-macro-character t #\# #\#)
+         (:dispatch-macro-character t #\# #\$)
+         (:dispatch-macro-character t #\# #\&)
+         (:dispatch-macro-character t #\# #\')
+         (:dispatch-macro-character t #\# #\()
+         (:dispatch-macro-character t #\# #\))
+         (:dispatch-macro-character t #\# #\*)
+         (:dispatch-macro-character t #\# #\+)
+         (:dispatch-macro-character t #\# #\-)
+         (:dispatch-macro-character t #\# #\.)
+         (:dispatch-macro-character t #\# #\:)
+         (:dispatch-macro-character t #\# #\<)
+         (:dispatch-macro-character t #\# #\=)
+         (:dispatch-macro-character t #\# #\>)
+         (:dispatch-macro-character t #\# #\A)
+         (:dispatch-macro-character t #\# #\B)
+         (:dispatch-macro-character t #\# #\C)
+         (:dispatch-macro-character t #\# #\O)
+         (:dispatch-macro-character t #\# #\P)
+         (:dispatch-macro-character t #\# #\R)
+         (:dispatch-macro-character t #\# #\S)
+         (:dispatch-macro-character t #\# #\X)
+         (:dispatch-macro-character t #\# #\\)
+         (:dispatch-macro-character t #\# #\_)
+         (:dispatch-macro-character t #\# #\|)
+         (:dispatch-macro-character t #\# #\Latin_Capital_Letter_E_With_Circumflex)
+         (:macro-character nil #\')
+         (:macro-character nil #\()
+         (:macro-character nil #\))
+         (:macro-character nil #\,)
+         (:macro-character nil #\;)
+         (:macro-character nil #\`)


          )
ViewGit