|
| constexpr std::uint32_t | score_run (std::span< const std::uint8_t > run, const std::vector< bool > &folded) |
| | Selectivity of a byte run.
|
| |
| constexpr std::int32_t | fold_pair_letter (const ast &tree, const ast_node &n) |
| | The lower-case ASCII letter a class node matches in either case and in no other way, else -1.
|
| |
| constexpr void | flush (walk_state &st) |
| | Score the current byte run and keep it (with its prefix boundary) if it beats best, then clear it (capped at inner_literal_max).
|
| |
| constexpr bool | is_pure_byte_run (const ast &tree, std::int32_t idx) noexcept |
| | Whether idx is a pure fixed byte run: only byte / nested concat / group of the same.
|
| |
| constexpr bool | byte_run_is_empty (const ast &tree, std::int32_t idx) noexcept |
| | Whether a byte-run subtree can match the empty string — i.e. holds no byte at all.
|
| |
| constexpr bool | walk (const ast &tree, std::int32_t idx, walk_state &st, std::int32_t top_child) |
| | Walk one node, appending guaranteed-present literal bytes to walk_state::run.
|
| |
| constexpr bool | is_top_wb_anchor (const ast &tree, std::int32_t idx) noexcept |
| | Whether idx is a top-level \b or \B anchor — a peel candidate.
|
| |
| constexpr std::uint8_t | wb_hint_from_anchor (anchor_kind k) noexcept |
| | Encodes a peeled word-boundary anchor as the hint value inner_literal::wb_lead and inner_literal::wb_trail carry.
|
| |
| constexpr bool | is_word_only_run (const ast &tree, std::int32_t k) |
| | Whether node k is a repetition, at least once, of a class every member of which is a word character (groups around it looked through).
|
| |
| constexpr std::size_t | byte_run_width (const ast &tree, std::int32_t idx) noexcept |
| | Width in bytes of a subtree is_pure_byte_run accepted.
|
| |
| constexpr bool | is_unit (const ast &tree, std::int32_t idx) noexcept |
| | Whether a subtree matches exactly one unit: a byte, a class or ., groups looked through.
|
| |
| constexpr bool | scan_prefix (const ast &tree, std::int32_t idx, std::array< bool, 256 > &bytes) |
| | Marks in bytes every byte a match of the subtree can contain, and says whether the subtree has a RIGID variable width: an alternation whose branches differ in width, or a repeat of anything wider than one unit whose count is not fixed.
|
| |
| constexpr bool | can_occur_in_prefix (const inner_literal &lit, const std::array< bool, 256 > &bytes) noexcept |
| | Whether an occurrence of lit can begin inside a prefix whose matches hold only the bytes flagged in bytes.
|
| |
Helpers for real::detail::extract_inner_literal; not part of any interface.
| constexpr std::int32_t real::detail::inner_literal_detail::fold_pair_letter |
( |
const ast & |
tree, |
|
|
const ast_node & |
n |
|
) |
| |
|
constexpr |
The lower-case ASCII letter a class node matches in either case and in no other way, else -1.
The class must be exactly one letter's two cases: [xX], or a lone letter under icase ((?i)x). Under text-mode icase the letter's Unicode fold orbit must be those two only, read from the fold table the compiler folds with: k (KELVIN SIGN) and s (LONG S) have a third member, a multi-byte one a two-byte scan would miss. In bytes mode or under (?a) the fold is ASCII-only.
- Parameters
-
| [in] | tree | The AST holding the node. |
| [in] | n | The node. |
- Returns
- The lower-case letter, or -1.
| constexpr bool real::detail::inner_literal_detail::is_pure_byte_run |
( |
const ast & |
tree, |
|
|
std::int32_t |
idx |
|
) |
| |
|
constexprnoexcept |
Whether idx is a pure fixed byte run: only byte / nested concat / group of the same.
Decides whether an alternation may be flushed past: with every branch literal text, the reverse-prefix still represents it as a deterministic byte DFA. Anything else (klass, repeat, nested alt, …) declines.
- Parameters
-
| [in] | tree | The AST holding the node. |
| [in] | idx | Node index; a negative index is the empty subtree and counts as pure. |
- Returns
true if every node in the subtree is a fixed byte, a concat of such, or a group of such.
| constexpr bool real::detail::inner_literal_detail::is_word_only_run |
( |
const ast & |
tree, |
|
|
std::int32_t |
k |
|
) |
| |
|
constexpr |
Whether node k is a repetition, at least once, of a class every member of which is a word character (groups around it looked through).
What makes a peeled lead \b sound before such a prefix: the reverse scan finds the leftmost start of the run, and every later start is preceded by a member of the class – a word character – so no later start can be a boundary. Only the leftmost can, and that is the one confirm_at checks.
- Parameters
-
| [in] | tree | The parsed pattern. |
| [in] | k | The node. |
- Returns
- True for such a run.
| constexpr bool real::detail::inner_literal_detail::walk |
( |
const ast & |
tree, |
|
|
std::int32_t |
idx, |
|
|
walk_state & |
st, |
|
|
std::int32_t |
top_child |
|
) |
| |
|
constexpr |
Walk one node, appending guaranteed-present literal bytes to walk_state::run.
Every byte appended is present in every match; the confirming scan verifies the context. Pure-literal alternations flush and continue (no branch bytes), so a later run (req=) can still arm. An optional breaks the run, as a class does. Met before any kept run, the walk goes on; after an inner run, the walk ends with that run kept; after a HEAD run, the extraction declines by choice (https?:// keeps its head literal http, a stronger filter than an inner scan for ://). Past an optional the literal must score at least optional_literal_min_score. An optional over a body wider than one unit in the prefix is left to extract_inner_literal's rigid-prefix decline: (ab)?bb is (ab|)bb.
- Parameters
-
| [in] | tree | The AST holding the node. |
| [in] | idx | Node index; a negative index is the empty subtree and succeeds trivially. |
| [in,out] | st | Walk state the run accumulates into. |
| [in] | top_child | The top-level concat child index this node belongs to, or -1 when nested in a group/repeat — a run starting there has no clean top-level prefix boundary. |
- Returns
false to DECLINE the whole extraction: a non-literal alternation, an optional (repeat with min 0) with no rare inner run before it, a lookaround or an anchor would make a required inner literal unsound, since a path could bypass it, or the route a loss.