Skip to content

Commit 9d6e259

Browse files
committed
Remove the use of the batteries library
1 parent 14b74ba commit 9d6e259

File tree

8 files changed

+674
-10
lines changed

8 files changed

+674
-10
lines changed

IMPROVEMENTS.md

Lines changed: 664 additions & 0 deletions
Large diffs are not rendered by default.

liquid_interpreter/interpreter.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ and interpret_style settings ctx str body =
248248
and interpret_render settings ctx str ~filename ~render_ctx ~body =
249249
if filename = Settings.style_tag then interpret_style settings ctx str body
250250
else
251-
(* File.write "logs/body.txt" (Batteries.dump body); *)
252251
let ast = ast_from_file settings filename in
253252
let val_ctx = Values.unwrap_render_context ~outer_ctx:ctx ~render_ctx in
254253
let _, rendered_text = interpret settings val_ctx "" ast in

liquid_std/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(library
22
(public_name liquid_std)
3-
(libraries base core stdio re2 calendar base64 sha liquid_syntax
3+
(libraries base core stdio re2 calendar base64 sha str liquid_syntax
44
liquid_parser)
55
(preprocess
66
(pps bisect_ppx --conditional)))

liquid_syntax.opam

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ homepage: "https://github.com/benfaerber/liquid-ml"
1111
bug-reports: "https://github.com/benfaerber/liquid-ml/issues"
1212
dev-repo: "git+https://github.com/benfaerber/liquid-ml.git"
1313
license: "MIT"
14-
depends: [
14+
depends: [
1515
"ocaml" { >= "4.11" }
1616
"dune" { >= "2.5" }
1717
"base" { >= "v0.15.0" }
18-
"core" { >= "v0.15.0" }
19-
"stdio" { >= "v0.10.0" }
18+
"core" { >= "v0.15.0" }
19+
"stdio" { >= "v0.10.0" }
2020
"re2" { >= "v0.13.0" }
21-
"batteries" { >= "3.1.0" }
2221
"calendar" { >= "3.0.0"}
2322
]
2423
build: [

liquid_syntax/debug.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ let block_token_as_string = show_block_token
88
let operator_as_string = show_operator
99
let lex_value_as_string = show_lex_value
1010
let lex_combiner_as_string = show_lex_combiner
11-
let dump x = x |> Batteries.dump |> Stdio.print_endline
11+
12+
(* Generic debug printer - for any type with a show function *)
13+
let dump show_fn x = x |> show_fn |> Stdio.print_endline
1214

1315
let remove_nl text =
1416
let exp = Re2.create_exn "\n" in

liquid_syntax/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(library
22
(public_name liquid_syntax)
3-
(libraries base core stdio batteries re2 calendar ppx_deriving.runtime)
3+
(libraries base core stdio re2 calendar ppx_deriving.runtime)
44
(preprocess
55
(pps ppx_deriving.show bisect_ppx --conditional)))

liquid_syntax/syntax.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ type ast =
140140

141141
let list_of_range = function
142142
| LexRange (start, stop) ->
143-
Batteries.( -- ) start stop |> Batteries.List.of_enum
143+
List.range start (stop + 1)
144144
| _ -> raise (Failure "This is not a range!")
145145

146146
let liq_list_of_range r =

liquid_syntax/tools.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let ( != ) = Stdlib.( != )
66
let ( > ) = Stdlib.( > )
77
let ( < ) = Stdlib.( < )
88
let ( ~/ ) = Re2.create_exn
9-
let range x = Batteries.( -- ) 0 x |> Batteries.List.of_enum
9+
let range x = List.range 0 (x + 1)
1010
let sub_prefix text x = String.sub text ~pos:0 ~len:x
1111
let sub_suffix text x = String.sub text ~pos:x ~len:(String.length text - x)
1212
let sub_list lst start_i end_i = List.sub lst ~pos:start_i ~len:(end_i - start_i)

0 commit comments

Comments
 (0)