From fd376f92536a7a1d8016292f5dbbab9e5af964e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Tue, 15 Oct 2024 12:23:57 -0300 Subject: Simplify sweep condition --- base.lisp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/base.lisp b/base.lisp index 2a80086..a5d8b9d 100644 --- a/base.lisp +++ b/base.lisp @@ -26,9 +26,11 @@ (let ((next-parser (funcall f nil input)) (inner-limit -1)) (do ((sweep-input input (advance sweep-input))) - ((or (not (has-data? sweep-input)) - (and limit (> (cursor-distance sweep-input input) limit)) - (> inner-limit -1)) nil) + ((or (if limit + (> (cursor-distance sweep-input input) limit) + (not (has-data? sweep-input))) + (> inner-limit -1)) + nil) (when (lazy-parsing-p (funcall next-parser sweep-input :lazy t)) (setf inner-limit (cursor-distance sweep-input input)) (when limit (decf limit inner-limit)))) -- cgit v1.2.3