Skip to content
Browse files

OCaml 4.01: update deprecated syntax

  • Loading branch information...
1 parent c59ffd6 commit 148f00f723e2853401078ac3ebfc86a2835fa239 @hbbio hbbio committed Dec 4, 2013
View
6 compiler/libtrx/tgrammar.ml
@@ -139,7 +139,7 @@ module P = PreGrammar
let rec def_map_to_string ?cf dm =
StringMap.fold (
fun x y acc ->
- Printf.sprintf "%s%s%s%s%s%s <- %s" acc (if y.P.mark & (not y.P.debug) & (not (acc = "")) then ";" else "") (if acc = "" then "" else "\n\n") (if y.P.debug then "%" else "") (if y.P.mark then "+" else "") x (def_to_string ?cf y)
+ Printf.sprintf "%s%s%s%s%s%s <- %s" acc (if y.P.mark && (not y.P.debug) && (not (acc = "")) then ";" else "") (if acc = "" then "" else "\n\n") (if y.P.debug then "%" else "") (if y.P.mark then "+" else "") x (def_to_string ?cf y)
) dm ""
and def_to_string ?cf d =
expr_to_string ?cf d.P.expression
@@ -305,8 +305,8 @@ let match_char c l =
let rec aux = function
| [] -> false
| Any::_ -> true
- | (One c1)::tl -> c1 = c or aux tl
- | (Range (c1, c2))::tl -> (c >= c1 && c <= c2) or aux tl
+ | (One c1)::tl -> c1 = c || aux tl
+ | (Range (c1, c2))::tl -> (c >= c1 && c <= c2) || aux tl
in aux l
let str2memo_type = function
View
2 ocamllib/libbase/baseChar.ml
@@ -64,7 +64,7 @@ let is_hex c = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' &&
let is_lower c = c >= 'a' && c <= 'z'
let is_upper c = c >= 'A' && c <= 'Z'
-let is_alpha c = is_digit c or is_lower c or is_upper c
+let is_alpha c = is_digit c || is_lower c || is_upper c
let pred a = (Obj.magic (pred (Obj.magic a)) : char)
let succ a = (Obj.magic (succ (Obj.magic a)) : char)
View
4 ocamllib/libbase/baseMap.ml
@@ -169,10 +169,10 @@ struct
let sl = size l
and sr = size r in
if sl = 0 then
- if sr = 0 or Random.int (sr + 1) = 0 then v, d
+ if sr = 0 || Random.int (sr + 1) = 0 then v, d
else random r
else if sr = 0 then
- if sl = 0 or Random.int (sl + 1) = 0 then v, d
+ if sl = 0 || Random.int (sl + 1) = 0 then v, d
else random l
else
match Random.int (sl + sr + 1) with
View
12 ocamllib/libbase/baseString.ml
@@ -223,7 +223,7 @@ let remove_trail s =
else
let pm = pred p in
let c = unsafe_get s pm in
- if c = '\n' or c = '\r' then aux pm
+ if c = '\n' || c = '\r' then aux pm
else sub s 0 p
in aux l
@@ -369,15 +369,15 @@ let for_all f s = not (exists (fun c -> not (f c)) s)
let equal_insensitive s1 s2 =
let l = length s1 in
let rec aux i =
- i=l or (Char.equal_insensitive (unsafe_get s1 i) (unsafe_get s2 i) && aux (succ i))
+ i=l || (Char.equal_insensitive (unsafe_get s1 i) (unsafe_get s2 i) && aux (succ i))
in
l = length s2 && aux 0
let compare_insensitive s1 s2 =
let l1 = length s1
and l2 = length s2 in
let rec aux i =
- if i=l1 or i=l2 then compare_int l1 l2
+ if i=l1 || i=l2 then compare_int l1 l2
else
let c = Char.compare_insensitive (unsafe_get s1 i) (unsafe_get s2 i) in
if c = 0 then aux (succ i) else c
@@ -415,7 +415,7 @@ let is_substring s s1 p1 =
if p1 < 0 then invalid_arg "String.is_substring" else
let l = length s and l1 = length s1 in
let rec aux p =
- p = l or (
+ p = l || (
let pp1 = p1 + p in
pp1 < l1 && unsafe_get s p = unsafe_get s1 pp1 && aux (succ p)
)
@@ -427,7 +427,7 @@ let is_substring_compare compare s s1 p1 =
and l1 = length s1 in
let rec aux p =
let pp1 = p1 + p in
- p = l or (pp1 < l1 &&
+ p = l || (pp1 < l1 &&
compare (unsafe_get s p) (unsafe_get s1 pp1) = 0
&& aux (succ p))
in
@@ -713,7 +713,7 @@ let limit lim s =
let limit_width lim s =
let l = length s in
let rec aux sum pos =
- if pos = l or sum >= lim then pos
+ if pos = l || sum >= lim then pos
else
let w = Char.width (unsafe_get s pos) in
aux (sum + w) (succ pos)
View
4 ocamllib/libbase/file.ml
@@ -449,7 +449,7 @@ let rec iter_dir_rec ?(showdir=false) f d =
| Unix.S_REG -> f ~name:x ~path
| Unix.S_DIR ->
if showdir && x="." then f ~name:x ~path:d
- else if x="." or x=".." then ()
+ else if x="." || x=".." then ()
else iter_dir_rec f path ~showdir
| _ -> ()
done
@@ -466,7 +466,7 @@ let fold_dir_rec f i d =
match st.Unix.st_kind with
| Unix.S_REG -> aux d dh (f r ~name:x ~path)
| Unix.S_DIR ->
- if x="." or x=".." then aux d dh r
+ if x="." || x=".." then aux d dh r
else aux d dh (aux path (Unix.opendir path) r)
| _ -> aux d dh r
with
View
2 ocamllib/libbase/uchar.ml
@@ -42,7 +42,7 @@ let uchar s pos =
(** benchmark vs FUNC *)
let ulength_of_string s =
let l = ref 0 in
- String.iter (fun x -> if x < '\128' or (x >= '\192' && x < '\248') then incr l) s ;
+ String.iter (fun x -> if x < '\128' || (x >= '\192' && x < '\248') then incr l) s ;
!l
let length_of_ustring us =
View
2 ocamllib/libbase/xml.ml
@@ -256,7 +256,7 @@ let build_ids ?(tag="id") xml =
let mem = StringMap.mem value acc in
#<If> if mem then
debug "Warning: id %s is defined several times" value #<End>;
- StringMap.add value id acc, mem or err
+ StringMap.add value id acc, mem || err
else (acc, err)
) xml.nodes (StringMap.empty, false)
View
6 ocamllib/libbase/xmlm.ml
@@ -551,7 +551,7 @@ struct
let p_attr_value i = (* {S}? {AttValue} *)
skip_white i;
let delim =
- if i.c = u_quot or i.c = u_apos then i.c else
+ if i.c = u_quot || i.c = u_apos then i.c else
err_expected_chars i [ u_quot; u_apos]
in
nextc i;
@@ -570,7 +570,7 @@ struct
if not (is_white i.c) then pre_acc, acc else
begin
skip_white i;
- if i.c = u_slash or i.c = u_gt then pre_acc, acc else
+ if i.c = u_slash || i.c = u_gt then pre_acc, acc else
begin
let (prefix, local) as n = p_qname i in
let v = skip_white i; accept i u_eq; p_attr_value i in
@@ -767,7 +767,7 @@ struct
end
end
end
- else if i.c = u_quot or i.c = u_apos then
+ else if i.c = u_quot || i.c = u_apos then
begin
let c = i.c in
buf c; nextc i;

0 comments on commit 148f00f

Please sign in to comment.
Something went wrong with that request. Please try again.