C++ Actor Framework  0.18
Public Member Functions | Public Attributes | List of all members
caf::parser_state< Iterator, Sentinel > Struct Template Reference

Stores all information necessary for implementing an FSM-based parser. More...

#include <parser_state.hpp>

Collaboration diagram for caf::parser_state< Iterator, Sentinel >:
Collaboration graph

Public Member Functions

 parser_state (Iterator first) noexcept
 
 parser_state (Iterator first, Sentinel last) noexcept
 
 parser_state (const parser_state &) noexcept=default
 
parser_stateoperator= (const parser_state &) noexcept=default
 
char next () noexcept
 Returns the null terminator when reaching the end of the string, otherwise the next character. More...
 
char current () const noexcept
 Returns the null terminator if i == e, otherwise the current character.
 
bool at_end () const noexcept
 Checks whether i == e.
 
void skip_whitespaces () noexcept
 Skips any whitespaces characters in the input.
 
bool consume (char x) noexcept
 Tries to read x as the next character, automatically skipping leading whitespaces. More...
 
template<class Predicate >
bool consume_if (Predicate predicate) noexcept
 Consumes the next character if it satisfies given predicate, automatically skipping leading whitespaces. More...
 
bool consume_strict (char x) noexcept
 Tries to read x as the next character without automatically skipping leading whitespaces. More...
 
template<class Predicate >
bool consume_strict_if (Predicate predicate) noexcept
 Consumes the next character if it satisfies given predicate without automatically skipping leading whitespaces. More...
 

Public Attributes

Iterator i
 Current position of the parser.
 
Sentinel e
 End-of-input marker.
 
pec code
 Current state of the parser.
 
int32_t line
 Current line in the input.
 
int32_t column
 Position in the current line.
 

Detailed Description

template<class Iterator, class Sentinel>
struct caf::parser_state< Iterator, Sentinel >

Stores all information necessary for implementing an FSM-based parser.

Member Function Documentation

◆ consume()

template<class Iterator , class Sentinel >
bool caf::parser_state< Iterator, Sentinel >::consume ( char  x)
noexcept

Tries to read x as the next character, automatically skipping leading whitespaces.

◆ consume_if()

template<class Iterator , class Sentinel >
template<class Predicate >
bool caf::parser_state< Iterator, Sentinel >::consume_if ( Predicate  predicate)
noexcept

Consumes the next character if it satisfies given predicate, automatically skipping leading whitespaces.

◆ consume_strict()

template<class Iterator , class Sentinel >
bool caf::parser_state< Iterator, Sentinel >::consume_strict ( char  x)
noexcept

Tries to read x as the next character without automatically skipping leading whitespaces.

◆ consume_strict_if()

template<class Iterator , class Sentinel >
template<class Predicate >
bool caf::parser_state< Iterator, Sentinel >::consume_strict_if ( Predicate  predicate)
noexcept

Consumes the next character if it satisfies given predicate without automatically skipping leading whitespaces.

◆ next()

template<class Iterator , class Sentinel >
char caf::parser_state< Iterator, Sentinel >::next ( )
noexcept

Returns the null terminator when reaching the end of the string, otherwise the next character.


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