1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 17:17:42 +00:00

LibCpp: Do not emit empty whitespace token after include statement

If an include statement didn't contain whitespace between the word
"include" and the '<' or '"', the lexer would previous emit an empty
whitespace token. This has been changed now.
This commit is contained in:
Max Wipfli 2021-06-04 21:00:17 +02:00 committed by Ali Mohammad Pur
parent 2aa0cbaf22
commit 617c54a00b

View file

@ -534,10 +534,13 @@ Vector<Token> Lexer::lex()
if (directive == "#include") { if (directive == "#include") {
commit_token(Token::Type::IncludeStatement); commit_token(Token::Type::IncludeStatement);
begin_token(); if (is_ascii_space(peek())) {
while (is_ascii_space(peek())) begin_token();
consume(); do {
commit_token(Token::Type::Whitespace); consume();
} while (is_ascii_space(peek()));
commit_token(Token::Type::Whitespace);
}
begin_token(); begin_token();
if (peek() == '<' || peek() == '"') { if (peek() == '<' || peek() == '"') {