diff --git a/src/inline_tests.ml b/src/inline_tests.ml index 8f3a1e8a..fa6c64f4 100644 --- a/src/inline_tests.ml +++ b/src/inline_tests.ml @@ -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 = diff --git a/src/stdune/sexp.mli b/src/stdune/sexp.mli index 39096073..0d03211d 100644 --- a/src/stdune/sexp.mli +++ b/src/stdune/sexp.mli @@ -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