We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8bd8ebf commit 1170565Copy full SHA for 1170565
ppx_regexp.ml
@@ -40,15 +40,19 @@ let fresh_var =
40
let c = ref 0 in
41
fun () -> incr c; Printf.sprintf "_ppx_regexp_%d" !c
42
43
+let rec is_zero p k =
44
+ (match p.[k] with
45
+ | '0' -> is_zero p (k + 1)
46
+ | '1'..'9' -> false
47
+ | _ -> true)
48
+
49
let rec must_match p i =
50
let l = String.length p in
51
if i = l then true else
52
if p.[i] = '?' || p.[i] = '*' then false else
53
if p.[i] = '{' then
54
let j = String.index_from p (i + 1) '}' in
- (match String.split_on_char ',' (String.sub p (i + 1) (j - i - 1)) with
- | k :: _ when int_of_string k = 0 -> false
- | _ -> must_match p (j + 1))
55
+ not (is_zero p (i + 1)) && must_match p (j + 1)
56
else
57
true
58
0 commit comments