Browse Source

fixed reader function

master
Michał Herda 4 years ago
parent
commit
d812135b57
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      pseudonyms.lisp

+ 4
- 3
pseudonyms.lisp View File

@@ -125,18 +125,19 @@ pseudonyms should be printed."
(defun pseudonym-reader (stream char)
"This is the reader macro for local pseudonyms."
(declare (ignore char))
(let* ((table (gethash (package-name *package*) *pseudonym-table*))
(let* ((table (gethash (string-downcase (package-name *package*)) *pseudonym-table*))
(pseudlist (loop for char = (read-char stream)
collect char
until (equal (peek-char nil stream) #\:)))
(pseudonym (string-downcase (concatenate 'string pseudlist)))
(name (string=-getf-key table pseudonym))
(symbol (read stream)))
;;(format t "debug: ~A ~A ~A ~A ~A ~A~%"
;;(string-downcase (package-name *package*))
;;pseudlist pseudonym table name symbol)
(assert (not (null name)) ()
"Pseudonym ~S was not set. Check your spelling or use defpseudonym."
pseudonym)
;;(format t "debug: ~A ~A ~A ~A ~A~%"
;;(package-name *package*) pseudlist pseudonym name symbol)
(read-from-string (format nil "~A:~A" name symbol))))

;; todo: named readtables

Loading…
Cancel
Save