summaryrefslogtreecommitdiff
path: root/input.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'input.lisp')
-rw-r--r--input.lisp11
1 files changed, 9 insertions, 2 deletions
diff --git a/input.lisp b/input.lisp
index d88d14d..dcea8f6 100644
--- a/input.lisp
+++ b/input.lisp
@@ -1,4 +1,4 @@
-(in-package #:input)
+(in-package #:monparser)
(defclass input ()
((cursor :initarg :cursor :accessor cursor :initform 0)
@@ -28,8 +28,15 @@
(defun from-string (str)
(make-instance 'input :data str))
+(defun read-file (path)
+ (with-open-file (file path)
+ (let* ((size (file-length file))
+ (buf (make-string size)))
+ (read-sequence buf file)
+ buf)))
+
(defun from-file (filename)
- (make-instance 'input :file filename :data (str:read-file filename)))
+ (make-instance 'input :file filename :data (read-file filename)))
(defun line-and-column (input)
(let ((line 1) (column 1))