LibCpp: Add preprocessor option to ignore unsupported keywords

Under some circumstances we need to ignore unsupported preprocessor
keywords instead of crashing the processing, for example during live
parsing in HackStudio.
This commit is contained in:
Vyacheslav Pukhanov 2021-03-17 21:18:08 +03:00 committed by Andreas Kling
commit 0b5d414eba
Notes: sideshowbarker 2024-07-18 21:15:20 +09:00
2 changed files with 11 additions and 2 deletions

View file

@ -184,8 +184,11 @@ void Preprocessor::handle_preprocessor_line(const StringView& line)
lexer.consume_all();
return;
}
dbgln("Unsupported preprocessor keyword: {}", keyword);
VERIFY_NOT_REACHED();
if (!m_options.ignore_unsupported_keywords) {
dbgln("Unsupported preprocessor keyword: {}", keyword);
VERIFY_NOT_REACHED();
}
}
const String& Preprocessor::processed_text()