Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
38 kB · 1076 lines
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077diff --git a/comby-kernel.opam b/comby-kernel.opamindex 9db7cc5..83e6e7b 100644--- a/comby-kernel.opam+++ b/comby-kernel.opam@@ -20,7 +20,7 @@ build: [ depends: [ "dune" {>= "2.8.0"} "ocaml" {>= "4.08.1"}- "core_kernel"+ "core-kernel" {>= "v0.16.0"} "mparser" {>= "1.3"} "mparser-pcre" "ppx_deriving"diff --git a/comby-semantic.opam b/comby-semantic.opamindex 88563f6..fbbc122 100644--- a/comby-semantic.opam+++ b/comby-semantic.opam@@ -20,7 +20,7 @@ build: [ depends: [ "dune" {>= "2.8.0"} "ocaml" {>= "4.08.1"}- "core_kernel"+ "core_kernel" {>= "v0.15.0"} "ppx_deriving" "lwt" "cohttp"diff --git a/comby.opam b/comby.opamindex 9e5d96b..d5be316 100644--- a/comby.opam+++ b/comby.opam@@ -31,7 +31,7 @@ depends: [ "cohttp-lwt-unix" "comby-kernel" {= "1.7.0"} "comby-semantic" {= "1.7.0"}- "core"+ "core" {>= "v0.16.0"} "hack_parallel" {arch != "arm32" & arch != "arm64"} "lwt" "lwt_react"diff --git a/lib/app/configuration/command_configuration.ml b/lib/app/configuration/command_configuration.mlindex 75c3107..29826a9 100644--- a/lib/app/configuration/command_configuration.ml+++ b/lib/app/configuration/command_configuration.ml@@ -1,7 +1,7 @@ open Core open Camlzip -open Polymorphic_compare+open Poly open Comby_kernel @@ -16,21 +16,21 @@ type 'a next = let fold_directory ?(sorted=false) root ~init ~f = let rec aux acc absolute_path depth =- if Sys.is_file absolute_path = `Yes then+ if Sys_unix.is_file absolute_path = `Yes then match f acc ~depth ~absolute_path ~is_file:true with | Continue acc | Skip acc -> acc- else if Sys.is_directory absolute_path = `Yes then+ else if Sys_unix.is_directory absolute_path = `Yes then match f acc ~depth ~absolute_path ~is_file:false with | Skip acc -> acc | Continue acc -> let dir_contents = if Option.is_some (Sys.getenv "COMBY_TEST") || sorted then- Sys.ls_dir absolute_path+ Sys_unix.ls_dir absolute_path |> List.sort ~compare:String.compare |> List.rev else- Sys.ls_dir absolute_path+ Sys_unix.ls_dir absolute_path in List.fold dir_contents ~init:acc ~f:(fun acc subdir -> aux acc (Filename.concat absolute_path subdir) (depth + 1))@@ -50,8 +50,8 @@ let parse_source_directories let exact_file_paths, file_patterns = List.partition_map file_filters ~f:(fun path -> let is_exact path =- (String.contains path '/' && Sys.is_file path = `Yes)- || (Sys.is_file ("." ^/ path) = `Yes) (* See if it matches something in the current directory *)+ (String.contains path '/' && Sys_unix.is_file path = `Yes)+ || (Sys_unix.is_file ("." ^/ path) = `Yes) (* See if it matches something in the current directory *) in if is_exact path then Either.First path else Either.Second path) in@@ -167,8 +167,8 @@ let parse_templates ?metasyntax ?(warn_for_missing_file_in_dir = false) paths = let f acc ~depth:_ ~absolute_path ~is_file = let is_leaf_directory absolute_path = not is_file &&- Sys.ls_dir absolute_path- |> List.for_all ~f:(fun path -> Sys.is_directory (absolute_path ^/ path) = `No)+ Sys_unix.ls_dir absolute_path+ |> List.for_all ~f:(fun path -> Sys_unix.is_directory (absolute_path ^/ path) = `No) in if is_leaf_directory absolute_path then match parse_directory absolute_path with@@ -178,7 +178,7 @@ let parse_templates ?metasyntax ?(warn_for_missing_file_in_dir = false) paths = Continue acc in List.concat_map paths ~f:(fun path ->- if Sys.is_directory path = `Yes then+ if Sys_unix.is_directory path = `Yes then fold_directory path ~sorted:true ~init:[] ~f else parse_toml ?metasyntax path)@@ -428,7 +428,7 @@ let parse_metasyntax metasyntax_path = match metasyntax_path with | None -> Matchers.Metasyntax.default_metasyntax | Some metasyntax_path ->- match Sys.file_exists metasyntax_path with+ match Sys_unix.file_exists metasyntax_path with | `No | `Unknown -> Format.eprintf "Could not open file: %s@." metasyntax_path; exit 1@@ -477,14 +477,14 @@ let emit_errors { input_options; output_options; _ } = ; Option.is_some input_options.directory_depth && Option.value_exn (input_options.directory_depth) < 0 , "-depth must be 0 or greater."- ; Sys.is_directory input_options.target_directory = `No+ ; Sys_unix.is_directory input_options.target_directory = `No , "Directory specified with -d or -directory is not a directory." ; output_options.json_only_diff && not output_options.json_lines , "-json-only-diff can only be supplied with -json-lines." ; (Option.is_some output_options.chunk_matches) && Option.is_some input_options.zip_file , "chunk-matches output format is not supported for zip files." ; Option.is_some output_options.interactive_review &&- (not (String.equal input_options.target_directory (Sys.getcwd ())))+ (not (String.equal input_options.target_directory (Sys_unix.getcwd ()))) , "Please remove the -d option and `cd` to the directory where you want to \ review from. The -review, -editor, or -default-no options should only be run \ at the root directory of the project files to patch."@@ -492,11 +492,11 @@ let emit_errors { input_options; output_options; _ } = match input_options.templates with | Some inputs -> List.find_map inputs ~f:(fun input ->- if Sys.is_file input = `Yes then+ if Sys_unix.is_file input = `Yes then (match Toml.Parser.from_filename input with | `Error (s, _) -> Some s | _ -> None)- else if not (Sys.is_directory input = `Yes) then+ else if not (Sys_unix.is_directory input = `Yes) then Some (Format.sprintf "Directory %S specified with -templates is not a directory." input) else None)@@ -611,7 +611,7 @@ let filter_zip_entries file_filters exclude_directory_prefix exclude_file_prefix let syntax custom_matcher_path = match- Sys.file_exists custom_matcher_path with+ Sys_unix.file_exists custom_matcher_path with | `No | `Unknown -> Format.eprintf "Could not open file: %s@." custom_matcher_path; exit 1@@ -795,7 +795,7 @@ let create | Directory -> let target_directory = if target_directory = "." then- Filename.realpath target_directory+ Filename_unix.realpath target_directory else target_directory indiff --git a/lib/app/configuration/dune b/lib/app/configuration/duneindex e0f9748..e417cfe 100644--- a/lib/app/configuration/dune+++ b/lib/app/configuration/dune@@ -1,6 +1,21 @@ (library- (name configuration)- (public_name comby.configuration)- (instrumentation (backend bisect_ppx))- (preprocess (pps ppx_deriving.show ppx_sexp_conv ppx_sexp_message ppx_deriving_yojson))- (libraries comby-kernel comby-semantic comby.patdiff comby.camlzip core yojson ppx_deriving_yojson toml lwt lwt.unix tar tar-unix))+ (name configuration)+ (public_name comby.configuration)+ (instrumentation+ (backend bisect_ppx))+ (preprocess+ (pps ppx_deriving.show ppx_sexp_conv ppx_sexp_message ppx_deriving_yojson))+ (libraries+ comby-kernel+ comby-semantic+ comby.patdiff+ comby.camlzip+ core+ core_unix.sys_unix+ yojson+ ppx_deriving_yojson+ toml+ lwt+ lwt.unix+ tar+ tar-unix))diff --git a/lib/app/configuration/external_semantic.ml b/lib/app/configuration/external_semantic.mlindex bdc7051..ac69b1b 100644--- a/lib/app/configuration/external_semantic.ml+++ b/lib/app/configuration/external_semantic.ml@@ -2,13 +2,10 @@ open Core_kernel open Comby_semantic -let debug =- match Sys.getenv "DEBUG_COMBY" with- | exception Not_found -> false- | _ -> true+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some let lsif_hover ~name:_ ~filepath ~line ~column =- String.chop_prefix_if_exists filepath ~prefix:(Sys.getcwd ()) |> fun filepath_relative_root ->+ String.chop_prefix_if_exists filepath ~prefix:(Sys_unix.getcwd ()) |> fun filepath_relative_root -> if debug then Format.printf "File relative root: %s@." filepath; if debug then Format.printf "Querying type at %d::%d@." line column; let context =diff --git a/lib/app/dune b/lib/app/duneindex 2ed553c..a91f826 100644--- a/lib/app/dune+++ b/lib/app/dune@@ -1,9 +1,8 @@ (library- (name comby)- (public_name comby)- (instrumentation (backend bisect_ppx))- (preprocess (pps ppx_deriving.show ppx_deriving.eq ppx_sexp_conv))- (libraries - core - comby-kernel- comby.pipeline))+ (name comby)+ (public_name comby)+ (instrumentation+ (backend bisect_ppx))+ (preprocess+ (pps ppx_deriving.show ppx_deriving.eq ppx_sexp_conv))+ (libraries core comby-kernel comby.pipeline))diff --git a/lib/app/interactive/dune b/lib/app/interactive/duneindex 815aff5..63c1757 100644--- a/lib/app/interactive/dune+++ b/lib/app/interactive/dune@@ -1,5 +1,12 @@ (library- (name interactive)- (public_name comby.interactive)- (preprocess (pps ppx_sexp_conv))- (libraries comby-kernel comby.configuration core shell.filename_extended lwt lwt.unix))+ (name interactive)+ (public_name comby.interactive)+ (preprocess+ (pps ppx_sexp_conv))+ (libraries+ comby-kernel+ comby.configuration+ core+ shell.filename_extended+ lwt+ lwt.unix))diff --git a/lib/app/interactive/interactive.ml b/lib/app/interactive/interactive.mlindex d4bf200..b27105a 100644--- a/lib/app/interactive/interactive.ml+++ b/lib/app/interactive/interactive.ml@@ -1,5 +1,6 @@ open Core open Lwt+module Unix = Core_unix open Configuration @@ -37,6 +38,7 @@ module Diff = struct ~big_enough:line_big_enough ~prev ~next+ () | Some prog -> let compare x y = let cmd = sprintf "%s %S %S" prog x y in@@ -52,7 +54,7 @@ module Diff = struct let compare = compare end) in- P.get_hunks ~transform ~context ~big_enough:line_big_enough ~prev ~next+ P.get_hunks ~transform ~context ~big_enough:line_big_enough ~prev ~next () in match float_tolerance with | None -> hunksdiff --git a/lib/app/pipeline/dune b/lib/app/pipeline/duneindex 3369b9e..e6ec880 100644--- a/lib/app/pipeline/dune+++ b/lib/app/pipeline/dune@@ -1,11 +1,23 @@ (library- (name pipeline)- (public_name comby.pipeline)- (instrumentation (backend bisect_ppx))- (preprocess (pps ppx_sexp_conv ppx_deriving_yojson))- (libraries comby-kernel comby.statistics comby.configuration comby.interactive comby.camlzip core core.uuid yojson ppx_deriving_yojson parany- (select parallel_hack.ml from- (hack_parallel -> parallel_hack.available.ml)- (!hack_parallel -> parallel_hack.parany_fallback.ml)) - ))-+ (name pipeline)+ (public_name comby.pipeline)+ (instrumentation+ (backend bisect_ppx))+ (preprocess+ (pps ppx_sexp_conv ppx_deriving_yojson))+ (libraries+ comby-kernel+ comby.statistics+ comby.configuration+ comby.interactive+ comby.camlzip+ core+ core_unix.uuid+ yojson+ ppx_deriving_yojson+ parany+ (select+ parallel_hack.ml+ from+ (hack_parallel -> parallel_hack.available.ml)+ (!hack_parallel -> parallel_hack.parany_fallback.ml))))diff --git a/lib/app/pipeline/parallel_hack.available.ml b/lib/app/pipeline/parallel_hack.available.mlindex a901eea..ad33070 100644--- a/lib/app/pipeline/parallel_hack.available.ml+++ b/lib/app/pipeline/parallel_hack.available.ml@@ -1,4 +1,5 @@ open Core+module Unix = Core_unix open Hack_parallel diff --git a/lib/app/statistics/dune b/lib/app/statistics/duneindex b14d5b1..12aff7f 100644--- a/lib/app/statistics/dune+++ b/lib/app/statistics/dune@@ -1,6 +1,8 @@ (library- (name statistics)- (public_name comby.statistics)- (instrumentation (backend bisect_ppx))- (preprocess (pps ppx_deriving_yojson))- (libraries yojson ppx_deriving_yojson ppx_deriving_yojson.runtime))+ (name statistics)+ (public_name comby.statistics)+ (instrumentation+ (backend bisect_ppx))+ (preprocess+ (pps ppx_deriving_yojson))+ (libraries yojson ppx_deriving_yojson ppx_deriving_yojson.runtime))diff --git a/lib/app/vendored/patdiff/kernel/src/dune b/lib/app/vendored/patdiff/kernel/src/duneindex 7a6353d..b79cba2 100644--- a/lib/app/vendored/patdiff/kernel/src/dune+++ b/lib/app/vendored/patdiff/kernel/src/dune@@ -1,3 +1,6 @@-(library (name patdiff_kernel) (public_name comby.patdiff_kernel)+(library+ (name patdiff_kernel)+ (public_name comby.patdiff_kernel) (libraries core_kernel.composition_infix core_kernel patience_diff re)- (preprocess (pps ppx_jane)))+ (preprocess+ (pps ppx_jane)))diff --git a/lib/app/vendored/patdiff/kernel/src/float_tolerance.ml b/lib/app/vendored/patdiff/kernel/src/float_tolerance.mlindex 4e064fb..dca77b2 100644--- a/lib/app/vendored/patdiff/kernel/src/float_tolerance.ml+++ b/lib/app/vendored/patdiff/kernel/src/float_tolerance.ml@@ -287,7 +287,7 @@ end = struct ~running_step:(fun (car, pos) cadr -> match car, cadr with | Same car_lines, Same cadr_lines ->- Skip (Same (Array.concat [ car_lines; cadr_lines ]), pos)+ Skip {state = (Same (Array.concat [ car_lines; cadr_lines ]), pos)} | Unified _, _ | _, Unified _ -> raise_s [%message@@ -296,7 +296,7 @@ end = struct (cadr : string Range.t)] | (Prev _ | Next _ | Replace _), (Prev _ | Next _ | Replace _) | Same _, (Prev _ | Next _ | Replace _)- | (Prev _ | Next _ | Replace _), Same _ -> Yield ((car, pos), (cadr, Middle)))+ | (Prev _ | Next _ | Replace _), Same _ -> Yield {value = (car, pos); state = (cadr, Middle)}) ~inner_finished:(fun (last, pos) -> match last, pos with | Unified _, _ ->@@ -308,7 +308,7 @@ end = struct Some (last, End)) ~finishing_step:(function | None -> Done- | Some result -> Yield (result, None))+ | Some result -> Yield {value = result; state = None}) ;; include struct@@ -448,7 +448,7 @@ end = struct ~init:{ prev_start; next_start; ranges = [] } ~running_step:(fun t drop_or_keep -> match (drop_or_keep : Drop_or_keep.t) with- | Keep range -> Skip { t with ranges = range :: t.ranges }+ | Keep range -> Skip {state = { t with ranges = range :: t.ranges }} | Drop n -> let hunk = to_hunk t in let t =@@ -457,11 +457,11 @@ end = struct ; ranges = [] } in- if List.is_empty (Hunk.ranges hunk) then Skip t else Yield (hunk, t))+ if List.is_empty (Hunk.ranges hunk) then Skip {state = t} else Yield {value = hunk; state = t}) ~inner_finished:(fun t -> if List.is_empty t.ranges then None else Some t) ~finishing_step:(function | None -> Done- | Some t -> Yield (to_hunk t, None))+ | Some t -> Yield {value = to_hunk t; state = None}) ;; end diff --git a/lib/app/vendored/patdiff/kernel/src/patdiff_core.ml b/lib/app/vendored/patdiff/kernel/src/patdiff_core.mlindex 4f53a0b..88ee0e3 100644--- a/lib/app/vendored/patdiff/kernel/src/patdiff_core.ml+++ b/lib/app/vendored/patdiff/kernel/src/patdiff_core.ml@@ -138,6 +138,7 @@ module Make (Output_impls : Output_impls) = struct ~big_enough:line_big_enough ~prev ~next+ () ;; type word_or_newline =@@ -345,6 +346,7 @@ module Make (Output_impls : Output_impls) = struct ~big_enough:word_big_enough ~prev:prev_pieces ~next:next_pieces+ () ;; let ranges_are_just_whitespace (ranges : _ Patience_diff.Range.t list) =diff --git a/lib/app/vendored/patdiff/lib/src/compare_core.ml b/lib/app/vendored/patdiff/lib/src/compare_core.mlindex fafb201..8b40d09 100644--- a/lib/app/vendored/patdiff/lib/src/compare_core.ml+++ b/lib/app/vendored/patdiff/lib/src/compare_core.ml@@ -1,5 +1,6 @@ open! Core open! Import+module Unix = Core_unix let lines_of_contents contents = let lines = Array.of_list (String.split_lines contents) in@@ -100,6 +101,7 @@ let compare_lines (config : Configuration.t) ?prev_diff ?next_diff ~prev ~next ( ~big_enough:line_big_enough ~prev ~next+ () | Some prog -> let compare x y = let cmd = sprintf "%s %S %S" prog x y in@@ -116,7 +118,7 @@ let compare_lines (config : Configuration.t) ?prev_diff ?next_diff ~prev ~next ( let compare = compare end) in- P.get_hunks ~transform ~context ~big_enough:line_big_enough ~prev ~next+ P.get_hunks ~transform ~context ~big_enough:line_big_enough ~prev ~next () in let hunks = match config.float_tolerance with@@ -361,7 +363,7 @@ let rec diff_dirs_internal (config : Configuration.t) ~prev_dir ~next_dir ~file_ | None -> Fn.const true | Some file_filter -> file_filter in- Sys.ls_dir (File_name.real_name_exn dir)+ Sys_unix.ls_dir (File_name.real_name_exn dir) |> List.filter ~f:(fun x -> let x = File_name.real_name_exn dir ^/ x in match Unix.stat x withdiff --git a/lib/app/vendored/patdiff/lib/src/compare_core.mli b/lib/app/vendored/patdiff/lib/src/compare_core.mliindex e919512..caa8dcb 100644--- a/lib/app/vendored/patdiff/lib/src/compare_core.mli+++ b/lib/app/vendored/patdiff/lib/src/compare_core.mli@@ -1,5 +1,6 @@ open! Core open! Import+module Unix = Core_unix val diff_files : Configuration.tdiff --git a/lib/app/vendored/patdiff/lib/src/configuration.ml b/lib/app/vendored/patdiff/lib/src/configuration.mlindex 6879daa..7d59706 100644--- a/lib/app/vendored/patdiff/lib/src/configuration.ml+++ b/lib/app/vendored/patdiff/lib/src/configuration.ml@@ -481,7 +481,7 @@ let rec load_exn' ~set config_file = | Error _another_exn -> raise exn | Ok c -> (let new_file = config_file ^ ".new" in- match Sys.file_exists new_file with+ match Sys_unix.file_exists new_file with | `Yes | `Unknown -> () | `No -> (try Sexp.save_hum new_file (On_disk.V1.sexp_of_t c) with@@ -564,7 +564,7 @@ let get_config ?filename () = (* ~/.patdiff exists *) Option.bind (Sys.getenv "HOME") ~f:(fun home -> let f = home ^/ ".patdiff" in- match Sys.file_exists f with+ match Sys_unix.file_exists f with | `Yes -> Some f | `No | `Unknown -> None) indiff --git a/lib/app/vendored/patdiff/lib/src/dune b/lib/app/vendored/patdiff/lib/src/duneindex 007acad..b6a0f80 100644--- a/lib/app/vendored/patdiff/lib/src/dune+++ b/lib/app/vendored/patdiff/lib/src/dune@@ -1,4 +1,13 @@-(library (name patdiff) (public_name comby.patdiff)- (libraries core_kernel.composition_infix core core.linux_ext comby.patdiff_kernel+(library+ (name patdiff)+ (public_name comby.patdiff)+ (libraries+ core_kernel.composition_infix+ core+ core_unix+ core_unix.linux_ext+ core_unix.sys_unix+ comby.patdiff_kernel patience_diff)- (preprocess (pps ppx_jane)))+ (preprocess+ (pps ppx_jane)))diff --git a/lib/app/vendored/patdiff/lib/src/html_output.ml b/lib/app/vendored/patdiff/lib/src/html_output.mlindex 3d08f91..93ae8af 100644--- a/lib/app/vendored/patdiff/lib/src/html_output.ml+++ b/lib/app/vendored/patdiff/lib/src/html_output.ml@@ -1,5 +1,6 @@ open! Core open! Import+module Unix = Core_unix include Patdiff_kernel.Html_output.Private.Make (struct let mtime file =diff --git a/lib/kernel/match/dune b/lib/kernel/match/duneindex 03b120a..4d48b61 100644--- a/lib/kernel/match/dune+++ b/lib/kernel/match/dune@@ -1,6 +1,12 @@ (library- (name match)- (public_name comby-kernel.match)- (instrumentation (backend bisect_ppx))- (preprocess (pps ppx_deriving.eq ppx_sexp_conv ppx_deriving_yojson))- (libraries core_kernel yojson ppx_deriving_yojson ppx_deriving_yojson.runtime))+ (name match)+ (public_name comby-kernel.match)+ (instrumentation+ (backend bisect_ppx))+ (preprocess+ (pps ppx_deriving.eq ppx_sexp_conv ppx_deriving_yojson))+ (libraries+ core_kernel+ yojson+ ppx_deriving_yojson+ ppx_deriving_yojson.runtime))diff --git a/lib/kernel/matchers/alpha.ml b/lib/kernel/matchers/alpha.mlindex d6116f7..7d16171 100644--- a/lib/kernel/matchers/alpha.ml+++ b/lib/kernel/matchers/alpha.ml@@ -13,20 +13,11 @@ module R = MakeRegexp(Regexp) let configuration_ref = ref (Configuration.create ()) let weaken_delimiter_hole_matching = false -let debug =- match Sys.getenv "DEBUG_COMBY" with- | exception Not_found -> false- | _ -> true+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some -let debug_hole =- match Sys.getenv "DEBUG_COMBY_HOLE" with- | exception Not_found -> false- | _ -> true+let debug_hole = Sys.getenv "DEBUG_COMBY_HOLE" |> Option.is_some -let debug_position =- match Sys.getenv "DEBUG_COMBY_POS" with- | exception Not_found -> false- | _ -> true+let debug_position = Sys.getenv "DEBUG_COMBY_POS" |> Option.is_some let f _ = return Types.Unit @@ -147,7 +138,7 @@ module Make (Lang : Types.Language.S) (Meta : Types.Metasyntax.S) (Ext : Types.E ] >>= fun _ -> f Types.Unit - let sequence_chain (plist : ('c, Match.t) parser sexp_list) : ('c, Match.t) parser =+ let sequence_chain (plist : ('c, Match.t) parser list) : ('c, Match.t) parser = List.fold plist ~init:(return Types.Unit) ~f:(>>) let with_debug_matcher s tag =@@ -745,7 +736,7 @@ module Make (Lang : Types.Language.S) (Meta : Types.Metasyntax.S) (Ext : Types.E let hole_parser ?at_depth sort dimension = let open Types.Hole in let hole_parser =- let open Polymorphic_compare in+ let open Poly in List.fold ~init:[] hole_parsers ~f:(fun acc (sort', parser) -> if sort' = sort then parser::acc else acc) in let skip_signal hole = skip (string "_signal_hole") |>> fun () -> Types.Hole hole indiff --git a/lib/kernel/matchers/dune b/lib/kernel/matchers/duneindex 12ed326..4625458 100644--- a/lib/kernel/matchers/dune+++ b/lib/kernel/matchers/dune@@ -1,6 +1,18 @@ (library- (name matchers)- (public_name comby-kernel.matchers)- (instrumentation (backend bisect_ppx))- (preprocess (pps ppx_here ppx_sexp_conv ppx_sexp_message ppx_deriving_yojson))- (libraries comby-kernel.replacement comby-kernel.parsers comby-kernel.match comby-kernel.vangstrom core_kernel mparser mparser-pcre re yojson ppx_deriving_yojson))+ (name matchers)+ (public_name comby-kernel.matchers)+ (instrumentation+ (backend bisect_ppx))+ (preprocess+ (pps ppx_here ppx_sexp_conv ppx_sexp_message ppx_deriving_yojson))+ (libraries+ comby-kernel.replacement+ comby-kernel.parsers+ comby-kernel.match+ comby-kernel.vangstrom+ core_kernel+ mparser+ mparser-pcre+ re+ yojson+ ppx_deriving_yojson))diff --git a/lib/kernel/matchers/evaluate.ml b/lib/kernel/matchers/evaluate.mlindex 9ea71a0..4f63ab6 100644--- a/lib/kernel/matchers/evaluate.ml+++ b/lib/kernel/matchers/evaluate.ml@@ -3,10 +3,7 @@ open Core_kernel open Match open Types.Ast -let debug =- match Sys.getenv "DEBUG_COMBY" with- | exception Not_found -> false- | _ -> true+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some type result = bool * Match.environment option @@ -102,7 +99,7 @@ let apply |> Option.some in List.find_map cases ~f:(fun (template, case_expression) -> evaluate template case_expression)- |> Option.value_map ~f:ident ~default:(false, Some env)+ |> Option.value_map ~f:Fn.id ~default:(false, Some env) (* rewrite ... { ... } *) | Rewrite (Template t, (match_template, rewrite_template)) ->diff --git a/lib/kernel/matchers/omega.ml b/lib/kernel/matchers/omega.mlindex 61cc69a..3445307 100644--- a/lib/kernel/matchers/omega.ml+++ b/lib/kernel/matchers/omega.ml@@ -32,15 +32,9 @@ let push_source_ref : string ref = ref "" let filepath_ref : string option ref = ref None -let debug =- match Sys.getenv "DEBUG_COMBY" with- | exception Not_found -> false- | _ -> true+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some -let rewrite =- match Sys.getenv "REWRITE" with- | exception Not_found -> false- | _ -> true+let rewrite = Sys.getenv "REWRITE" |> Option.is_some let actual = Buffer.create 10 @@ -540,7 +534,7 @@ module Make (Language : Types.Language.S) (Meta : Metasyntax.S) (Ext : External. let hole_parser sort dimension : (production * 'a) t t = let hole_parser = (* This must be fold, can't be find *)- let open Polymorphic_compare in+ let open Poly in List.fold ~init:[] Template.Matching.hole_parsers ~f:(fun acc (sort', parser) -> if sort' = sort then parser::acc else acc) indiff --git a/lib/kernel/matchers/preprocess.ml b/lib/kernel/matchers/preprocess.mlindex 84f3ed0..b6d10e7 100644--- a/lib/kernel/matchers/preprocess.ml+++ b/lib/kernel/matchers/preprocess.ml@@ -1,9 +1,6 @@ open Core_kernel -let debug =- match Sys.getenv "DEBUG_COMBY" with- | exception Not_found -> false- | _ -> true+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some let append_rule (module Parser : Types.Rule.S) rule parent_rule = let open Option indiff --git a/lib/kernel/matchers/regexp.ml b/lib/kernel/matchers/regexp.mlindex ef0bd59..906820b 100644--- a/lib/kernel/matchers/regexp.ml+++ b/lib/kernel/matchers/regexp.ml@@ -3,7 +3,7 @@ open Vangstrom let debug = match Sys.getenv "DEBUG_COMBY" with | exception Not_found -> false- | _ -> true+ | (_ : string) -> true module type Regexp_engine_intf = sig type tdiff --git a/lib/kernel/matchers/rewrite.ml b/lib/kernel/matchers/rewrite.mlindex 32c4740..545cba5 100644--- a/lib/kernel/matchers/rewrite.ml+++ b/lib/kernel/matchers/rewrite.ml@@ -4,10 +4,7 @@ open Core_kernel open Match open Replacement -let debug =- match Sys.getenv "DEBUG_COMBY" with- | exception Not_found -> false- | _ -> true+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some let counter = let uuid_for_id_counter = ref 0 in@@ -46,24 +43,24 @@ let parse_first_label ?(metasyntax = Metasyntax.default_metasyntax) template = in parse_string ~consume:All parser template |> function- | Ok label -> List.find_map label ~f:ident+ | Ok label -> List.find_map label ~f:Fn.id | Error _ -> None let substitute_fresh ?(metasyntax = Metasyntax.default_metasyntax) ?(fresh = counter) template =- let label_table = String.Table.create () in+ let label_table = Hashtbl.create (module String) in let template_ref = ref template in let current_label_ref = ref (parse_first_label ~metasyntax !template_ref) in while Option.is_some !current_label_ref do let label = Option.value_exn !current_label_ref in let id =- match String.Table.find label_table label with+ match Hashtbl.find label_table label with | Some id -> id | None -> let id = fresh () in- if String.(label <> "") then String.Table.add_exn label_table ~key:label ~data:id;+ if String.(label <> "") then Hashtbl.add_exn label_table ~key:label ~data:id; id in let left, right = replacement_sentinel metasyntax indiff --git a/lib/kernel/matchers/template.ml b/lib/kernel/matchers/template.mlindex 423a07f..136236c 100644--- a/lib/kernel/matchers/template.ml+++ b/lib/kernel/matchers/template.ml@@ -4,10 +4,7 @@ open Core_kernel open Match open Types.Template -let debug =- match Sys.getenv "DEBUG_COMBY" with- | exception Not_found -> false- | _ -> true+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some module Make (Metasyntax : Types.Metasyntax.S) (External : Types.External.S) : Types.Template.S = struct diff --git a/lib/kernel/parsers/dune b/lib/kernel/parsers/duneindex 28b020c..0cc1fa5 100644--- a/lib/kernel/parsers/dune+++ b/lib/kernel/parsers/dune@@ -1,6 +1,8 @@ (library- (name parsers)- (public_name comby-kernel.parsers)- (instrumentation (backend bisect_ppx))- (preprocess (pps ppx_sexp_conv))- (libraries core_kernel comby-kernel.vangstrom mparser))+ (name parsers)+ (public_name comby-kernel.parsers)+ (instrumentation+ (backend bisect_ppx))+ (preprocess+ (pps ppx_sexp_conv))+ (libraries core_kernel comby-kernel.vangstrom mparser))diff --git a/lib/kernel/replacement/dune b/lib/kernel/replacement/duneindex 3e62de6..485b716 100644--- a/lib/kernel/replacement/dune+++ b/lib/kernel/replacement/dune@@ -1,6 +1,13 @@ (library- (name replacement)- (public_name comby-kernel.replacement)- (instrumentation (backend bisect_ppx))- (preprocess (pps ppx_deriving_yojson))- (libraries comby-kernel.match core_kernel yojson ppx_deriving_yojson ppx_deriving_yojson.runtime))+ (name replacement)+ (public_name comby-kernel.replacement)+ (instrumentation+ (backend bisect_ppx))+ (preprocess+ (pps ppx_deriving_yojson))+ (libraries+ comby-kernel.match+ core_kernel+ yojson+ ppx_deriving_yojson+ ppx_deriving_yojson.runtime))diff --git a/lib/semantic/dune b/lib/semantic/duneindex 9a244d3..186a2ed 100644--- a/lib/semantic/dune+++ b/lib/semantic/dune@@ -1,11 +1,8 @@ (library- (name comby_semantic)- (public_name comby-semantic)- (instrumentation (backend bisect_ppx))- (preprocess (pps ppx_deriving.show ppx_deriving.eq ppx_sexp_conv))- (libraries- core_kernel- lwt- cohttp- cohttp-lwt-unix- yojson))+ (name comby_semantic)+ (public_name comby-semantic)+ (instrumentation+ (backend bisect_ppx))+ (preprocess+ (pps ppx_deriving.show ppx_deriving.eq ppx_sexp_conv))+ (libraries core_kernel lwt cohttp cohttp-lwt-unix yojson))diff --git a/lib/semantic/lsif.ml b/lib/semantic/lsif.mlindex 49747bc..d6b3e19 100644--- a/lib/semantic/lsif.ml+++ b/lib/semantic/lsif.ml@@ -3,10 +3,7 @@ open Lwt open Cohttp open Cohttp_lwt_unix -let debug =- match Sys.getenv "DEBUG_COMBY" with- | exception Not_found -> false- | _ -> true+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some module Formatting = struct type t =diff --git a/src/dune b/src/duneindex 444a5a3..f006195 100644--- a/src/dune+++ b/src/dune@@ -1,10 +1,17 @@ (executables- (libraries comby core ppx_deriving_yojson ppx_deriving_yojson.runtime- (select if_hack_parallel.ml from- (hack_parallel -> if_hack_parallel.available.ml)- (!hack_parallel -> if_hack_parallel.unavailable.ml))- )- (preprocess (pps ppx_deriving_yojson ppx_let ppx_deriving.show ppx_sexp_conv))+ (libraries+ comby+ core+ core_unix.command_unix+ ppx_deriving_yojson+ ppx_deriving_yojson.runtime+ (select+ if_hack_parallel.ml+ from+ (hack_parallel -> if_hack_parallel.available.ml)+ (!hack_parallel -> if_hack_parallel.unavailable.ml)))+ (preprocess+ (pps ppx_deriving_yojson ppx_let ppx_deriving.show ppx_sexp_conv)) (modules main if_hack_parallel) (modes byte exe) (names main))@@ -20,4 +27,5 @@ (install (package comby) (section bin)- (files (main.exe as comby)))+ (files+ (main.exe as comby)))diff --git a/src/main.ml b/src/main.mlindex 1def81d..79af76b 100644--- a/src/main.ml+++ b/src/main.ml@@ -1,4 +1,5 @@ open Core+module Unix = Core_unix open Command.Let_syntax open Comby_kernel@@ -47,7 +48,7 @@ let substitute_environment_only_and_exit metasyntax_path anonymous_arguments jso match metasyntax_path with | None -> Matchers.Metasyntax.default_metasyntax | Some metasyntax_path ->- match Sys.file_exists metasyntax_path with+ match Sys_unix.file_exists metasyntax_path with | `No | `Unknown -> Format.eprintf "Could not open file: %s@." metasyntax_path; exit 1@@ -95,7 +96,7 @@ let base_command_parameters : (unit -> 'result) Command.Param.t = and verbose = flag "verbose" no_arg ~doc:(Format.sprintf "Log to %s" verbose_out_file) and rule = flag "rule" (optional_with_default "where true" string) ~doc:"rule Apply rules to matches." and match_timeout = flag "timeout" (optional_with_default 3 int) ~doc:"seconds Set match timeout on a source. Default: 3 seconds"- and target_directory = flag "directory" ~aliases:["d"] (optional_with_default (Sys.getcwd ()) string) ~doc:(Format.sprintf "path Run recursively on files in a directory relative to the root. Default is current directory: %s" @@ Sys.getcwd ())+ and target_directory = flag "directory" ~aliases:["d"] (optional_with_default (Sys_unix.getcwd ()) string) ~doc:(Format.sprintf "path Run recursively on files in a directory relative to the root. Default is current directory: %s" @@ Sys_unix.getcwd ()) and directory_depth = flag "depth" (optional int) ~doc:"n Depth to recursively descend into directories" and templates = flag "templates" ~aliases:["config"; "configuration"] (optional (Arg_type.comma_separated string)) ~doc:"paths CSV of directories containing templates, or TOML configuration files" and file_filters = flag "extensions" ~aliases:["e"; "file-extensions"; "f"] (optional (Arg_type.comma_separated string)) ~doc:"extensions Comma-separated extensions to include, like \".go\" or \".c,.h\". It is just a file suffix, so you can use it to filter file names like \"main.go\". The extension will be used to infer a matcher, unless -custom-matcher or -matcher is specified"@@ -147,7 +148,7 @@ let base_command_parameters : (unit -> 'result) Command.Param.t = | l -> List.map l ~f:(fun pattern -> if String.contains pattern '/' then- match Filename.realpath pattern with+ match Filename_unix.realpath pattern with | exception Unix.Unix_error _ -> Format.eprintf "No such file or directory: %s. Comby interprets \@@ -204,7 +205,7 @@ let base_command_parameters : (unit -> 'result) Command.Param.t = let omega = omega || omega_env in let fast_offset_conversion_env = Option.is_some @@ Sys.getenv "FAST_OFFSET_CONVERSION_COMBY" in let fast_offset_conversion = fast_offset_conversion_env || fast_offset_conversion in- let arch = Unix.Utsname.machine (Core.Unix.uname ()) in+ let arch = Unix.Utsname.machine (Unix.uname ()) in let compute_mode = match sequential, parany, arch with | true, _, _ -> `Sequential | _, true, _@@ -304,7 +305,7 @@ let parse_comby_dot_file () = let () = If_hack_parallel.check_entry_point ();- Command.run default_command ~version:"1.8.1" ~extend:(fun _ ->- match Sys.file_exists ".comby" with+ Command_unix.run default_command ~version:"1.8.1" ~extend:(fun _ ->+ match Sys_unix.file_exists ".comby" with | `Yes -> parse_comby_dot_file () | _ -> [])diff --git a/test/alpha/dune b/test/alpha/duneindex d7e5532..020677c 100644--- a/test/alpha/dune+++ b/test/alpha/dune@@ -1,17 +1,14 @@ (library (name alpha_test_integration) (package comby)- (modules- test_special_matcher_cases- test_substring_disabled)+ (modules test_special_matcher_cases test_substring_disabled) (inline_tests)- (preprocess (pps ppx_expect ppx_sexp_message ppx_deriving_yojson))- (libraries- comby- cohttp-lwt-unix- core- camlzip))+ (preprocess+ (pps ppx_expect ppx_sexp_message ppx_deriving_yojson))+ (libraries comby cohttp-lwt-unix core camlzip)) (alias-(name runtest)-(deps (source_tree example) (source_tree example/src/.ignore-me)))+ (name runtest)+ (deps+ (source_tree example)+ (source_tree example/src/.ignore-me)))diff --git a/test/common/dune b/test/common/duneindex 6851f2e..bc3c055 100644--- a/test/common/dune+++ b/test/common/dune@@ -36,16 +36,14 @@ test_regex_holes test_template_constraints test_custom_metasyntax- test_rewrite_attributes- )+ test_rewrite_attributes) (inline_tests)- (preprocess (pps ppx_expect ppx_sexp_message ppx_deriving_yojson))- (libraries- comby- cohttp-lwt-unix- core- camlzip))+ (preprocess+ (pps ppx_expect ppx_sexp_message ppx_deriving_yojson))+ (libraries comby cohttp-lwt-unix core camlzip)) (alias-(name runtest)-(deps (source_tree example) (source_tree example/src/.ignore-me)))+ (name runtest)+ (deps+ (source_tree example)+ (source_tree example/src/.ignore-me)))diff --git a/test/common/test_cli.ml b/test/common/test_cli.mlindex 3606367..d5d0c0b 100644--- a/test/common/test_cli.ml+++ b/test/common/test_cli.ml@@ -1,7 +1,10 @@ open Core open Camlzip +module Filename = Filename_unix+module Sys = Sys_unix module Time = Core_kernel.Time_ns.Span+module Unix = Core_unix let binary_path = "../../../../comby" diff --git a/test/common/test_cli_helper.ml b/test/common/test_cli_helper.mlindex 5791ee6..18372ae 100644--- a/test/common/test_cli_helper.ml+++ b/test/common/test_cli_helper.ml@@ -1,6 +1,7 @@ open Core module Time = Core_kernel.Time_ns.Span+module Unix = Core_unix let binary_path = "../../../../comby" diff --git a/test/omega/dune b/test/omega/duneindex 3b31a7e..bf68dcb 100644--- a/test/omega/dune+++ b/test/omega/dune@@ -2,20 +2,19 @@ (name omega_test_integration) (package comby) (modules-;-; TODO-;+ ;+ ; TODO+ ; test_optional_holes test_special_matcher_cases test_substring_disabled) (inline_tests)- (preprocess (pps ppx_expect ppx_sexp_message ppx_deriving_yojson))- (libraries- comby- cohttp-lwt-unix- core- camlzip))+ (preprocess+ (pps ppx_expect ppx_sexp_message ppx_deriving_yojson))+ (libraries comby cohttp-lwt-unix core camlzip)) (alias-(name runtest)-(deps (source_tree example) (source_tree example/src/.ignore-me)))+ (name runtest)+ (deps+ (source_tree example)+ (source_tree example/src/.ignore-me)))