nodes/patterns: Fixed crashes when recursion occurred

This commit is contained in:
WerWolv
2021-03-07 13:20:33 +01:00
parent d4265f16eb
commit 8423f78586
6 changed files with 45 additions and 0 deletions

View File

@@ -33,6 +33,16 @@ namespace hex::lang {
} else
return false;
});
this->m_preprocessor->addPragmaHandler("eval_depth", [this](std::string value) {
auto limit = strtol(value.c_str(), nullptr, 0);
if (limit <= 0)
return false;
this->m_recursionLimit = limit;
return true;
});
this->m_preprocessor->addDefaultPragmaHandlers();
}
@@ -56,6 +66,9 @@ namespace hex::lang {
return { };
}
this->m_evaluator->setDefaultEndian(this->m_defaultEndian);
this->m_evaluator->setRecursionLimit(this->m_recursionLimit);
auto tokens = this->m_lexer->lex(preprocessedCode.value());
if (!tokens.has_value()) {
this->m_currError = this->m_lexer->getError();