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