REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::dfa_munch_progress Class Reference

Where a munch stood when its subject ended with the walk still alive, so that the next munch from the same start, over the subject with text appended, goes on from there without reading again what it read. More...

#include <dfa.hpp>

Public Member Functions

std::size_t read () const noexcept
 Bytes the walk has read past its start.
 
void reset () noexcept
 Starts the next munch over: from another start, or over a subject that changed before its end.
 

Private Attributes

std::size_t read_ {0}
 Bytes read past the start.
 
std::uint32_t state_ {0}
 The state the walk stood in after them.
 
std::uint32_t rule_ {0}
 The last accepting rule, or detail::dfa_no_rule (set with the first walk).
 
std::size_t length_ {0}
 That accept's length.
 
const void * owner_ {nullptr}
 The dfa's tables it describes.
 

Friends

class dfa
 

Detailed Description

Where a munch stood when its subject ended with the walk still alive, so that the next munch from the same start, over the subject with text appended, goes on from there without reading again what it read.

A lexer reading text that arrives in pieces munches a token that is still open once per piece; from its start each time, a token of n bytes in pieces of c costs on the order of n²/c steps, and with a progress n. Pass it to dfa::munch(std::string_view, std::size_t, dfa_munch_progress&) const; it is bound to one dfa and one start, which the caller keeps (the text before the subject's end may move in memory, not change).

Member Function Documentation

◆ read()

std::size_t real::dfa_munch_progress::read ( ) const
inlinenoexcept

Bytes the walk has read past its start.

Returns
0 for a fresh progress, or one a final munch left.

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