From: Lynn W. <owi...@in...> - 2006-12-16 05:17:13
|
I'm using SBCL 0.9.18. Can anyone confirm that the following code leads to an error? I was also redefining #\( and #\;, but the error seems to correspond only to redefining linefeed. [I'm trying to write a program to map source code comments to the defined names/types which they describe]. Thanks, Lynn (defvar cataloging-readtable nil) (defun read-newline (stream ignore) (declare (ignore ignore)) (declare (ignore stream)) (values)) (defun init-comment-cataloging-readtable () (setq cataloging-readtable (copy-readtable nil)) (set-syntax-from-char #\linefeed #\; cataloging-readtable cataloging-readtable) (set-macro-character #\linefeed #'read-newline cataloging-readtable cataloging-readtable) ) (defun cataloging-read (stream) (let ((rt *readtable*) (result nil)) (setq *readtable* cataloging-readtable) (unwind-protect (setq result (read stream nil :eof nil)) (setq *readtable* rt) result))) (init-comment-cataloging-readtable) (cataloging-read *standard-input*) ooooo ====> READER-ERROR on #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}>: invalid constituent [Condition of type READER-ERROR] Restarts: 0: [ABORT-REQUEST] Abort handling SLIME request. 1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" {AA0E7E9}>) Backtrace: 0: (SB-IMPL::%READER-ERROR #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}> "invalid constituent") Locals: SB-DEBUG::ARG-0 = 2 SB-DEBUG::ARG-1 = #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}> SB-DEBUG::ARG-2 = "invalid constituent" 1: (SB-IMPL::READ-TOKEN #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}> #\o) Locals: SB-DEBUG::ARG-0 = 2 SB-DEBUG::ARG-1 = #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}> SB-DEBUG::ARG-2 = #\o 2: (READ-PRESERVING-WHITESPACE #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}> NIL :EOF T) Locals: SB-IMPL::EOF-ERROR-P = NIL SB-IMPL::EOF-VALUE = :EOF SB-IMPL::RECURSIVEP = T STREAM = #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}> 3: (READ-PRESERVING-WHITESPACE #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}> NIL :EOF NIL) Locals: SB-IMPL::EOF-ERROR-P = NIL SB-IMPL::EOF-VALUE = :EOF SB-IMPL::RECURSIVEP = NIL STREAM = #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}> 4: (READ #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}> NIL :EOF NIL) Locals: SB-IMPL::EOF-ERROR-P = NIL SB-IMPL::EOF-VALUE = :EOF SB-IMPL::RECURSIVEP = NIL STREAM = #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}> 5: (CATALOGING-READ #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}>) Locals: SB-DEBUG::ARG-0 = #<SWANK-BACKEND::SLIME-INPUT-STREAM {A9FF1D1}> |