mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-12 10:40:39 +09:00
LibCpp: Add option in Preprocessor to keep #include's in processed text
This commit is contained in:
parent
14e0011825
commit
0522a4360b
Notes:
sideshowbarker
2024-07-18 17:33:08 +09:00
Author: https://github.com/itamar8910
Commit: 0522a4360b
Pull-request: https://github.com/SerenityOS/serenity/pull/7383
Reviewed-by: https://github.com/gunnarbeutner
2 changed files with 12 additions and 1 deletions
|
@ -22,11 +22,20 @@ const String& Preprocessor::process()
|
|||
{
|
||||
for (; m_line_index < m_lines.size(); ++m_line_index) {
|
||||
auto& line = m_lines[m_line_index];
|
||||
|
||||
bool include_in_processed_text = false;
|
||||
if (line.starts_with("#")) {
|
||||
handle_preprocessor_line(line);
|
||||
auto keyword = handle_preprocessor_line(line);
|
||||
if (m_options.keep_include_statements && keyword == "include")
|
||||
include_in_processed_text = true;
|
||||
} else if (m_state == State::Normal) {
|
||||
include_in_processed_text = true;
|
||||
}
|
||||
|
||||
if (include_in_processed_text) {
|
||||
m_builder.append(line);
|
||||
}
|
||||
|
||||
m_builder.append("\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue