diff options
author | Boutade <thegoofist@protonmail.com> | 2019-05-01 20:22:38 -0500 |
---|---|---|
committer | Boutade <thegoofist@protonmail.com> | 2019-05-01 20:22:38 -0500 |
commit | 7a657a7dfd3ebe86604ec1191c6e7eff4d7150f2 (patch) | |
tree | dca7bd71acdd4ce55cf86ddb8f50849b1fdda1ec | |
parent | c591dafbe1d3378784a0dc3d06358183250b9314 (diff) |
cleanup
-rw-r--r-- | parzival.lisp | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/parzival.lisp b/parzival.lisp index e869006..e841c24 100644 --- a/parzival.lisp +++ b/parzival.lisp @@ -109,31 +109,6 @@ in then. If the parse fails the combinator else is run instead." ;;; The <<PLUS COMBINATOR is vital, and gives us amazing powers to choose our ;;; own future! This section defines <<plus and uses it to define some nice utilities. - -;;; TODO - what could make this more efficient is if there was some kind of -;;; "cleanup stream" function that would search for the smallest safe stream -;;; abstraction to return in case of a success. Call it instead of -;;; recover-source. -;; (defun <<plus (parser1 parser2) -;; "Introduces a choice between two parsers. If PARSER1 succeeds then its result -;; is used. If PARSER1 fails then the stream is rewound and tried again with -;; PARSER2." -;; (lambda (stream2) -;; ;; we need stream2 to rewind from in case of failure -;; (let ((stream2 (replay-on stream1))) -;; (<<if (result parser1 stream2) -;; ;; stream3 is whatever parser1 has created, it might be anything -;; (lambda (stream3) -;; (funcall (<<result result) -;; ;; to save memory when possible, we recover the -;; ;; underlying stream. Only safe to do when stream3 IS stream2 -;; (if (eq stream3 stream2) -;; (recover-source stream2) ;; a.k.a. stream1 -;; stream3))) -;; (lambda (stream3) -;; ;; in case of failure, we rewind from stream2 and try anew. -;; (funcall parser2 (rewind stream2))))))) - (defun <<plus (parser1 parser2) (lambda (stream) (let ((chkpt (checkpoint stream))) |