Add Sexp.Of_sexp.capture
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
parent
ff46b30a78
commit
2d1765285a
|
@ -199,6 +199,12 @@ module Of_sexp = struct
|
||||||
let ctx = Values (Ast.loc sexp, None, context) in
|
let ctx = Values (Ast.loc sexp, None, context) in
|
||||||
result ctx (t ctx [sexp])
|
result ctx (t ctx [sexp])
|
||||||
|
|
||||||
|
let capture ctx state =
|
||||||
|
let f t =
|
||||||
|
result ctx (t ctx state)
|
||||||
|
in
|
||||||
|
(f, [])
|
||||||
|
|
||||||
let end_of_list (Values (loc, cstr, _)) =
|
let end_of_list (Values (loc, cstr, _)) =
|
||||||
match cstr with
|
match cstr with
|
||||||
| None ->
|
| None ->
|
||||||
|
|
|
@ -122,6 +122,9 @@ module Of_sexp : sig
|
||||||
until the end of sequence is reached. *)
|
until the end of sequence is reached. *)
|
||||||
val repeat : 'a t -> 'a list t
|
val repeat : 'a t -> 'a list t
|
||||||
|
|
||||||
|
(** Capture the rest of the input for later parsing *)
|
||||||
|
val capture : ('a t -> 'a) t
|
||||||
|
|
||||||
(** [enter t] expect the next element of the input to be a list and
|
(** [enter t] expect the next element of the input to be a list and
|
||||||
parse its contents with [t]. *)
|
parse its contents with [t]. *)
|
||||||
val enter : 'a t -> 'a t
|
val enter : 'a t -> 'a t
|
||||||
|
|
Loading…
Reference in New Issue