Skip to content
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
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
(name re)
(synopsis "RE is a regular expression library for OCaml")
(depends
(ocaml (>= 4.12.0))
(ocaml (>= 4.08.0))
(ppx_expect :with-test)
(ounit2 :with-test)
(js_of_ocaml :with-test))
Expand Down
1 change: 1 addition & 0 deletions lib/emacs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*)

module Re = Core
open Import

exception Parse_error
exception Not_supported
Expand Down
10 changes: 10 additions & 0 deletions lib/fake/atomic.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type 'a t = 'a ref

let make x = ref x
let get x = !x
let set atomic v = atomic := v

let fetch_and_add atomic n =
let v = !atomic in
atomic := v + n;
v
22 changes: 19 additions & 3 deletions lib/import.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
module List = Stdlib.ListLabels
module List = struct
let[@warning "-32"] rec equal ~eq l1 l2 = match l1, l2 with
| [], [] -> true
| [], _::_ | _::_, [] -> false
| x::xs, y::ys -> if eq x y then equal ~eq xs ys else false

let[@warning "-32"] rec compare ~cmp l1 l2 = match l1, l2 with
| [], [] -> 0
| [], _::_ -> -1
| _::_, [] -> 1
| x::xs, y::ys ->
let r = cmp x y in
if r = 0 then compare ~cmp xs ys else r

include Stdlib.ListLabels
end

module Poly = struct
let equal = ( = )
Expand All @@ -13,12 +28,13 @@ let ( = ) = Int.equal
let ( == ) = [ `Use_phys_equal ]
let ( < ) (x : int) (y : int) = x < y
let ( > ) (x : int) (y : int) = x > y
let min = Int.min
let max = Int.max
let min (x : int) (y : int) = if x <= y then x else y
let max (x : int) (y : int) = if x >= y then x else y
let compare = Int.compare

module Int = struct
let[@warning "-32"] hash (x : int) = Hashtbl.hash x
let[@warning "-32"] max (x : int) (y : int) = if x >= y then x else y

include Stdlib.Int
end
2 changes: 1 addition & 1 deletion re.opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ homepage: "https://github.com/ocaml/ocaml-re"
bug-reports: "https://github.com/ocaml/ocaml-re/issues"
depends: [
"dune" {>= "3.15"}
"ocaml" {>= "4.12.0"}
"ocaml" {>= "4.08.0"}
"ppx_expect" {with-test}
"ounit2" {with-test}
"js_of_ocaml" {with-test}
Expand Down