ERROR type, check of passed type, many expected types in Arguments

This commit is contained in:
ProgramSnail 2024-02-22 18:46:01 +03:00
parent a5fc0c7ee7
commit 005fb6aaf3
7 changed files with 200 additions and 112 deletions

View file

@ -21,6 +21,8 @@ const static std::string OPTIONAL_IDENTIFIER = "Optional";
const static std::string RESULT_IDENTIFIER = "Result";
const static std::string ERROR_IDENTIFIER = "Error";
// -- basic types
const static std::string FLOAT_IDENTIFIER = "Float";
@ -56,6 +58,7 @@ enum class Type {
ARRAY,
OPTIONAL,
RESULT,
ERROR,
// -- basic types
FLOAT,
DOUBLE,
@ -86,6 +89,8 @@ inline std::string to_string(Type type) {
return OPTIONAL_IDENTIFIER;
case Type::RESULT:
return RESULT_IDENTIFIER;
case Type::ERROR:
return ERROR_IDENTIFIER;
// -- basic types
case Type::FLOAT:
return FLOAT_IDENTIFIER;
@ -127,6 +132,7 @@ inline Type to_type(const std::string &str) {
builtin_types[ARRAY_IDENTIFIER] = Type::ARRAY;
builtin_types[OPTIONAL_IDENTIFIER] = Type::OPTIONAL;
builtin_types[RESULT_IDENTIFIER] = Type::RESULT;
builtin_types[ERROR_IDENTIFIER] = Type::ERROR;
// -- basic types
builtin_types[FLOAT_IDENTIFIER] = Type::FLOAT;
@ -172,6 +178,7 @@ inline std::optional<size_t> get_parameters_count(Type type) {
case Type::ARRAY:
case Type::OPTIONAL:
case Type::RESULT:
case Type::ERROR:
return 1;
// -- basic types
case Type::FLOAT: