Module delimited

Module delimited 

Source
Expand description

§The core module of delimited literals

crate::delimited defines an enumeration type XRegex that represents a choice from Regex struct and ReSequence structs. Its associated functions try_from and from_str call parse and compile functions sebsequently that convert any delimited regular expression literal into compiled struct via a intermediate data BTreeMap<u32,Meta>.

Structs§

BuildError
An error that occurs when construction of a Regex fails.
Input
The parameters for a regex search including the haystack to search.
Match
A representation of a match reported by a regex engine.
PatternID
The identifier of a regex pattern, represented by a SmallIndex.
ReSequence
ReSequence is the sequence of regex_automata::Regex (can be either single-pattern or multiple-pattern) that can be utilized in a timeline /series of matching events. Its method matching_indices provide vector data for including Naive Bayers Classifiers in future.
Regex
A regex matcher that works by composing several other regex matchers automatically.
Span
A representation of a span reported by a regex engine.
XRegex
a collection of regular expression data artifacts

Enums§

Anchored
The type of anchored search to perform.
Error
An error that occurred during parsing or compiling a regular expression.
LiteralForm
identifiers for regex literal kinds

Constants§

DELIMITER
A static variable for storing regex literal delimiter (1-4 single-byte punctuations transcoded into u32 value).

Statics§

DELIMITER_CHARS
DELIMITER_CHARS is a collection of punctuations for composing regular expression delimiters. It consists of the following punctuations: !#$%&*+,./:;=?@^_|~-
RE_SEPARATOR
the punctuations used as the SEPARATORs among items in regex sets (regex union and sequence)
RE_SET_DELIMITERS
the punctuations used as the delimiters in regex sets (regex union and sequence)

Functions§

get_delimiter
set_delimiter
function set_delimiter customises delimiters for regex literal. The passed delimiter value (as a byte array) consists of 1 or upto 4 single-byte characters. It is firstly validated against DELIMITER_CHARS; and then is converted into u32 and stored in thread_local static DELIMITER and the function returns true if it is valid; otherwise DELIMITER is not updated and the function reuturns false.
validate_delimiter
function validate_delimiter checks delimiter against DELIMITER_CHARS, A byte sequence that consists of either a single-byte candidate puncutation or multiple (up to 4) repetitive ones is valid for enclosing pattern text. Note bracket style delimiters in many PCRE (Perl Compatible Regular Expressions ) engines are excluded from DELIMITER_CHARS, as they are reserved for delimiting elements in regex sets.