|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
Forward iterator over the non-overlapping matches in a text. More...
#include <real.hpp>
Public Types | |
| using | value_type = basic_match_result< typename Storage::slot_storage > |
| Yielded match type. | |
| using | difference_type = std::ptrdiff_t |
| Iterator traits. | |
| using | reference = const value_type & |
| Dereference type. | |
| using | pointer = const value_type * |
| Arrow type. | |
| using | iterator_category = std::forward_iterator_tag |
| Multipass: copies are independent. | |
Public Member Functions | |
| constexpr | basic_match_iterator ()=default |
| 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 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 | operator== (const basic_match_iterator &other) const |
Returns true if both denote the same position/end. | |
Private Member Functions | |
| constexpr void | advance () |
| Finds the next match, applying the empty-match advance rules. | |
Private Attributes | |
| 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_ {} |
| OPT-C: 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. | |
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.
| Storage | The regex's storage policy (selects the result/scratch types). |
| using real::basic_match_iterator< Storage >::difference_type = std::ptrdiff_t |
| using real::basic_match_iterator< Storage >::iterator_category = std::forward_iterator_tag |
| using real::basic_match_iterator< Storage >::pointer = const value_type* |
| using real::basic_match_iterator< Storage >::reference = const value_type& |
| using real::basic_match_iterator< Storage >::value_type = basic_match_result<typename Storage::slot_storage> |
|
constexprdefault |
Constructs the end sentinel.
|
inlineconstexpr |
Constructs a begin iterator and finds the first match.
| [in] | prog | The compiled program to run. |
| [in] | pattern | The pattern text (for named-group resolution). |
| [in] | text | The text to iterate over (borrowed). |
| [in] | start | Byte offset to begin iterating from (0 = the whole text). |
| [in] | sem | Match semantics: leftmost-first (default) or the experimental leftmost-longest. |
|
inlineconstexprprivate |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |