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

Resource limits guarding against pattern-driven resource exhaustion. More...

#include "real/version.hpp"
#include <cstddef>
#include <cstdint>
Include dependency graph for config.hpp:

Go to the source code of this file.

Namespaces

namespace  real
 
namespace  real::detail
 

Variables

constexpr std::size_t real::detail::max_program_size {262144}
 Maximum number of NFA instructions in a compiled program.
 
constexpr std::int32_t real::detail::max_repeat_count {1000}
 Per-quantifier bounded-repeat cap, enforced at parse time.
 
constexpr std::int32_t real::detail::max_group_count {32766}
 Maximum capture groups; bounds slot_count = 2 * (groups + 1).
 
constexpr std::int32_t real::detail::max_nesting_depth {200}
 Maximum parser recursion depth; prevents stack overflow on deep nesting.
 
constexpr std::int32_t real::detail::max_lookaround_length {255}
 Maximum bytes a bounded lookaround sub-pattern may consume (its L_max). Bounds the per-position lookaround evaluation, preserving linear time.
 
constexpr std::size_t real::detail::max_dfa_states {65536}
 Maximum DFA states (opt-in real::dfa). Subset construction is 2^NFA in the worst case; this caps it so a pathological pattern throws real::dfa_error instead of exhausting memory. Generous: real lexer DFAs use far fewer.
 

Detailed Description

Resource limits guarding against pattern-driven resource exhaustion.

Bounded-repeat unrolling, parser nesting, capture-group count and compiled program size are each capped. Values are conservative for portability while still admitting practical patterns (e.g. a{1000}).

Definition in file config.hpp.