REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::detail::inner_literal_bill Struct Reference

Tells when the inner-literal route's candidates should give way to the core search, from what reaching their starts and confirming them read against the distance crossed. More...

#include <pike.hpp>

Public Member Functions

constexpr bool overspent (std::size_t read, std::size_t crossed)
 Bills one candidate the confirm rejected, and tells whether the route should give way.
 
constexpr std::size_t allowance (std::size_t crossed) const
 The bytes a candidate's reverse may still read before the bill is spent.
 

Public Attributes

std::size_t spent {0}
 What the candidates have cost so far, in the units above.
 

Static Public Attributes

static constexpr std::size_t per_candidate {80}
 One candidate, ten times its weight.
 
static constexpr std::size_t per_read_byte {10}
 One byte its reverse or its confirm read.
 
static constexpr std::size_t per_crossed {9}
 One byte crossed: the bound of 0.9, ten times.
 
static constexpr std::size_t slack {640}
 About eight candidates before any verdict.
 

Detailed Description

Tells when the inner-literal route's candidates should give way to the core search, from what reaching their starts and confirming them read against the distance crossed.

A candidate's start is found by reversing the prefix, which reads back until its state dies (over a run of the prefix's class, the whole run). Score 8 * candidates + bytes read per byte crossed: the route lost at >= 1.04 ([a-z ]*x\d{4} 1.61x) and won at <= 0.74 (\w+\s*:\s*\d+ 0.13x); the bound sits at 0.9. A class walk back is not billed: it reads no automaton.

Member Function Documentation

◆ allowance()

constexpr std::size_t real::detail::inner_literal_bill::allowance ( std::size_t  crossed) const
inlineconstexpr

The bytes a candidate's reverse may still read before the bill is spent.

Parameters
[in]crossedBytes from where the scan began to that candidate.
Returns
The allowance; zero once the candidates have spent what the core's pass would.

◆ overspent()

constexpr bool real::detail::inner_literal_bill::overspent ( std::size_t  read,
std::size_t  crossed 
)
inlineconstexpr

Bills one candidate the confirm rejected, and tells whether the route should give way.

Parameters
[in]readBytes its reverse and its confirm read.
[in]crossedBytes from where the scan began to the candidate.
Returns
True once the core search would clearly cost less.

The documentation for this struct was generated from the following file: