package yuujinchou
Name pattern combinators
Install
Dune Dependency
Authors
Maintainers
Sources
0.10.0.tar.gz
md5=e52bf8aea716d680731d6b5e4651f42b
sha512=5bf09b4700894a8869b128583efba8c64fd4c3133478b861e4b6943cf1ec4fb8c110fc7fa3104e3e73ed0f0d01930ce73109980acfe354cba6150d3799343e7b
Description
This package implements a pattern language for selecting names. It intends to facilitate the implementation of the "import" statement or any feature that allows users to select a group of names by patterns.
Published: 20 Jul 2020
README
README.mkd
# Yuujinchou: Name Pattern Combinators _Yuujinchou_ is an OCaml package of name patterns for implementing import statements. Please consult the [documentation](https://favonia.org/yuujinchou/yuujinchou/Yuujinchou). ## How to Use It ```ocaml open Yuujinchou type data = int (** An environment is a mapping from paths to data. *) type env = (Pattern.path, data) Hashtbl.t (** [remap pattern env] uses the [pattern] to massage the environment [env]. *) let remap pattern env = let compiled_pattern = Result.get_ok @@ Action.compile_ pattern in let new_env = Hashtbl.create @@ Hashtbl.length env in begin env |> Hashtbl.iter @@ fun path data -> match Action.run_ compiled_pattern path with | `NoMatch -> () | `Matched l -> l |> List.iter @@ fun (path, ()) -> match Hashtbl.find_opt new_env path with | None -> Hashtbl.replace new_env path data | Some data' -> if data <> data' then failwith "Inconsistent data assigned to the same path." end; new_env (** [import env pattern imported] imports the environment [imported] massaged by [pattern] into [env]. *) let import env pattern imported = Hashtbl.replace_seq env @@ Hashtbl.to_seq @@ remap pattern imported ``` ## Installation You need OCaml 4.08.0 or newer. The package is available on the OPAM repository: ``` opam install yuujinchou ``` You could also check out the source repository and install the latest version in development: ``` git clone https://github.com/favonia/yuujinchou.git opam install ./yuujinchou ```
Dependencies (3)
-
ppx_deriving
>= "4.5"
-
ocaml
>= "4.08.0"
-
dune
>= "2.5"
Dev Dependencies (1)
-
odoc
with-doc
Used by
None
Conflicts
None
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page