![]() |
ArkScript
A small, fast, functional and scripting language for video games
|
Namespaces | |
namespace | details |
Classes | |
struct | Contract |
A contract is a list of typed arguments that a function can follow. More... | |
class | TypeCheckingError |
struct | Typedef |
A type definition within a contract. More... | |
Functions | |
template<typename... Ts, typename = details::AllSame<ValueType, Ts...>> | |
bool | check (const std::vector< Value > &args, Ts... types) |
Helper to see if a builtin has been given a wanted set of types. | |
ARK_API void | generateError (const std::string_view &funcname, const std::vector< Contract > &contracts, const std::vector< Value > &args, std::ostream &os=std::cout, bool colorize=true) |
Generate an error message based on a given set of types contracts provided argument list. | |
std::string | typeListToString (const std::vector< ValueType > &types) |
void | displayContract (const Contract &contract, const std::vector< Value > &args, std::ostream &os, const bool colorize) |
|
nodiscard |
Helper to see if a builtin has been given a wanted set of types.
Ts | Variadic argument list composed of ValueTypes |
args | arguments passed to the function |
types | accepted types |
Definition at line 54 of file TypeChecker.hpp.
References Ark::types::details::checkN().
void Ark::types::displayContract | ( | const Contract & | contract, |
const std::vector< Value > & | args, | ||
std::ostream & | os, | ||
const bool | colorize ) |
Definition at line 28 of file TypeChecker.cpp.
References Ark::Any, Ark::types::Contract::arguments, typeListToString(), Ark::types::Typedef::types, Ark::types_to_str, and Ark::types::Typedef::variadic.
Referenced by generateError().
void Ark::types::generateError | ( | const std::string_view & | funcname, |
const std::vector< Contract > & | contracts, | ||
const std::vector< Value > & | args, | ||
std::ostream & | os = std::cout, | ||
bool | colorize = true ) |
Generate an error message based on a given set of types contracts provided argument list.
funcname | ArkScript name of the function |
contracts | types contracts the function can follow |
args | provided argument list |
os | output stream, default to cout |
colorize | enable output colorizing |
Definition at line 110 of file TypeChecker.cpp.
References displayContract(), Ark::Undefined, and Ark::Value::valueType().
Referenced by Ark::types::TypeCheckingError::details().
std::string Ark::types::typeListToString | ( | const std::vector< ValueType > & | types | ) |
Definition at line 12 of file TypeChecker.cpp.
References Ark::Any, and Ark::types_to_str.
Referenced by displayContract().