Page
Library
Module
Module type
Parameter
Class
Class type
Source
Yuujinchou.Action
SourceThe Action
module implements the engine running the patterns.
The abstract type of compiled patterns.
type 'a matching_result = [
| `NoMatch
The pattern does not match the name.
*)| `Matched of (Pattern.path * 'a) list
The pattern matches the name and outputs a list of tagged new names.
*) ]
The result type of pattern matching. See Outcomes.
type 'a error =
| ReplacementNotUsed of 'a Pattern.pattern
Renaming patterns are run under the inverse mode.
*)| EmptyMeet of 'a Pattern.pattern
The join patterns under the inverse mode (or, equivalently, the meet patterns under the normal mode) have no subpatterns.
*)The type of errors due to the violation of some invariant of patterns. See Invariants. It should be impossible to violate these invariants unless Pattern.unsafe_meet
or Pattern.unsafe_inv
is used.
The pattern embedded in the error message is the fragment that violates the invariant. The pattern pat
in EmptyMeet pat
is not useful on its own---it must be PatJoin []
---but it facilitates using or-patterns in error handling.
val compile :
join:('a -> 'a -> 'a) ->
meet:('a -> 'a -> 'a) ->
'a Pattern.pattern ->
('a compiled_pattern, 'a error) result
The pattern compiler.
This is compile
specialized to unit pattern
where the attribute type is unit
.
run pat ~default path
runs a compiled pattern to match path
with the default attribute being default
.
This is run
specialized to unit pattern
where the attribute type is unit
.
Pretty printer for error
.
val pp_matching_result :
(Format.formatter -> 'a -> unit) ->
Format.formatter ->
'a matching_result ->
unit
Pretty printer for matching_result
.