-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patterns: Added recursion and array size limit pragma
- Loading branch information
Showing
4 changed files
with
62 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,17 @@ namespace hex::pl { | |
if (limit <= 0) | ||
return false; | ||
|
||
this->m_recursionLimit = limit; | ||
this->m_evalDepth = limit; | ||
return true; | ||
}); | ||
|
||
this->m_preprocessor->addPragmaHandler("array_limit", [this](std::string value) { | ||
auto limit = strtol(value.c_str(), nullptr, 0); | ||
|
||
if (limit <= 0) | ||
return false; | ||
|
||
this->m_arrayLimit = limit; | ||
return true; | ||
}); | ||
|
||
|
@@ -69,6 +79,8 @@ namespace hex::pl { | |
this->m_currError.reset(); | ||
this->m_evaluator->getConsole().clear(); | ||
this->m_evaluator->setProvider(provider); | ||
this->m_evalDepth = 32; | ||
this->m_arrayLimit = 0x1000; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
WerWolv
Author
Owner
|
||
|
||
for (auto &node : this->m_currAST) | ||
delete node; | ||
|
@@ -81,7 +93,8 @@ namespace hex::pl { | |
} | ||
|
||
this->m_evaluator->setDefaultEndian(this->m_defaultEndian); | ||
// this->m_evaluator->setRecursionLimit(this->m_recursionLimit); | ||
this->m_evaluator->setEvaluationDepth(this->m_evalDepth); | ||
this->m_evaluator->setArrayLimit(this->m_arrayLimit); | ||
|
||
auto tokens = this->m_lexer->lex(preprocessedCode.value()); | ||
if (!tokens.has_value()) { | ||
|
Would be awesome if you could add a setting for the limit, this change broke a pattern I made.