-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handling all conversions inside the code so that it doesn't thro…
…w any warnings
- Loading branch information
Showing
26 changed files
with
278 additions
and
235 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,10 @@ | |
* @file Optimizer.hpp | ||
* @author Alexandre Plateau ([email protected]) | ||
* @brief Optimizes a given ArkScript AST | ||
* @version 0.4 | ||
* @date 2020-10-27 | ||
* @version 1.0 | ||
* @date 2024-07-09 | ||
* | ||
* @copyright Copyright (c) 2020-2021 | ||
* @copyright Copyright (c) 2020-2024 | ||
* | ||
*/ | ||
|
||
|
@@ -32,8 +32,9 @@ namespace Ark::internal | |
/** | ||
* @brief Construct a new Optimizer | ||
* | ||
* @param debug level of debug | ||
*/ | ||
explicit Optimizer(uint16_t options) noexcept; | ||
explicit Optimizer(unsigned debug) noexcept; | ||
|
||
/** | ||
* @brief Send the AST to the optimizer, then run the different optimization strategies on it | ||
|
@@ -51,7 +52,7 @@ namespace Ark::internal | |
|
||
private: | ||
Node m_ast; | ||
uint16_t m_options; | ||
unsigned m_debug; | ||
std::unordered_map<std::string, unsigned> m_sym_appearances; | ||
|
||
/** | ||
|
@@ -74,7 +75,7 @@ namespace Ark::internal | |
* @param node | ||
* @param func | ||
*/ | ||
void runOnGlobalScopeVars(Node& node, const std::function<void(Node&, Node&, int)>& func); | ||
void runOnGlobalScopeVars(Node& node, const std::function<void(Node&, Node&, std::size_t)>& func); | ||
|
||
/** | ||
* @brief Count the occurrences of each symbol in the AST, recursively | ||
|
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 |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* @file Files.hpp | ||
* @author Alexandre Plateau ([email protected]) | ||
* @brief Lots of utilities about the filesystem | ||
* @version 0.2 | ||
* @date 2021-11-25 | ||
* @version 0.3 | ||
* @date 2024-07-09 | ||
* | ||
* @copyright Copyright (c) 2021-2024 | ||
* | ||
|
@@ -62,16 +62,16 @@ namespace Ark::Utils | |
if (!ifs.good()) | ||
return std::vector<uint8_t> {}; | ||
|
||
const std::size_t pos = ifs.tellg(); | ||
const auto pos = ifs.tellg(); | ||
// reserve appropriate number of bytes | ||
std::vector<char> temp(pos); | ||
std::vector<char> temp(static_cast<std::size_t>(pos)); | ||
ifs.seekg(0, std::ios::beg); | ||
ifs.read(&temp[0], pos); | ||
ifs.close(); | ||
|
||
auto bytecode = std::vector<uint8_t>(pos); | ||
auto bytecode = std::vector<uint8_t>(static_cast<std::size_t>(pos)); | ||
// TODO would it be faster to memcpy? | ||
for (std::size_t i = 0; i < pos; ++i) | ||
for (std::size_t i = 0; i < static_cast<std::size_t>(pos); ++i) | ||
bytecode[i] = static_cast<uint8_t>(temp[i]); | ||
return bytecode; | ||
} | ||
|
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 |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* @file Utils.hpp | ||
* @author Alexandre Plateau ([email protected]) | ||
* @brief Lots of utilities about string, filesystem and more | ||
* @version 0.4 | ||
* @date 2020-10-27 | ||
* @version 1.0 | ||
* @date 2024-07-09 | ||
* | ||
* @copyright Copyright (c) 2020-2024 | ||
* | ||
|
@@ -65,9 +65,9 @@ namespace Ark::Utils | |
* | ||
* @param str1 | ||
* @param str2 | ||
* @return int | ||
* @return std::size_t | ||
*/ | ||
int levenshteinDistance(const std::string& str1, const std::string& str2); | ||
std::size_t levenshteinDistance(const std::string& str1, const std::string& str2); | ||
} | ||
|
||
#endif |
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
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
Oops, something went wrong.