File tree 1 file changed +9
-9
lines changed 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -36,15 +36,15 @@ let compile_regexp s c =
36
36
}
37
37
;;
38
38
39
- let state = ref None
39
+ let state = Domain.DLS. new_key ( fun () -> None )
40
40
41
41
let string_match re s p =
42
42
match exec ~pos: p (Lazy. force re.mtch) s with
43
43
| res ->
44
- state := Some res;
44
+ Domain.DLS. set state ( Some res) ;
45
45
true
46
46
| exception Not_found ->
47
- state := None ;
47
+ Domain.DLS. set state None ;
48
48
false
49
49
;;
50
50
@@ -58,34 +58,34 @@ let string_partial_match re s p =
58
58
let search_forward re s p =
59
59
match exec ~pos: p (Lazy. force re.srch) s with
60
60
| res ->
61
- state := Some res;
61
+ Domain.DLS. set state ( Some res) ;
62
62
fst (Group. offset res 0 )
63
63
| exception Not_found ->
64
- state := None ;
64
+ Domain.DLS. set state None ;
65
65
raise Not_found
66
66
;;
67
67
68
68
let rec search_backward re s p =
69
69
match exec ~pos: p (Lazy. force re.mtch) s with
70
70
| res ->
71
- state := Some res;
71
+ Domain.DLS. set state ( Some res) ;
72
72
p
73
73
| exception Not_found ->
74
- state := None ;
74
+ Domain.DLS. set state None ;
75
75
if p = 0 then raise Not_found else search_backward re s (p - 1 )
76
76
;;
77
77
78
78
let valid_group n =
79
79
n > = 0
80
80
&& n < 10
81
81
&&
82
- match ! state with
82
+ match Domain.DLS. get state with
83
83
| None -> false
84
84
| Some m -> n < Group. nb_groups m
85
85
;;
86
86
87
87
let offset_group i =
88
- match ! state with
88
+ match Domain.DLS. get state with
89
89
| Some m -> Group. offset m i
90
90
| None -> raise Not_found
91
91
;;
You can’t perform that action at this time.
0 commit comments