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

LibWeb: Correct parsing invalid list of declarations

We were only discarding at most one token when a declaration is
invalid, when we should discard all until we see a ; or EOF.
This commit is contained in:
Sam Atkins 2021-07-09 20:08:09 +01:00 committed by Andreas Kling
parent c249fbd17c
commit 86994336a7

View file

@ -890,8 +890,10 @@ Vector<DeclarationOrAtRule> Parser::consume_a_list_of_declarations(TokenStream<T
log_parse_error();
tokens.reconsume_current_input_token();
auto peek = tokens.peek_token();
if (!(peek.is(Token::Type::Semicolon) || peek.is(Token::Type::EndOfFile))) {
while (!(peek.is(Token::Type::Semicolon) || peek.is(Token::Type::EndOfFile))) {
dbgln("Discarding token: '{}'", peek.to_debug_string());
(void)consume_a_component_value(tokens);
peek = tokens.peek_token();
}
}