feat: add sepby1 combinator
`sepby1` is a common reusable combinator in Haskell Parsec. This adds `mpc_sepby1(mpc_fold_t f, mpc_parser_t *sep, mpc_parser_t *a)` according to Haskell's implementation: https://hackage.haskell.org/package/parsec-3.1.16.1/docs/src/Text.Parsec.Combinator.html#sepBy1 Reuses existing `mpc_and`, `mpc_many`, and `mpcf_snd_free`.
This commit is contained in:
@@ -356,6 +356,14 @@ Runs `a` one or more times until it fails. Results are combined with fold functi
|
||||
|
||||
* * *
|
||||
|
||||
```c
|
||||
mpc_parser_t *mpc_sepby1(mpc_fold_t f, mpc_parser_t *sep, mpc_parser_t *a);
|
||||
```
|
||||
|
||||
Runs `a` one or more times, separated by `sep`. Results are combined with fold function `f`.
|
||||
|
||||
* * *
|
||||
|
||||
```c
|
||||
mpc_parser_t *mpc_count(int n, mpc_fold_t f, mpc_parser_t *a, mpc_dtor_t da);
|
||||
```
|
||||
|
Reference in New Issue
Block a user