REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
inner_literal_reverse.hpp File Reference

The prefix-reverse of the inner-literal prefilter: given a required inner literal found at a candidate position, reverse-match the pattern's PREFIX — everything before the literal — to recover the match start. Reuses the engine's reverse machinery, build_byte_program() plus reverse_dfa, on the prefix sub-program alone. More...

#include <real/version.hpp>
#include <cstddef>
#include <cstdint>
#include <string_view>
#include <real/automata/lazy_dfa.hpp>
#include <real/frontend/ast.hpp>
#include <real/frontend/compiler.hpp>
#include <real/frontend/inner_literal.hpp>
Include dependency graph for inner_literal_reverse.hpp:

Namespaces

namespace  real
 REAL's public API: real::regex, real::static_regex, real::flags and the match/iterator types built on them.
 
namespace  real::detail
 DFA construction internals: subset construction over a flattened NFA. Not a stable API.
 

Functions

std::size_t real::detail::prefix_reverse_start (const ast &tree, std::int32_t count, flags compile_flags, std::string_view text, std::size_t h, std::size_t min_start)
 The match start for a literal candidate at h: reverse-match the prefix (the first count top-level children) ending at h, bounded below by min_start. count == 0 means the literal is at the head, so the reverse is the identity (the match starts at the candidate). Returns npos when the prefix cannot reach a start (an orphan candidate). Runtime only — the reverse DFA is not constexpr; a static_regex would keep the inner-literal path dynamic.
 

Detailed Description

The prefix-reverse of the inner-literal prefilter: given a required inner literal found at a candidate position, reverse-match the pattern's PREFIX — everything before the literal — to recover the match start. Reuses the engine's reverse machinery, build_byte_program() plus reverse_dfa, on the prefix sub-program alone.

Unrouted: real::detail::prefix_reverse_start has no caller outside its own test. The protocol lives here, written and tested, so that a route can be given it rather than inventing one.