pattern: Fixed many code inconsistencies and bugs

This commit is contained in:
WerWolv
2022-01-31 14:37:12 +01:00
parent 8f8f3c5415
commit 61fc479c79
22 changed files with 303 additions and 246 deletions

View File

@@ -10,8 +10,6 @@
#include <hex/pattern_language/validator.hpp>
#include <hex/pattern_language/evaluator.hpp>
#include <unistd.h>
namespace hex::pl {
class PatternData;
@@ -113,6 +111,15 @@ namespace hex::pl {
return std::nullopt;
}
if (!this->m_validator->validate(*ast)) {
this->m_currError = this->m_validator->getError();
for (auto &node : *ast)
delete node;
return std::nullopt;
}
return ast;
}
@@ -172,7 +179,7 @@ namespace hex::pl {
return this->m_evaluator->getConsole().getLog();
}
const std::optional<std::pair<u32, std::string>> &PatternLanguage::getError() {
const std::optional<PatternLanguageError> &PatternLanguage::getError() {
return this->m_currError;
}