mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +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:
parent
2aa0cbaf22
commit
617c54a00b
Notes:
sideshowbarker
2024-07-18 16:52:41 +09:00
Author: https://github.com/MaxWipfli
Commit: 617c54a00b
Pull-request: https://github.com/SerenityOS/serenity/pull/7768
Issue: https://github.com/SerenityOS/serenity/issues/7349
Reviewed-by: https://github.com/alimpfard
1 changed files with 7 additions and 4 deletions
|
@ -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() == '"') {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue