[slime-devel] reader macros get EOF

Pascal J.Bourguignon pjb at informatimago.com
Fri Dec 10 04:20:37 UTC 2004


Assuming this reader macro in clisp\slime:

(SET-DISPATCH-MACRO-CHARACTER
    (CHARACTER "#") (CHARACTER "!")
  (LAMBDA (STREAM CHAR ARG)
    (DECLARE (IGNORE CHAR ARG))
    ;; read characters up to the first occurence of "!#",
    ;; and return the string read.
    (loop for curr = (read-char stream nil nil t)
          while (and curr
                     (or (char/= (character "!") curr)
                         (char/= (character "#") 
                                 (peek-char nil stream nil nil t))))
          collect curr into str
          finally (read-char stream nil nil t)
          (return (coerce str 'string)))))


Typing: 

   #! hello RET

returns:

    " hello
    "

instead of waiting for further input.

With clisp\xterm this works as expected:

    #! hello RET

waits for further input:

    the last line !# RET

returns:

    " hello
    the last line "

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.




More information about the slime-devel mailing list