summaryrefslogtreecommitdiff
path: root/input.lisp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2024-10-02 22:06:16 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2024-10-02 22:06:16 -0300
commit33518551e019f4dab7d95c9390c66b6b8b2339f2 (patch)
tree7c21f5ce849154579ba6ff295613917f7f186685 /input.lisp
parentaabcaf712f67ac88ec8bd32b5477f17c1a182080 (diff)
downloadmonparser-33518551e019f4dab7d95c9390c66b6b8b2339f2.tar.gz
monparser-33518551e019f4dab7d95c9390c66b6b8b2339f2.zip
Move the project into a new path of breadth first parsing
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))