diff --git a/plugins/libimhex/source/pattern_language/preprocessor.cpp b/plugins/libimhex/source/pattern_language/preprocessor.cpp index d40d29c01..a82cd3515 100644 --- a/plugins/libimhex/source/pattern_language/preprocessor.cpp +++ b/plugins/libimhex/source/pattern_language/preprocessor.cpp @@ -15,6 +15,7 @@ namespace hex::pl { std::optional Preprocessor::preprocess(const std::string& code, bool initialRun) { u32 offset = 0; u32 lineNumber = 1; + bool isInString = false; if (initialRun) { this->m_defines.clear(); @@ -27,6 +28,14 @@ namespace hex::pl { try { bool startOfLine = true; while (offset < code.length()) { + if (offset > 0 && code[offset - 1] != '\\' && code[offset] == '\"') + isInString = !isInString; + else if (isInString) { + output += code[offset]; + offset += 1; + continue; + } + if (code[offset] == '#' && startOfLine) { offset += 1;