Skip to content

iris::build::Scope< D, P > Class Template Reference

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

The scope of a block, at depth D (the number of enclosing repeats) and presence P (whether the statements run in every record). More...

#include <iris/build.hpp>

Public Member Functions

template<class T, TypeLike Ty>
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)).
template<class T, class V>
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))
template<class T, Operand E>
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.
template<class V, std::size_t H, Presence HP, Operand E>
requires std::same_as<ValueOf<E>, V> && (detail::same_depth(detail::depth_in<E, D>, H))
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
template<class T>
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
template<class T, Operand E>
detail::TargetOut< T, ValueOf< E >, detail::param_depth< E, D >, P > param (const T &target, E &&fallback, std::source_location site=std::source_location::current())
 param target = fallback.
template<Operand E>
void check (E &&condition, std::source_location site=std::source_location::current())
 check condition
template<Operand E>
void check (E &&condition, std::string_view message, std::source_location site=std::source_location::current())
 check condition "message"
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
template<Operand E>
void skip_lines (E &&lines, std::source_location site=std::source_location::current())
 skip count lines
template<Operand E>
void index (E &&position, std::source_location site=std::source_location::current())
 index position
template<TypeLike Ty>
requires (type_dims<Ty> == 0)
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
template<Operand C, class F>
requires std::invocable<F, Scope<detail::plus(D, 1), P> &>
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
template<class F>
requires std::invocable<F, Scope<detail::plus(D, 1), P> &>
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
template<class F>
requires std::invocable<F, Scope<detail::plus(D, 1), P> &>
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
template<class F>
requires std::invocable<F, Scope<detail::plus(D, 1), P> &>
std::invoke_result_t< F, Scope< detail::plus(D, 1), P > & > repeat_until (const Strings &terminators, const UntilOptions &options, F &&body, std::source_location site=std::source_location::current())
 repeat until "line" ... store target { body }; returns the result of the body
template<class F>
requires std::invocable<F, Arms<D, P> &>
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
template<class F>
requires std::invocable<F, Arms<D, P> &>
std::invoke_result_t< F, Arms< D, P > & > sections (const SectionsOptions &options, F &&body, std::source_location site=std::source_location::current())
 sections until ... store ... skip other { arms }
template<class F>
requires std::invocable<F, Arms<D, P> &>
std::invoke_result_t< F, Arms< D, P > & > sections (std::initializer_list< SectionsOptions > clauses, F &&body, std::source_location site=std::source_location::current())
 sections with several clauses in order, as in {{.until = "END"}, {.until = "x"}}
template<Operand C, class F>
requires std::invocable<F, Scope<D, Presence::Maybe> &>
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
template<CaptureType Ty>
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.
template<CaptureType Ty>
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.
template<class H>
requires detail::IsField<H>::value
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.

Static Public Attributes

static constexpr std::size_t depth = D
 The scope of a statement nested in this one.
static constexpr Presence presence = P
 Whether the statements of this scope run in every record.

Detailed Description

template<std::size_t D = 0, Presence P = Presence::Required>
class iris::build::Scope< D, P >

The scope of a block, at depth D (the number of enclosing repeats) and presence P (whether the statements run in every record).

The statements of a block go to its scope, which its closure receives. A scope is a handle to its block: a statement written through a scope whose block is not the innermost open one is a builder error. Every statement takes a trailing std::source_location, so that errors name the call.

Template Parameters
Dthe depth, or dynamic_depth
PPresence::Maybe inside a branch or an optional arm

Member Function Documentation

as_name()

template<std::size_t D = 0, Presence P = Presence::Required>
void iris::build::Scope< D, P >::as_name ( std::string_view name,
std::source_location site = std::source_location::current() )
inline

Name the list of the innermost repeat, as name.

capture()

template<std::size_t D = 0, Presence P = Presence::Required>
template<CaptureType Ty>
Field< CaptureValue< Ty >, D, P > iris::build::Scope< D, P >::capture ( std::string_view name,
const Ty & type,
std::source_location site = std::source_location::current() )
inline

A capture for patterns, {name:type}, in the scope of this block.

check() [1/2]

template<std::size_t D = 0, Presence P = Presence::Required>
template<Operand E>
void iris::build::Scope< D, P >::check ( E && condition,
std::source_location site = std::source_location::current() )
inline

check condition

check() [2/2]

template<std::size_t D = 0, Presence P = Presence::Required>
template<Operand E>
void iris::build::Scope< D, P >::check ( E && condition,
std::string_view message,
std::source_location site = std::source_location::current() )
inline

check condition "message"

define_type()

template<std::size_t D = 0, Presence P = Presence::Required>
template<TypeLike Ty>
requires (type_dims<Ty> == 0)
NamedType< TypeValue< Ty > > iris::build::Scope< D, P >::define_type ( std::string_view name,
const Ty & type,
std::source_location site = std::source_location::current() )
inline

type name = type, a named type for declarations and captures

each_name()

template<std::size_t D = 0, Presence P = Presence::Required>
void iris::build::Scope< D, P >::each_name ( std::string_view name,
std::source_location site = std::source_location::current() )
inline

Name the current record of the innermost repeat, each name.

expect()

template<std::size_t D = 0, Presence P = Presence::Required>
void iris::build::Scope< D, P >::expect ( const Strings & words,
std::source_location site = std::source_location::current() )
inline

expect "word" ...

find()

template<std::size_t D = 0, Presence P = Presence::Required>
void iris::build::Scope< D, P >::find ( PatternArg text,
std::source_location site = std::source_location::current() )
inline

forward()

template<std::size_t D = 0, Presence P = Presence::Required>
template<class H>
requires detail::IsField<H>::value
H iris::build::Scope< D, P >::forward ( std::string_view name,
std::source_location site = std::source_location::current() )
inline

A handle of type H for a name that a later statement defines, as in forward<Field<std::int64_t>>("n").

forward_record()

template<std::size_t D = 0, Presence P = Presence::Required>
Record iris::build::Scope< D, P >::forward_record ( std::string_view each,
std::string_view list,
std::source_location site = std::source_location::current() )
inline

A record handle for a repeat that comes later, with the names each and list; record_as in the repeat binds it.

if_()

template<std::size_t D = 0, Presence P = Presence::Required>
template<Operand C, class F>
requires std::invocable<F, Scope<D, Presence::Maybe> &>
If< D, P, std::invoke_result_t< F, Scope< D, Presence::Maybe > & > > iris::build::Scope< D, P >::if_ ( C && condition,
F && body,
std::source_location site = std::source_location::current() )
inline

if condition { body }; else_if, else_ and else_read_if on the result continue it

index()

template<std::size_t D = 0, Presence P = Presence::Required>
template<Operand E>
void iris::build::Scope< D, P >::index ( E && position,
std::source_location site = std::source_location::current() )
inline

index position

let()

template<std::size_t D = 0, Presence P = Presence::Required>
template<class T, Operand E>
detail::TargetOut< T, ValueOf< E >, detail::let_depth< E, D >, P > iris::build::Scope< D, P >::let ( const T & target,
E && value,
std::source_location site = std::source_location::current() )
inline

let target = value.

A scalar expression keeps the depth of the scope; a lookup or a Dynamic value gives dynamic_depth.

line()

template<std::size_t D = 0, Presence P = Presence::Required>
void iris::build::Scope< D, P >::line ( PatternArg text,
std::source_location site = std::source_location::current() )
inline

list()

template<std::size_t D = 0, Presence P = Presence::Required>
template<class T, class V>
detail::TargetOut< T, V, detail::plus(D, 1), P > iris::build::Scope< D, P >::list ( const T & target,
const ListReading< V > & reading,
std::source_location site = std::source_location::current() )
inline

list target: type until end, as in list("x", int_.until(0))

optional_capture()

template<std::size_t D = 0, Presence P = Presence::Required>
template<CaptureType Ty>
Field< CaptureValue< Ty >, D, Presence::Maybe > iris::build::Scope< D, P >::optional_capture ( std::string_view name,
const Ty & type,
std::source_location site = std::source_location::current() )
inline

A capture for patterns whose entry may be undefined.

param() [1/2]

template<std::size_t D = 0, Presence P = Presence::Required>
template<class T, Operand E>
detail::TargetOut< T, ValueOf< E >, detail::param_depth< E, D >, P > iris::build::Scope< D, P >::param ( const T & target,
E && fallback,
std::source_location site = std::source_location::current() )
inline

param target = fallback.

A scalar default, including a handle of depth 0 outside every repeat, keeps the depth of the scope; any other default gives dynamic_depth, since a caller's value replaces it with a scalar.

param() [2/2]

template<std::size_t D = 0, Presence P = Presence::Required>
template<class T>
detail::TargetOut< T, Dynamic, dynamic_depth, P > iris::build::Scope< D, P >::param ( const T & target,
std::source_location site = std::source_location::current() )
inline

param target, a parameter without a default

read()

template<std::size_t D = 0, Presence P = Presence::Required>
template<class T, TypeLike Ty>
detail::TargetOut< T, TypeValue< Ty >, detail::plus(D, type_dims< Ty >), P > iris::build::Scope< D, P >::read ( const T & target,
const Ty & type,
std::source_location site = std::source_location::current() )
inline

target: type, a declaration, as in read("n", int_) or read("x", int_.dim(n)).

A name gives a typed handle, a handle redefines its name and gives a DynField, and discard gives nothing.

record()

template<std::size_t D = 0, Presence P = Presence::Required>
Record iris::build::Scope< D, P >::record ( ) const
inlinenodiscard

The records of the innermost repeat.

record_as()

template<std::size_t D = 0, Presence P = Presence::Required>
void iris::build::Scope< D, P >::record_as ( const Record & record,
std::source_location site = std::source_location::current() )
inline

Bind a record from forward_record to the innermost repeat.

repeat()

template<std::size_t D = 0, Presence P = Presence::Required>
template<Operand C, class F>
requires std::invocable<F, Scope<detail::plus(D, 1), P> &>
std::invoke_result_t< F, Scope< detail::plus(D, 1), P > & > iris::build::Scope< D, P >::repeat ( C && times,
F && body,
std::source_location site = std::source_location::current() )
inline

repeat count { body }; returns the result of the body

repeat_until() [1/2]

template<std::size_t D = 0, Presence P = Presence::Required>
template<class F>
requires std::invocable<F, Scope<detail::plus(D, 1), P> &>
std::invoke_result_t< F, Scope< detail::plus(D, 1), P > & > iris::build::Scope< D, P >::repeat_until ( const Strings & terminators,
const UntilOptions & options,
F && body,
std::source_location site = std::source_location::current() )
inline

repeat until "line" ... store target { body }; returns the result of the body

repeat_until() [2/2]

template<std::size_t D = 0, Presence P = Presence::Required>
template<class F>
requires std::invocable<F, Scope<detail::plus(D, 1), P> &>
std::invoke_result_t< F, Scope< detail::plus(D, 1), P > & > iris::build::Scope< D, P >::repeat_until ( const Strings & terminators,
F && body,
std::source_location site = std::source_location::current() )
inline

repeat until "line" ... { body }; returns the result of the body

repeat_until_eof()

template<std::size_t D = 0, Presence P = Presence::Required>
template<class F>
requires std::invocable<F, Scope<detail::plus(D, 1), P> &>
std::invoke_result_t< F, Scope< detail::plus(D, 1), P > & > iris::build::Scope< D, P >::repeat_until_eof ( F && body,
std::source_location site = std::source_location::current() )
inline

repeat until eof { body }; returns the result of the body

sections() [1/3]

template<std::size_t D = 0, Presence P = Presence::Required>
template<class F>
requires std::invocable<F, Arms<D, P> &>
std::invoke_result_t< F, Arms< D, P > & > iris::build::Scope< D, P >::sections ( const SectionsOptions & options,
F && body,
std::source_location site = std::source_location::current() )
inline

sections until ... store ... skip other { arms }

sections() [2/3]

template<std::size_t D = 0, Presence P = Presence::Required>
template<class F>
requires std::invocable<F, Arms<D, P> &>
std::invoke_result_t< F, Arms< D, P > & > iris::build::Scope< D, P >::sections ( F && body,
std::source_location site = std::source_location::current() )
inline

sections { arms }; returns the result of the body, which receives the Arms

sections() [3/3]

template<std::size_t D = 0, Presence P = Presence::Required>
template<class F>
requires std::invocable<F, Arms<D, P> &>
std::invoke_result_t< F, Arms< D, P > & > iris::build::Scope< D, P >::sections ( std::initializer_list< SectionsOptions > clauses,
F && body,
std::source_location site = std::source_location::current() )
inline

sections with several clauses in order, as in {{.until = "END"}, {.until = "x"}}

set()

template<std::size_t D = 0, Presence P = Presence::Required>
template<class V, std::size_t H, Presence HP, Operand E>
requires std::same_as<ValueOf<E>, V> && (detail::same_depth(detail::depth_in<E, D>, H))
void iris::build::Scope< D, P >::set ( const Field< V, H, HP > & handle,
E && value,
std::source_location site = std::source_location::current() )
inline

let handle = value, keeping the handle's type and depth: the value must have both

skip_line()

template<std::size_t D = 0, Presence P = Presence::Required>
void iris::build::Scope< D, P >::skip_line ( std::source_location site = std::source_location::current())
inline

skip line

skip_lines()

template<std::size_t D = 0, Presence P = Presence::Required>
template<Operand E>
void iris::build::Scope< D, P >::skip_lines ( E && lines,
std::source_location site = std::source_location::current() )
inline

skip count lines

undefined()

template<std::size_t D = 0, Presence P = Presence::Required>
DynField iris::build::Scope< D, P >::undefined ( std::string_view name,
std::source_location site = std::source_location::current() )
inline

A handle for a name that nothing defines, for defined(x).

Member Data Documentation

depth

template<std::size_t D = 0, Presence P = Presence::Required>
std::size_t iris::build::Scope< D, P >::depth = D
staticconstexpr

The scope of a statement nested in this one.

presence

template<std::size_t D = 0, Presence P = Presence::Required>
Presence iris::build::Scope< D, P >::presence = P
staticconstexpr

Whether the statements of this scope run in every record.