A simple scripting language in C++
Ferenc Szontágh
2025-04-18 fcb28cc03f93a4b00ec181a8492432dfa0e5fa11
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
// SymbolKind.hpp
#ifndef SYMBOL_KIND_HPP
#define SYMBOL_KIND_HPP
 
#include <cstdint>
#include <string>
#include <unordered_map>
 
namespace Symbols {
 
enum class Kind : std::uint8_t {
    Variable,
    Constant,
    Function
    // Later: Module, Class, etc..
};
 
static std::string kindToString(Symbols::Kind kind) {
    std::unordered_map<Symbols::Kind, std::string> KindToString = {
        { Symbols::Kind::Variable, "Variable" },
        { Symbols::Kind::Constant, "Constant" },
        { Symbols::Kind::Function, "Function" },
    };
 
    auto it = KindToString.find(kind);
    if (it != KindToString.end()) {
        return it->second;
    }
    return "Unknown kind: " + std::to_string(static_cast<int>(kind));
}
};  // namespace Symbols
 
#endif