Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Convert some Str.split and remove Utils.split_on_char #127

Merged
merged 1 commit into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/FindFiles.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ let isSourceFile name =
|| Filename.check_suffix name ".mli"

let compiledNameSpace name =
Str.split (Str.regexp_string "-") name
String.split_on_char '-' name
|> List.map String.capitalize_ascii
|> String.concat ""
(* Remove underscores??? Whyyy bucklescript, whyyyy *)
|> Str.split (Str.regexp_string "_")
|> String.split_on_char '_'
|> String.concat ""

let compiledBaseName ~namespace name =
Expand Down
2 changes: 1 addition & 1 deletion src/Packages.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ let newBsPackage rootPath =
match item |> Json.string with
| None -> opens
| Some s -> (
let parts = Utils.split_on_char ' ' s in
let parts = String.split_on_char ' ' s in
match parts with
| "-open" :: name :: _ -> name :: opens
| _ -> opens))
Expand Down
15 changes: 0 additions & 15 deletions src/Utils.ml
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
(*
steal from OCaml stdlib
https://github.com/ocaml/ocaml/blob/7c9c210884e1b46f21af5bb4dfab995bb3336cf7/stdlib/string.ml#L205-L214
*)
let split_on_char sep s =
let open String in
let r = ref [] in
let j = ref (length s) in
for i = length s - 1 downto 0 do
if unsafe_get s i = sep then (
r := sub s (i + 1) (!j - i - 1) :: !r;
j := i)
done;
sub s 0 !j :: !r

let topLoc fname =
{
Location.loc_start =
Expand Down