summaryrefslogtreecommitdiff
path: root/input.lisp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2022-12-17 03:48:05 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2022-12-17 03:48:05 -0300
commitf3cc5d4cc7e722e44fe92e63a66983dfb012395c (patch)
treef189bb808b447088e1e7bfe80b44f5a4a4c4032e /input.lisp
parenta484c32ae01c697f002e62d17f513155c1151d60 (diff)
downloadmonparser-f3cc5d4cc7e722e44fe92e63a66983dfb012395c.tar.gz
monparser-f3cc5d4cc7e722e44fe92e63a66983dfb012395c.zip
Add negate operator and polish literals
Diffstat (limited to 'input.lisp')
-rw-r--r--input.lisp20
1 files changed, 4 insertions, 16 deletions
diff --git a/input.lisp b/input.lisp
index 2cdfd84..8b031fd 100644
--- a/input.lisp
+++ b/input.lisp
@@ -9,30 +9,18 @@
(<= (+ window-size (input-cursor input))
(length (input-data input))))
-(defun peek-1 (input)
+(defun prefix? (target input)
+ (string= target (input-data input) :start2 (input-cursor input) :end2 (+ (input-cursor input) (length target))))
+
+(defun peek (input)
(char (input-data input)
(input-cursor input)))
-(defun peek-n (input window-size)
- (subseq (input-data input)
- (input-cursor input)
- (+ window-size (input-cursor input))))
-
-(defun peek-rest (input)
- (subseq (input-data input)
- (input-cursor input)
- (length (input-data input))))
-
(defun advance (input &optional (amount 1))
(let ((new-input (copy-structure input)))
(incf (input-cursor new-input) amount)
new-input))
-(defun advance-to-end (input)
- (let ((new-input (copy-structure input)))
- (setf (input-cursor new-input) (length (input-data input)))
- new-input))
-
(declaim (ftype (function (simple-string) (values input &optional)) from-string))
(defun from-string (str)
(make-input :data str))