6#include <fmt/ostream.h>
20 m_value = std::string();
64 m_type(
ValueType::Dict), m_value(std::make_shared<Dict_t>(std::move(value)))
73 list().emplace_back(value);
78 list().emplace_back(std::move(value));
86 return fmt::format(
"{}", number());
90 return fmt::format(
"\"{}\"",
string());
94 return fmt::format(
"Function@{}", pageAddr());
101 std::string out =
"[";
102 for (
auto it = constList().begin(), it_end = constList().end(); it != it_end; ++it)
105 out +=
"\"" + it->toString(vm) +
"\"";
107 out += it->toString(vm);
108 if (it + 1 != it_end)
115 return closure().toString(vm);
118 return fmt::format(
"{}", fmt::streamed(usertype()));
121 return dict().toString(vm);
136 if (reference() !=
this)
137 return reference()->toString(vm);
141 return fmt::format(
"Instruction@{}", pageAddr());
144 return fmt::format(
"Garbage (expected)");
154 if (A.m_type != B.m_type)
161 return A.dict() == B.dict();
163 return A.m_value == B.m_value;
168 switch (A.valueType())
171 return A.constList().empty();
174 return A.number() == 0.0;
177 return A.string().empty();
180 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.