compat with merlin by using [@@@ifge 4.12] instead of [%IFGE 4.12]

This commit is contained in:
Simon Cruanes 2022-02-16 23:14:26 -05:00
parent bc6c8947b1
commit 7ae113b6dc
No known key found for this signature in database
GPG key ID: 4AC01D0849AA62B6
4 changed files with 21 additions and 19 deletions

View file

@ -1,10 +1,10 @@
[%IFGE 4.12]
[@@@ifge 4.12]
include Atomic
[%ELSE]
[@@@else_]
open CCShims_.Stdlib (* for == *)
@ -32,4 +32,4 @@ let[@inline] incr r = r.x <- 1 + r.x
let[@inline] decr r = r.x <- r.x - 1
[%ENDIF]
[@@@endif]

View file

@ -10,11 +10,11 @@ let opaque_identity x = x
include Sys
include CCShims_.Stdlib
[%IFGE 4.8]
[@@@ifge 4.8]
include Fun
[%ELSE]
[@@@else_]
external id : 'a -> 'a = "%identity"
let[@inline] flip f x y = f y x
@ -29,7 +29,7 @@ let[@inline] protect ~finally f =
finally();
raise e
[%ENDIF]
[@@@endif]
let compose f g x = g (f x)

View file

@ -3,11 +3,12 @@
(** Basic operations on Functions *)
[%IFGE 4.8]
[@@@ifge 4.8]
include module type of Fun
(** @inline *)
[%ELSE]
[@@@else_]
(** This is an API imitating the new standard Fun module *)
external id : 'a -> 'a = "%identity"
val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
@ -17,7 +18,8 @@ val negate : ('a -> bool) -> 'a -> bool
val protect : finally:(unit -> unit) -> (unit -> 'a) -> 'a
(* this doesn't have the exact same semantics as the stdlib's finally.
It will not attempt to catch exceptions raised from [finally] at all. *)
[%ENDIF]
[@@@endif]
val compose : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
(** [compose f g x] is [g (f x)]. Composition. *)

View file

@ -42,16 +42,16 @@ let preproc_lines ~file ~major ~minor (ic:in_channel) : unit =
| exception End_of_file -> Eof
| line ->
incr pos;
if prefix line ~pre:"[%IFLE" then
Scanf.sscanf line "[%%IFLE %d.%d]" (fun x y -> If(Le,x,y))
else if prefix line ~pre:"[%IFGE" then
Scanf.sscanf line "[%%IFGE %d.%d]" (fun x y -> If(Ge,x,y))
else if prefix line ~pre:"[%ELIFLE" then
Scanf.sscanf line "[%%ELIFLE %d.%d]" (fun x y -> Elseif(Le,x,y))
else if prefix line ~pre:"[%ELIFGE" then
Scanf.sscanf line "[%%ELIFGE %d.%d]" (fun x y -> Elseif(Ge,x,y))
else if line="[%ELSE]" then Else
else if line="[%ENDIF]" then Endif
if prefix line ~pre:"[@@@ifle" then
Scanf.sscanf line "[@@@ifle %d.%d]" (fun x y -> If(Le,x,y))
else if prefix line ~pre:"[@@@ifge" then
Scanf.sscanf line "[@@@ifge %d.%d]" (fun x y -> If(Ge,x,y))
else if prefix line ~pre:"[@@@elifle" then
Scanf.sscanf line "[@@@elifle %d.%d]" (fun x y -> Elseif(Le,x,y))
else if prefix line ~pre:"[@@@elifge" then
Scanf.sscanf line "[@@@elifge %d.%d]" (fun x y -> Elseif(Ge,x,y))
else if line="[@@@else_]" then Else
else if line="[@@@endif]" then Endif
else Raw line
in