ArkScript
A small, fast, functional and scripting language for video games
ValTableElem.hpp
Go to the documentation of this file.
1/**
2 * @file ValTableElem.hpp
3 * @author Alexandre Plateau ([email protected])
4 * @brief The basic value type handled by the compiler
5 * @date 2020-10-27
6 *
7 * @copyright Copyright (c) 2020-2025
8 *
9 */
10
11#ifndef ARK_COMPILER_VALTABLEELEM_HPP
12#define ARK_COMPILER_VALTABLEELEM_HPP
13
14#include <variant>
15#include <string>
16
18
19namespace Ark::internal
20{
21 /**
22 * @brief Enumeration to keep track of the type of a Compiler Value
23 *
24 */
26 {
27 Number,
28 String,
29 PageAddr // for function definitions
30 };
31
32 /**
33 * @brief A Compiler Value class helper to handle multiple types
34 *
35 */
37 {
38 std::variant<double, std::string, std::size_t> value;
40
41 // automatic handling (Number/String/Function)
42 explicit ValTableElem(const Node& node) noexcept;
43 // Functions
44 explicit ValTableElem(std::size_t page) noexcept;
45
46 bool operator==(const ValTableElem& A) const noexcept;
47 };
48}
49
50#endif
AST node used by the parser, optimizer and compiler.
A node of an Abstract Syntax Tree for ArkScript.
Definition Node.hpp:30
ValTableElemType
Enumeration to keep track of the type of a Compiler Value.
A Compiler Value class helper to handle multiple types.
std::variant< double, std::string, std::size_t > value
bool operator==(const ValTableElem &A) const noexcept
ValTableElem(const Node &node) noexcept