Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 16 lines (13 sloc) 0.74 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
(in-package #:quickdist-reader)

(defvar *safe-readtable*
  (let ((readtable (copy-readtable *readtable*)))
    (flet ((read* (stream &rest ignore)
             (declare (ignore ignore))
             (safe-read stream nil (values) t)))
      (set-dispatch-macro-character #\# #\. #'read* readtable))
    readtable))

(defun safe-read (&optional (stream *standard-input*) (eof-error-p t) eof-value recursive-p)
  (handler-bind ((symbol-in-missing-package-error (lambda (c) (declare (ignore c)) (invoke-restart 'intern-here)))
                 (symbol-missing-in-package-error (lambda (c) (declare (ignore c)) (invoke-restart 'make-symbol))))
    (let ((*readtable* *safe-readtable*))
      (read stream eof-error-p eof-value recursive-p))))
Something went wrong with that request. Please try again.