1
0
mirror of synced 2024-12-14 08:42:54 +01:00
ImHex/lib/libimhex/source/pattern_language/log_console.cpp

27 lines
754 B
C++
Raw Normal View History

#include <hex/pattern_language/log_console.hpp>
#include <hex/pattern_language/ast_node.hpp>
namespace hex::pl {
void LogConsole::log(Level level, const std::string &message) {
this->m_consoleLog.emplace_back(level, message);
}
[[noreturn]] void LogConsole::abortEvaluation(const std::string &message) {
throw PatternLanguageError(0, message);
}
[[noreturn]] void LogConsole::abortEvaluation(const std::string &message, const ASTNode *node) {
2022-01-30 15:18:45 +01:00
if (node == nullptr)
abortEvaluation(message);
else
throw PatternLanguageError(node->getLineNumber(), message);
}
void LogConsole::clear() {
this->m_consoleLog.clear();
this->m_lastHardError = {};
}
}