[slime-devel] broken clojure REPL
Terje Norderhaug
terje at in-progress.com
Thu Jan 14 00:10:01 UTC 2010
A main reason for swank messages to encode some symbols as strings
has been differences in how lisps escape characters in symbols. I
suggest we formalize the symbol syntax in such a way that we no
longer have to encode symbols as strings in swank messages. Just
agreeing on using a backslash will do.
On Jan 10, 2010, at 12:15 AM, Helmut Eller wrote:
> * Terje Norderhaug [2010-01-09 22:52+0100] writes:
>> Now that there are multiple clients and servers, I think it is time
>> that we formalize the lisp syntax of the messages in the swank
>> protocol. It should be simple, limited to a subset of what is allowed
>> by Common Lisp... something parseable with say less than a page of
>> lisp code.
>
> Here's a one page reader:
>
> (defun simple-read ()
> (let ((c (read-char)))
> (case c
> (#\" (with-output-to-string (*standard-output*)
> (loop for c = (read-char) do
> (case c
> (#\" (return))
> (#\\ (write-char (read-char)))
> (t (write-char c))))))
> (#\( (loop collect (simple-read)
> while (ecase (read-char)
> (#\) nil)
> (#\space t))))
> (#\' `(quote ,(simple-read)))
> (t (let ((string (with-output-to-string (*standard-output*)
> (loop for ch = c then (read-char nil nil) do
> (case ch
> ((nil) (return))
> ((#\space #\)) (unread-char ch)
> (return))
> (t (write-char ch)))))))
> (cond ((digit-char-p (aref string 0)) (parse-integer
> string))
> ((intern string))))))))
-- Terje Norderhaug
terje at in-progress.com
More information about the slime-devel
mailing list