pattern: Make preprocessor not drop defines after include (#433)
Co-authored-by: Dmitry Polshakov <dmitry.polshakov@dsr-corporation.com>
This commit is contained in:
parent
2f61a91459
commit
24f3b8dd3d
@ -84,7 +84,7 @@ namespace hex::pl {
|
|||||||
preprocessor.m_defines = this->m_defines;
|
preprocessor.m_defines = this->m_defines;
|
||||||
preprocessor.m_onceIncludedFiles = this->m_onceIncludedFiles;
|
preprocessor.m_onceIncludedFiles = this->m_onceIncludedFiles;
|
||||||
|
|
||||||
auto preprocessedInclude = preprocessor.preprocess(file.readString(), true);
|
auto preprocessedInclude = preprocessor.preprocess(file.readString(), /*initialRun =*/false);
|
||||||
|
|
||||||
if (!preprocessedInclude.has_value())
|
if (!preprocessedInclude.has_value())
|
||||||
throw *preprocessor.m_error;
|
throw *preprocessor.m_error;
|
||||||
@ -201,7 +201,6 @@ namespace hex::pl {
|
|||||||
offset += 1;
|
offset += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initialRun) {
|
|
||||||
// Apply defines
|
// Apply defines
|
||||||
std::vector<std::tuple<std::string, std::string, u32>> sortedDefines;
|
std::vector<std::tuple<std::string, std::string, u32>> sortedDefines;
|
||||||
std::copy(this->m_defines.begin(), this->m_defines.end(), std::back_inserter(sortedDefines));
|
std::copy(this->m_defines.begin(), this->m_defines.end(), std::back_inserter(sortedDefines));
|
||||||
@ -225,7 +224,6 @@ namespace hex::pl {
|
|||||||
} else
|
} else
|
||||||
throwPreprocessorError(hex::format("no #pragma handler registered for type {0}", type.c_str()), pragmaLine);
|
throwPreprocessorError(hex::format("no #pragma handler registered for type {0}", type.c_str()), pragmaLine);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (PatternLanguageError &e) {
|
} catch (PatternLanguageError &e) {
|
||||||
this->m_error = e;
|
this->m_error = e;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user