Skip to content

Commit 2e33f30

Browse files
committed
String.split_on_char was added in OCaml 4.04
1 parent 0600d37 commit 2e33f30

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

lib/mustache.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ module Render = struct
413413
in
414414

415415
let print_indented_string indent s =
416-
let lines = Mustache_lexer.split_on_char '\n' s in
416+
let lines = String.split_on_char '\n' s in
417417
align indent; Buffer.add_string buf (List.hd lines);
418418
List.iter (fun line ->
419419
Buffer.add_char buf '\n';

lib/mustache_lexer.mll

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,9 @@
3939
x
4040
)
4141

42-
let split_on_char sep s =
43-
let open String in
44-
let r = ref [] in
45-
let j = ref (length s) in
46-
for i = length s - 1 downto 0 do
47-
if unsafe_get s i = sep then begin
48-
r := sub s (i + 1) (!j - i - 1) :: !r;
49-
j := i
50-
end
51-
done;
52-
sub s 0 !j :: !r
53-
5442
let split_ident ident =
5543
if ident = "." then []
56-
else split_on_char '.' ident
44+
else String.split_on_char '.' ident
5745
}
5846

5947
let blank = [' ' '\t']*

0 commit comments

Comments
 (0)