Only expose `if_eos`
Signed-off-by: Etienne Millon <me@emillon.org>
This commit is contained in:
parent
6298d283ba
commit
6ed0b1b498
|
@ -130,22 +130,22 @@ include Sub_system.Register_end_point(
|
|||
open Stanza.Of_sexp
|
||||
|
||||
let parse =
|
||||
eos >>= function
|
||||
| true -> loc >>| empty
|
||||
| false ->
|
||||
record
|
||||
(let%map loc = loc
|
||||
and deps = field "deps" (list Dep_conf.t) ~default:[]
|
||||
and flags = Ordered_set_lang.Unexpanded.field "flags"
|
||||
and backend = field_o "backend" (located string)
|
||||
and libraries = field "libraries" (list (located string)) ~default:[]
|
||||
in
|
||||
{ loc
|
||||
; deps
|
||||
; flags
|
||||
; backend
|
||||
; libraries
|
||||
})
|
||||
if_eos
|
||||
~then_:(loc >>| empty)
|
||||
~else_:
|
||||
(record
|
||||
(let%map loc = loc
|
||||
and deps = field "deps" (list Dep_conf.t) ~default:[]
|
||||
and flags = Ordered_set_lang.Unexpanded.field "flags"
|
||||
and backend = field_o "backend" (located string)
|
||||
and libraries = field "libraries" (list (located string)) ~default:[]
|
||||
in
|
||||
{ loc
|
||||
; deps
|
||||
; flags
|
||||
; backend
|
||||
; libraries
|
||||
}))
|
||||
end
|
||||
|
||||
let gen_rules c ~(info:Info.t) ~backends =
|
||||
|
|
|
@ -117,9 +117,8 @@ module Of_sexp : sig
|
|||
(** Return the location of the list currently being parsed. *)
|
||||
val loc : (Loc.t, _) parser
|
||||
|
||||
(** End of sequence condition. Returns [true] iff they are no more
|
||||
S-expressions to parse *)
|
||||
val eos : (bool, _) parser
|
||||
(** End of sequence condition. Uses [then_] if there are no more
|
||||
S-expressions to parse, [else_] otherwise. *)
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue