|
| 1 | +opam-version: "2.0" |
| 2 | +maintainer: "Leonardo Santos <leomendesantos@gmail.com>" |
| 3 | +authors: [ |
| 4 | + "Petter A. Urkedal <paurkedal@gmail.com>" |
| 5 | + "Gabriel Radanne <drupyog@zoho.com>" |
| 6 | + "Leonardo Santos <leomendesantos@gmail.com>" |
| 7 | +] |
| 8 | +license: "LGPL-3.0-or-later WITH LGPL-3.0-linking-exception" |
| 9 | +homepage: "https://github.com/ahrefs/ppx_mikmatch" |
| 10 | +bug-reports: "https://github.com/ahrefs/ppx_mikmatch/issues" |
| 11 | +depends: [ |
| 12 | + "ocaml" {>= "4.10"} |
| 13 | + "dune" {>= "1.11"} |
| 14 | + "ppxlib" {>= "0.36.0"} |
| 15 | + "re" {>= "1.7.2"} |
| 16 | + "menhir" {>= "20240715"} |
| 17 | + "ounit2" {with-test} |
| 18 | +] |
| 19 | +build: ["dune" "build" "-p" name "-j" jobs] |
| 20 | +dev-repo: "git+https://github.com/ahrefs/ppx_mikmatch.git" |
| 21 | +synopsis: "Matching Regular Expressions with OCaml Patterns using Mikmatch's syntax" |
| 22 | +description: """ |
| 23 | +This syntax extension turns |
| 24 | +``` |
| 25 | +match%mikmatch x with |
| 26 | +| {| re1 |} -> e1 |
| 27 | +... |
| 28 | +| {| reN |} -> eN |
| 29 | +| _ -> e0 |
| 30 | +``` |
| 31 | + |
| 32 | +into suitable invocations to the ocaml-re library. The patterns are plain |
| 33 | +strings of the form accepted by Re_pcre, except groups can be bound to |
| 34 | +variables using the syntax (... as var). The type of var will be |
| 35 | +string if a match is of the groups is guaranteed given a match of the |
| 36 | +whole pattern, and string option if the variable is bound to or nested |
| 37 | +below an optionally matched group. |
| 38 | + |
| 39 | +Additional extensions: |
| 40 | + |
| 41 | +- `let%mikmatch name = {|re|}` defines reusable patterns for use within `(?U/N<name>)` patterns |
| 42 | +- `type name = {%mikmatch| re |}` generates record types with parse/pp functions from patterns |
| 43 | +- let destructuring via `let%pcre/mikmatch {| regex |} = s`, where `regex` binds values and `s` is the input string |
| 44 | +- `/regex/flags` for providing compiler flags. `i` for caseless, `a` (%pcre) anchored, `u` (%mikmatch) unanchored |
| 45 | +- Caseless groups via the `~` operator |
| 46 | +- Mixed matching (raw strings supported) via `function | {%mikmatch| ... |} -> ... | "raw string" -> ...` |
| 47 | +- Matching guards are supported across all match extensions |
| 48 | +""" |
| 49 | +url { |
| 50 | + src: "https://github.com/ahrefs/ppx_mikmatch/archive/refs/tags/1.2.tar.gz" |
| 51 | + checksum: [ |
| 52 | + "md5=607d525df297c70ec7104d7188d2aa5b" |
| 53 | + "sha512=1f1da92620be9dbf1c7530c7d0bfc92bb736f4189ef97285b24b90bbb8ce24aaa0aa001c268a4029458def31dc972e813d163092caee5dc784f96380f9125618" |
| 54 | + ] |
| 55 | +} |
0 commit comments