Skip to content

Commit

Permalink
Fix bug in execute bind
Browse files Browse the repository at this point in the history
When last q-parse-result fails, it was possible for there to be no p-parse-result and empty
q-parse-result, and unless clause failed.
  • Loading branch information
Ramarren committed Oct 24, 2008
1 parent d1344aa commit 0522d8f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions combinators.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#'(lambda ()
(let ((result nil))
(iter (when q-parse-result (setf result (next-result q-parse-result)))
(until (or result
(and (null p-parse-result)
(null q-parse-result))))
(unless result
(setf q-parse-result
(let ((p-next-result
Expand All @@ -20,10 +23,7 @@
(let ((v (tree-of p-next-result))
(inp-prime (suffix-of p-next-result)))
(funcall (force (funcall parser-promise-generator v)) inp-prime))
(setf p-parse-result nil)))))
(until (or result
(and (null p-parse-result)
(null q-parse-result)))))
(setf p-parse-result nil))))))
result))))

(defmacro bind (parser-promise parser-promise-generator) ; results in parser-promise
Expand Down

0 comments on commit 0522d8f

Please sign in to comment.