summaryrefslogtreecommitdiff
path: root/lib/configuration/ast.mli
blob: 404c26ee9f9adffbe6605ed3ed60a898f62e83ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
type setting

val init : unit -> setting

val get_content : setting -> Model.Identifier.t -> Model.content option
(** Get the content from the setting. *)

val get_list : setting -> Model.Identifier.t -> Model.list option
(** Get the list declared with the given name, if any *)

val lists : setting -> Model.list list
(** All the lists declared in the setting *)

val root_contents : setting -> Model.content list
(** Extract all the content in the topological order.

    Only the root content are repored in the list *)

val register_content : setting -> Model.content -> unit
(** Register a content and all the associated subcontent in the top level,
    giving the possibility to fetch any content or subcontent by its name
    without traversing the whole tree each time. *)

exception BrokenLink : ('a Type.Id.t * 'a * Model.Identifier.t) -> exn
(** Exception raised when a reference in the configuration targets neither an
    existing content nor a declared list *)

exception ConflictingFields of Model.Identifier.t * Model.Identifier.t
(** Exception raised when a content or a list declares two fields with the same
    name but different types *)

val register_list : setting -> Model.list -> setting
(** Register a list in the setting, replacing any previous list with the same
    id. Lists are registered while they are decoded, so that a list can
    reference the lists declared before it. *)

val check : setting -> (unit, exn) result
(** Check the setting and return the the error as an exception *)

val tree : ?required:bool -> setting -> Graph_tree.t
val escaped : string -> string