mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:07:34 +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:
parent
8fefbfd5ac
commit
dc68c765b7
3 changed files with 62 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue