Only expose `if_eos`

Signed-off-by: Etienne Millon <me@emillon.org>
This commit is contained in:
Etienne Millon 2018-07-31 13:07:07 +02:00 committed by Etienne Millon
parent 6298d283ba
commit 6ed0b1b498
2 changed files with 18 additions and 19 deletions

View File

@ -130,22 +130,22 @@ include Sub_system.Register_end_point(
open Stanza.Of_sexp open Stanza.Of_sexp
let parse = let parse =
eos >>= function if_eos
| true -> loc >>| empty ~then_:(loc >>| empty)
| false -> ~else_:
record (record
(let%map loc = loc (let%map loc = loc
and deps = field "deps" (list Dep_conf.t) ~default:[] and deps = field "deps" (list Dep_conf.t) ~default:[]
and flags = Ordered_set_lang.Unexpanded.field "flags" and flags = Ordered_set_lang.Unexpanded.field "flags"
and backend = field_o "backend" (located string) and backend = field_o "backend" (located string)
and libraries = field "libraries" (list (located string)) ~default:[] and libraries = field "libraries" (list (located string)) ~default:[]
in in
{ loc { loc
; deps ; deps
; flags ; flags
; backend ; backend
; libraries ; libraries
}) }))
end end
let gen_rules c ~(info:Info.t) ~backends = let gen_rules c ~(info:Info.t) ~backends =

View File

@ -117,9 +117,8 @@ module Of_sexp : sig
(** Return the location of the list currently being parsed. *) (** Return the location of the list currently being parsed. *)
val loc : (Loc.t, _) parser val loc : (Loc.t, _) parser
(** End of sequence condition. Returns [true] iff they are no more (** End of sequence condition. Uses [then_] if there are no more
S-expressions to parse *) S-expressions to parse, [else_] otherwise. *)
val eos : (bool, _) parser
val if_eos : then_:('a, 'b) parser -> else_:('a, 'b) parser -> ('a, 'b) parser val if_eos : then_:('a, 'b) parser -> else_:('a, 'b) parser -> ('a, 'b) parser
(** If the next element of the sequence is a list, parse it with (** If the next element of the sequence is a list, parse it with