|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
The best required inner literal of a pattern (the memmem candidate). More...
#include <inner_literal.hpp>
Public Member Functions | |
| constexpr bool | found () const |
| Whether an inner literal was found at all. | |
Public Attributes | |
| std::array< std::uint8_t, 16 > | bytes {} |
| The literal's bytes, the first len of which are meaningful. Fixed capacity, so an inner_literal is copyable and needs no allocation; inner_literal_max is that bound. | |
| std::uint8_t | len {0} |
| std::uint16_t | folded {0} |
Bit i: position i is an ASCII letter that matches in either case, and bytes[i] holds its lower case ((?i)x, [xX]). The scan finds both; every other position is exact. | |
| std::uint32_t | score {0} |
| std::int32_t | prefix_child_count {-1} |
| Top-level concat children BEFORE the literal: the sub-pattern the prefix-reverse matches backwards from a candidate to find the match start. 0 = the literal is at the head (start = candidate); -1 = nested in a group/repeat, so no top-level prefix boundary (the memmem candidate still applies). | |
| std::int32_t | prefix_skip {0} |
Leading top-level children to skip when building the reverse-prefix (peeled lead \b/\B). prefix_child_count is counted from the first non-peeled body child, so the reverse program is children[prefix_skip .. prefix_skip + prefix_child_count). | |
| std::uint8_t | wb_lead {0} |
0/1/2 — peeled lead \b/\B (informational; confirm checks). | |
| std::uint8_t | wb_trail {0} |
0/1/2 — peeled trail \b/\B. | |
The best required inner literal of a pattern (the memmem candidate).
len == 0 means the pattern declined: a non-literal alternation, an optional (?/*/{0,n}) after a head run or around a literal too common to pay, a lookaround or a non-wb anchor at the level walked, or no literal run: anything that would make a required literal unsound, or the route slower than the one it replaces (see real::detail::inner_literal_detail::walk). Top-level \b/\B are peeled into wb_lead / wb_trail and prefix_skip, so the reverse-prefix excludes them (asserts are not byte-DFA-eligible) while confirm_at runs the full program and checks them.
|
inlineconstexpr |
Whether an inner literal was found at all.
true if len is non-zero, i.e. the pattern did not decline. | std::uint8_t real::detail::inner_literal::len {0} |
Bytes held in bytes; 0 means the pattern declined.
| std::uint32_t real::detail::inner_literal::score {0} |
Selectivity: higher = rarer/longer = fewer memmem candidates.