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

The context bits both lazy DFAs keep for the byte beside a position (before it forward, after it backward): a newline, an ASCII word byte, or – under word_quit only – a non-ASCII byte, which sets both bits at once since no ASCII byte does. More...

Functions

constexpr bool is_newline (std::uint8_t ctx)
 Whether context ctx says its byte is a newline.
 
constexpr bool is_word (std::uint8_t ctx)
 Whether context ctx says its byte is an ASCII word byte.
 
constexpr bool is_nonascii (std::uint8_t ctx)
 Whether context ctx says its byte is not ASCII.
 
constexpr std::uint8_t of (std::uint8_t b, bool cr)
 The context bits of byte b.
 

Variables

constexpr std::uint8_t newline {2}
 The byte is a newline.
 
constexpr std::uint8_t word {4}
 The byte is an ASCII word byte.
 
constexpr std::uint8_t nonascii {6}
 The byte is not ASCII (word_quit only).
 

Detailed Description

The context bits both lazy DFAs keep for the byte beside a position (before it forward, after it backward): a newline, an ASCII word byte, or – under word_quit only – a non-ASCII byte, which sets both bits at once since no ASCII byte does.

Function Documentation

◆ is_newline()

constexpr bool real::detail::byte_ctx::is_newline ( std::uint8_t  ctx)
constexpr

Whether context ctx says its byte is a newline.

Parameters
[in]ctxContext bits.
Returns
True for a newline; false for a non-ASCII byte, which also carries the newline bit.

◆ is_nonascii()

constexpr bool real::detail::byte_ctx::is_nonascii ( std::uint8_t  ctx)
constexpr

Whether context ctx says its byte is not ASCII.

Parameters
[in]ctxContext bits.
Returns
True for a non-ASCII byte under word_quit.

◆ is_word()

constexpr bool real::detail::byte_ctx::is_word ( std::uint8_t  ctx)
constexpr

Whether context ctx says its byte is an ASCII word byte.

Parameters
[in]ctxContext bits.
Returns
True for an ASCII word byte.

◆ of()

constexpr std::uint8_t real::detail::byte_ctx::of ( std::uint8_t  b,
bool  cr 
)
constexpr

The context bits of byte b.

Parameters
[in]bThe byte.
[in]crThe program's line assertions are ECMAScript's, which end a line at \r too.
Returns
Its context bits.