diff --git a/src/jbuild.ml b/src/jbuild.ml index db050cb4..ec76cdc2 100644 --- a/src/jbuild.ml +++ b/src/jbuild.ml @@ -264,8 +264,10 @@ module Named = struct peek_exn >>= function | List (_, Atom (loc, A s) :: _) when String.length s > 1 && s.[0] = ':' -> - binding elem >>| fun (name, values) -> - Left (name, (loc, values)) + let name = String.sub s ~pos:1 ~len:(String.length s - 1) in + enter (junk >>= fun () -> + repeat elem >>| fun values -> + Left (name, (loc, values))) | _ -> elem >>| fun elem -> Right elem in diff --git a/src/stdune/sexp.ml b/src/stdune/sexp.ml index 651e4688..01134809 100644 --- a/src/stdune/sexp.ml +++ b/src/stdune/sexp.ml @@ -380,26 +380,6 @@ module Of_sexp = struct } "Unknown constructor %s" name - let binding t = - let t name = repeat t >>| fun t -> (name, t) in - next_with_user_context (fun uc sexp -> - match sexp with - | Atom (loc, A s) -> - let ctx = Values (loc, Some s, uc) in - result ctx (t s ctx []) - | Template { loc; _ } - | Quoted_string (loc, _) -> - of_sexp_error loc "Atom expected" - | List (loc, []) -> - of_sexp_error loc "Non-empty list expected" - | List (loc, name :: args) -> - match name with - | Quoted_string (loc, _) | List (loc, _) | Template { loc; _ } -> - of_sexp_error loc "Atom expected" - | Atom (s_loc, A s) -> - let ctx loc = Values (loc, Some s, uc) in - result (ctx s_loc) (t s (ctx loc) args)) - let sum cstrs = next_with_user_context (fun uc sexp -> match sexp with diff --git a/src/stdune/sexp.mli b/src/stdune/sexp.mli index de2aa7ee..948a3d80 100644 --- a/src/stdune/sexp.mli +++ b/src/stdune/sexp.mli @@ -201,8 +201,6 @@ module Of_sexp : sig list parser. *) val sum : (string * 'a t) list -> 'a t - val binding : 'a t -> (string * ('a list)) t - (** Check the result of a list parser, and raise a properly located error in case of failure. *) val map_validate