We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d29d318 commit 1f04286Copy full SHA for 1f04286
src/main/scala/parsley/combinator.scala
@@ -33,7 +33,7 @@ object combinator {
33
}
34
35
/**`decide(p, q)` removes the option from inside parser `p`, if it returned `None` then `q` is executed.*/
36
- def decide[A](p: =>Parsley[Option[A]], q: =>Parsley[A]): Parsley[A] = decide(p).orElse(q)
+ def decide[A](p: =>Parsley[Option[A]], q: =>Parsley[A]): Parsley[A] = select(p.map(_.toRight(())), q.map(x => (_: Unit) => x))
37
38
/**optional(p) tries to apply parser `p`. It will parse `p` or nothing. It only fails if `p`
39
* fails after consuming input. It discards the result of `p`.*/
0 commit comments