|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
Enumerates selected sub-matches (or the text between matches) — std::regex_token_iterator.
More...
#include <regex_iter.hpp>
Public Types | |
| using | regex_type = basic_regex< CharT, Traits > |
| The pattern type. | |
| using | value_type = sub_match< BidirIt > |
| Yielded token. | |
| using | difference_type = std::ptrdiff_t |
| Iterator traits. | |
| using | pointer = const value_type * |
| Arrow type. | |
| using | reference = const value_type & |
| Dereference type. | |
| using | iterator_category = std::forward_iterator_tag |
| std::regex_token_iterator parity. | |
Public Member Functions | |
| regex_token_iterator ()=default | |
| Constructs the end sentinel. | |
| regex_token_iterator (BidirIt first, BidirIt last, const regex_type &re, int submatch=0, regex_constants::match_flag_type flags=regex_constants::match_default) | |
Selects a single sub-match field (0 = whole match, N = group N, -1 = split). | |
| regex_token_iterator (BidirIt first, BidirIt last, const regex_type &re, const std::vector< int > &submatches, regex_constants::match_flag_type flags=regex_constants::match_default) | |
Selects a list of fields, cycled per match (e.g. {1, 2}, {-1}). The match flags are forwarded to the wrapped regex_iterator, so the nullable/honors routing is inherited. | |
| regex_token_iterator (BidirIt first, BidirIt last, const regex_type &re, std::initializer_list< int > submatches, regex_constants::match_flag_type flags=regex_constants::match_default) | |
Selects a list of fields from a braced list (e.g. {-1}). | |
| regex_token_iterator (BidirIt first, BidirIt last, const regex_type &&re, int submatch=0, regex_constants::match_flag_type flags=regex_constants::match_default)=delete | |
| Constructing from a temporary regex would dangle (std::regex_token_iterator parity). | |
| regex_token_iterator (BidirIt first, BidirIt last, const regex_type &&re, const std::vector< int > &submatches, regex_constants::match_flag_type flags=regex_constants::match_default)=delete | |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| reference | operator* () const |
| pointer | operator-> () const |
| regex_token_iterator & | operator++ () |
| regex_token_iterator | operator++ (int) |
| bool | operator== (const regex_token_iterator &other) const |
| bool | operator!= (const regex_token_iterator &other) const |
Private Member Functions | |
| void | set_field () |
Computes the current token from the current match and subs_[n_]. | |
| void | init (BidirIt first, BidirIt last) |
| Establishes the first token (or the whole-sequence token when there is no match). | |
Private Attributes | |
| regex_iterator< BidirIt, CharT, Traits > | position_ |
| The underlying match walk. | |
| std::vector< int > | subs_ |
| Field selectors, cycled per match. | |
| std::size_t | n_ {0} |
| Current field index into subs_. | |
| value_type | current_ |
| Current token (by value — no aliasing). | |
| bool | has_m1_ {false} |
Whether a -1 (split) field is present. | |
| bool | suffix_mode_ {false} |
| Emitting the trailing split suffix. | |
| bool | at_end_ {true} |
| End-of-sequence. | |
Enumerates selected sub-matches (or the text between matches) — std::regex_token_iterator.
Wraps regex_iterator, so it inherits the per-operation nullable routing untouched (it never replays the engine choice). For each match it yields the requested fields in order: a field N >= 0 is capture group N (a non-participating group yields an empty matched == false token); the field -1 is the text before this match since the previous one — i.e. the match's prefix() — which turns -1 into a splitter. After the last match, a trailing -1 field yields the final suffix iff it is non-empty (std's rule; an empty field between adjacent matches is still produced, the asymmetry std pins). With -1 and no match at all, the whole sequence is the single token.
| BidirIt | A contiguous iterator into the searched sequence. |
Definition at line 194 of file regex_iter.hpp.
| using real::compat::regex_token_iterator< BidirIt, CharT, Traits >::difference_type = std::ptrdiff_t |
Iterator traits.
Definition at line 200 of file regex_iter.hpp.
| using real::compat::regex_token_iterator< BidirIt, CharT, Traits >::iterator_category = std::forward_iterator_tag |
std::regex_token_iterator parity.
Definition at line 203 of file regex_iter.hpp.
| using real::compat::regex_token_iterator< BidirIt, CharT, Traits >::pointer = const value_type* |
Arrow type.
Definition at line 201 of file regex_iter.hpp.
| using real::compat::regex_token_iterator< BidirIt, CharT, Traits >::reference = const value_type& |
Dereference type.
Definition at line 202 of file regex_iter.hpp.
| using real::compat::regex_token_iterator< BidirIt, CharT, Traits >::regex_type = basic_regex<CharT, Traits> |
The pattern type.
Definition at line 198 of file regex_iter.hpp.
| using real::compat::regex_token_iterator< BidirIt, CharT, Traits >::value_type = sub_match<BidirIt> |
Yielded token.
Definition at line 199 of file regex_iter.hpp.
|
default |
Constructs the end sentinel.
|
inline |
Selects a single sub-match field (0 = whole match, N = group N, -1 = split).
Definition at line 209 of file regex_iter.hpp.
|
inline |
Selects a list of fields, cycled per match (e.g. {1, 2}, {-1}). The match flags are forwarded to the wrapped regex_iterator, so the nullable/honors routing is inherited.
Definition at line 223 of file regex_iter.hpp.
|
inline |
Selects a list of fields from a braced list (e.g. {-1}).
Definition at line 243 of file regex_iter.hpp.
|
delete |
Constructing from a temporary regex would dangle (std::regex_token_iterator parity).
|
delete |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlineprivate |
Establishes the first token (or the whole-sequence token when there is no match).
Definition at line 349 of file regex_iter.hpp.
|
inline |
Definition at line 327 of file regex_iter.hpp.
|
inline |
Definition at line 267 of file regex_iter.hpp.
|
inline |
Definition at line 277 of file regex_iter.hpp.
|
inline |
Definition at line 308 of file regex_iter.hpp.
|
inline |
Definition at line 272 of file regex_iter.hpp.
|
inline |
Definition at line 315 of file regex_iter.hpp.
|
inlineprivate |
Computes the current token from the current match and subs_[n_].
Definition at line 343 of file regex_iter.hpp.
|
private |
End-of-sequence.
Definition at line 340 of file regex_iter.hpp.
|
private |
Current token (by value — no aliasing).
Definition at line 337 of file regex_iter.hpp.
|
private |
Whether a -1 (split) field is present.
Definition at line 338 of file regex_iter.hpp.
|
private |
Current field index into subs_.
Definition at line 336 of file regex_iter.hpp.
|
private |
The underlying match walk.
Definition at line 334 of file regex_iter.hpp.
|
private |
Field selectors, cycled per match.
Definition at line 335 of file regex_iter.hpp.
|
private |
Emitting the trailing split suffix.
Definition at line 339 of file regex_iter.hpp.