aboutsummaryrefslogtreecommitdiff
path: root/lib/configuration/importConf.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/configuration/importConf.ml')
-rw-r--r--lib/configuration/importConf.ml57
1 files changed, 3 insertions, 54 deletions
diff --git a/lib/configuration/importConf.ml b/lib/configuration/importConf.ml
index 8516008..2df24bd 100644
--- a/lib/configuration/importConf.ml
+++ b/lib/configuration/importConf.ml
@@ -1,68 +1,17 @@
-open StdLabels
-module Syntax = Syntax
-module CTE = Cte
-module Table = ImportDataTypes.Table
-module Path = ImportDataTypes.Path
-module T = Read_conf
-module Expression = ImportExpression.T
-
-let latest_version = 1
-
module TomlReader = Read_conf.Make (Helpers.Toml.Decode)
-let t_of_toml : Otoml.t -> (Syntax.t, string) result =
+let t_of_toml : Otoml.t -> (ImporterSyntax.t, string) result =
fun toml ->
let version =
- Otoml.find_or ~default:latest_version toml
+ Otoml.find_or ~default:ImporterSyntax.latest_version toml
(Otoml.get_integer ~strict:false)
[ "version" ]
in
match version with
- | n when n = latest_version -> TomlReader.read toml
+ | n when n = ImporterSyntax.latest_version -> TomlReader.read toml
| _ ->
Printf.eprintf "Unsuported version : %d\n" version;
exit 1
-let dummy_conf =
- Syntax.
- {
- source = { file = ""; tab = 0; name = "" };
- version = latest_version;
- locale = Some "C";
- externals = [];
- columns = [];
- filters = [];
- sort = [];
- uniq = [];
- }
-
-let get_table_for_name : Syntax.t -> string option -> Table.t =
- fun conf name ->
- match name with
- | None -> conf.source
- | Some name ->
- if String.equal name conf.source.name then conf.source
- else
- let ext =
- List.find conf.externals ~f:(fun (ext : Syntax.Extern.t) ->
- String.equal name ext.target.name)
- in
- ext.target
-
-let root_table : Syntax.t -> Table.t = fun conf -> conf.source
-
-let get_dependancies_for_table : Syntax.t -> Table.t -> Syntax.Extern.t list =
- fun conf source ->
- let is_root = source = conf.source in
-
- List.filter conf.externals ~f:(fun (ext : Syntax.Extern.t) ->
- (* Enumerate the intern_key and check the source pointed by each column *)
- Expression.fold_values ext.intern_key ~init:false ~f:(fun acc expr ->
- if acc then acc
- else
- match expr.Syntax.Path.alias with
- | Some v -> String.equal v source.name
- | None -> is_root))
-
let expression_from_string s =
Read_conf.ExpressionParser.of_string Read_conf.ExpressionParser.path s