Skip to content

Commit

Permalink
Merge pull request #219 from dialohq/skip-many-tail-recursive
Browse files Browse the repository at this point in the history
Make `skip_many` tail-recursive
  • Loading branch information
seliopou committed Nov 22, 2023
2 parents 5536d1d + 34ef832 commit aff4665
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/angstrom.ml
Expand Up @@ -521,7 +521,10 @@ let sep_by s p =

let skip_many p =
fix (fun m ->
(p *> m) <|> return ())
((p >>| fun _ -> true) <|> return false) >>= function
| true -> m
| false -> return ()
)

let skip_many1 p =
p *> skip_many p
Expand Down

0 comments on commit aff4665

Please sign in to comment.