summaryrefslogtreecommitdiff
path: root/parser.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'parser.lisp')
-rw-r--r--parser.lisp8
1 files changed, 6 insertions, 2 deletions
diff --git a/parser.lisp b/parser.lisp
index bfe2614..d22ae81 100644
--- a/parser.lisp
+++ b/parser.lisp
@@ -40,6 +40,10 @@
:message (format nil "Didn't reach expected limit: ~a." limit))
(make-parsing :tree tree :left input))))
+(defun fail (message)
+ (lambda (input &key limit lazy)
+ (make-failure :place input :message message)))
+
(defun bind (p f &key (greedy t))
(lambda (input &key limit lazy)
(let (r)
@@ -165,7 +169,7 @@
(defun many (p)
(comp ((x p)
(xs (if (not x)
- (error "Cannot define (many (optional x)). Use (optional (many x)) instead.")
+ (fail "Parsing result is empty.")
(optional (many p)))))
(cons x xs)))
@@ -191,7 +195,7 @@
(comp ((v p)
(sep (optional separator))
(vn (if sep
- (crit (separated-list p separator))
+ (separated-list p separator)
nothing)))
(if include-separator
(cons v (cons sep vn))