diff options
author | David Thompson <davet@gnu.org> | 2015-08-10 15:47:11 -0400 |
---|---|---|
committer | David Thompson <davet@gnu.org> | 2015-08-10 15:47:11 -0400 |
commit | f7fbfe2c91cb614a021440ae40378d3e95170d89 (patch) | |
tree | 210748aef1ab28625d47d34ef0e674aa30793cbc | |
parent | 84a4d4b68ebd5d1f9a7ed7fd50b813327e416061 (diff) |
Re-organize.
-rw-r--r-- | parser-combinators.scm | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/parser-combinators.scm b/parser-combinators.scm index a92cd72..4a3a3f8 100644 --- a/parser-combinators.scm +++ b/parser-combinators.scm @@ -113,13 +113,6 @@ (loop rest)) (result result))))))) -;; This is a special form due to the lazy evaluation used to handle -;; right recursive grammars. -(define-syntax-rule (parse-any parser ...) - "Create a disjunctive parser that succeeds if any of the input -parsers succeed." - (%parse-any (delay parser) ...)) - (define (%parse-each . parsers) (lambda (stream) (let loop ((stream stream) @@ -133,6 +126,13 @@ parsers succeed." (($ <parse-result> value stream) (loop stream rest (cons value result))))))))) +;; parse-any and parse-seach are special forms to abstract the lazy +;; evaluation used to handle right recursive grammars. +(define-syntax-rule (parse-any parser ...) + "Create a disjunctive parser that succeeds if any of the input +parsers succeed." + (%parse-any (delay parser) ...)) + (define-syntax-rule (parse-each parser ...) (%parse-each (delay parser) ...)) |