summaryrefslogtreecommitdiff
path: root/cl-forth.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'cl-forth.lisp')
-rw-r--r--cl-forth.lisp18
1 files changed, 14 insertions, 4 deletions
diff --git a/cl-forth.lisp b/cl-forth.lisp
index ec2a0f3..b0bcdbd 100644
--- a/cl-forth.lisp
+++ b/cl-forth.lisp
@@ -20,9 +20,13 @@
(iter (for ch = (read-char stream))
(cond ((char= ch #\")
(finish))
- ((and (char= ch #\\) (char= (peek-char nil stream) #\n))
- (read-char stream)
- (write-char #\Newline str))
+ ((char= ch #\\)
+ (case (peek-char nil stream)
+ (#\n (write-char #\Newline str))
+ (#\0 (write-char (code-char 0) str))
+ (#\\ (write-char #\\ str))
+ (#\" (write-char #\" str)))
+ (read-char stream))
(t (write-char ch str))))))
(defun read-character (stream line-num line col)
@@ -214,11 +218,17 @@
((eq :son (car tok)) (reverse makrodef))
(push tok makrodef)))))
+(defun find-library (name)
+ (or (probe-file (merge-pathnames name sb-ext:*core-pathname*))
+ (probe-file (merge-pathnames name (from-root "test/")))
+ (probe-file (merge-pathnames name (from-root "lib/")))
+ (error "library ~a could not be found." name)))
+
(defmethod parse-op ((parser parser) token (id (eql :kütüphane)))
"Library and the executable must be in the same location, no other search is made currently."
(let ((file (car (read-token parser))))
(setf (tokens parser)
- (append (lex-file (merge-pathnames file sb-ext:*core-pathname*))
+ (append (lex-file (find-library file))
(tokens parser)))))
(defun parse-tokens (tokens)