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

Compiled form of a pattern and the public flags / error types. More...

#include "real/version.hpp"
#include <array>
#include <cstdint>
#include <exception>
#include <limits>
#include <span>
#include <string>
#include <vector>
#include "real/core/charclass.hpp"
Include dependency graph for program.hpp:

Go to the source code of this file.

Classes

class  real::regex_error
 
struct  real::detail::code_range
 An inclusive code-point range [lo, hi]. Shared by character classes (ast.hpp) and the generated Unicode property / fold tables; lives here so those low-level headers need not pull in the parser. More...
 
struct  real::detail::cp_class
 A match-time code-point class for the klass_cp opcode: an ASCII bitmap for code points < 0x80 plus a slice of sorted non-ASCII ranges (indexing the program's flat cp_ranges buffer). It is the already-effective set (any \W/[^…] negation is materialised at compile time). Unlike the byte-NFA klass, the ranges are kept and binary-searched at match time — O(log ranges) per position, independent of the range count. More...
 
struct  real::detail::lookaround_sub
 A bounded lookaround sub-program, referenced by assert_lookaround's arg16. More...
 
struct  real::detail::instr
 One NFA instruction. Field meaning depends on op. More...
 
struct  real::detail::pattern_hints
 Search-acceleration hints extracted from a compiled program. More...
 
struct  real::detail::named_group
 A named capture group. More...
 
struct  real::detail::program_view
 
struct  real::detail::dynamic_program
 Owning, heap-allocated program: the storage backing real::regex. More...
 

Namespaces

namespace  real
 
namespace  real::detail
 

Enumerations

enum class  real::flags : std::uint8_t {
  real::none = 0 , real::icase = 1 , real::multiline = 2 , real::dotall = 4 ,
  real::bytes = 8 , real::verbose = 16 , real::ecma = 32 , real::ascii = 64 ,
  real::dollar_endonly = 128
}
 Compilation flags, mirroring Python's re.I, re.M and re.S. More...
 
enum class  real::match_semantics : std::uint8_t { real::first = 0 , real::longest = 1 }
 Which match a search returns among those starting at the leftmost position (an experimental, opt-in, off-by-default engine mode — the default is unchanged). More...
 
enum class  real::error_kind : std::uint8_t { real::syntax , real::unsupported }
 Exception thrown for an invalid pattern (or one exceeding a limit). More...
 
enum class  real::detail::opcode : std::uint8_t {
  real::detail::byte , real::detail::klass , real::detail::klass_cp , real::detail::split ,
  real::detail::jump , real::detail::save , real::detail::assert_position , real::detail::match ,
  real::detail::assert_lookaround
}
 NFA instruction opcodes executed by the Pike VM. More...
 
enum class  real::detail::assert_kind : std::uint8_t {
  real::detail::text_start , real::detail::text_end , real::detail::text_end_or_final_newline , real::detail::line_start ,
  real::detail::line_end , real::detail::word_boundary , real::detail::not_word_boundary , real::detail::word_start ,
  real::detail::word_end
}
 Kind of zero-width assertion carried in assert_position's arg8. More...
 
enum class  real::detail::look_dir : std::uint8_t { real::detail::ahead , real::detail::behind }
 Direction of a lookaround sub-pattern. More...
 

Functions

constexpr flags real::operator| (flags lhs, flags rhs)
 Bitwise-OR of two flag sets.
 
constexpr flags real::operator& (flags lhs, flags rhs)
 Bitwise-AND of two flag sets.
 
constexpr bool real::has_flag (flags value, flags flag)
 Tests whether flag is set in value.
 

Variables

constexpr std::size_t real::npos {std::numeric_limits<std::size_t>::max()}
 Sentinel for "no position" / unset capture slot (akin to std::string::npos).
 

Detailed Description

Compiled form of a pattern and the public flags / error types.

Defines the NFA instruction set executed by the engine, the heap-allocated program the compiler produces, the non-owning view the engine runs over, the compilation real::flags, and real::regex_error (thrown on an invalid pattern).

Definition in file program.hpp.