summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parser-combinators.scm13
1 files changed, 7 insertions, 6 deletions
diff --git a/parser-combinators.scm b/parser-combinators.scm
index 1b8c960..27fa176 100644
--- a/parser-combinators.scm
+++ b/parser-combinators.scm
@@ -36,7 +36,6 @@
parse-success?
%parse-failure
parse-fail
- parse-end
parse-bind
parse-return
parse-lift
@@ -46,6 +45,7 @@
parse-match
parse-any
parse-each
+ parse-end
parse-zero-or-more
parse-one-or-more
parse-up-to
@@ -83,11 +83,6 @@
"Always fail to parse STREAM."
%parse-failure)
-(define (parse-end stream)
- (if (stream-null? stream)
- (parse-result #t stream-null)
- %parse-failure))
-
(define (parse-bind proc parser)
(lambda (stream)
(match (parser stream)
@@ -176,6 +171,12 @@ parsers succeed."
all of the input parsers succeed."
(%parse-each (delay parser) ...))
+(define (parse-end stream)
+ "Succeed with #t if STREAM is emtpy or fail otherwise."
+ (if (stream-null? stream)
+ (parse-result #t stream-null)
+ %parse-failure))
+
(define (parse-zero-or-more parser)
"Create a parser that applies PARSER as many times as it can before
failing and returns list of the successful parse results."