@@ -42,7 +42,7 @@ let parse s =
42
42
match s.[4] with
43
43
| ':' -> `Http, 7
44
44
| 's' -> `Https, 8
45
- | _ -> Exn.fail "parse: %S" s
45
+ | _ -> failwith "parse"
46
46
in
47
47
let last = String.index_from s first '/' in
48
48
let host = String.slice s ~first ~last in
@@ -51,8 +51,7 @@ let parse s =
51
51
| exception _ -> host, default_port scheme
52
52
| (host,port) -> host, int_of_string port
53
53
in
54
- let (path,query,fragment) = make_path @@ String.slice s ~first:last in
55
- { scheme; host; port; path; query; fragment }
54
+ ...
56
55
57
56
(* in mikmatch: *)
58
57
@@ -61,9 +60,8 @@ let parse s =
61
60
| {|/ "http" ('s' as https)? "://" ([^ '/' ':']+ as host) (":" (digit+ as port : int))? '/'? (_* as rest) /|} ->
62
61
let scheme = match https with Some _ -> `Https | None -> `Http in
63
62
let port = match port with Some p -> p | None -> default_port scheme in
64
- let path, query, fragment = make_path ("/" ^ rest) in
65
- { scheme; host; port; path; query; fragment }
66
- | _ -> Exn.fail "Url.parse: %S" s
63
+ ...
64
+ | _ -> failwith "parse"
67
65
68
66
```
69
67
@@ -110,17 +108,13 @@ The patterns are plain strings of the form accepted by `Re.Pcre`, with the follo
110
108
the whole pattern matches, and ` string option ` if the variable is bound
111
109
to or nested below an optionally matched group.
112
110
113
- - ` (N?< var> ) ` gets substituted by the value of the globally defined string variable named ` var ` ,
111
+ - ` (?& var) ` refers to any identifier bound to a typed regular expression of type ` 'a Re.t `
114
112
and binds whatever it matches as ` var ` .
115
113
The type of ` var ` will be the same as ` (?<var>...) ` .
116
114
117
- - ` (N?<var as name>) ` gets substituted by the value of the globally defined string variable named ` var ` ,
118
- and binds whatever it matches as ` name ` .
115
+ - ` (?&name:var>) ` same as above but binds whatever it matches as ` name ` . (shortcut for ` (?<v>(?&qname)) ` )
119
116
The type of ` name ` will be the same as ` (?<var>...) ` .
120
117
121
- - ` (U?<var>) ` gets substituted by the value of the globally defined string variable named ` var ` ,
122
- and does not bind its match to any name.
123
-
124
118
- ` ?<var> ` at the start of a pattern binds group 0 as ` var : string ` .
125
119
This may not be the full string if the pattern is unanchored.
126
120
0 commit comments