File tree 3 files changed +31
-7
lines changed
3 files changed +31
-7
lines changed Original file line number Diff line number Diff line change @@ -245,13 +245,14 @@ let create_child parent name_ =
245
245
246
246
let of_string str =
247
247
let for_pack_prefix, name =
248
- match String. rindex_opt str '.' with
249
- | None -> Prefix. empty, Name. of_string str
250
- | Some 0 ->
251
- (* See [Name.check_as_path_component]; this allows ".cinaps" as a
252
- compilation unit *)
253
- Prefix. empty, Name. of_string str
254
- | Some _ -> Misc. fatal_errorf " [of_string] does not parse qualified names"
248
+ (* Also see [Name.check_as_path_component] *)
249
+ if String. equal str " .cinaps" || String. equal str " (.cinaps)"
250
+ then Prefix. empty, Name. of_string str
251
+ else
252
+ match String. rindex_opt str '.' with
253
+ | None -> Prefix. empty, Name. of_string str
254
+ | Some _ ->
255
+ Misc. fatal_errorf " [of_string] does not parse qualified names: %s" str
255
256
in
256
257
create for_pack_prefix name
257
258
Original file line number Diff line number Diff line change @@ -1443,3 +1443,24 @@ end
1443
1443
module type T4 = sig
1444
1444
type ('a, 'b, 'c, 'd) t
1445
1445
end
1446
+
1447
+ let remove_double_underscores s =
1448
+ let len = String. length s in
1449
+ let buf = Buffer. create len in
1450
+ let skip = ref false in
1451
+ let rec loop i =
1452
+ if i < len
1453
+ then (
1454
+ let c = String. get s i in
1455
+ if c = '.' then skip := true ;
1456
+ if (not ! skip) && c = '_' && i + 1 < len && String. get s (i + 1 ) = '_'
1457
+ then (
1458
+ Buffer. add_char buf '.' ;
1459
+ skip := true ;
1460
+ loop (i + 2 ))
1461
+ else (
1462
+ Buffer. add_char buf c;
1463
+ loop (i + 1 )))
1464
+ in
1465
+ loop 0 ;
1466
+ Buffer. contents buf
Original file line number Diff line number Diff line change 895
895
type filepath = string
896
896
897
897
type alerts = string Stdlib.String.Map .t
898
+
899
+ val remove_double_underscores : string -> string
You can’t perform that action at this time.
0 commit comments