SpECTRE  v2024.04.12
Option Parsing

Classes

class  Options::Auto< T, Label >
 A class indicating that a parsed value can be automatically computed instead of specified. More...
 
struct  Options::Context
 Information about the nested operations being performed by the parser, for use in printing errors. A default-constructed Context is printed as an empty string. This struct is primarily used as an argument to PARSE_ERROR for reporting input file parsing errors. Users outside of the core option parsing code should not need to manipulate the contents. More...
 
class  Options::Option
 The type that options are passed around as. Contains YAML node data and an Context. More...
 
struct  Options::create_from_yaml< T >
 Used by the parser to create an object. The default action is to parse options using T::options. This struct may be specialized to change that behavior for specific types. More...
 
class  Options::Parser< OptionList, Group >
 Class that handles parsing an input file. More...
 

Macros

#define PARSE_ERROR(context, m)
 Like ERROR("\n" << (context) << m), but instead throws an exception that will be caught in a higher level Options if not passed a top-level context. This is used to print a parsing "backtrace" since we can't pass any extra data through the yaml-cpp code. More...
 

Detailed Description

Things related to parsing YAML input files.

Macro Definition Documentation

◆ PARSE_ERROR

#define PARSE_ERROR (   context,
 
)
Value:
do { \
if ((context).top_level) { \
/* clang-tidy: macro arg in parentheses */ \
ERROR_NO_TRACE("\n" << (context) << m); /* NOLINT */ \
} else { \
std::ostringstream avoid_name_collisions_PARSE_ERROR; \
/* clang-tidy: macro arg in parentheses */ \
avoid_name_collisions_PARSE_ERROR << (context) << m; /* NOLINT */ \
throw ::Options::detail::propagate_context( \
avoid_name_collisions_PARSE_ERROR.str()); \
} \
} while (false)

Like ERROR("\n" << (context) << m), but instead throws an exception that will be caught in a higher level Options if not passed a top-level context. This is used to print a parsing "backtrace" since we can't pass any extra data through the yaml-cpp code.

Parameters
contextContext used to print a parsing traceback
merror message, as for ERROR