mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-29 00:10:02 -05:00
Add enums
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "token.hpp"
|
||||
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace hex::lang {
|
||||
@@ -13,6 +14,7 @@ namespace hex::lang {
|
||||
VariableDecl,
|
||||
TypeDecl,
|
||||
Struct,
|
||||
Enum,
|
||||
Scope,
|
||||
};
|
||||
|
||||
@@ -78,4 +80,19 @@ namespace hex::lang {
|
||||
std::string m_name, m_customTypeName;
|
||||
};
|
||||
|
||||
class ASTNodeEnum : public ASTNode {
|
||||
public:
|
||||
explicit ASTNodeEnum(const Token::TypeToken::Type &type, const std::string &name)
|
||||
: ASTNode(Type::Enum), m_type(type), m_name(name) { }
|
||||
|
||||
const std::string& getName() const { return this->m_name; };
|
||||
|
||||
const Token::TypeToken::Type& getUnderlyingType() const { return this->m_type; }
|
||||
std::vector<std::pair<u64, std::string>>& getValues() { return this->m_values; }
|
||||
private:
|
||||
Token::TypeToken::Type m_type;
|
||||
std::string m_name;
|
||||
std::vector<std::pair<u64, std::string>> m_values;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user