diff options
Diffstat (limited to 'lib/configuration/ast.ml')
| -rw-r--r-- | lib/configuration/ast.ml | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/configuration/ast.ml b/lib/configuration/ast.ml index 36ba349..d874428 100644 --- a/lib/configuration/ast.ml +++ b/lib/configuration/ast.ml @@ -1,10 +1,6 @@ open StdLabels -module Splay = Splay.Make (struct - include String - - let pp = Format.pp_print_string -end) +module Splay = Splay.Make (Model.Identifier) let escaped = String.escaped @@ -18,19 +14,19 @@ type setting = { let init : unit -> setting = fun () -> { contents = Splay.empty (); lists = [] } (** Get the content from the setting. *) -let get_content : setting -> string -> Model.Reference.t Model.Content.t option - = +let get_content : + setting -> Model.Identifier.t -> Model.Reference.t Model.Content.t option = fun settings name -> Splay.find name settings.contents -exception BrokenLink : ('a Type.Id.t * 'a * string) -> exn -exception NotImplemented : ('a Type.Id.t * 'a * string) -> exn +exception BrokenLink : ('a Type.Id.t * 'a * Model.Identifier.t) -> exn +exception NotImplemented : ('a Type.Id.t * 'a * Model.Identifier.t) -> exn (** Convert the content having fields referencing element by name into content having fields referencing other contents *) let rec convert : 'a Type.Id.t -> setting -> - ('a * string) Model.Content.t -> + ('a * Model.Identifier.t) Model.Content.t -> Model.Reference.t Model.Content.t = fun ty setting content -> let subcontents = @@ -56,7 +52,8 @@ let rec convert : (* Also check from the list catalog *) begin match List.find_opt setting.lists ~f:(fun { id; _ } -> - String.equal id name) + String.equal id + (Model.Identifier.to_string name)) with | Some v -> ignore v; @@ -77,7 +74,7 @@ let rec convert : giving the possibility to fetch any content or subcontent by is’s name without traversing the whole tree each time. *) let register_content : - 'a Type.Id.t -> setting -> ('a * string) Model.Content.t -> unit = + 'a Type.Id.t -> setting -> ('a * Model.Identifier.t) Model.Content.t -> unit = fun ty setting content -> let rec traverse content = let () = |
