Skip to content

Commit dbf9f70

Browse files
committed
Integrate descriptions in opam files.
1 parent ba25868 commit dbf9f70

File tree

4 files changed

+46
-44
lines changed

4 files changed

+46
-44
lines changed

ppx_regexp.descr

Lines changed: 0 additions & 16 deletions
This file was deleted.

ppx_regexp.opam

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,20 @@ depends: [
1717
]
1818
build: ["dune" "build" "-p" name "-j" jobs]
1919
dev-repo: "git+https://github.com/paurkedal/ppx_regexp.git"
20+
synopsis: "Matching Regular Expressions with OCaml Patterns"
21+
description: """
22+
This syntax extension turns
23+
24+
match%pcre x with
25+
| {|re1|} -> e1
26+
...
27+
| {|reN|} -> eN
28+
| _ -> e0
29+
30+
into suitable invocations to the ocaml-re library. The patterns are plain
31+
strings of the form accepted by `Re_pcre`, except groups can be bound to
32+
variables using the syntax `(?<var>...)`. The type of `var` will be
33+
`string` if a match is of the groups is guaranteed given a match of the
34+
whole pattern, and `string option` if the variable is bound to or nested
35+
below an optionally matched group.
36+
"""

ppx_tyre.descr

Lines changed: 0 additions & 28 deletions
This file was deleted.

ppx_tyre.opam

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,32 @@ depends: [
1818
]
1919
build: ["dune" "build" "-p" name "-j" jobs]
2020
dev-repo: "git+https://github.com/paurkedal/ppx_regexp.git"
21+
synopsis: "PPX syntax for tyre regular expressions and routes"
22+
description: """
23+
This PPX compiles
24+
25+
[%tyre {|re|}]
26+
27+
into `'a Tyre.t` and
28+
29+
function%tyre
30+
| {|re1|} as x1 -> e1
31+
...
32+
| {|reN|} as x2 -> eN
33+
34+
into `'a Type.route`, where `re`, `re1`, ... are regular expressions
35+
expressed in a slightly extended subset of PCRE. The interpretations are:
36+
37+
- `re?` extracts an option of what `re` extracts.
38+
- `re+`, `re*`, `re{n,m}` extracts a list of what `re` extracts.
39+
- `(?@qname)` refers to any identifier bound to a typed regular expression
40+
of type `'a Tyre.t`.
41+
- One or more `(?<v>re)` at the top level can be used to bind variables
42+
instead of `as ...`.
43+
- One or more `(?<v>re)` in a sequence extracts an object where each method
44+
`v` is bound to what `re` extracts.
45+
- An alternative with one `(?<v>re)` per branch extracts a polymorphic
46+
variant where each constructor `` `v`` receives what `re` extracts as its
47+
argument.
48+
- `(?&v:qname)` is a shortcut for `(?<v>(?&qname))`.
49+
"""

0 commit comments

Comments
 (0)