parsi/fn/expect.hpp

namespace parsi

Functions

template<std::size_t SizeV>
constexpr auto expect(const char (&str)[SizeV]) noexcept -> fn::ExpectFixedString<SizeV, const char>

Creates a parser that expects the stream to start with the given fixed string. Parser’s expected string is fixed and cannot be changed. better performance for string literals.

template<std::size_t SizeV, typename CharT = const char>
constexpr auto expect(FixedString<SizeV, CharT> expected) noexcept -> fn::ExpectFixedString<SizeV, CharT>

Creates a parser that expects the stream to start with the given fixed string. Parser’s expected string is fixed and cannot be changed. better performance for string literals.

inline auto expect(std::string expected) noexcept -> fn::ExpectString

Creates a parser that expects the stream to start with the given string.

constexpr auto expect(char expected) noexcept -> fn::ExpectChar

Creates a parser that expects the stream to start with the given character.

constexpr auto expect_not(char expected) noexcept -> fn::ExpectChar

Creates a parser that expects the stream to start with the given character.

constexpr auto expect(Charset expected) noexcept -> fn::ExpectCharset

Creates a parser that expects the stream to start with a character the is in the given charset.

constexpr auto expect_not(Charset expected) noexcept -> fn::ExpectCharset

Creates a parser that expects the stream to start with a character the is in the given charset.

namespace fn
struct ExpectChar
#include <expect.hpp>

A parser that expects the stream to start with the given character.

Public Functions

inline constexpr auto operator()(Stream stream) const noexcept -> Result

Public Members

char expected
bool negate = false
struct ExpectCharset
#include <expect.hpp>

A parser that expects the stream to start with a character that is in the given charset.

Public Functions

inline constexpr auto operator()(Stream stream) const noexcept -> Result

Public Members

Charset charset
template<std::size_t SizeV, typename CharT = const char>
struct ExpectFixedString

Public Functions

inline constexpr auto operator()(Stream stream) const noexcept -> Result

Public Members

FixedString<SizeV, CharT> expected
struct ExpectString
#include <expect.hpp>

A parser that expects the stream to start with the given string.

Public Functions

inline auto operator()(Stream stream) const noexcept -> Result

Public Members

std::string expected