|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
AST → NFA program, via Thompson construction. More...
#include "real/version.hpp"#include <algorithm>#include <array>#include <cstdint>#include <vector>#include "real/frontend/ast.hpp"#include "real/core/charclass.hpp"#include "real/core/config.hpp"#include "real/engine/prefilter.hpp"#include "real/frontend/inner_literal.hpp"#include "real/core/program.hpp"#include "real/unicode/unicode_fold.hpp"#include "real/automata/utf8_ranges.hpp"Classes | |
| class | real::detail::compiler |
| Compiles an ast into a dynamic_program (NFA bytecode). More... | |
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 | |
| constexpr bool | real::detail::is_any_non_ascii (const std::vector< code_range > &ranges) |
Whether ranges is exactly the whole non-ASCII space [U+0080, U+10FFFF] — the "any non-ASCII code point" shape emitted by compiler::emit_any_codepoint_class. | |
| constexpr bool | real::detail::cp_ranges_are_normalised (const std::vector< code_range > &ranges) |
Whether ranges is what every consumer of a cp_class requires: each range non-empty, the sequence strictly ascending and disjoint. | |
| constexpr class_def | real::detail::unicode_casefold (const class_def &in) |
Expands a character class to its Unicode simple case-fold closure (text-mode icase). | |
| constexpr bool | real::detail::node_nullable (const ast &tree, std::int32_t idx) |
True if the AST subtree rooted at idx can match the empty string. empty, anchor and lookaround are zero-width, so exactly nullable; byte/klass/any never are. | |
| constexpr bool | real::detail::subtree_has_nullable_capturing_group (const ast &tree, std::int32_t idx) |
True if the AST subtree rooted at idx contains, at any depth, a capturing group (group >= 0) whose body is nullable (node_nullable). | |
| constexpr bool | real::detail::ast_has_nullable_captured_repeat (const ast &tree, std::int32_t idx) |
True if a capturing group with a nullable body sits anywhere under a quantifier (? included): the source of pattern_hints::nullable_captured_repeat. A safe over-approximation: it flags the shape ((\b|x)+ counts), not a proven divergent capture. | |
| constexpr dynamic_program | real::detail::compile (const ast &tree, flags compile_flags) |
Compiles tree to an NFA program (convenience over compiler). | |
AST → NFA program, via Thompson construction.
The program always has the shape save 0, <body>, save 1, match: slots 0/1 delimit group 0. Multi-byte code points compile to UTF-8 byte classes joined by split/jump, so the engine steps one byte at a time in lock-step (linear time). Branch targets are emitted as placeholders and patched only through patch_primary / patch_secondary.