Skip to content

iris::build::SpecBuilder Class Reference

Doxygen 1.15.0 generates this reference during each site build from the public headers. The C++ guide shows the API in use.

A reader spec under construction: the scope of the top level, with the settings that only the top level has. More...

#include <iris/build.hpp>

Public Member Functions

 SpecBuilder ()
 A builder without a format statement.
 SpecBuilder (std::string_view format, std::source_location site=std::source_location::current())
 A builder that starts with format name.
void format (std::string_view name, std::source_location site=std::source_location::current())
 format name
void comment (const Strings &markers, std::source_location site=std::source_location::current())
 comment "marker" ...
void stop (const Strings &markers, std::source_location site=std::source_location::current())
 stop "marker" ...
void tokens (std::string_view characters, std::source_location site=std::source_location::current())
 tokens "characters"
void separators (std::string_view characters, std::source_location site=std::source_location::current())
 separators "characters"
void ignore_trailing (std::source_location site=std::source_location::current())
 ignore trailing
template<class F>
requires std::invocable<F, Scope<0, Presence::Required> &>
std::invoke_result_t< F, Scope< 0, Presence::Required > & > instances (F &&body, std::source_location site=std::source_location::current())
 instances { body }; returns the result of the body
std::string source () const
 Return the text of the spec. Throws BuildError for a builder check.
std::expected< std::string, BuildError > try_source () const
 Return the text of the spec, or the BuildError of a builder check.
Spec build () const
 Print and parse the spec.
std::expected< Spec, BuildError > try_build () const
 Print and parse the spec, or return the BuildError.
Public Member Functions inherited from iris::build::Scope< 0, Presence::Required >
detail::TargetOut< T, TypeValue< Ty >, detail::plus(D, type_dims< Ty >), P > read (const T &target, const Ty &type, std::source_location site=std::source_location::current())
 target: type, a declaration, as in read("n", int_) or read("x", int_.dim(n)).
detail::TargetOut< T, V, detail::plus(D, 1), P > list (const T &target, const ListReading< V > &reading, std::source_location site=std::source_location::current())
 list target: type until end, as in list("x", int_.until(0))
detail::TargetOut< T, ValueOf< E >, detail::let_depth< E, D >, P > let (const T &target, E &&value, std::source_location site=std::source_location::current())
 let target = value.
void set (const Field< V, H, HP > &handle, E &&value, std::source_location site=std::source_location::current())
 let handle = value, keeping the handle's type and depth: the value must have both
detail::TargetOut< T, Dynamic, dynamic_depth, P > param (const T &target, std::source_location site=std::source_location::current())
 param target, a parameter without a default
void check (E &&condition, std::source_location site=std::source_location::current())
 check condition
void expect (const Strings &words, std::source_location site=std::source_location::current())
 expect "word" ...
void line (PatternArg text, std::source_location site=std::source_location::current())
 line "pattern"
void find (PatternArg text, std::source_location site=std::source_location::current())
 find "pattern"
void skip_line (std::source_location site=std::source_location::current())
 skip line
void skip_lines (E &&lines, std::source_location site=std::source_location::current())
 skip count lines
void index (E &&position, std::source_location site=std::source_location::current())
 index position
NamedType< TypeValue< Ty > > define_type (std::string_view name, const Ty &type, std::source_location site=std::source_location::current())
 type name = type, a named type for declarations and captures
std::invoke_result_t< F, Scope< detail::plus(D, 1), P > & > repeat (C &&times, F &&body, std::source_location site=std::source_location::current())
 repeat count { body }; returns the result of the body
std::invoke_result_t< F, Scope< detail::plus(D, 1), P > & > repeat_until_eof (F &&body, std::source_location site=std::source_location::current())
 repeat until eof { body }; returns the result of the body
std::invoke_result_t< F, Scope< detail::plus(D, 1), P > & > repeat_until (const Strings &terminators, F &&body, std::source_location site=std::source_location::current())
 repeat until "line" ... { body }; returns the result of the body
std::invoke_result_t< F, Arms< D, P > & > sections (F &&body, std::source_location site=std::source_location::current())
 sections { arms }; returns the result of the body, which receives the Arms
If< D, P, std::invoke_result_t< F, Scope< D, Presence::Maybe > & > > if_ (C &&condition, F &&body, std::source_location site=std::source_location::current())
 if condition { body }; else_if, else_ and else_read_if on the result continue it
Field< CaptureValue< Ty >, D, P > capture (std::string_view name, const Ty &type, std::source_location site=std::source_location::current())
 A capture for patterns, {name:type}, in the scope of this block.
Field< CaptureValue< Ty >, D, Presence::Maybe > optional_capture (std::string_view name, const Ty &type, std::source_location site=std::source_location::current())
 A capture for patterns whose entry may be undefined.
H forward (std::string_view name, std::source_location site=std::source_location::current())
 A handle of type H for a name that a later statement defines, as in forward<Field<std::int64_t>>("n").
DynField undefined (std::string_view name, std::source_location site=std::source_location::current())
 A handle for a name that nothing defines, for defined(x).
Record forward_record (std::string_view each, std::string_view list, std::source_location site=std::source_location::current())
 A record handle for a repeat that comes later, with the names each and list; record_as in the repeat binds it.
Record record () const
 The records of the innermost repeat.
void each_name (std::string_view name, std::source_location site=std::source_location::current())
 Name the current record of the innermost repeat, each name.
void as_name (std::string_view name, std::source_location site=std::source_location::current())
 Name the list of the innermost repeat, as name.
void record_as (const Record &record, std::source_location site=std::source_location::current())
 Bind a record from forward_record to the innermost repeat.

Additional Inherited Members

Static Public Attributes inherited from iris::build::Scope< 0, Presence::Required >
static constexpr std::size_t depth
 The scope of a statement nested in this one.
static constexpr Presence presence
 Whether the statements of this scope run in every record.

Detailed Description

A reader spec under construction: the scope of the top level, with the settings that only the top level has.

build() prints the statements and parses the text; source() returns the text. Both report builder checks first.

Constructor & Destructor Documentation

SpecBuilder() [1/2]

iris::build::SpecBuilder::SpecBuilder ( )

A builder without a format statement.

SpecBuilder() [2/2]

iris::build::SpecBuilder::SpecBuilder ( std::string_view format,
std::source_location site = std::source_location::current() )
explicit

A builder that starts with format name.

Member Function Documentation

build()

Spec iris::build::SpecBuilder::build ( ) const
nodiscard

Print and parse the spec.

Throws BuildError for a builder check or a language error.

comment()

void iris::build::SpecBuilder::comment ( const Strings & markers,
std::source_location site = std::source_location::current() )

comment "marker" ...

format()

void iris::build::SpecBuilder::format ( std::string_view name,
std::source_location site = std::source_location::current() )

format name

ignore_trailing()

void iris::build::SpecBuilder::ignore_trailing ( std::source_location site = std::source_location::current())

ignore trailing

instances()

template<class F>
requires std::invocable<F, Scope<0, Presence::Required> &>
std::invoke_result_t< F, Scope< 0, Presence::Required > & > iris::build::SpecBuilder::instances ( F && body,
std::source_location site = std::source_location::current() )
inline

instances { body }; returns the result of the body

separators()

void iris::build::SpecBuilder::separators ( std::string_view characters,
std::source_location site = std::source_location::current() )

separators "characters"

source()

std::string iris::build::SpecBuilder::source ( ) const
nodiscard

Return the text of the spec. Throws BuildError for a builder check.

stop()

void iris::build::SpecBuilder::stop ( const Strings & markers,
std::source_location site = std::source_location::current() )

stop "marker" ...

tokens()

void iris::build::SpecBuilder::tokens ( std::string_view characters,
std::source_location site = std::source_location::current() )

tokens "characters"

try_build()

std::expected< Spec, BuildError > iris::build::SpecBuilder::try_build ( ) const
nodiscard

Print and parse the spec, or return the BuildError.

try_source()

std::expected< std::string, BuildError > iris::build::SpecBuilder::try_source ( ) const
nodiscard

Return the text of the spec, or the BuildError of a builder check.