diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2002-07-23 14:12:03 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2002-07-23 14:12:03 +0000 |
commit | 37bf95c248f7f8e9f0f2557224837e530c428e93 (patch) | |
tree | 1fe95869eaf97ba5888bb1f2a7163a4d6770d4f3 /ocamldoc/odoc_name.ml | |
parent | 30fdb7585514c6557ad38b87f8bfe079c322edc4 (diff) |
detabisation
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5029 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'ocamldoc/odoc_name.ml')
-rw-r--r-- | ocamldoc/odoc_name.ml | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/ocamldoc/odoc_name.ml b/ocamldoc/odoc_name.ml index 00adb2cb0..670166b0e 100644 --- a/ocamldoc/odoc_name.ml +++ b/ocamldoc/odoc_name.ml @@ -25,10 +25,10 @@ let infix_chars = [ '|' ; '/' ; '$' ; '%' ; - '=' ; - ':' ; - '~' ; - '!' ; + '=' ; + ':' ; + '~' ; + '!' ; ] type t = string @@ -48,31 +48,31 @@ let cut name = | s -> let len = String.length s in match s.[len-1] with - ')' -> - ( - let j = ref 0 in - let buf = [|Buffer.create len ; Buffer.create len |] in - for i = 0 to len - 1 do - match s.[i] with - '.' when !j = 0 -> - if i < len - 1 then - match s.[i+1] with - '(' -> - j := 1 - | _ -> - Buffer.add_char buf.(!j) '(' - else - Buffer.add_char buf.(!j) s.[i] - | c -> - Buffer.add_char buf.(!j) c - done; - (Buffer.contents buf.(0), Buffer.contents buf.(1)) - ) - | _ -> - match List.rev (Str.split (Str.regexp_string ".") s) with - [] -> ("", "") - | h :: q -> - (String.concat "." (List.rev q), h) + ')' -> + ( + let j = ref 0 in + let buf = [|Buffer.create len ; Buffer.create len |] in + for i = 0 to len - 1 do + match s.[i] with + '.' when !j = 0 -> + if i < len - 1 then + match s.[i+1] with + '(' -> + j := 1 + | _ -> + Buffer.add_char buf.(!j) '(' + else + Buffer.add_char buf.(!j) s.[i] + | c -> + Buffer.add_char buf.(!j) c + done; + (Buffer.contents buf.(0), Buffer.contents buf.(1)) + ) + | _ -> + match List.rev (Str.split (Str.regexp_string ".") s) with + [] -> ("", "") + | h :: q -> + (String.concat "." (List.rev q), h) let simple name = snd (cut name) let father name = fst (cut name) @@ -112,11 +112,11 @@ let hide_given_modules l s = let rec iter = function [] -> s | h :: q -> - let s2 = get_relative h s in - if s = s2 then - iter q - else - s2 + let s2 = get_relative h s in + if s = s2 then + iter q + else + s2 in iter l @@ -131,9 +131,9 @@ let to_path n = match List.fold_left (fun acc_opt -> fun s -> - match acc_opt with - None -> Some (Path.Pident (Ident.create s)) - | Some acc -> Some (Path.Pdot (acc, s, 0))) + match acc_opt with + None -> Some (Path.Pident (Ident.create s)) + | Some acc -> Some (Path.Pdot (acc, s, 0))) None (Str.split (Str.regexp "\\.") n) with @@ -146,14 +146,14 @@ let name_alias name cpl_aliases = let rec f n1 = function [] -> raise Not_found | (n2, n3) :: q -> - if n2 = n1 then - n3 - else - if prefix n2 n1 then - let ln2 = String.length n2 in - n3^(String.sub n1 ln2 ((String.length n1) - ln2)) - else - f n1 q + if n2 = n1 then + n3 + else + if prefix n2 n1 then + let ln2 = String.length n2 in + n3^(String.sub n1 ln2 ((String.length n1) - ln2)) + else + f n1 q in let rec iter n = try iter (f n cpl_aliases) |