it works, but if I use another read-macro inside my read-macro it can happen, that the other read-macro reads the commas first, and throws an error. how can I change this behavior
this is my macro definition:
Code: Select all
(defun stream-replace (new &optional (stream *standard-input*))
(case (peek-char t stream t)
(#\,
(read-char stream t)
(let1 element (read stream t)
(list element new)))
(#\(
(read-char stream t)
(do ((list nil (cons (stream-replace new stream) list)))
((eq (peek-char t stream t) #\) ) (progn (read-char stream t) (reverse list)))))
(otherwise
(read stream t))))
(set-macro-character #\@ (lambda (stream char)
(declare (ignore char))
(let1 comma (get-macro-character #\,)
(set-syntax-from-char #\, #\x)
(stream-replace (read stream t) stream)
(set-macro-character #\, comma))))