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

Zero-width assertion evaluation (^ $ \b \B \A \Z \< \>) as free functions over a subject and a position, shared by the Pike VM and the one-pass extractor. More...

#include <cstddef>
#include <cstdint>
#include <string_view>
#include "real/core/charclass.hpp"
#include "real/core/program.hpp"
#include "real/unicode/unicode_props.hpp"
#include "real/unicode/utf8.hpp"
Include dependency graph for assert_eval.hpp:

Go to the source code of this file.

Namespaces

namespace  real
 
namespace  real::detail
 

Functions

constexpr bool real::detail::word_before (std::string_view text, std::size_t pos, bool ascii_word)
 Word-ness of the code point ending at pos — the left side of a boundary. False at the text start or on a malformed sequence; ASCII / bytes / re.A (ascii_word) stay byte-level.
 
constexpr bool real::detail::word_after (std::string_view text, std::size_t pos, bool ascii_word)
 Word-ness of the code point starting at pos — the right side of a boundary. False at the text end or on a malformed sequence; ASCII / bytes / re.A stay byte-level.
 
constexpr bool real::detail::assertion_holds (assert_kind kind, std::string_view text, std::size_t pos, bool ascii_word)
 Evaluates a zero-width assertion at pos in text.
 

Detailed Description

Zero-width assertion evaluation (^ $ \b \B \A \Z \< \>) as free functions over a subject and a position, shared by the Pike VM and the one-pass extractor.

The multiline / trailing-newline subtleties are resolved at compile time into the real::detail::assert_kind carried by an assert_position op, so evaluation here is a pure predicate on (text, pos) plus the word-ness mode. The Pike VM (pike.hpp) delegates to these; the one-pass runtime (onepass.hpp) evaluates the same predicates for an edge's assertion conditions, so both agree by construction.

Definition in file assert_eval.hpp.