Library
Module
Module type
Parameter
Class
Class type
The Pattern
module defines the patterns.
We assume names are hierarchical and can be encoded as lists of strings. For example, the name x.y.z
is represented as the following OCaml list:
["x"; "y"; "z"]
The type of patterns, parametrized by the type of hook labels. See hook
.
The pattern type is abstract---you should build a pattern using the following builders and execute it by Action.run
.
val any : 'hook t
any
keeps the content of the current tree. It is an error if the tree is empty (no name to match).
only path
keeps the subtree rooted at path
. It is an error if the subtree was empty.
val none : 'hook t
none
drops everything. It is an error if the tree was already empty (nothing to drop).
renaming path path'
relocates the subtree rooted at path
to path'
. It is an error if the subtree was empty (nothing to move).
seq [pat0; pat1; pat2; ...; patn]
runs the patterns pat0
, pat1
, pat2
, ..., patn
in order.
union [pat0; pat1; pat2; ...; patn]
calculates the union of the results of individual patterns pat0
, pat1
, pat2
, ..., patn
.
val hook : 'hook -> 'hook t
hook h
applies the hook labelled h
to the entire trie; see Action.run_with_hooks
.
val pp_path : Format.formatter -> Pattern.path -> unit
Pretty printer for path
.