6#include <fmt/ostream.h>
20 m_value = std::string();
60 m_type(
ValueType::Dict), m_value(std::make_shared<Dict_t>(std::move(value)))
69 list().emplace_back(value);
74 list().emplace_back(std::move(value));
82 return fmt::format(
"{}", number());
86 return fmt::format(
"\"{}\"",
string());
90 return fmt::format(
"Function@{}", pageAddr());
97 std::string out =
"[";
98 for (
auto it = constList().begin(), it_end = constList().end(); it != it_end; ++it)
101 out +=
"\"" + it->toString(vm) +
"\"";
103 out += it->toString(vm);
104 if (it + 1 != it_end)
111 return closure().toString(vm);
114 return fmt::format(
"{}", fmt::streamed(usertype()));
117 return dict().toString(vm);
132 if (reference() !=
this)
133 return reference()->toString(vm);
137 return fmt::format(
"Instruction@{}", pageAddr());
140 return fmt::format(
"Garbage (expected)");
150 if (A.m_type != B.m_type)
157 return A.dict() == B.dict();
159 return A.m_value == B.m_value;
164 switch (A.valueType())
167 return A.constList().empty();
170 return A.number() == 0.0;
173 return A.string().empty();
176 return std::cmp_equal(A.dict().size(), 0);
Define how dictionaries are handled.
Wrapper object for user-defined functions.
Default value type handled by the virtual machine.
Storage class to hold custom functions.
A class to be use C++ objects in ArkScript.
The ArkScript virtual machine, executing ArkScript bytecode.
Value() noexcept
Construct a new Value object.
void push_back(const Value &value)
Add an element to the list held by the value (if the value type is set to list)
std::string toString(VM &vm, bool show_as_code=false) const noexcept
std::vector< Value > List_t
bool operator==(const Namespace &A, const Namespace &B)
bool operator!(const Value &A) noexcept
@ Garbage
Used to signal a value was used and can/should be collected and removed from the stack.