-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathValue.hpp
39 lines (35 loc) · 835 Bytes
/
Value.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
#include <vector>
#include <cstdint>
#include <functional>
#include <variant>
#include <string>
#include "Type.hpp"
namespace GobLang
{
class Machine;
class MemoryNode;
using FunctionValue = std::function<void(Machine *)>;
using Value = std::variant<bool, char, float, int32_t, MemoryNode *, FunctionValue>;
struct MemoryValue
{
Type type;
Value value;
};
/**
* @brief Compare two memory values and validate that both are equal
*
* @param a
* @param b
* @return true
* @return false
*/
bool areEqual(MemoryValue const &a, MemoryValue const &b);
/**
* @brief Create a string representation of a given value
*
* @param val
* @return std::string
*/
std::string valueToString(MemoryValue const &val);
}