at master 38 kB view raw
1diff --git a/comby-kernel.opam b/comby-kernel.opam 2index 9db7cc5..83e6e7b 100644 3--- a/comby-kernel.opam 4+++ b/comby-kernel.opam 5@@ -20,7 +20,7 @@ build: [ 6 depends: [ 7 "dune" {>= "2.8.0"} 8 "ocaml" {>= "4.08.1"} 9- "core_kernel" 10+ "core-kernel" {>= "v0.16.0"} 11 "mparser" {>= "1.3"} 12 "mparser-pcre" 13 "ppx_deriving" 14diff --git a/comby-semantic.opam b/comby-semantic.opam 15index 88563f6..fbbc122 100644 16--- a/comby-semantic.opam 17+++ b/comby-semantic.opam 18@@ -20,7 +20,7 @@ build: [ 19 depends: [ 20 "dune" {>= "2.8.0"} 21 "ocaml" {>= "4.08.1"} 22- "core_kernel" 23+ "core_kernel" {>= "v0.15.0"} 24 "ppx_deriving" 25 "lwt" 26 "cohttp" 27diff --git a/comby.opam b/comby.opam 28index 9e5d96b..d5be316 100644 29--- a/comby.opam 30+++ b/comby.opam 31@@ -31,7 +31,7 @@ depends: [ 32 "cohttp-lwt-unix" 33 "comby-kernel" {= "1.7.0"} 34 "comby-semantic" {= "1.7.0"} 35- "core" 36+ "core" {>= "v0.16.0"} 37 "hack_parallel" {arch != "arm32" & arch != "arm64"} 38 "lwt" 39 "lwt_react" 40diff --git a/lib/app/configuration/command_configuration.ml b/lib/app/configuration/command_configuration.ml 41index 75c3107..29826a9 100644 42--- a/lib/app/configuration/command_configuration.ml 43+++ b/lib/app/configuration/command_configuration.ml 44@@ -1,7 +1,7 @@ 45 open Core 46 open Camlzip 47 48-open Polymorphic_compare 49+open Poly 50 51 open Comby_kernel 52 53@@ -16,21 +16,21 @@ type 'a next = 54 55 let fold_directory ?(sorted=false) root ~init ~f = 56 let rec aux acc absolute_path depth = 57- if Sys.is_file absolute_path = `Yes then 58+ if Sys_unix.is_file absolute_path = `Yes then 59 match f acc ~depth ~absolute_path ~is_file:true with 60 | Continue acc 61 | Skip acc -> acc 62- else if Sys.is_directory absolute_path = `Yes then 63+ else if Sys_unix.is_directory absolute_path = `Yes then 64 match f acc ~depth ~absolute_path ~is_file:false with 65 | Skip acc -> acc 66 | Continue acc -> 67 let dir_contents = 68 if Option.is_some (Sys.getenv "COMBY_TEST") || sorted then 69- Sys.ls_dir absolute_path 70+ Sys_unix.ls_dir absolute_path 71 |> List.sort ~compare:String.compare 72 |> List.rev 73 else 74- Sys.ls_dir absolute_path 75+ Sys_unix.ls_dir absolute_path 76 in 77 List.fold dir_contents ~init:acc ~f:(fun acc subdir -> 78 aux acc (Filename.concat absolute_path subdir) (depth + 1)) 79@@ -50,8 +50,8 @@ let parse_source_directories 80 let exact_file_paths, file_patterns = 81 List.partition_map file_filters ~f:(fun path -> 82 let is_exact path = 83- (String.contains path '/' && Sys.is_file path = `Yes) 84- || (Sys.is_file ("." ^/ path) = `Yes) (* See if it matches something in the current directory *) 85+ (String.contains path '/' && Sys_unix.is_file path = `Yes) 86+ || (Sys_unix.is_file ("." ^/ path) = `Yes) (* See if it matches something in the current directory *) 87 in 88 if is_exact path then Either.First path else Either.Second path) 89 in 90@@ -167,8 +167,8 @@ let parse_templates ?metasyntax ?(warn_for_missing_file_in_dir = false) paths = 91 let f acc ~depth:_ ~absolute_path ~is_file = 92 let is_leaf_directory absolute_path = 93 not is_file && 94- Sys.ls_dir absolute_path 95- |> List.for_all ~f:(fun path -> Sys.is_directory (absolute_path ^/ path) = `No) 96+ Sys_unix.ls_dir absolute_path 97+ |> List.for_all ~f:(fun path -> Sys_unix.is_directory (absolute_path ^/ path) = `No) 98 in 99 if is_leaf_directory absolute_path then 100 match parse_directory absolute_path with 101@@ -178,7 +178,7 @@ let parse_templates ?metasyntax ?(warn_for_missing_file_in_dir = false) paths = 102 Continue acc 103 in 104 List.concat_map paths ~f:(fun path -> 105- if Sys.is_directory path = `Yes then 106+ if Sys_unix.is_directory path = `Yes then 107 fold_directory path ~sorted:true ~init:[] ~f 108 else 109 parse_toml ?metasyntax path) 110@@ -428,7 +428,7 @@ let parse_metasyntax metasyntax_path = 111 match metasyntax_path with 112 | None -> Matchers.Metasyntax.default_metasyntax 113 | Some metasyntax_path -> 114- match Sys.file_exists metasyntax_path with 115+ match Sys_unix.file_exists metasyntax_path with 116 | `No | `Unknown -> 117 Format.eprintf "Could not open file: %s@." metasyntax_path; 118 exit 1 119@@ -477,14 +477,14 @@ let emit_errors { input_options; output_options; _ } = 120 ; Option.is_some input_options.directory_depth 121 && Option.value_exn (input_options.directory_depth) < 0 122 , "-depth must be 0 or greater." 123- ; Sys.is_directory input_options.target_directory = `No 124+ ; Sys_unix.is_directory input_options.target_directory = `No 125 , "Directory specified with -d or -directory is not a directory." 126 ; output_options.json_only_diff && not output_options.json_lines 127 , "-json-only-diff can only be supplied with -json-lines." 128 ; (Option.is_some output_options.chunk_matches) && Option.is_some input_options.zip_file 129 , "chunk-matches output format is not supported for zip files." 130 ; Option.is_some output_options.interactive_review && 131- (not (String.equal input_options.target_directory (Sys.getcwd ()))) 132+ (not (String.equal input_options.target_directory (Sys_unix.getcwd ()))) 133 , "Please remove the -d option and `cd` to the directory where you want to \ 134 review from. The -review, -editor, or -default-no options should only be run \ 135 at the root directory of the project files to patch." 136@@ -492,11 +492,11 @@ let emit_errors { input_options; output_options; _ } = 137 match input_options.templates with 138 | Some inputs -> 139 List.find_map inputs ~f:(fun input -> 140- if Sys.is_file input = `Yes then 141+ if Sys_unix.is_file input = `Yes then 142 (match Toml.Parser.from_filename input with 143 | `Error (s, _) -> Some s 144 | _ -> None) 145- else if not (Sys.is_directory input = `Yes) then 146+ else if not (Sys_unix.is_directory input = `Yes) then 147 Some (Format.sprintf "Directory %S specified with -templates is not a directory." input) 148 else 149 None) 150@@ -611,7 +611,7 @@ let filter_zip_entries file_filters exclude_directory_prefix exclude_file_prefix 151 152 let syntax custom_matcher_path = 153 match 154- Sys.file_exists custom_matcher_path with 155+ Sys_unix.file_exists custom_matcher_path with 156 | `No | `Unknown -> 157 Format.eprintf "Could not open file: %s@." custom_matcher_path; 158 exit 1 159@@ -795,7 +795,7 @@ let create 160 | Directory -> 161 let target_directory = 162 if target_directory = "." then 163- Filename.realpath target_directory 164+ Filename_unix.realpath target_directory 165 else 166 target_directory 167 in 168diff --git a/lib/app/configuration/dune b/lib/app/configuration/dune 169index e0f9748..e417cfe 100644 170--- a/lib/app/configuration/dune 171+++ b/lib/app/configuration/dune 172@@ -1,6 +1,21 @@ 173 (library 174- (name configuration) 175- (public_name comby.configuration) 176- (instrumentation (backend bisect_ppx)) 177- (preprocess (pps ppx_deriving.show ppx_sexp_conv ppx_sexp_message ppx_deriving_yojson)) 178- (libraries comby-kernel comby-semantic comby.patdiff comby.camlzip core yojson ppx_deriving_yojson toml lwt lwt.unix tar tar-unix)) 179+ (name configuration) 180+ (public_name comby.configuration) 181+ (instrumentation 182+ (backend bisect_ppx)) 183+ (preprocess 184+ (pps ppx_deriving.show ppx_sexp_conv ppx_sexp_message ppx_deriving_yojson)) 185+ (libraries 186+ comby-kernel 187+ comby-semantic 188+ comby.patdiff 189+ comby.camlzip 190+ core 191+ core_unix.sys_unix 192+ yojson 193+ ppx_deriving_yojson 194+ toml 195+ lwt 196+ lwt.unix 197+ tar 198+ tar-unix)) 199diff --git a/lib/app/configuration/external_semantic.ml b/lib/app/configuration/external_semantic.ml 200index bdc7051..ac69b1b 100644 201--- a/lib/app/configuration/external_semantic.ml 202+++ b/lib/app/configuration/external_semantic.ml 203@@ -2,13 +2,10 @@ open Core_kernel 204 205 open Comby_semantic 206 207-let debug = 208- match Sys.getenv "DEBUG_COMBY" with 209- | exception Not_found -> false 210- | _ -> true 211+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some 212 213 let lsif_hover ~name:_ ~filepath ~line ~column = 214- String.chop_prefix_if_exists filepath ~prefix:(Sys.getcwd ()) |> fun filepath_relative_root -> 215+ String.chop_prefix_if_exists filepath ~prefix:(Sys_unix.getcwd ()) |> fun filepath_relative_root -> 216 if debug then Format.printf "File relative root: %s@." filepath; 217 if debug then Format.printf "Querying type at %d::%d@." line column; 218 let context = 219diff --git a/lib/app/dune b/lib/app/dune 220index 2ed553c..a91f826 100644 221--- a/lib/app/dune 222+++ b/lib/app/dune 223@@ -1,9 +1,8 @@ 224 (library 225- (name comby) 226- (public_name comby) 227- (instrumentation (backend bisect_ppx)) 228- (preprocess (pps ppx_deriving.show ppx_deriving.eq ppx_sexp_conv)) 229- (libraries 230- core 231- comby-kernel 232- comby.pipeline)) 233+ (name comby) 234+ (public_name comby) 235+ (instrumentation 236+ (backend bisect_ppx)) 237+ (preprocess 238+ (pps ppx_deriving.show ppx_deriving.eq ppx_sexp_conv)) 239+ (libraries core comby-kernel comby.pipeline)) 240diff --git a/lib/app/interactive/dune b/lib/app/interactive/dune 241index 815aff5..63c1757 100644 242--- a/lib/app/interactive/dune 243+++ b/lib/app/interactive/dune 244@@ -1,5 +1,12 @@ 245 (library 246- (name interactive) 247- (public_name comby.interactive) 248- (preprocess (pps ppx_sexp_conv)) 249- (libraries comby-kernel comby.configuration core shell.filename_extended lwt lwt.unix)) 250+ (name interactive) 251+ (public_name comby.interactive) 252+ (preprocess 253+ (pps ppx_sexp_conv)) 254+ (libraries 255+ comby-kernel 256+ comby.configuration 257+ core 258+ shell.filename_extended 259+ lwt 260+ lwt.unix)) 261diff --git a/lib/app/interactive/interactive.ml b/lib/app/interactive/interactive.ml 262index d4bf200..b27105a 100644 263--- a/lib/app/interactive/interactive.ml 264+++ b/lib/app/interactive/interactive.ml 265@@ -1,5 +1,6 @@ 266 open Core 267 open Lwt 268+module Unix = Core_unix 269 270 open Configuration 271 272@@ -37,6 +38,7 @@ module Diff = struct 273 ~big_enough:line_big_enough 274 ~prev 275 ~next 276+ () 277 | Some prog -> 278 let compare x y = 279 let cmd = sprintf "%s %S %S" prog x y in 280@@ -52,7 +54,7 @@ module Diff = struct 281 let compare = compare 282 end) 283 in 284- P.get_hunks ~transform ~context ~big_enough:line_big_enough ~prev ~next 285+ P.get_hunks ~transform ~context ~big_enough:line_big_enough ~prev ~next () 286 in 287 match float_tolerance with 288 | None -> hunks 289diff --git a/lib/app/pipeline/dune b/lib/app/pipeline/dune 290index 3369b9e..e6ec880 100644 291--- a/lib/app/pipeline/dune 292+++ b/lib/app/pipeline/dune 293@@ -1,11 +1,23 @@ 294 (library 295- (name pipeline) 296- (public_name comby.pipeline) 297- (instrumentation (backend bisect_ppx)) 298- (preprocess (pps ppx_sexp_conv ppx_deriving_yojson)) 299- (libraries comby-kernel comby.statistics comby.configuration comby.interactive comby.camlzip core core.uuid yojson ppx_deriving_yojson parany 300- (select parallel_hack.ml from 301- (hack_parallel -> parallel_hack.available.ml) 302- (!hack_parallel -> parallel_hack.parany_fallback.ml)) 303- )) 304- 305+ (name pipeline) 306+ (public_name comby.pipeline) 307+ (instrumentation 308+ (backend bisect_ppx)) 309+ (preprocess 310+ (pps ppx_sexp_conv ppx_deriving_yojson)) 311+ (libraries 312+ comby-kernel 313+ comby.statistics 314+ comby.configuration 315+ comby.interactive 316+ comby.camlzip 317+ core 318+ core_unix.uuid 319+ yojson 320+ ppx_deriving_yojson 321+ parany 322+ (select 323+ parallel_hack.ml 324+ from 325+ (hack_parallel -> parallel_hack.available.ml) 326+ (!hack_parallel -> parallel_hack.parany_fallback.ml)))) 327diff --git a/lib/app/pipeline/parallel_hack.available.ml b/lib/app/pipeline/parallel_hack.available.ml 328index a901eea..ad33070 100644 329--- a/lib/app/pipeline/parallel_hack.available.ml 330+++ b/lib/app/pipeline/parallel_hack.available.ml 331@@ -1,4 +1,5 @@ 332 open Core 333+module Unix = Core_unix 334 335 open Hack_parallel 336 337diff --git a/lib/app/statistics/dune b/lib/app/statistics/dune 338index b14d5b1..12aff7f 100644 339--- a/lib/app/statistics/dune 340+++ b/lib/app/statistics/dune 341@@ -1,6 +1,8 @@ 342 (library 343- (name statistics) 344- (public_name comby.statistics) 345- (instrumentation (backend bisect_ppx)) 346- (preprocess (pps ppx_deriving_yojson)) 347- (libraries yojson ppx_deriving_yojson ppx_deriving_yojson.runtime)) 348+ (name statistics) 349+ (public_name comby.statistics) 350+ (instrumentation 351+ (backend bisect_ppx)) 352+ (preprocess 353+ (pps ppx_deriving_yojson)) 354+ (libraries yojson ppx_deriving_yojson ppx_deriving_yojson.runtime)) 355diff --git a/lib/app/vendored/patdiff/kernel/src/dune b/lib/app/vendored/patdiff/kernel/src/dune 356index 7a6353d..b79cba2 100644 357--- a/lib/app/vendored/patdiff/kernel/src/dune 358+++ b/lib/app/vendored/patdiff/kernel/src/dune 359@@ -1,3 +1,6 @@ 360-(library (name patdiff_kernel) (public_name comby.patdiff_kernel) 361+(library 362+ (name patdiff_kernel) 363+ (public_name comby.patdiff_kernel) 364 (libraries core_kernel.composition_infix core_kernel patience_diff re) 365- (preprocess (pps ppx_jane))) 366+ (preprocess 367+ (pps ppx_jane))) 368diff --git a/lib/app/vendored/patdiff/kernel/src/float_tolerance.ml b/lib/app/vendored/patdiff/kernel/src/float_tolerance.ml 369index 4e064fb..dca77b2 100644 370--- a/lib/app/vendored/patdiff/kernel/src/float_tolerance.ml 371+++ b/lib/app/vendored/patdiff/kernel/src/float_tolerance.ml 372@@ -287,7 +287,7 @@ end = struct 373 ~running_step:(fun (car, pos) cadr -> 374 match car, cadr with 375 | Same car_lines, Same cadr_lines -> 376- Skip (Same (Array.concat [ car_lines; cadr_lines ]), pos) 377+ Skip {state = (Same (Array.concat [ car_lines; cadr_lines ]), pos)} 378 | Unified _, _ | _, Unified _ -> 379 raise_s 380 [%message 381@@ -296,7 +296,7 @@ end = struct 382 (cadr : string Range.t)] 383 | (Prev _ | Next _ | Replace _), (Prev _ | Next _ | Replace _) 384 | Same _, (Prev _ | Next _ | Replace _) 385- | (Prev _ | Next _ | Replace _), Same _ -> Yield ((car, pos), (cadr, Middle))) 386+ | (Prev _ | Next _ | Replace _), Same _ -> Yield {value = (car, pos); state = (cadr, Middle)}) 387 ~inner_finished:(fun (last, pos) -> 388 match last, pos with 389 | Unified _, _ -> 390@@ -308,7 +308,7 @@ end = struct 391 Some (last, End)) 392 ~finishing_step:(function 393 | None -> Done 394- | Some result -> Yield (result, None)) 395+ | Some result -> Yield {value = result; state = None}) 396 ;; 397 398 include struct 399@@ -448,7 +448,7 @@ end = struct 400 ~init:{ prev_start; next_start; ranges = [] } 401 ~running_step:(fun t drop_or_keep -> 402 match (drop_or_keep : Drop_or_keep.t) with 403- | Keep range -> Skip { t with ranges = range :: t.ranges } 404+ | Keep range -> Skip {state = { t with ranges = range :: t.ranges }} 405 | Drop n -> 406 let hunk = to_hunk t in 407 let t = 408@@ -457,11 +457,11 @@ end = struct 409 ; ranges = [] 410 } 411 in 412- if List.is_empty (Hunk.ranges hunk) then Skip t else Yield (hunk, t)) 413+ if List.is_empty (Hunk.ranges hunk) then Skip {state = t} else Yield {value = hunk; state = t}) 414 ~inner_finished:(fun t -> if List.is_empty t.ranges then None else Some t) 415 ~finishing_step:(function 416 | None -> Done 417- | Some t -> Yield (to_hunk t, None)) 418+ | Some t -> Yield {value = to_hunk t; state = None}) 419 ;; 420 end 421 422diff --git a/lib/app/vendored/patdiff/kernel/src/patdiff_core.ml b/lib/app/vendored/patdiff/kernel/src/patdiff_core.ml 423index 4f53a0b..88ee0e3 100644 424--- a/lib/app/vendored/patdiff/kernel/src/patdiff_core.ml 425+++ b/lib/app/vendored/patdiff/kernel/src/patdiff_core.ml 426@@ -138,6 +138,7 @@ module Make (Output_impls : Output_impls) = struct 427 ~big_enough:line_big_enough 428 ~prev 429 ~next 430+ () 431 ;; 432 433 type word_or_newline = 434@@ -345,6 +346,7 @@ module Make (Output_impls : Output_impls) = struct 435 ~big_enough:word_big_enough 436 ~prev:prev_pieces 437 ~next:next_pieces 438+ () 439 ;; 440 441 let ranges_are_just_whitespace (ranges : _ Patience_diff.Range.t list) = 442diff --git a/lib/app/vendored/patdiff/lib/src/compare_core.ml b/lib/app/vendored/patdiff/lib/src/compare_core.ml 443index fafb201..8b40d09 100644 444--- a/lib/app/vendored/patdiff/lib/src/compare_core.ml 445+++ b/lib/app/vendored/patdiff/lib/src/compare_core.ml 446@@ -1,5 +1,6 @@ 447 open! Core 448 open! Import 449+module Unix = Core_unix 450 451 let lines_of_contents contents = 452 let lines = Array.of_list (String.split_lines contents) in 453@@ -100,6 +101,7 @@ let compare_lines (config : Configuration.t) ?prev_diff ?next_diff ~prev ~next ( 454 ~big_enough:line_big_enough 455 ~prev 456 ~next 457+ () 458 | Some prog -> 459 let compare x y = 460 let cmd = sprintf "%s %S %S" prog x y in 461@@ -116,7 +118,7 @@ let compare_lines (config : Configuration.t) ?prev_diff ?next_diff ~prev ~next ( 462 let compare = compare 463 end) 464 in 465- P.get_hunks ~transform ~context ~big_enough:line_big_enough ~prev ~next 466+ P.get_hunks ~transform ~context ~big_enough:line_big_enough ~prev ~next () 467 in 468 let hunks = 469 match config.float_tolerance with 470@@ -361,7 +363,7 @@ let rec diff_dirs_internal (config : Configuration.t) ~prev_dir ~next_dir ~file_ 471 | None -> Fn.const true 472 | Some file_filter -> file_filter 473 in 474- Sys.ls_dir (File_name.real_name_exn dir) 475+ Sys_unix.ls_dir (File_name.real_name_exn dir) 476 |> List.filter ~f:(fun x -> 477 let x = File_name.real_name_exn dir ^/ x in 478 match Unix.stat x with 479diff --git a/lib/app/vendored/patdiff/lib/src/compare_core.mli b/lib/app/vendored/patdiff/lib/src/compare_core.mli 480index e919512..caa8dcb 100644 481--- a/lib/app/vendored/patdiff/lib/src/compare_core.mli 482+++ b/lib/app/vendored/patdiff/lib/src/compare_core.mli 483@@ -1,5 +1,6 @@ 484 open! Core 485 open! Import 486+module Unix = Core_unix 487 488 val diff_files 489 : Configuration.t 490diff --git a/lib/app/vendored/patdiff/lib/src/configuration.ml b/lib/app/vendored/patdiff/lib/src/configuration.ml 491index 6879daa..7d59706 100644 492--- a/lib/app/vendored/patdiff/lib/src/configuration.ml 493+++ b/lib/app/vendored/patdiff/lib/src/configuration.ml 494@@ -481,7 +481,7 @@ let rec load_exn' ~set config_file = 495 | Error _another_exn -> raise exn 496 | Ok c -> 497 (let new_file = config_file ^ ".new" in 498- match Sys.file_exists new_file with 499+ match Sys_unix.file_exists new_file with 500 | `Yes | `Unknown -> () 501 | `No -> 502 (try Sexp.save_hum new_file (On_disk.V1.sexp_of_t c) with 503@@ -564,7 +564,7 @@ let get_config ?filename () = 504 (* ~/.patdiff exists *) 505 Option.bind (Sys.getenv "HOME") ~f:(fun home -> 506 let f = home ^/ ".patdiff" in 507- match Sys.file_exists f with 508+ match Sys_unix.file_exists f with 509 | `Yes -> Some f 510 | `No | `Unknown -> None) 511 in 512diff --git a/lib/app/vendored/patdiff/lib/src/dune b/lib/app/vendored/patdiff/lib/src/dune 513index 007acad..b6a0f80 100644 514--- a/lib/app/vendored/patdiff/lib/src/dune 515+++ b/lib/app/vendored/patdiff/lib/src/dune 516@@ -1,4 +1,13 @@ 517-(library (name patdiff) (public_name comby.patdiff) 518- (libraries core_kernel.composition_infix core core.linux_ext comby.patdiff_kernel 519+(library 520+ (name patdiff) 521+ (public_name comby.patdiff) 522+ (libraries 523+ core_kernel.composition_infix 524+ core 525+ core_unix 526+ core_unix.linux_ext 527+ core_unix.sys_unix 528+ comby.patdiff_kernel 529 patience_diff) 530- (preprocess (pps ppx_jane))) 531+ (preprocess 532+ (pps ppx_jane))) 533diff --git a/lib/app/vendored/patdiff/lib/src/html_output.ml b/lib/app/vendored/patdiff/lib/src/html_output.ml 534index 3d08f91..93ae8af 100644 535--- a/lib/app/vendored/patdiff/lib/src/html_output.ml 536+++ b/lib/app/vendored/patdiff/lib/src/html_output.ml 537@@ -1,5 +1,6 @@ 538 open! Core 539 open! Import 540+module Unix = Core_unix 541 542 include Patdiff_kernel.Html_output.Private.Make (struct 543 let mtime file = 544diff --git a/lib/kernel/match/dune b/lib/kernel/match/dune 545index 03b120a..4d48b61 100644 546--- a/lib/kernel/match/dune 547+++ b/lib/kernel/match/dune 548@@ -1,6 +1,12 @@ 549 (library 550- (name match) 551- (public_name comby-kernel.match) 552- (instrumentation (backend bisect_ppx)) 553- (preprocess (pps ppx_deriving.eq ppx_sexp_conv ppx_deriving_yojson)) 554- (libraries core_kernel yojson ppx_deriving_yojson ppx_deriving_yojson.runtime)) 555+ (name match) 556+ (public_name comby-kernel.match) 557+ (instrumentation 558+ (backend bisect_ppx)) 559+ (preprocess 560+ (pps ppx_deriving.eq ppx_sexp_conv ppx_deriving_yojson)) 561+ (libraries 562+ core_kernel 563+ yojson 564+ ppx_deriving_yojson 565+ ppx_deriving_yojson.runtime)) 566diff --git a/lib/kernel/matchers/alpha.ml b/lib/kernel/matchers/alpha.ml 567index d6116f7..7d16171 100644 568--- a/lib/kernel/matchers/alpha.ml 569+++ b/lib/kernel/matchers/alpha.ml 570@@ -13,20 +13,11 @@ module R = MakeRegexp(Regexp) 571 let configuration_ref = ref (Configuration.create ()) 572 let weaken_delimiter_hole_matching = false 573 574-let debug = 575- match Sys.getenv "DEBUG_COMBY" with 576- | exception Not_found -> false 577- | _ -> true 578+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some 579 580-let debug_hole = 581- match Sys.getenv "DEBUG_COMBY_HOLE" with 582- | exception Not_found -> false 583- | _ -> true 584+let debug_hole = Sys.getenv "DEBUG_COMBY_HOLE" |> Option.is_some 585 586-let debug_position = 587- match Sys.getenv "DEBUG_COMBY_POS" with 588- | exception Not_found -> false 589- | _ -> true 590+let debug_position = Sys.getenv "DEBUG_COMBY_POS" |> Option.is_some 591 592 let f _ = return Types.Unit 593 594@@ -147,7 +138,7 @@ module Make (Lang : Types.Language.S) (Meta : Types.Metasyntax.S) (Ext : Types.E 595 ] 596 >>= fun _ -> f Types.Unit 597 598- let sequence_chain (plist : ('c, Match.t) parser sexp_list) : ('c, Match.t) parser = 599+ let sequence_chain (plist : ('c, Match.t) parser list) : ('c, Match.t) parser = 600 List.fold plist ~init:(return Types.Unit) ~f:(>>) 601 602 let with_debug_matcher s tag = 603@@ -745,7 +736,7 @@ module Make (Lang : Types.Language.S) (Meta : Types.Metasyntax.S) (Ext : Types.E 604 let hole_parser ?at_depth sort dimension = 605 let open Types.Hole in 606 let hole_parser = 607- let open Polymorphic_compare in 608+ let open Poly in 609 List.fold ~init:[] hole_parsers ~f:(fun acc (sort', parser) -> if sort' = sort then parser::acc else acc) 610 in 611 let skip_signal hole = skip (string "_signal_hole") |>> fun () -> Types.Hole hole in 612diff --git a/lib/kernel/matchers/dune b/lib/kernel/matchers/dune 613index 12ed326..4625458 100644 614--- a/lib/kernel/matchers/dune 615+++ b/lib/kernel/matchers/dune 616@@ -1,6 +1,18 @@ 617 (library 618- (name matchers) 619- (public_name comby-kernel.matchers) 620- (instrumentation (backend bisect_ppx)) 621- (preprocess (pps ppx_here ppx_sexp_conv ppx_sexp_message ppx_deriving_yojson)) 622- (libraries comby-kernel.replacement comby-kernel.parsers comby-kernel.match comby-kernel.vangstrom core_kernel mparser mparser-pcre re yojson ppx_deriving_yojson)) 623+ (name matchers) 624+ (public_name comby-kernel.matchers) 625+ (instrumentation 626+ (backend bisect_ppx)) 627+ (preprocess 628+ (pps ppx_here ppx_sexp_conv ppx_sexp_message ppx_deriving_yojson)) 629+ (libraries 630+ comby-kernel.replacement 631+ comby-kernel.parsers 632+ comby-kernel.match 633+ comby-kernel.vangstrom 634+ core_kernel 635+ mparser 636+ mparser-pcre 637+ re 638+ yojson 639+ ppx_deriving_yojson)) 640diff --git a/lib/kernel/matchers/evaluate.ml b/lib/kernel/matchers/evaluate.ml 641index 9ea71a0..4f63ab6 100644 642--- a/lib/kernel/matchers/evaluate.ml 643+++ b/lib/kernel/matchers/evaluate.ml 644@@ -3,10 +3,7 @@ open Core_kernel 645 open Match 646 open Types.Ast 647 648-let debug = 649- match Sys.getenv "DEBUG_COMBY" with 650- | exception Not_found -> false 651- | _ -> true 652+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some 653 654 type result = bool * Match.environment option 655 656@@ -102,7 +99,7 @@ let apply 657 |> Option.some 658 in 659 List.find_map cases ~f:(fun (template, case_expression) -> evaluate template case_expression) 660- |> Option.value_map ~f:ident ~default:(false, Some env) 661+ |> Option.value_map ~f:Fn.id ~default:(false, Some env) 662 663 (* rewrite ... { ... } *) 664 | Rewrite (Template t, (match_template, rewrite_template)) -> 665diff --git a/lib/kernel/matchers/omega.ml b/lib/kernel/matchers/omega.ml 666index 61cc69a..3445307 100644 667--- a/lib/kernel/matchers/omega.ml 668+++ b/lib/kernel/matchers/omega.ml 669@@ -32,15 +32,9 @@ let push_source_ref : string ref = ref "" 670 671 let filepath_ref : string option ref = ref None 672 673-let debug = 674- match Sys.getenv "DEBUG_COMBY" with 675- | exception Not_found -> false 676- | _ -> true 677+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some 678 679-let rewrite = 680- match Sys.getenv "REWRITE" with 681- | exception Not_found -> false 682- | _ -> true 683+let rewrite = Sys.getenv "REWRITE" |> Option.is_some 684 685 let actual = Buffer.create 10 686 687@@ -540,7 +534,7 @@ module Make (Language : Types.Language.S) (Meta : Metasyntax.S) (Ext : External. 688 689 let hole_parser sort dimension : (production * 'a) t t = 690 let hole_parser = (* This must be fold, can't be find *) 691- let open Polymorphic_compare in 692+ let open Poly in 693 List.fold ~init:[] Template.Matching.hole_parsers ~f:(fun acc (sort', parser) -> 694 if sort' = sort then parser::acc else acc) 695 in 696diff --git a/lib/kernel/matchers/preprocess.ml b/lib/kernel/matchers/preprocess.ml 697index 84f3ed0..b6d10e7 100644 698--- a/lib/kernel/matchers/preprocess.ml 699+++ b/lib/kernel/matchers/preprocess.ml 700@@ -1,9 +1,6 @@ 701 open Core_kernel 702 703-let debug = 704- match Sys.getenv "DEBUG_COMBY" with 705- | exception Not_found -> false 706- | _ -> true 707+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some 708 709 let append_rule (module Parser : Types.Rule.S) rule parent_rule = 710 let open Option in 711diff --git a/lib/kernel/matchers/regexp.ml b/lib/kernel/matchers/regexp.ml 712index ef0bd59..906820b 100644 713--- a/lib/kernel/matchers/regexp.ml 714+++ b/lib/kernel/matchers/regexp.ml 715@@ -3,7 +3,7 @@ open Vangstrom 716 let debug = 717 match Sys.getenv "DEBUG_COMBY" with 718 | exception Not_found -> false 719- | _ -> true 720+ | (_ : string) -> true 721 722 module type Regexp_engine_intf = sig 723 type t 724diff --git a/lib/kernel/matchers/rewrite.ml b/lib/kernel/matchers/rewrite.ml 725index 32c4740..545cba5 100644 726--- a/lib/kernel/matchers/rewrite.ml 727+++ b/lib/kernel/matchers/rewrite.ml 728@@ -4,10 +4,7 @@ open Core_kernel 729 open Match 730 open Replacement 731 732-let debug = 733- match Sys.getenv "DEBUG_COMBY" with 734- | exception Not_found -> false 735- | _ -> true 736+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some 737 738 let counter = 739 let uuid_for_id_counter = ref 0 in 740@@ -46,24 +43,24 @@ let parse_first_label ?(metasyntax = Metasyntax.default_metasyntax) template = 741 in 742 parse_string ~consume:All parser template 743 |> function 744- | Ok label -> List.find_map label ~f:ident 745+ | Ok label -> List.find_map label ~f:Fn.id 746 | Error _ -> None 747 748 let substitute_fresh 749 ?(metasyntax = Metasyntax.default_metasyntax) 750 ?(fresh = counter) 751 template = 752- let label_table = String.Table.create () in 753+ let label_table = Hashtbl.create (module String) in 754 let template_ref = ref template in 755 let current_label_ref = ref (parse_first_label ~metasyntax !template_ref) in 756 while Option.is_some !current_label_ref do 757 let label = Option.value_exn !current_label_ref in 758 let id = 759- match String.Table.find label_table label with 760+ match Hashtbl.find label_table label with 761 | Some id -> id 762 | None -> 763 let id = fresh () in 764- if String.(label <> "") then String.Table.add_exn label_table ~key:label ~data:id; 765+ if String.(label <> "") then Hashtbl.add_exn label_table ~key:label ~data:id; 766 id 767 in 768 let left, right = replacement_sentinel metasyntax in 769diff --git a/lib/kernel/matchers/template.ml b/lib/kernel/matchers/template.ml 770index 423a07f..136236c 100644 771--- a/lib/kernel/matchers/template.ml 772+++ b/lib/kernel/matchers/template.ml 773@@ -4,10 +4,7 @@ open Core_kernel 774 open Match 775 open Types.Template 776 777-let debug = 778- match Sys.getenv "DEBUG_COMBY" with 779- | exception Not_found -> false 780- | _ -> true 781+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some 782 783 module Make (Metasyntax : Types.Metasyntax.S) (External : Types.External.S) : Types.Template.S = struct 784 785diff --git a/lib/kernel/parsers/dune b/lib/kernel/parsers/dune 786index 28b020c..0cc1fa5 100644 787--- a/lib/kernel/parsers/dune 788+++ b/lib/kernel/parsers/dune 789@@ -1,6 +1,8 @@ 790 (library 791- (name parsers) 792- (public_name comby-kernel.parsers) 793- (instrumentation (backend bisect_ppx)) 794- (preprocess (pps ppx_sexp_conv)) 795- (libraries core_kernel comby-kernel.vangstrom mparser)) 796+ (name parsers) 797+ (public_name comby-kernel.parsers) 798+ (instrumentation 799+ (backend bisect_ppx)) 800+ (preprocess 801+ (pps ppx_sexp_conv)) 802+ (libraries core_kernel comby-kernel.vangstrom mparser)) 803diff --git a/lib/kernel/replacement/dune b/lib/kernel/replacement/dune 804index 3e62de6..485b716 100644 805--- a/lib/kernel/replacement/dune 806+++ b/lib/kernel/replacement/dune 807@@ -1,6 +1,13 @@ 808 (library 809- (name replacement) 810- (public_name comby-kernel.replacement) 811- (instrumentation (backend bisect_ppx)) 812- (preprocess (pps ppx_deriving_yojson)) 813- (libraries comby-kernel.match core_kernel yojson ppx_deriving_yojson ppx_deriving_yojson.runtime)) 814+ (name replacement) 815+ (public_name comby-kernel.replacement) 816+ (instrumentation 817+ (backend bisect_ppx)) 818+ (preprocess 819+ (pps ppx_deriving_yojson)) 820+ (libraries 821+ comby-kernel.match 822+ core_kernel 823+ yojson 824+ ppx_deriving_yojson 825+ ppx_deriving_yojson.runtime)) 826diff --git a/lib/semantic/dune b/lib/semantic/dune 827index 9a244d3..186a2ed 100644 828--- a/lib/semantic/dune 829+++ b/lib/semantic/dune 830@@ -1,11 +1,8 @@ 831 (library 832- (name comby_semantic) 833- (public_name comby-semantic) 834- (instrumentation (backend bisect_ppx)) 835- (preprocess (pps ppx_deriving.show ppx_deriving.eq ppx_sexp_conv)) 836- (libraries 837- core_kernel 838- lwt 839- cohttp 840- cohttp-lwt-unix 841- yojson)) 842+ (name comby_semantic) 843+ (public_name comby-semantic) 844+ (instrumentation 845+ (backend bisect_ppx)) 846+ (preprocess 847+ (pps ppx_deriving.show ppx_deriving.eq ppx_sexp_conv)) 848+ (libraries core_kernel lwt cohttp cohttp-lwt-unix yojson)) 849diff --git a/lib/semantic/lsif.ml b/lib/semantic/lsif.ml 850index 49747bc..d6b3e19 100644 851--- a/lib/semantic/lsif.ml 852+++ b/lib/semantic/lsif.ml 853@@ -3,10 +3,7 @@ open Lwt 854 open Cohttp 855 open Cohttp_lwt_unix 856 857-let debug = 858- match Sys.getenv "DEBUG_COMBY" with 859- | exception Not_found -> false 860- | _ -> true 861+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some 862 863 module Formatting = struct 864 type t = 865diff --git a/src/dune b/src/dune 866index 444a5a3..f006195 100644 867--- a/src/dune 868+++ b/src/dune 869@@ -1,10 +1,17 @@ 870 (executables 871- (libraries comby core ppx_deriving_yojson ppx_deriving_yojson.runtime 872- (select if_hack_parallel.ml from 873- (hack_parallel -> if_hack_parallel.available.ml) 874- (!hack_parallel -> if_hack_parallel.unavailable.ml)) 875- ) 876- (preprocess (pps ppx_deriving_yojson ppx_let ppx_deriving.show ppx_sexp_conv)) 877+ (libraries 878+ comby 879+ core 880+ core_unix.command_unix 881+ ppx_deriving_yojson 882+ ppx_deriving_yojson.runtime 883+ (select 884+ if_hack_parallel.ml 885+ from 886+ (hack_parallel -> if_hack_parallel.available.ml) 887+ (!hack_parallel -> if_hack_parallel.unavailable.ml))) 888+ (preprocess 889+ (pps ppx_deriving_yojson ppx_let ppx_deriving.show ppx_sexp_conv)) 890 (modules main if_hack_parallel) 891 (modes byte exe) 892 (names main)) 893@@ -20,4 +27,5 @@ 894 (install 895 (package comby) 896 (section bin) 897- (files (main.exe as comby))) 898+ (files 899+ (main.exe as comby))) 900diff --git a/src/main.ml b/src/main.ml 901index 1def81d..79af76b 100644 902--- a/src/main.ml 903+++ b/src/main.ml 904@@ -1,4 +1,5 @@ 905 open Core 906+module Unix = Core_unix 907 open Command.Let_syntax 908 909 open Comby_kernel 910@@ -47,7 +48,7 @@ let substitute_environment_only_and_exit metasyntax_path anonymous_arguments jso 911 match metasyntax_path with 912 | None -> Matchers.Metasyntax.default_metasyntax 913 | Some metasyntax_path -> 914- match Sys.file_exists metasyntax_path with 915+ match Sys_unix.file_exists metasyntax_path with 916 | `No | `Unknown -> 917 Format.eprintf "Could not open file: %s@." metasyntax_path; 918 exit 1 919@@ -95,7 +96,7 @@ let base_command_parameters : (unit -> 'result) Command.Param.t = 920 and verbose = flag "verbose" no_arg ~doc:(Format.sprintf "Log to %s" verbose_out_file) 921 and rule = flag "rule" (optional_with_default "where true" string) ~doc:"rule Apply rules to matches." 922 and match_timeout = flag "timeout" (optional_with_default 3 int) ~doc:"seconds Set match timeout on a source. Default: 3 seconds" 923- 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 ()) 924+ 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 ()) 925 and directory_depth = flag "depth" (optional int) ~doc:"n Depth to recursively descend into directories" 926 and templates = flag "templates" ~aliases:["config"; "configuration"] (optional (Arg_type.comma_separated string)) ~doc:"paths CSV of directories containing templates, or TOML configuration files" 927 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" 928@@ -147,7 +148,7 @@ let base_command_parameters : (unit -> 'result) Command.Param.t = 929 | l -> 930 List.map l ~f:(fun pattern -> 931 if String.contains pattern '/' then 932- match Filename.realpath pattern with 933+ match Filename_unix.realpath pattern with 934 | exception Unix.Unix_error _ -> 935 Format.eprintf 936 "No such file or directory: %s. Comby interprets \ 937@@ -204,7 +205,7 @@ let base_command_parameters : (unit -> 'result) Command.Param.t = 938 let omega = omega || omega_env in 939 let fast_offset_conversion_env = Option.is_some @@ Sys.getenv "FAST_OFFSET_CONVERSION_COMBY" in 940 let fast_offset_conversion = fast_offset_conversion_env || fast_offset_conversion in 941- let arch = Unix.Utsname.machine (Core.Unix.uname ()) in 942+ let arch = Unix.Utsname.machine (Unix.uname ()) in 943 let compute_mode = match sequential, parany, arch with 944 | true, _, _ -> `Sequential 945 | _, true, _ 946@@ -304,7 +305,7 @@ let parse_comby_dot_file () = 947 948 let () = 949 If_hack_parallel.check_entry_point (); 950- Command.run default_command ~version:"1.8.1" ~extend:(fun _ -> 951- match Sys.file_exists ".comby" with 952+ Command_unix.run default_command ~version:"1.8.1" ~extend:(fun _ -> 953+ match Sys_unix.file_exists ".comby" with 954 | `Yes -> parse_comby_dot_file () 955 | _ -> []) 956diff --git a/test/alpha/dune b/test/alpha/dune 957index d7e5532..020677c 100644 958--- a/test/alpha/dune 959+++ b/test/alpha/dune 960@@ -1,17 +1,14 @@ 961 (library 962 (name alpha_test_integration) 963 (package comby) 964- (modules 965- test_special_matcher_cases 966- test_substring_disabled) 967+ (modules test_special_matcher_cases test_substring_disabled) 968 (inline_tests) 969- (preprocess (pps ppx_expect ppx_sexp_message ppx_deriving_yojson)) 970- (libraries 971- comby 972- cohttp-lwt-unix 973- core 974- camlzip)) 975+ (preprocess 976+ (pps ppx_expect ppx_sexp_message ppx_deriving_yojson)) 977+ (libraries comby cohttp-lwt-unix core camlzip)) 978 979 (alias 980-(name runtest) 981-(deps (source_tree example) (source_tree example/src/.ignore-me))) 982+ (name runtest) 983+ (deps 984+ (source_tree example) 985+ (source_tree example/src/.ignore-me))) 986diff --git a/test/common/dune b/test/common/dune 987index 6851f2e..bc3c055 100644 988--- a/test/common/dune 989+++ b/test/common/dune 990@@ -36,16 +36,14 @@ 991 test_regex_holes 992 test_template_constraints 993 test_custom_metasyntax 994- test_rewrite_attributes 995- ) 996+ test_rewrite_attributes) 997 (inline_tests) 998- (preprocess (pps ppx_expect ppx_sexp_message ppx_deriving_yojson)) 999- (libraries 1000- comby 1001- cohttp-lwt-unix 1002- core 1003- camlzip)) 1004+ (preprocess 1005+ (pps ppx_expect ppx_sexp_message ppx_deriving_yojson)) 1006+ (libraries comby cohttp-lwt-unix core camlzip)) 1007 1008 (alias 1009-(name runtest) 1010-(deps (source_tree example) (source_tree example/src/.ignore-me))) 1011+ (name runtest) 1012+ (deps 1013+ (source_tree example) 1014+ (source_tree example/src/.ignore-me))) 1015diff --git a/test/common/test_cli.ml b/test/common/test_cli.ml 1016index 3606367..d5d0c0b 100644 1017--- a/test/common/test_cli.ml 1018+++ b/test/common/test_cli.ml 1019@@ -1,7 +1,10 @@ 1020 open Core 1021 open Camlzip 1022 1023+module Filename = Filename_unix 1024+module Sys = Sys_unix 1025 module Time = Core_kernel.Time_ns.Span 1026+module Unix = Core_unix 1027 1028 let binary_path = "../../../../comby" 1029 1030diff --git a/test/common/test_cli_helper.ml b/test/common/test_cli_helper.ml 1031index 5791ee6..18372ae 100644 1032--- a/test/common/test_cli_helper.ml 1033+++ b/test/common/test_cli_helper.ml 1034@@ -1,6 +1,7 @@ 1035 open Core 1036 1037 module Time = Core_kernel.Time_ns.Span 1038+module Unix = Core_unix 1039 1040 let binary_path = "../../../../comby" 1041 1042diff --git a/test/omega/dune b/test/omega/dune 1043index 3b31a7e..bf68dcb 100644 1044--- a/test/omega/dune 1045+++ b/test/omega/dune 1046@@ -2,20 +2,19 @@ 1047 (name omega_test_integration) 1048 (package comby) 1049 (modules 1050-; 1051-; TODO 1052-; 1053+ ; 1054+ ; TODO 1055+ ; 1056 test_optional_holes 1057 test_special_matcher_cases 1058 test_substring_disabled) 1059 (inline_tests) 1060- (preprocess (pps ppx_expect ppx_sexp_message ppx_deriving_yojson)) 1061- (libraries 1062- comby 1063- cohttp-lwt-unix 1064- core 1065- camlzip)) 1066+ (preprocess 1067+ (pps ppx_expect ppx_sexp_message ppx_deriving_yojson)) 1068+ (libraries comby cohttp-lwt-unix core camlzip)) 1069 1070 (alias 1071-(name runtest) 1072-(deps (source_tree example) (source_tree example/src/.ignore-me))) 1073+ (name runtest) 1074+ (deps 1075+ (source_tree example) 1076+ (source_tree example/src/.ignore-me)))