LibGUI: Fix CppLexer assertion on incomplete #include statements
Thanks to @NotKyon for reporting this bug with a solid analysis. Fixes #1488.
This commit is contained in:
parent
a502ba73dc
commit
37af1d74cc
Notes:
sideshowbarker
2024-07-19 07:57:39 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/37af1d74cc3
1 changed files with 5 additions and 5 deletions
|
@ -363,16 +363,16 @@ Vector<CppToken> CppLexer::lex()
|
|||
begin_token();
|
||||
if (peek() == '<' || peek() == '"') {
|
||||
char closing = consume() == '<' ? '>' : '"';
|
||||
while (peek() != closing && peek() != '\n')
|
||||
while (peek() && peek() != closing && peek() != '\n')
|
||||
consume();
|
||||
|
||||
if (consume() == '\n') {
|
||||
if (peek() && consume() == '\n') {
|
||||
commit_token(CppToken::Type::IncludePath);
|
||||
continue;
|
||||
} else {
|
||||
commit_token(CppToken::Type::IncludePath);
|
||||
begin_token();
|
||||
}
|
||||
|
||||
commit_token(CppToken::Type::IncludePath);
|
||||
begin_token();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue