std::regex compatibility, part 1/3: the constants, the error type, the backend-routing screens and basic_regex.
More...
|
| constexpr syntax_option_type | real::compat::regex_constants::operator| (syntax_option_type a, syntax_option_type b) noexcept |
| | Bitwise OR of two syntax options, so ECMAScript | icase stays typed.
|
| |
| constexpr syntax_option_type | real::compat::regex_constants::operator& (syntax_option_type a, syntax_option_type b) noexcept |
| | Bitwise AND of two syntax options, for testing a bit.
|
| |
| constexpr match_flag_type | real::compat::regex_constants::operator| (match_flag_type a, match_flag_type b) noexcept |
| | Bitwise OR of two match flags.
|
| |
| constexpr match_flag_type | real::compat::regex_constants::operator& (match_flag_type a, match_flag_type b) noexcept |
| | Bitwise AND of two match flags, for testing a bit.
|
| |
| constexpr match_flag_type | real::compat::regex_constants::operator~ (match_flag_type a) noexcept |
| | Bitwise complement of a match-flag set, for masking bits off.
|
| |
| bool | real::compat::detail::grammar_forces_std (regex_constants::syntax_option_type f) noexcept |
| | Options REAL cannot serve once translate_posix has declined: a POSIX grammar bit, and always collate and nosubs (REAL reports every group, std only group 0 under nosubs).
|
| |
| bool | real::compat::detail::pattern_forces_std (std::string_view p) noexcept |
| | Pattern text REAL accepts but reads differently from std, screened out before REAL compiles it so that the divergence is never silent.
|
| |
| bool | real::compat::detail::std_sed_keeps_final_backslash () |
| | Whether the native std keeps a final lone backslash of a format_sed format, as libstdc++ and libc++ do; MS STL drops it. REAL's sed expansion follows the native std there.
|
| |
| bool | real::compat::detail::std_dollar_zero_is_match () |
| | Whether the native std reads $0 in a format as the whole match, as libstdc++ and libc++ do; match_results::format follows it, being the one place REAL expands a $0 itself.
|
| |
| template<bool Sed, typename CharT , typename Put , typename Group , typename Prefix , typename Suffix > |
| void | real::compat::detail::expand_replacement (const CharT *first, const CharT *last, Put &&put, Group &&group, Prefix &&prefix, Suffix &&suffix) |
| | Expands a replacement format: the one rule set behind match_results::format and regex_replace.
|
| |
| bool | real::compat::detail::format_forces_std (std::string_view fmt) noexcept |
| | Whether a replacement format holds $0, which std implementations read differently (libstdc++: the whole match; MS STL: a literal), so the replace routes to std; $$ is an escaped dollar.
|
| |
| std::string | real::compat::detail::posix_class_ranges (std::string_view name) |
| | A POSIX bracket-class name to its ASCII (C-locale) range content, appended inside a [...] during ERE translation. Empty for an unknown name (the caller then falls back to std).
|
| |
| std::optional< std::string > | real::compat::detail::translate_ecma_classes (std::string_view p, bool icase) |
| | Rewrites the POSIX classes an ECMAScript bracket may hold ([[:alpha:]], which [re.grammar] adds to ECMAScript) as their ASCII ranges, which REAL reads; everything else passes through unchanged.
|
| |
| bool | real::compat::detail::translate_bracket (std::string_view p, std::size_t &i, std::string &out) |
| | Translates a POSIX bracket expression, the same in BRE and ERE: a POSIX class becomes its ASCII ranges, other members pass through.
|
| |
| bool | real::compat::detail::append_awk_escape (std::string_view p, std::size_t &i, std::string &out) |
| | Appends REAL's form of the awk escape at i, as the exact byte \xHH: \b is a backspace, not a word boundary; \a, \n, \t, \r, \f, \v the controls; \/ and \" literals; \ddd an octal byte, up to 0377.
|
| |
| bool | real::compat::detail::has_empty_alternation_branch (std::string_view p) |
| | Whether p has an empty alternation branch ((|, |), ||, or a | at either end), which std rejects in the POSIX grammars. Conservative: a false positive costs only linear coverage, a false negative would be a silent over-accept.
|
| |
| std::optional< std::string > | real::compat::detail::translate_ere (std::string_view p, bool awk=false) |
| | Translates an ERE pattern (with awk, an awk one: append_awk_escape) to REAL's syntax, or nullopt on a construct the grammars read differently: an ECMAScript shorthand, an ambiguous {, an unknown class, an empty branch (has_empty_alternation_branch).
|
| |
| std::optional< std::string > | real::compat::detail::translate_bre (std::string_view p) |
| | Translates a BRE pattern to REAL's syntax, or nullopt: \(, \) and \{n\} group and quantify, a bare ( ) { } | + ? is escaped as the literal it is. Declines on a backreference, an ECMAScript escape, a non-strict \{, an unknown class, a * opening an expression, or a ^ or $ away from the pattern's ends.
|
| |
| template<typename LineFn > |
| std::optional< std::string > | real::compat::detail::translate_newline_alt (std::string_view p, LineFn translate_line) |
| | grep / egrep: each newline-separated line is translated by translate_line and the lines joined with |, the lowest precedence, so each line keeps its own anchors. A line that declines, or an empty one, declines the whole pattern.
|
| |
| std::optional< std::string > | real::compat::detail::translate_posix (std::string_view p, regex_constants::syntax_option_type f) |
| | Dispatches a single POSIX grammar to its translator; nullopt for no grammar bit or several, or under collate or nosubs.
|
| |
| real::flags | real::compat::detail::to_real (regex_constants::syntax_option_type f) noexcept |
| | Maps compat options to REAL's flags, always with bytes | ecma: one REAL byte per std::regex char.
|
| |
| std::regex_constants::syntax_option_type | real::compat::detail::to_std (regex_constants::syntax_option_type f) noexcept |
| | Maps compat options to std::regex syntax flags (the fallback path).
|
| |
| template<typename Call > |
| decltype(auto) | real::compat::detail::std_call (Call &&call) |
| | Runs call on the std backend and reports its errors as regex_error, the type every error of this layer has. A std::basic_regex can fail while it matches (error_complexity, error_stack), long after it was built.
|
| |
| std::string | real::compat::detail::rewrite_end_context (std::string_view pattern, bool not_eol, bool not_eow, bool multiline) |
| | pattern with match_not_eol and match_not_eow written into it, so a REAL search honors them without run-time context: under not_eol a $ holds at no end of the sequence (in multiline only before a line terminator), under not_eow a \b holds at no end and a \B does.
|
| |
|
|
constexpr error_type | real::compat::regex_constants::error_collate {std::regex_constants::error_collate} |
| | As std's: an invalid collating element.
|
| |
|
constexpr error_type | real::compat::regex_constants::error_ctype {std::regex_constants::error_ctype} |
| | As std's: an invalid character class.
|
| |
|
constexpr error_type | real::compat::regex_constants::error_escape {std::regex_constants::error_escape} |
| | As std's: an invalid escape.
|
| |
|
constexpr error_type | real::compat::regex_constants::error_backref {std::regex_constants::error_backref} |
| | As std's: an invalid back reference.
|
| |
|
constexpr error_type | real::compat::regex_constants::error_brack {std::regex_constants::error_brack} |
| | As std's: mismatched brackets.
|
| |
|
constexpr error_type | real::compat::regex_constants::error_paren {std::regex_constants::error_paren} |
| | As std's: mismatched parentheses.
|
| |
|
constexpr error_type | real::compat::regex_constants::error_brace {std::regex_constants::error_brace} |
| | As std's: mismatched braces.
|
| |
|
constexpr error_type | real::compat::regex_constants::error_badbrace {std::regex_constants::error_badbrace} |
| | As std's: an invalid range in braces.
|
| |
|
constexpr error_type | real::compat::regex_constants::error_range {std::regex_constants::error_range} |
| | As std's: an invalid character range.
|
| |
|
constexpr error_type | real::compat::regex_constants::error_space {std::regex_constants::error_space} |
| | As std's: out of memory.
|
| |
|
constexpr error_type | real::compat::regex_constants::error_badrepeat {std::regex_constants::error_badrepeat} |
| | As std's: a repeat with nothing to repeat.
|
| |
|
constexpr error_type | real::compat::regex_constants::error_complexity {std::regex_constants::error_complexity} |
| | As std's; also a strict-policy rejection.
|
| |
|
constexpr error_type | real::compat::regex_constants::error_stack {std::regex_constants::error_stack} |
| | As std's: out of stack.
|
| |
| template<typename CharT , typename Traits > |
| constexpr bool | real::compat::detail::real_eligible |
| | Whether REAL can serve this instantiation: char with default traits only, anything else is std. A compile-time gate: REAL's char-only code must be compiled out for other CharT, not skipped.
|
| |
std::regex compatibility, part 1/3: the constants, the error type, the backend-routing screens and basic_regex.