Struct regex_automata::meta::strategy::Pre
source · struct Pre<P> {
pre: P,
group_info: GroupInfo,
}
Fields§
§pre: P
§group_info: GroupInfo
Implementations§
source§impl Pre<()>
impl Pre<()>
sourcefn from_prefixes(info: &RegexInfo, prefixes: &Seq) -> Option<Arc<dyn Strategy>>
fn from_prefixes(info: &RegexInfo, prefixes: &Seq) -> Option<Arc<dyn Strategy>>
Given a sequence of prefixes, attempt to return a full Strategy
using
just the prefixes.
Basically, this occurs when the prefixes given not just prefixes, but an enumeration of the entire language matched by the regular expression.
A number of other conditions need to be true too. For example, there can be only one pattern, the number of explicit capture groups is 0, no look-around assertions and so on.
Note that this ignores Config::get_auto_prefilter
because if this
returns something, then it isn’t a prefilter but a matcher itself.
Therefore, it shouldn’t suffer from the problems typical to prefilters
(such as a high false positive rate).
sourcefn from_alternation_literals(
info: &RegexInfo,
hirs: &[&Hir],
) -> Option<Arc<dyn Strategy>>
fn from_alternation_literals( info: &RegexInfo, hirs: &[&Hir], ) -> Option<Arc<dyn Strategy>>
Attempts to extract an alternation of literals, and if it’s deemed worth doing, returns an Aho-Corasick prefilter as a strategy.
And currently, this only returns something when ‘hirs.len() == 1’. This could in theory do something if there are multiple HIRs where all of them are alternation of literals, but I haven’t had the time to go down that path yet.