summaryrefslogtreecommitdiff
path: root/input.lisp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2022-12-06 17:57:26 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2022-12-06 17:57:26 -0300
commit1d6874e060fce727616017f73149bef197f69d7b (patch)
tree0987ddc51920e4a67a5cb36f5b890348789103f5 /input.lisp
parentcdbfa453e870756dc32785b23a934b37e28d071c (diff)
downloadmonparser-1d6874e060fce727616017f73149bef197f69d7b.tar.gz
monparser-1d6874e060fce727616017f73149bef197f69d7b.zip
Fix lookahead input and introduce discarding bind
Diffstat (limited to 'input.lisp')
-rw-r--r--input.lisp6
1 files changed, 3 insertions, 3 deletions
diff --git a/input.lisp b/input.lisp
index 4f803ec..1900459 100644
--- a/input.lisp
+++ b/input.lisp
@@ -6,8 +6,8 @@
(data nil :read-only t))
(defun has-data? (input &optional (window-size 1))
- (< (+ window-size -1 (input-cursor input))
- (length (input-data input))))
+ (<= (+ window-size (input-cursor input))
+ (length (input-data input))))
(defun peek-1 (input)
(char (input-data input)
@@ -16,7 +16,7 @@
(defun peek-n (input window-size)
(subseq (input-data input)
(input-cursor input)
- window-size))
+ (+ window-size (input-cursor input))))
(defun advance (input &optional (amount 1))
(let ((new-input (copy-structure input)))