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
This commit is contained in:
WerWolv
2022-02-27 23:25:39 +01:00
committed by GitHub
parent b28eaf2dbf
commit 66d1b3fd2f
85 changed files with 4990 additions and 5146 deletions

View File

@@ -8,6 +8,8 @@
#include <utility>
#include <vector>
#include <hex/helpers/concepts.hpp>
#include <hex/pattern_language/error.hpp>
namespace hex::pl {
@@ -26,11 +28,25 @@ namespace hex::pl {
[[nodiscard]] const auto &getLog() const { return this->m_consoleLog; }
void log(Level level, const std::string &message);
void log(Level level, const std::string &message) {
this->m_consoleLog.emplace_back(level, message);
}
[[noreturn]] static void abortEvaluation(const std::string &message, const ASTNode *node = nullptr);
[[noreturn]] static void abortEvaluation(const std::string &message) {
abortEvaluation(message, nullptr);
}
void clear();
template<typename T = ASTNode>
[[noreturn]] static void abortEvaluation(const std::string &message, const std::unique_ptr<T> &node) {
abortEvaluation(message, node.get());
}
[[noreturn]] static void abortEvaluation(const std::string &message, const ASTNode *node);
void clear() {
this->m_consoleLog.clear();
this->m_lastHardError.reset();
}
void setHardError(const PatternLanguageError &error) { this->m_lastHardError = error; }