Move sexpable to dsexp
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
b34394509a
commit
4ba8f7d225
|
@ -15,9 +15,9 @@ end
|
|||
module Diff_mode = Action_intf.Diff_mode
|
||||
|
||||
module Make_ast
|
||||
(Program : Sexp.Sexpable)
|
||||
(Path : Sexp.Sexpable)
|
||||
(String : Sexp.Sexpable)
|
||||
(Program : Dsexp.Sexpable)
|
||||
(Path : Dsexp.Sexpable)
|
||||
(String : Dsexp.Sexpable)
|
||||
(Ast : Action_intf.Ast
|
||||
with type program := Program.t
|
||||
with type path := Path.t
|
||||
|
|
|
@ -72,7 +72,7 @@ module Unexpanded : sig
|
|||
with type path := String_with_vars.t
|
||||
with type string := String_with_vars.t
|
||||
|
||||
include Sexp.Sexpable with type t := t
|
||||
include Dsexp.Sexpable with type t := t
|
||||
|
||||
module Partial : sig
|
||||
include Action_intf.Ast
|
||||
|
|
|
@ -113,8 +113,8 @@ module Dep_conf : sig
|
|||
| Package of String_with_vars.t
|
||||
| Universe
|
||||
|
||||
val t : t Sexp.Of_sexp.t
|
||||
val sexp_of_t : t -> Sexp.t
|
||||
val t : t Dsexp.Of_sexp.t
|
||||
val sexp_of_t : t -> Dsexp.t
|
||||
end
|
||||
|
||||
module Buildable : sig
|
||||
|
@ -170,7 +170,7 @@ module Sub_system_info : sig
|
|||
val syntax : Syntax.t
|
||||
|
||||
(** Parse parameters written by the user in jbuid/dune files *)
|
||||
val parse : t Sexp.Of_sexp.t
|
||||
val parse : t Dsexp.Of_sexp.t
|
||||
end
|
||||
|
||||
module Register(M : S) : sig end
|
||||
|
@ -184,13 +184,13 @@ module Mode_conf : sig
|
|||
| Native
|
||||
| Best (** [Native] if available and [Byte] if not *)
|
||||
|
||||
val t : t Sexp.Of_sexp.t
|
||||
val t : t Dsexp.Of_sexp.t
|
||||
val compare : t -> t -> Ordering.t
|
||||
val pp : Format.formatter -> t -> unit
|
||||
|
||||
module Set : sig
|
||||
include Set.S with type elt = t
|
||||
val t : t Sexp.Of_sexp.t
|
||||
val t : t Dsexp.Of_sexp.t
|
||||
|
||||
(** Both Byte and Native *)
|
||||
val default : t
|
||||
|
@ -260,8 +260,8 @@ module Executables : sig
|
|||
; kind : Binary_kind.t
|
||||
}
|
||||
|
||||
val t : t Sexp.Of_sexp.t
|
||||
val sexp_of_t : t Sexp.To_sexp.t
|
||||
val t : t Dsexp.Of_sexp.t
|
||||
val sexp_of_t : t Dsexp.To_sexp.t
|
||||
|
||||
val exe : t
|
||||
val object_ : t
|
||||
|
@ -391,6 +391,6 @@ module Stanzas : sig
|
|||
: file:Path.t
|
||||
-> kind:File_tree.Dune_file.Kind.t
|
||||
-> Dune_project.t
|
||||
-> Sexp.Ast.t list
|
||||
-> Dsexp.Ast.t list
|
||||
-> t
|
||||
end
|
||||
|
|
|
@ -76,7 +76,7 @@ module Unexpanded : sig
|
|||
type expanded = t
|
||||
type t
|
||||
|
||||
include Sexp.Sexpable with type t := t
|
||||
include Dsexp.Sexpable with type t := t
|
||||
val standard : t
|
||||
|
||||
val field
|
||||
|
|
|
@ -4,3 +4,9 @@ module Io = struct
|
|||
let load ?lexer path ~mode =
|
||||
Io.with_lexbuf_from_file path ~f:(Usexp.Parser.parse ~mode ?lexer)
|
||||
end
|
||||
|
||||
module type Sexpable = sig
|
||||
type t
|
||||
val t : t Of_sexp.t
|
||||
val sexp_of_t : t To_sexp.t
|
||||
end
|
||||
|
|
|
@ -601,9 +601,3 @@ module Of_sexp = struct
|
|||
let const = return
|
||||
end
|
||||
end
|
||||
|
||||
module type Sexpable = sig
|
||||
type t
|
||||
val t : t Of_sexp.t
|
||||
val sexp_of_t : t To_sexp.t
|
||||
end
|
||||
|
|
|
@ -249,9 +249,3 @@ module Of_sexp : sig
|
|||
val const : 'a -> ('a, _) parser
|
||||
end
|
||||
end
|
||||
|
||||
module type Sexpable = sig
|
||||
type t
|
||||
val t : t Of_sexp.t
|
||||
val sexp_of_t : t To_sexp.t
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ module Version : sig
|
|||
[Z <= Y]. *)
|
||||
type t = int * int
|
||||
|
||||
include Sexp.Sexpable with type t := t
|
||||
include Dsexp.Sexpable with type t := t
|
||||
|
||||
val to_string : t -> string
|
||||
|
||||
|
@ -57,24 +57,24 @@ val greatest_supported_version : t -> Version.t
|
|||
|
||||
(** Indicate the field/constructor being parsed was deleted in the
|
||||
given version *)
|
||||
val deleted_in : t -> Version.t -> (unit, _) Sexp.Of_sexp.parser
|
||||
val deleted_in : t -> Version.t -> (unit, _) Dsexp.Of_sexp.parser
|
||||
|
||||
(** Indicate the field/constructor being parsed was renamed in the
|
||||
given version *)
|
||||
val renamed_in : t -> Version.t -> to_:string -> (unit, _) Sexp.Of_sexp.parser
|
||||
val renamed_in : t -> Version.t -> to_:string -> (unit, _) Dsexp.Of_sexp.parser
|
||||
|
||||
(** Indicate the field/constructor being parsed was introduced in the
|
||||
given version *)
|
||||
val since : t -> Version.t -> (unit, _) Sexp.Of_sexp.parser
|
||||
val since : t -> Version.t -> (unit, _) Dsexp.Of_sexp.parser
|
||||
|
||||
(** {2 Low-level functions} *)
|
||||
|
||||
val set
|
||||
: t
|
||||
-> Version.t
|
||||
-> ('a, 'k) Sexp.Of_sexp.parser
|
||||
-> ('a, 'k) Sexp.Of_sexp.parser
|
||||
-> ('a, 'k) Dsexp.Of_sexp.parser
|
||||
-> ('a, 'k) Dsexp.Of_sexp.parser
|
||||
|
||||
val get_exn : t -> (Version.t, 'k) Sexp.Of_sexp.parser
|
||||
val get_exn : t -> (Version.t, 'k) Dsexp.Of_sexp.parser
|
||||
|
||||
val key : t -> Version.t Univ_map.Key.t
|
||||
|
|
|
@ -14,11 +14,11 @@ module type S = sig
|
|||
end
|
||||
val get_exn : string -> Instance.t
|
||||
end
|
||||
val load : Path.t -> f:(Lang.Instance.t -> 'a Sexp.Of_sexp.t) -> 'a
|
||||
val load : Path.t -> f:(Lang.Instance.t -> 'a Dsexp.Of_sexp.t) -> 'a
|
||||
val parse_contents
|
||||
: Lexing.lexbuf
|
||||
-> Dune_lexer.first_line
|
||||
-> f:(Lang.Instance.t -> 'a Sexp.Of_sexp.t)
|
||||
-> f:(Lang.Instance.t -> 'a Dsexp.Of_sexp.t)
|
||||
-> 'a
|
||||
end
|
||||
|
||||
|
@ -43,7 +43,7 @@ module Make(Data : sig type t end) = struct
|
|||
let name = Syntax.name syntax in
|
||||
if Hashtbl.mem langs name then
|
||||
Exn.code_error "Versioned_file.Lang.register: already registered"
|
||||
[ "name", Sexp.To_sexp.string name ];
|
||||
[ "name", Dsexp.To_sexp.string name ];
|
||||
Hashtbl.add langs name { syntax; data }
|
||||
|
||||
let parse first_line : Instance.t =
|
||||
|
@ -53,8 +53,8 @@ module Make(Data : sig type t end) = struct
|
|||
} = first_line
|
||||
in
|
||||
let ver =
|
||||
Sexp.Of_sexp.parse Syntax.Version.t Univ_map.empty
|
||||
(Atom (ver_loc, Sexp.Atom.of_string ver)) in
|
||||
Dsexp.Of_sexp.parse Syntax.Version.t Univ_map.empty
|
||||
(Atom (ver_loc, Dsexp.Atom.of_string ver)) in
|
||||
match Hashtbl.find langs name with
|
||||
| None ->
|
||||
Loc.fail name_loc "Unknown language %S.%s" name
|
||||
|
@ -76,11 +76,11 @@ module Make(Data : sig type t end) = struct
|
|||
|
||||
let parse_contents lb first_line ~f =
|
||||
let lang = Lang.parse first_line in
|
||||
let sexp = Sexp.Parser.parse lb ~mode:Many_as_one in
|
||||
let sexp = Dsexp.Parser.parse lb ~mode:Many_as_one in
|
||||
let parsing_context =
|
||||
Univ_map.singleton (Syntax.key lang.syntax) lang.version
|
||||
in
|
||||
Sexp.Of_sexp.parse (Sexp.Of_sexp.enter (f lang)) parsing_context sexp
|
||||
Dsexp.Of_sexp.parse (Dsexp.Of_sexp.enter (f lang)) parsing_context sexp
|
||||
|
||||
let load fn ~f =
|
||||
Io.with_lexbuf_from_file fn ~f:(fun lb ->
|
||||
|
|
Loading…
Reference in New Issue