diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2024-10-02 22:06:16 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2024-10-02 22:06:16 -0300 |
commit | 33518551e019f4dab7d95c9390c66b6b8b2339f2 (patch) | |
tree | 7c21f5ce849154579ba6ff295613917f7f186685 /input.lisp | |
parent | aabcaf712f67ac88ec8bd32b5477f17c1a182080 (diff) | |
download | monparser-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.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)) |