-;; Copyright (c) 2003 Nikodemus Siivola
-;;
+;; Copyright (c) 2003, 2011 Nikodemus Siivola <nikodemus@random-state.net>
+;;
;; Permission is hereby granted, free of charge, to any person obtaining
;; a copy of this software and associated documentation files (the
;; "Software"), to deal in the Software without restriction, including
;; distribute, sublicense, and/or sell copies of the Software, and to
;; permit persons to whom the Software is furnished to do so, subject to
;; the following conditions:
-;;
+;;
;; The above copyright notice and this permission notice shall be included
;; in all copies or substantial portions of the Software.
-;;
+;;
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
(handler-case
(linedit:formedit
:prompt1 prompt
- :prompt2 (make-string (length prompt)
+ :prompt2 (make-string (length prompt)
:initial-element #\Space))
(end-of-file (e)
(if eof-quits
;; Hackins, I know.
"#.''end-of-file"))))))
(setf sb-int:*repl-prompt-fun* (constantly ""))
- (setf sb-int:*repl-read-form-fun*
+ (setf sb-int:*repl-read-form-fun*
(if wrap-current
(lambda (in out)
(declare (type stream out in))
;; FIXME: Yich.
(terpri)
- (with-input-from-string (in (meta-escape (repl-reader in out)))
+ (with-input-from-string (in (repl-reader in out))
(funcall read-form-fun in out)))
(lambda (in out)
(declare (type stream out in))
(handler-case (read-from-string (repl-reader in out))
- (end-of-file ()
+ (end-of-file ()
;; We never get here if eof-quits is true, so...
(fresh-line)
(write-line "#<end-of-file>")
"Like min, except ignores NILs."
(apply #'min (remove-if #'null args)))
-(defun meta-escape (string)
- (declare (simple-string string))
- (let (stack)
- (loop with last
- for i from 1 upto (length string)
- for char across string
- ;; KLUDGE: Deal with character literals. Not quite sure this is
- ;; the right and robust way to do it, though.
- when (and (eql #\\ char) (not (eql #\# last)))
- do (push #\\ stack)
- do (push char stack)
- (setf last char))
- (coerce (nreverse stack) 'simple-string)))
-
(defun eof-handler (lisp-name quit-fn)
(handler-case
(loop