#pragma once #include #include "providers/provider.hpp" #include "lang/pattern_data.hpp" #include "ast_node.hpp" #include #include #include #include namespace hex::lang { class Evaluator { public: Evaluator(prv::Provider* &provider, std::endian dataEndianess); std::pair> evaluate(const std::vector& ast); const std::pair& getError() { return this->m_error; } private: std::unordered_map m_types; prv::Provider* &m_provider; std::endian m_dataEndianess; std::pair m_error; std::pair createStructPattern(ASTNodeVariableDecl *varDeclNode, u64 offset); std::pair createUnionPattern(ASTNodeVariableDecl *varDeclNode, u64 offset); std::pair createEnumPattern(ASTNodeVariableDecl *varDeclNode, u64 offset); std::pair createBitfieldPattern(ASTNodeVariableDecl *varDeclNode, u64 offset); std::pair createArrayPattern(ASTNodeVariableDecl *varDeclNode, u64 offset); std::pair createStringPattern(ASTNodeVariableDecl *varDeclNode, u64 offset); std::pair createCustomTypePattern(ASTNodeVariableDecl *varDeclNode, u64 offset); std::pair createBuiltInTypePattern(ASTNodeVariableDecl *varDeclNode, u64 offset); }; }