blob: 4b49686be585c97d30004696889f2b71024c4fcf (
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
|
module TomlReader = Read_conf.Make (Helpers.Toml.Decode)
type loader_context = TomlReader.loader_context = {
checkFile : string -> bool;
loadFile : string -> Otoml.t;
}
let t_of_toml :
context:loader_context -> Otoml.t -> (ImporterSyntax.t, string) result =
fun ~context toml ->
let version =
Otoml.find_or ~default:ImporterSyntax.latest_version toml
(Otoml.get_integer ~strict:false)
[ "version" ]
in
match version with
| n when n = ImporterSyntax.latest_version -> begin
TomlReader.read context toml
end
| _ ->
Printf.eprintf "Unsuported version : %d\n" version;
exit 1
let expression_from_string s =
Read_conf.ExpressionParser.of_string Read_conf.ExpressionParser.path s
|