mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibCpp: Correctly parse lines that end in '\'
Such lines should be considered to be joined into the next line. This makes multiline preprocessor stuff "work".
This commit is contained in:
committed by
Andreas Kling
parent
8fefbfd5ac
commit
dc68c765b7
@@ -556,8 +556,16 @@ Vector<Token> Lexer::lex()
|
||||
begin_token();
|
||||
}
|
||||
} else {
|
||||
while (peek() && peek() != '\n')
|
||||
consume();
|
||||
while (peek()) {
|
||||
if (peek() == '\\' && peek(1) == '\n') {
|
||||
consume();
|
||||
consume();
|
||||
} else if (peek() == '\n') {
|
||||
break;
|
||||
} else {
|
||||
consume();
|
||||
}
|
||||
}
|
||||
|
||||
commit_token(Token::Type::PreprocessorStatement);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user