|
| | UnwrapOpt (std::size_t index) |
| | Construct an UnwrapOpt.
|
| |
|
bool | exclude_got () const |
| | Whether the statement indicating what was received instead of the expected type should be excluded.
|
| |
| UnwrapOpt & | exclude_got (bool exclude_got) |
| | Sets whether to exclude the "got" statement in the error message.
|
| |
|
bool | specify_number () const |
| | Whether to specify in the error message which kind of number was received (i.e. integer or floating point)
|
| |
| UnwrapOpt & | specify_number (bool specify_number) |
| | Sets whether to specify in the error message which kind of number was received.
|
| |
|
const std::string & | code () const |
| | The error code for the error message. Default value if omitted is EvalTypeError.
|
| |
| UnwrapOpt & | code (const std::string &value) |
| | Sets the error code for the error message.
|
| |
|
const std::string & | pre () const |
| | The error preamble. If omitted, a default preamble will be constructed from the operation metadata in the form "operand <i> must be <t>".
|
| |
| UnwrapOpt & | pre (const std::string &value) |
| | Sets the error preamble.
|
| |
|
const std::string & | message () const |
| | The full error message. If this is set, no message will be generated and instead this will be returned verbatim.
|
| |
| UnwrapOpt & | message (const std::string &value) |
| | Sets the full error message. If this is set, no message will be generated and instead this will be returned verbatim.
|
| |
| const std::string & | func () const |
| | The name of the function. If provide, will be a prefix on the message as "<func-name>:".
|
| |
| UnwrapOpt & | func (const std::string &value) |
| | Sets the name of the function.
|
| |
| const std::vector< Token > & | types () const |
| | The types to match against. The operand must be one of the provided types or else an error node will be returned.
|
| |
| UnwrapOpt & | types (const std::vector< Token > &value) |
| | Sets the types to match against.
|
| |
| const Token & | type () const |
| | The singular type to match against.
|
| |
| UnwrapOpt & | type (const Token &value) |
| | Sets the singular type to match against.
|
| |
| Node | unwrap (const Nodes &args) const |
| | Unwraps an argument from the provided vector of nodes.
|
| |
Options for unwrapping an argument.
This struct provides options for unwrapping an argument and producing an error message. The act of unwrapping a node is the process of testing whether a node or one of its direct descendents is of one or more types. So, for example, the following nodes:
(int 5)
Node scalar()
Creates a null scalar.
Would all be successfully unwrapped as (int 5) if the type Int was specified. However, if Float was specified, the result would be an error node.