|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
AST → NFA program, via Thompson construction. More...
#include "real/version.hpp"#include <algorithm>#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"Go to the source code of this file.
Classes | |
| class | real::detail::compiler |
| Compiles an ast into a dynamic_program (NFA bytecode). More... | |
Namespaces | |
| namespace | real |
| namespace | real::detail |
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 the compact compiler::emit_codepoint_class. | |
| 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 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 emitted program always has the shape save 0, <body>, save 1, match, so slots 0/1 delimit group 0 (the whole match).
Multi-codepoint semantics are compiled down to byte-level alternatives (RE2-style): . and negated classes expand to UTF-8 lead/continuation byte classes joined by split/jump, so the engine itself only ever steps one byte at a time, in lock-step — which preserves linear time.
Branch targets are emitted as placeholders and patched only through the patch_primary / patch_secondary helpers, never by rewriting emitted instructions wholesale.
Definition in file compiler.hpp.