Last active
April 15, 2022 20:30
-
-
Save cwfoo/2a03a1db0b9c1bdfc17b3da2b50f5d59 to your computer and use it in GitHub Desktop.
Reader macro that implements Scheme's SRFI 62 S-expression comments in Common Lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; Reader macro that implements Scheme's SRFI 62 S-expression comments in Common Lisp. | |
;;;; SRFI 62: https://srfi.schemers.org/srfi-62/srfi-62.html | |
;;;; Adapted from: https://stackoverflow.com/questions/69248229/reads-recursive-p-argument-when-used-inside-a-reader-macro | |
(eval-when (:compile-toplevel :load-toplevel :execute) | |
(set-dispatch-macro-character #\# #\; | |
(lambda (stream char n) | |
(declare (ignore char)) | |
(when n | |
(error "No number allowed between # and ;")) | |
(read stream t nil t) ; Discard the S-expression. | |
(values)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment