diff options
author | Chimrod <> | 2023-10-22 07:14:20 +0200 |
---|---|---|
committer | Chimrod <> | 2023-10-25 17:56:30 +0200 |
commit | 2a2198e91063684a1b19974acc19c25b55266724 (patch) | |
tree | b43e4b1b62c61fd828a53d6b261c790ffa797ae0 /bin/qsp_parser.ml | |
parent | 2cad3abf180c14e0c026033d65f4fb895b5348f7 (diff) |
Refactoring the API
Diffstat (limited to 'bin/qsp_parser.ml')
-rw-r--r-- | bin/qsp_parser.ml | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/bin/qsp_parser.ml b/bin/qsp_parser.ml index 8ab442b..cf64fed 100644 --- a/bin/qsp_parser.ml +++ b/bin/qsp_parser.ml @@ -1,8 +1,6 @@ open StdLabels module Report = Qsp_syntax.Report -type result = Report.t list [@@deriving show] - (** Filter the results given by the analysis *) let filter_report : Args.filters -> Report.t list -> Report.t -> Report.t list = fun filters reports r -> @@ -19,8 +17,8 @@ type ctx = { error_nb : int; warn_nb : int; debug_nb : int } (* List all the controls to apply *) -let _, _, _, e1 = Qsp_syntax.Check.build (module Qsp_syntax.Type_of) -let _, _, _, e2 = Qsp_syntax.Check.build (module Qsp_syntax.Dead_end) +let _, e1 = Qsp_syntax.Check.build (module Qsp_syntax.Type_of) +let _, e2 = Qsp_syntax.Check.build (module Qsp_syntax.Dead_end) module Check = Qsp_syntax.Check.Make (struct let t = [| e1; e2 |] @@ -34,7 +32,8 @@ let parse_location : ctx:ctx -> Qparser.Lexbuf.t -> Args.filters -> ctx = let result = Qparser.Analyzer.parse (module Check) lexbuf |> Result.map (fun (_, f) -> - List.fold_left f ~init:[] ~f:(filter_report filters)) + List.fold_left f ~init:[] ~f:(filter_report filters) + |> List.sort ~cmp:Report.compare) in match result with | Ok report -> ( @@ -44,7 +43,7 @@ let parse_location : ctx:ctx -> Qparser.Lexbuf.t -> Args.filters -> ctx = | _ -> let start_position, _ = Qparser.Lexbuf.positions lexbuf in Format.fprintf Format.std_formatter "Location@ %s@;@[%a@]@." - start_position.Lexing.pos_fname pp_result report; + start_position.Lexing.pos_fname Report.pp_result report; List.fold_left report ~init:ctx ~f:(fun ctx report -> match report.Report.level with |