rego-cpp 0.4.5
A C++ implementation of the Rego language and runtime
|
#include <rego.hh>
Public Member Functions | |
BuiltInsDef () noexcept | |
bool | is_builtin (const Location &name) const |
bool | is_deprecated (const Location &version, const Location &name) const |
Node | call (const Location &name, const Location &version, const Nodes &args) |
void | clear () |
BuiltInsDef & | register_builtin (const BuiltIn &built_in) |
const BuiltIn & | at (const Location &name) const |
bool | strict_errors () const |
BuiltInsDef & | strict_errors (bool strict_errors) |
template<typename T > | |
BuiltInsDef & | register_builtins (const T &built_ins) |
BuiltInsDef & | register_standard_builtins () |
std::map< Location, BuiltIn >::const_iterator | begin () const |
std::map< Location, BuiltIn >::const_iterator | end () const |
Static Public Member Functions | |
static std::shared_ptr< BuiltInsDef > | create () |
Manages the set of builtins used by an interpreter to resolve built-in calls.
|
noexcept |
Constructor.
const BuiltIn & rego::BuiltInsDef::at | ( | const Location & | name | ) | const |
Gets the built-in with the provided name.
Node rego::BuiltInsDef::call | ( | const Location & | name, |
const Location & | version, | ||
const Nodes & | args ) |
Calls the built-in with the provided name and arguments.
name | The name of the built-in to call. |
args | The arguments to pass to the built-in. |
version | The Rego version. |
void rego::BuiltInsDef::clear | ( | ) |
Called to clear any persistent state or caching.
|
static |
Creates the standard builtin set.
bool rego::BuiltInsDef::is_builtin | ( | const Location & | name | ) | const |
Determines whether the provided name refers to a built-in.
name | The name to check. |
bool rego::BuiltInsDef::is_deprecated | ( | const Location & | version, |
const Location & | name ) const |
Determines whether the provided builtin name is deprecated in the provided version.
version | The version to check. |
name | The name to check. |
BuiltInsDef & rego::BuiltInsDef::register_builtin | ( | const BuiltIn & | built_in | ) |
Registers a built-in.
built_in | The built-in to register. |
|
inline |
Registers a set of built-ins.
built_ins | The built-ins to register. |
BuiltInsDef & rego::BuiltInsDef::register_standard_builtins | ( | ) |
This registers the "standard library" of built-ins.
There are a number of built-ins which are provided by default. These built-ins are those documented here.
rego-cpp supports the following built-ins as standard:
bool rego::BuiltInsDef::strict_errors | ( | ) | const |
Whether to throw built-in errors.
If true, built-in errors will be thrown as exceptions. If false, built-in errors will result in Undefined nodes.