Move sexpable signature to Stdune.Sexp
Also tweak Syntax.Version to match this signature Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
8fea39b09b
commit
5bfacf766a
|
@ -10,16 +10,10 @@ module Outputs = struct
|
||||||
| Outputs -> "outputs"
|
| Outputs -> "outputs"
|
||||||
end
|
end
|
||||||
|
|
||||||
module type Sexpable = sig
|
|
||||||
type t
|
|
||||||
val t : t Sexp.Of_sexp.t
|
|
||||||
val sexp_of_t : t Sexp.To_sexp.t
|
|
||||||
end
|
|
||||||
|
|
||||||
module Make_ast
|
module Make_ast
|
||||||
(Program : Sexpable)
|
(Program : Sexp.Sexpable)
|
||||||
(Path : Sexpable)
|
(Path : Sexp.Sexpable)
|
||||||
(String : Sexpable)
|
(String : Sexp.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
|
||||||
|
|
|
@ -87,8 +87,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
|
||||||
|
|
||||||
val t : t Sexp.Of_sexp.t
|
include Sexp.Sexpable with type t := t
|
||||||
val sexp_of_t : t Sexp.To_sexp.t
|
|
||||||
|
|
||||||
module Partial : sig
|
module Partial : sig
|
||||||
include Action_intf.Ast
|
include Action_intf.Ast
|
||||||
|
|
|
@ -3,7 +3,7 @@ open Import
|
||||||
let parse_sub_systems sexps =
|
let parse_sub_systems sexps =
|
||||||
List.filter_map sexps ~f:(fun sexp ->
|
List.filter_map sexps ~f:(fun sexp ->
|
||||||
let name, ver, data =
|
let name, ver, data =
|
||||||
Sexp.Of_sexp.(triple string (located Syntax.Version.t_of_sexp) raw) sexp
|
Sexp.Of_sexp.(triple string (located Syntax.Version.t) raw) sexp
|
||||||
in
|
in
|
||||||
match Sub_system_name.get name with
|
match Sub_system_name.get name with
|
||||||
| None ->
|
| None ->
|
||||||
|
|
|
@ -52,8 +52,8 @@ val is_standard : t -> bool
|
||||||
module Unexpanded : sig
|
module Unexpanded : sig
|
||||||
type expanded = t
|
type expanded = t
|
||||||
type t
|
type t
|
||||||
val t : t Sexp.Of_sexp.t
|
|
||||||
val sexp_of_t : t Sexp.To_sexp.t
|
include Sexp.Sexpable with type t := t
|
||||||
val standard : t
|
val standard : t
|
||||||
|
|
||||||
val field : ?default:t -> string -> t Sexp.Of_sexp.record_parser
|
val field : ?default:t -> string -> t Sexp.Of_sexp.record_parser
|
||||||
|
|
|
@ -452,3 +452,9 @@ module Of_sexp = struct
|
||||||
String.uncapitalize name) }
|
String.uncapitalize name) }
|
||||||
"Unknown value %s" s
|
"Unknown value %s" s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module type Sexpable = sig
|
||||||
|
type t
|
||||||
|
val t : t Of_sexp.t
|
||||||
|
val sexp_of_t : t To_sexp.t
|
||||||
|
end
|
||||||
|
|
|
@ -169,3 +169,9 @@ module Of_sexp : sig
|
||||||
|
|
||||||
val enum : (string * 'a) list -> 'a t
|
val enum : (string * 'a) list -> 'a t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module type Sexpable = sig
|
||||||
|
type t
|
||||||
|
val t : t Of_sexp.t
|
||||||
|
val sexp_of_t : t To_sexp.t
|
||||||
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Version = struct
|
||||||
|
|
||||||
let sexp_of_t t = Sexp.unsafe_atom_of_string (to_string t)
|
let sexp_of_t t = Sexp.unsafe_atom_of_string (to_string t)
|
||||||
|
|
||||||
let t_of_sexp : t Sexp.Of_sexp.t = function
|
let t : t Sexp.Of_sexp.t = function
|
||||||
| Atom (loc, A s) -> begin
|
| Atom (loc, A s) -> begin
|
||||||
try
|
try
|
||||||
Scanf.sscanf s "%u.%u" (fun a b -> (a, b))
|
Scanf.sscanf s "%u.%u" (fun a b -> (a, b))
|
||||||
|
|
|
@ -9,8 +9,7 @@ module Version : sig
|
||||||
[Z <= Y]. *)
|
[Z <= Y]. *)
|
||||||
type t = int * int
|
type t = int * int
|
||||||
|
|
||||||
val sexp_of_t : t Sexp.To_sexp.t
|
include Sexp.Sexpable with type t := t
|
||||||
val t_of_sexp : t Sexp.Of_sexp.t
|
|
||||||
|
|
||||||
(** Whether the parser can read the data or not *)
|
(** Whether the parser can read the data or not *)
|
||||||
val can_read : parser_version:t -> data_version:t -> bool
|
val can_read : parser_version:t -> data_version:t -> bool
|
||||||
|
|
Loading…
Reference in New Issue