diff options
Diffstat (limited to 'input.lisp')
-rw-r--r-- | input.lisp | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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)) |