From 33518551e019f4dab7d95c9390c66b6b8b2339f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Wed, 2 Oct 2024 22:06:16 -0300 Subject: Move the project into a new path of breadth first parsing --- input.lisp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'input.lisp') 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)) -- cgit v1.2.3