diff options
| author | Daniil Baturin <daniil@baturin.org> | 2016-12-15 09:56:07 +0600 |
|---|---|---|
| committer | Daniil Baturin <daniil@baturin.org> | 2016-12-15 09:56:07 +0600 |
| commit | 88cca944fa1788d4f3089c9f93c59666bfcce1fb (patch) | |
| tree | 4fb211c72964405f14b25317268ba67c5d995c61 /src/reference_tree.ml | |
| parent | 6f95f4191699186a14a3109f08822189d0f8331e (diff) | |
| download | vyconf-88cca944fa1788d4f3089c9f93c59666bfcce1fb.tar.gz vyconf-88cca944fa1788d4f3089c9f93c59666bfcce1fb.zip | |
T212: use a directory (normally $program_dir/validators) for external validators.
What's bad is that right now way too many things are aware of the nature of external validators,
and the validators dir (formerly validators hashtable) is passed around a lot.
We'll need to think it through.
Diffstat (limited to 'src/reference_tree.ml')
| -rw-r--r-- | src/reference_tree.ml | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/reference_tree.ml b/src/reference_tree.ml index 69ddae7..48de53b 100644 --- a/src/reference_tree.ml +++ b/src/reference_tree.ml @@ -130,7 +130,7 @@ let load_from_xml reftree file = 5. It's a non-leaf, non-tag node with a name that doesn't exist in the reference tree *) -let rec validate_path validators node path = +let rec validate_path validators_dir node path = let show_path p = Util.string_of_path (List.rev p) in let rec aux node path acc = let data = Vytree.data_of_node node in @@ -143,7 +143,7 @@ let rec validate_path validators node path = (Printf.sprintf "Node \"%s\" requires a value" (show_path acc) )) | [p] -> if not data.valueless then - (if (Value_checker.validate_any validators data.constraints p) then (List.rev acc, Some p) + (if (Value_checker.validate_any validators_dir data.constraints p) then (List.rev acc, Some p) else raise (Validation_error data.constraint_error_message)) else raise (Validation_error (Printf.sprintf "Node %s cannot have a value" (show_path acc))) @@ -151,13 +151,13 @@ let rec validate_path validators node path = | Tag -> (match path with | p :: p' :: ps -> - if (Value_checker.validate_any validators data.constraints p) then + if (Value_checker.validate_any validators_dir data.constraints p) then let child = Vytree.find node p' in (match child with | Some c -> aux c ps (p' :: p :: acc) | None -> raise (Validation_error (Printf.sprintf "Node %s has no child %s" (show_path acc) p'))) else raise (Validation_error (Printf.sprintf "%s is not a valid child name for node %s" p (show_path acc))) - | [p] -> if (Value_checker.validate_any validators data.constraints p) then (List.rev acc, None) + | [p] -> if (Value_checker.validate_any validators_dir data.constraints p) then (List.rev acc, None) else raise (Validation_error (Printf.sprintf "Node %s has no child %s" (show_path acc) p)) | _ -> raise (Validation_error (Printf.sprintf "Path %s is incomplete" (show_path acc)))) | Other -> |
