Simplify Dep_conf.t

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
Jeremie Dimino 2018-07-09 18:47:55 +01:00 committed by Rudi Grinberg
parent 0b2bda03ed
commit eb68a9067d
1 changed files with 21 additions and 23 deletions

View File

@ -299,31 +299,29 @@ module Dep_conf = struct
| Package of String_with_vars.t | Package of String_with_vars.t
| Universe | Universe
let dep_cons = let t =
let sw = String_with_vars.t in let t =
[ "file" , (sw >>| fun x -> File x) let sw = String_with_vars.t in
; "alias" , (sw >>| fun x -> Alias x) sum
; "alias_rec" , (sw >>| fun x -> Alias_rec x) [ "file" , (sw >>| fun x -> File x)
; "glob_files" , (sw >>| fun x -> Glob_files x) ; "alias" , (sw >>| fun x -> Alias x)
; "package" , (sw >>| fun x -> Package x) ; "alias_rec" , (sw >>| fun x -> Alias_rec x)
; "universe" , return Universe ; "glob_files" , (sw >>| fun x -> Glob_files x)
; "files_recursively_in", ; "package" , (sw >>| fun x -> Package x)
(Syntax.renamed_in Stanza.syntax (1, 0) ~to_:"source_tree" ; "universe" , return Universe
>>= fun () -> ; "files_recursively_in",
sw >>| fun x -> Source_tree x) (Syntax.renamed_in Stanza.syntax (1, 0) ~to_:"source_tree"
; "source_tree", >>= fun () ->
(Syntax.since Stanza.syntax (1, 0) >>= fun () -> sw >>| fun x -> Source_tree x)
sw >>| fun x -> Source_tree x) ; "source_tree",
] (Syntax.since Stanza.syntax (1, 0) >>= fun () ->
sw >>| fun x -> Source_tree x)
let make_dep_parser ~single ~many = ]
in
peek_exn >>= function peek_exn >>= function
| Template _ | Atom _ | Quoted_string _ -> | Template _ | Atom _ | Quoted_string _ ->
String_with_vars.t >>| fun x -> single (File x) String_with_vars.t >>| fun x -> File x
| List _ -> many | List _ -> t
let t =
make_dep_parser ~single:(fun x -> x) ~many:(sum dep_cons)
open Sexp open Sexp
let sexp_of_t = function let sexp_of_t = function