Skip to content

Commit

Permalink
Handle the case of missing packages when parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
eschulte committed Sep 12, 2019
1 parent d425a95 commit 3fdcd50
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions software/lisp.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,30 @@
(make-instance 'skipped-input-result
:reason reason :start (car source) :end (cdr source)))

(defmethod eclector.reader:interpret-symbol
((client client) input-stream package-indicator symbol-name internp)
(let ((package (case package-indicator
(:current *package*)
(:keyword (find-package "KEYWORD"))
(t (or (find-package package-indicator)
;; Return a fake package for missing packages.
(find-package :missing)
(make-package :missing))))))
(if internp
(intern symbol-name package)
(multiple-value-bind (symbol status)
(find-symbol symbol-name package)
(cond ((null status)
(eclector.base::%reader-error input-stream 'symbol-does-not-exist
:package package
:symbol-name symbol-name))
((eq status :internal)
(eclector.base::%reader-error input-stream 'symbol-is-not-external
:package package
:symbol-name symbol-name))
(t
symbol))))))

(defun read-forms+ (string &key count)
(check-type count (or null integer))
(let ((*string* string)
Expand Down

0 comments on commit 3fdcd50

Please sign in to comment.