|
| constexpr | basic_match_iterator () noexcept |
| | Constructs the end sentinel.
|
| |
| constexpr | basic_match_iterator (detail::program_view prog, std::string_view pattern, std::string_view text, std::size_t start=0, match_semantics sem=match_semantics::first) |
| | Constructs a begin iterator and finds the first match.
|
| |
| constexpr void | decide_batching (detail::program_view prog, match_semantics sem, std::size_t text_bytes) |
| | Once per walk: which batched filler, if any, serves this scan.
|
| |
| constexpr const value_type & | operator* () const |
| | Returns the current match.
|
| |
| constexpr const value_type * | operator-> () const |
| | Returns pointer to the current match.
|
| |
| constexpr basic_match_iterator & | operator++ () |
| | Advances to the next match.
|
| |
| constexpr basic_match_iterator | operator++ (int) |
| | Advances to the next match (post-increment).
|
| |
| constexpr bool | exhausted () const noexcept |
| | Whether the walk is over, without building an end sentinel to compare against.
|
| |
| constexpr bool | operator== (const basic_match_iterator &other) const |
| | Returns true if both denote the same position in the same walk, or both are the end.
|
| |
|
|
detail::program_view | prog_ |
| | The program being run.
|
| |
|
std::string_view | pattern_ |
| | Pattern text (named lookups).
|
| |
|
std::string_view | text_ |
| | The text being scanned.
|
| |
|
std::size_t | pos_ {} |
| | Current scan offset.
|
| |
|
std::size_t | forbid_empty_until_ {} |
| | Empty-match guard (see pike.hpp).
|
| |
|
bool | done_ {true} |
| | True once exhausted.
|
| |
|
bool | cascade_ {} |
| | Chosen once — run the memchr-cascade class-run variant for this whole walk.
|
| |
|
match_semantics | sem_ {match_semantics::first} |
| | leftmost-first (default) or longest (find_iter_longest).
|
| |
|
value_type | current_ |
| | The current match.
|
| |
|
Storage::state_type | state_ |
| | VM scratch, reused across the walk.
|
| |
|
detail::pike_vm< typenameStorage::state_type, true >::cp_span | batch_ [batch_cap] {} |
| | The buffered spans; indices batch_i_ .. batch_n_ are the unread ones.
|
| |
|
std::size_t | batch_n_ {} |
| | Spans currently buffered.
|
| |
|
std::size_t | batch_i_ {} |
| | Next span to hand out.
|
| |
|
bool | batch_eligible_ {} |
| | Route/shape allows batching (decided once).
|
| |
| bool | trailing_la_walk_ {} |
| | This walk takes the trailing-lookaround route ([a-z]+(?=[a-z])), chosen once here rather than by specialization, so basic_regex::find_iter, whose return type fixes the specialization, reaches it too.
|
| |
|
bool | batch_bytes_ {} |
| | Batch the BYTE-class route rather than the code-point one.
|
| |
|
bool | batch_cp_ascii_ {} |
| | Batch the ./negated-class route (real::detail::pike_vm::fill_codepoint_class_spans).
|
| |
| bool | batch_single_cl_ {} |
| |
|
bool | wb_edge_ {} |
| | The pattern carries a dropped leading \b (real::detail::pattern_hints::wb_lead_maximal_run): its filler takes the window-edge guard as a template argument, never as a loop test.
|
| |
|
bool | batch_alt_ {} |
| | Batch the fixed-alternation route (real::detail::pike_vm::fill_alternation_spans).
|
| |
|
bool | batch_alt_asks_ {} |
| | The alternation batch has yet to ask whether the automaton takes the subject.
|
| |
|
bool | batch_wide_ {} |
| | Batch the wide alternation route (detail::pike_vm::fill_alternation_wide_spans).
|
| |
|
bool | batch_spent_ {} |
| | The last fill stopped short of the buffer at the end of the subject.
|
| |
|
bool | batch_lazy_dfa_ {} |
| | Batch the lazy-DFA route (pike.hpp's fill_lazy_dfa_spans), the one no recognizer claims.
|
| |
|
bool | batch_exact_lit_ {} |
| | Batch the exact-literal route (pike.hpp's fill_exact_literal_spans).
|
| |
|
bool | batch_inner_lit_ {} |
| | Batch the inner-literal route (pike.hpp's fill_inner_literal_spans); may stop short, see batch_partial_.
|
| |
| bool | batch_fixed_ {} |
| |
|
bool | batch_partial_ {} |
| | The last fill stopped without proving the subject spent: an empty buffer means "resume on the
per-match path", not "the walk is over". Set by the lazy-DFA, inner-literal and wide-alternation fillers and by the automaton's claim; every other filler scans the whole subject.
|
| |
|
bool | wb_kept_ {} |
| | The pattern keeps a \b/\B wrap, evaluated on every span by the byte and code-point class fillers; the other batched routes decline such patterns.
|
| |
template<typename Storage, bool TrailingLA = false>
class real::basic_match_iterator< Storage, TrailingLA >
Forward iterator over the non-overlapping matches in a text.
Follows Python's empty-match rules: an empty match is yielded (even right after a non-empty one), then the scan advances by one codepoint. The regex and the text must outlive the iterator. Obtained from basic_match_range.
- Template Parameters
-
| Storage | The regex's storage policy (selects the result/scratch types). |
template<typename Storage , bool TrailingLA = false>
Constructs the end sentinel.
User-provided, not = default: end()'s return {} value-initializes, and with a defaulted constructor that zero-fills the whole object (its VM state included, ~10 KB) before constructing it. The members a sentinel is read through carry their own initializers (done_ is true).
template<typename Storage , bool TrailingLA = false>
Counts the matches left, the current one included, and ends the walk.
The spans a batched fill buffered past the current match are counted without being handed out: handing one out writes its slots, which no count reads. The first span of each fill still goes through advance, so the walk keeps its one path for refills, partial fills and the per-match fallback.
- Returns
- The number of matches from the current one to the end.
template<typename Storage , bool TrailingLA = false>
Cold half of the batched walk: refills batch_ from the engine.
Outlined: this unit sits on gcc's per-unit inline budget (docs/design.dox §10.1), and inlined it grows advance enough to charge rows that never batch.
Each branch bills real::detail::prof::tick_route under the unbatched route's identifier, once per refill: entries / matches reads 1 / batch_cap while batching works.
- Warning
- Read docs/MEASUREMENT.md §3.2 before adding a branch here: one more branch moves unrelated rows even with every filler byte-identical.
- Returns
true if at least one span was buffered.
template<typename Storage , bool TrailingLA = false>
This walk takes the trailing-lookaround route ([a-z]+(?=[a-z])), chosen once here rather than by specialization, so basic_regex::find_iter, whose return type fixes the specialization, reaches it too.
Costs one test per match on advance's general path, which the unbatched routes pay. An enum shared with batch_eligible_ costs more: only a walk selected without a per-match test removes it.