Skip to content

Commit 429d404

Browse files
committed
update opam, README
1 parent 0cf9a72 commit 429d404

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

README.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ let parse s =
4242
match s.[4] with
4343
| ':' -> `Http, 7
4444
| 's' -> `Https, 8
45-
| _ -> Exn.fail "parse: %S" s
45+
| _ -> failwith "parse"
4646
in
4747
let last = String.index_from s first '/' in
4848
let host = String.slice s ~first ~last in
@@ -51,8 +51,7 @@ let parse s =
5151
| exception _ -> host, default_port scheme
5252
| (host,port) -> host, int_of_string port
5353
in
54-
let (path,query,fragment) = make_path @@ String.slice s ~first:last in
55-
{ scheme; host; port; path; query; fragment }
54+
...
5655
5756
(* in mikmatch: *)
5857
@@ -61,9 +60,8 @@ let parse s =
6160
| {|/ "http" ('s' as https)? "://" ([^ '/' ':']+ as host) (":" (digit+ as port : int))? '/'? (_* as rest) /|} ->
6261
let scheme = match https with Some _ -> `Https | None -> `Http in
6362
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"
6765
6866
```
6967

@@ -110,17 +108,13 @@ The patterns are plain strings of the form accepted by `Re.Pcre`, with the follo
110108
the whole pattern matches, and `string option` if the variable is bound
111109
to or nested below an optionally matched group.
112110

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`
114112
and binds whatever it matches as `var`.
115113
The type of `var` will be the same as `(?<var>...)`.
116114

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))`)
119116
The type of `name` will be the same as `(?<var>...)`.
120117

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-
124118
- `?<var>` at the start of a pattern binds group 0 as `var : string`.
125119
This may not be the full string if the pattern is unanchored.
126120

ppx_regexp_extended.opam

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ below an optionally matched group.
4040

4141
Additional extensions:
4242

43-
- `(?N<var>)` and `(?N<var as name>)` provide named substitution, and make the
43+
- `(?&var)` and `(?&name:var)` provide named substitution, and make the
4444
matched substring available in the right-hand side of match cases
45-
- `(?U<var>)` marks groups whose substrings are not needed in the right-hand side
4645
- `let%pcre name = {|re|}` defines reusable patterns for use within `(?U/N<name>)` patterns
4746
- `match%mikmatch` supports mikmatch-style syntax with typed captures and pattern
4847
composition, along with `let%mikmatch` for defining reusable patterns

0 commit comments

Comments
 (0)