pattern: Fixed pragma once memory corruption

This commit is contained in:
WerWolv
2022-02-06 15:28:20 +01:00
parent c1b4c4e42a
commit 99f8efac9a
2 changed files with 32 additions and 14 deletions

View File

@@ -22,10 +22,15 @@ namespace hex::pl {
std::optional<std::string> preprocess(const std::string &code, bool initialRun = true);
void addPragmaHandler(const std::string &pragmaType, const std::function<bool(const std::string &)> &function);
void removePragmaHandler(const std::string &pragmaType);
void addDefaultPragmaHandlers();
const std::optional<PatternLanguageError> &getError() { return this->m_error; }
bool shouldOnlyIncludeOnce() {
return this->m_onlyIncludeOnce;
}
private:
[[noreturn]] static void throwPreprocessorError(const std::string &error, u32 lineNumber) {
throw PatternLanguageError(lineNumber, "Preprocessor: " + error);
@@ -39,6 +44,8 @@ namespace hex::pl {
std::set<fs::path> m_onceIncludedFiles;
std::optional<PatternLanguageError> m_error;
bool m_onlyIncludeOnce = false;
};
}