2021-10-31 15:06:48 +01:00
|
|
|
#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) {
|
2022-01-24 00:45:46 +01:00
|
|
|
this->m_consoleLog.emplace_back(level, message);
|
2021-10-31 15:06:48 +01:00
|
|
|
}
|
|
|
|
|
2022-01-24 20:53:17 +01:00
|
|
|
[[noreturn]] void LogConsole::abortEvaluation(const std::string &message) {
|
2021-10-31 15:06:48 +01:00
|
|
|
throw EvaluateError(0, message);
|
|
|
|
}
|
|
|
|
|
2022-01-24 20:53:17 +01:00
|
|
|
[[noreturn]] void LogConsole::abortEvaluation(const std::string &message, const ASTNode *node) {
|
|
|
|
throw EvaluateError(static_cast<const ASTNode *>(node)->getLineNumber(), message);
|
2021-10-31 15:06:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void LogConsole::clear() {
|
|
|
|
this->m_consoleLog.clear();
|
2022-01-24 20:53:17 +01:00
|
|
|
this->m_lastHardError = {};
|
2021-10-31 15:06:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|