Add Sexp.kind
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
parent
43f274b323
commit
3c15e3d041
|
@ -508,6 +508,16 @@ module Of_sexp = struct
|
|||
(x, [])
|
||||
|
||||
let record t = enter (fields t)
|
||||
|
||||
type kind =
|
||||
| Values of Loc.t * string option
|
||||
| Fields of Loc.t * string option
|
||||
|
||||
let kind : type k. k context -> k -> kind * k
|
||||
= fun ctx state ->
|
||||
match ctx with
|
||||
| Values (loc, cstr, _) -> (Values (loc, cstr), state)
|
||||
| Fields (loc, cstr, _) -> (Fields (loc, cstr), state)
|
||||
end
|
||||
|
||||
module type Sexpable = sig
|
||||
|
|
|
@ -118,6 +118,14 @@ module Of_sexp : sig
|
|||
S-expressions to parse *)
|
||||
val eos : (bool, _) parser
|
||||
|
||||
(** What is currently being parsed. The second argument is the atom
|
||||
at the beginnig of the list when inside a [sum ...] or [field
|
||||
...]. *)
|
||||
type kind =
|
||||
| Values of Loc.t * string option
|
||||
| Fields of Loc.t * string option
|
||||
val kind : (kind, _) parser
|
||||
|
||||
(** [repeat t] use [t] to consume all remaning elements of the input
|
||||
until the end of sequence is reached. *)
|
||||
val repeat : 'a t -> 'a list t
|
||||
|
|
Loading…
Reference in New Issue