mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:07:46 +00:00
AK+Everywhere: Make GenericLexer::ignore_until() stop before the value
`consume_until(foo)` stops before foo, and so does `ignore_until(Predicate)`, so let's make the other `ignore_until()` overloads consistent with that so they're less confusing.
This commit is contained in:
parent
0511059d60
commit
c06f4ac6f5
5 changed files with 13 additions and 16 deletions
|
@ -72,21 +72,24 @@ static void consume_whitespace(GenericLexer& lexer)
|
|||
lexer.ignore(2);
|
||||
} else {
|
||||
lexer.ignore_until('\n');
|
||||
lexer.ignore();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
for (;;) {
|
||||
if (lexer.consume_specific("//"sv))
|
||||
if (lexer.consume_specific("//"sv)) {
|
||||
ignore_line();
|
||||
else if (lexer.consume_specific("/*"sv))
|
||||
} else if (lexer.consume_specific("/*"sv)) {
|
||||
lexer.ignore_until("*/");
|
||||
else if (lexer.next_is("\\\n"sv))
|
||||
lexer.ignore(2);
|
||||
else if (lexer.is_eof() || !lexer.next_is(isspace))
|
||||
} else if (lexer.next_is("\\\n"sv)) {
|
||||
lexer.ignore(2);
|
||||
} else if (lexer.is_eof() || !lexer.next_is(isspace)) {
|
||||
break;
|
||||
else
|
||||
} else {
|
||||
lexer.ignore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,10 +139,7 @@ Optional<MimeType> MimeType::from_string(StringView string)
|
|||
parameter_value = Fetch::Infrastructure::collect_an_http_quoted_string(lexer, Fetch::Infrastructure::HttpQuotedStringExtractValue::Yes);
|
||||
|
||||
// 2. Collect a sequence of code points that are not U+003B (;) from input, given position.
|
||||
// NOTE: This uses the predicate version as the ignore_until(char) version will also ignore the ';'.
|
||||
lexer.ignore_until([](char ch) {
|
||||
return ch == ';';
|
||||
});
|
||||
lexer.ignore_until(';');
|
||||
}
|
||||
|
||||
// 9. Otherwise:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue