mirror of
https://github.com/jorenchik/mdemory.git
synced 2026-03-22 00:26:21 +00:00
changes in code after tests on windows
This commit is contained in:
@@ -108,6 +108,24 @@ Result<ParseInfo> transpile(std::string fileContent) {
|
||||
start = std::chrono::high_resolution_clock::now();
|
||||
end = std::chrono::high_resolution_clock::now();
|
||||
|
||||
// Apstrādā jaunas rindas simbolus gan DOS,
|
||||
// gan UNIX formātā vienādi.
|
||||
std::string normalized;
|
||||
for (int i = 0; i < fileContent.size(); ++i) {
|
||||
if (fileContent[i] == '\r') {
|
||||
if (
|
||||
i + 1 < fileContent.size() &&
|
||||
fileContent[i + 1] == '\n'
|
||||
) {
|
||||
++i;
|
||||
}
|
||||
normalized.push_back('\n');
|
||||
} else {
|
||||
normalized.push_back(fileContent[i]);
|
||||
}
|
||||
}
|
||||
fileContent = normalized;
|
||||
|
||||
auto lexRes = tokenizeMdem(fileContent);
|
||||
auto tokens = lexRes.value;
|
||||
if (lexRes.error.length() > 0) {
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
#include "config.h"
|
||||
#include "result.h"
|
||||
|
||||
// Uz Windows sistēmās timegm funkcijai ir atšķirīgs nosaukums.
|
||||
#ifdef _WIN32
|
||||
#define timegm _mkgmtime
|
||||
#endif
|
||||
|
||||
std::vector<Token> tokens;
|
||||
std::vector<char> buffer;
|
||||
int32_t row;
|
||||
|
||||
Reference in New Issue
Block a user