1
0
mirror of synced 2024-11-27 17:10:51 +01:00
ImHex/lib/libimhex/include/hex/pattern_language/validator.hpp
WerWolv 66d1b3fd2f
patterns: Huge refactor of Pattern Language runtime to use smart pointers (#458)
* patterns: Initial work to refactor pattern language to use smart pointers

* patterns: Fixed remaining issues, moved patterns to unique files

* sys: Added missing includes for macOS
2022-02-27 23:25:39 +01:00

32 lines
680 B
C++

#pragma once
#include <hex.hpp>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include <hex/pattern_language/error.hpp>
namespace hex::pl {
class ASTNode;
class Validator {
public:
Validator() = default;
bool validate(const std::vector<std::shared_ptr<ASTNode>> &ast);
const std::optional<PatternLanguageError> &getError() { return this->m_error; }
private:
std::optional<PatternLanguageError> m_error;
[[noreturn]] static void throwValidatorError(const std::string &error, u32 lineNumber) {
throw PatternLanguageError(lineNumber, "Validator: " + error);
}
};
}