rego-cpp 0.4.5
A C++ implementation of the Rego language and runtime
Loading...
Searching...
No Matches
rego::BuiltInsDef Class Reference

#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 ()
 
BuiltInsDefregister_builtin (const BuiltIn &built_in)
 
const BuiltInat (const Location &name) const
 
bool strict_errors () const
 
BuiltInsDefstrict_errors (bool strict_errors)
 
template<typename T >
BuiltInsDefregister_builtins (const T &built_ins)
 
BuiltInsDefregister_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< BuiltInsDefcreate ()
 

Detailed Description

Manages the set of builtins used by an interpreter to resolve built-in calls.

Constructor & Destructor Documentation

◆ BuiltInsDef()

rego::BuiltInsDef::BuiltInsDef ( )
noexcept

Constructor.

Member Function Documentation

◆ at()

const BuiltIn & rego::BuiltInsDef::at ( const Location & name) const

Gets the built-in with the provided name.

◆ call()

Node rego::BuiltInsDef::call ( const Location & name,
const Location & version,
const Nodes & args )

Calls the built-in with the provided name and arguments.

Parameters
nameThe name of the built-in to call.
argsThe arguments to pass to the built-in.
versionThe Rego version.
Returns
The result of the built-in call.

◆ clear()

void rego::BuiltInsDef::clear ( )

Called to clear any persistent state or caching.

◆ create()

static std::shared_ptr< BuiltInsDef > rego::BuiltInsDef::create ( )
static

Creates the standard builtin set.

◆ is_builtin()

bool rego::BuiltInsDef::is_builtin ( const Location & name) const

Determines whether the provided name refers to a built-in.

Parameters
nameThe name to check.
Returns
True if the name refers to a built-in, otherwise false.

◆ is_deprecated()

bool rego::BuiltInsDef::is_deprecated ( const Location & version,
const Location & name ) const

Determines whether the provided builtin name is deprecated in the provided version.

Parameters
versionThe version to check.
nameThe name to check.

◆ register_builtin()

BuiltInsDef & rego::BuiltInsDef::register_builtin ( const BuiltIn & built_in)

Registers a built-in.

Parameters
built_inThe built-in to register.

◆ register_builtins()

template<typename T >
BuiltInsDef & rego::BuiltInsDef::register_builtins ( const T & built_ins)
inline

Registers a set of built-ins.

Parameters
built_insThe built-ins to register.

◆ register_standard_builtins()

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:

◆ strict_errors()

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.


The documentation for this class was generated from the following file: