Skip to content

Commit

Permalink
Make skip_many tail-recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
quernd committed Nov 13, 2021
1 parent 5536d1d commit 34ef832
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/angstrom.ml
Original file line number Diff line number Diff line change
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 34ef832

Please sign in to comment.