Module dfa

Source
Expand description

Types and routines specific to lazy DFAs.

This module is the home of hybrid::dfa::DFA.

This module also contains a hybrid::dfa::Builder and a hybrid::dfa::Config for configuring and building a lazy DFA.

Structsยง

Builder
A builder for constructing a lazy deterministic finite automaton from regular expressions.
Cache
A cache represents a partially computed DFA.
Config
The configuration used for building a lazy DFA.
DFA
A hybrid NFA/DFA (also called a โ€œlazy DFAโ€) for regex searching.
Lazy ๐Ÿ”’
A type that groups methods that require the base NFA/DFA and writable access to the cache.
LazyRef ๐Ÿ”’
A type that groups methods that require the base NFA/DFA and read-only access to the cache.
OverlappingState
Represents the current state of an overlapping search.
SearchProgress ๐Ÿ”’
Keeps track of the progress of the current search.

Enumsยง

StateSaver ๐Ÿ”’
A simple type that encapsulates the saving of a state ID through a cache clearing.

Constantsยง

MIN_STATES ๐Ÿ”’
The minimum number of states that a lazy DFAโ€™s cache size must support.
SENTINEL_STATES ๐Ÿ”’
The number of โ€œsentinelโ€ states that get added to every lazy DFA.

Functionsยง

minimum_cache_capacity ๐Ÿ”’
Based on the minimum number of states required for a useful lazy DFA cache, this returns a heuristic minimum number of bytes of heap space required.
minimum_lazy_state_id ๐Ÿ”’
Based on the minimum number of states required for a useful lazy DFA cache, this returns the minimum lazy state ID that must be representable.
skip_empty_utf8_splits_overlapping ๐Ÿ”’
Runs the given overlapping search function (forwards or backwards) until a match is found whose offset does not split a codepoint.

Type Aliasesยง

StateMap ๐Ÿ”’
A map from states to state identifiers. When using std, we use a standard hashmap, since itโ€™s a bit faster for this use case. (Other maps, like oneโ€™s based on FNV, have not yet been benchmarked.)