diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/args.ml | 10 | ||||
-rw-r--r-- | bin/args.mli | 2 | ||||
-rw-r--r-- | bin/qsp_parser.ml | 34 |
3 files changed, 25 insertions, 21 deletions
diff --git a/bin/args.ml b/bin/args.ml index 1503d18..e0e1419 100644 --- a/bin/args.ml +++ b/bin/args.ml @@ -29,7 +29,9 @@ let disable_module modules identifier = String.sub identifier ~pos:1 ~len:(String.length identifier - 1) in List.iter modules ~f:(fun t -> - let (module C : Qsp_syntax.S.Analyzer) = Qsp_checks.Check.get_module t in + let (module C : Qsp_syntax.Analyzer.T) = + Qsp_syntax.Identifier.get_module t + in if String.equal C.identifier identifier then C.active := false) let enable_module modules identifier = @@ -37,7 +39,9 @@ let enable_module modules identifier = String.sub identifier ~pos:1 ~len:(String.length identifier - 1) in List.iter modules ~f:(fun t -> - let (module C : Qsp_syntax.S.Analyzer) = Qsp_checks.Check.get_module t in + let (module C : Qsp_syntax.Analyzer.T) = + Qsp_syntax.Identifier.get_module t + in if String.equal C.identifier identifier then C.active := true) let speclist printer = @@ -74,7 +78,7 @@ let speclist printer = common_arguments @ windows_arguments let parse : - modules:Qsp_syntax.Catalog.ex list -> + modules:Qsp_syntax.Identifier.t list -> list_tests:(Format.formatter -> unit) -> string list * t = fun ~modules ~list_tests -> diff --git a/bin/args.mli b/bin/args.mli index a98b258..151a4ca 100644 --- a/bin/args.mli +++ b/bin/args.mli @@ -4,6 +4,6 @@ type t = { reset_line : bool; filters : filters } (** All the arguments given from the command line *) val parse : - modules:Qsp_syntax.Catalog.ex list -> + modules:Qsp_syntax.Identifier.t list -> list_tests:(Format.formatter -> unit) -> string list * t diff --git a/bin/qsp_parser.ml b/bin/qsp_parser.ml index 65a4e4a..7ec3eff 100644 --- a/bin/qsp_parser.ml +++ b/bin/qsp_parser.ml @@ -27,17 +27,17 @@ let dynamic_context_id : Qsp_checks.Dynamics.context Type.Id.t = Type.Id.make () *) let available_checks = [ - Qsp_syntax.Catalog.build ~context_id:dynamic_context_id + Qsp_syntax.Identifier.build ~context_id:dynamic_context_id (module Qsp_checks.Dynamics); - Qsp_syntax.Catalog.build (module Qsp_checks.Type_of); - Qsp_syntax.Catalog.build (module Qsp_checks.Dead_end); - Qsp_syntax.Catalog.build (module Qsp_checks.Nested_strings); - Qsp_syntax.Catalog.build (module Qsp_checks.Locations); - Qsp_syntax.Catalog.build (module Qsp_checks.Dup_test); - Qsp_syntax.Catalog.build (module Qsp_checks.Write_only); + Qsp_syntax.Identifier.build (module Qsp_checks.Type_of); + Qsp_syntax.Identifier.build (module Qsp_checks.Dead_end); + Qsp_syntax.Identifier.build (module Qsp_checks.Nested_strings); + Qsp_syntax.Identifier.build (module Qsp_checks.Locations); + Qsp_syntax.Identifier.build (module Qsp_checks.Dup_test); + Qsp_syntax.Identifier.build (module Qsp_checks.Write_only); ] -let pp_module formatter (module A : Qsp_syntax.S.Analyzer) = +let pp_module formatter (module A : Qsp_syntax.Analyzer.T) = Format.fprintf formatter "%s" A.identifier; Format.pp_print_tab formatter (); (match !A.active with @@ -51,8 +51,8 @@ let pp_module formatter (module A : Qsp_syntax.S.Analyzer) = let pp_modules formatter = let max_length = List.fold_left available_checks ~init:0 ~f:(fun l v -> - let (module A : Qsp_syntax.S.Analyzer) = - Qsp_checks.Check.get_module v + let (module A : Qsp_syntax.Analyzer.T) = + Qsp_syntax.Identifier.get_module v in max l (String.length A.identifier)) in @@ -71,7 +71,7 @@ let pp_modules formatter = Format.fprintf formatter "%a" (Format.pp_print_list (fun f v -> - let m = Qsp_checks.Check.get_module v in + let m = Qsp_syntax.Identifier.get_module v in pp_module f m) ~pp_sep:(fun f () -> Format.pp_force_newline f ())) available_checks; @@ -83,15 +83,15 @@ let pp_modules formatter = The expression is declared lazy in order to be sure to apply the filters from the command line before. *) let checkers : - (module Qsp_syntax.S.Analyzer + (module Qsp_syntax.Analyzer.T with type context = Qsp_checks.Check.result array) Lazy.t = lazy (let module Check = Qsp_checks.Check.Make (struct let t = List.filter available_checks ~f:(fun v -> - let (module A : Qsp_syntax.S.Analyzer) = - Qsp_checks.Check.get_module v + let (module A : Qsp_syntax.Analyzer.T) = + Qsp_syntax.Identifier.get_module v in !A.active) |> Array.of_list @@ -144,7 +144,7 @@ let display_result : The function update the context (list of errors) passed in arguments. *) let parse_location : ctx:ctx ref -> - (module Qsp_syntax.S.Analyzer + (module Qsp_syntax.Analyzer.T with type context = Qsp_checks.Check.result array) -> Qsp_checks.Check.result array -> Qparser.Lexbuf.t -> @@ -210,8 +210,8 @@ let () = | ".qsrc" -> (* Deactivate the tests which only applies to a global file *) List.iter available_checks ~f:(fun t -> - let (module C : Qsp_syntax.S.Analyzer) = - Qsp_checks.Check.get_module t + let (module C : Qsp_syntax.Analyzer.T) = + Qsp_syntax.Identifier.get_module t in if C.is_global && !C.active then C.active := false); |