mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09:00
LibWeb: Utilize SourceLocation for CSS/Parser logging
This commit is contained in:
parent
4022d3cb75
commit
46524426fb
Notes:
sideshowbarker
2024-07-18 19:08:25 +09:00
Author: https://github.com/bgianfo
Commit: 46524426fb
Pull-request: https://github.com/SerenityOS/serenity/pull/6623
1 changed files with 11 additions and 13 deletions
|
@ -4,9 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibWeb/CSS/CSSStyleRule.h>
|
||||
#include <AK/SourceLocation.h>
|
||||
#include <LibWeb/CSS/Parser/AtStyleRule.h>
|
||||
#include <LibWeb/CSS/Parser/DeclarationOrAtRule.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
|
@ -18,10 +16,10 @@
|
|||
|
||||
#define CSS_PARSER_TRACE 1
|
||||
|
||||
#define PARSE_ERROR() \
|
||||
do { \
|
||||
dbgln_if(CSS_PARSER_TRACE, "Parse error (CSS) {} @ {}", __PRETTY_FUNCTION__, __LINE__); \
|
||||
} while (0)
|
||||
static void log_parse_error(const SourceLocation& location = SourceLocation::current())
|
||||
{
|
||||
dbgln_if(CSS_PARSER_TRACE, "Parse error (CSS) {}", location);
|
||||
}
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
@ -161,7 +159,7 @@ AtStyleRule Parser::consume_an_at_rule()
|
|||
}
|
||||
|
||||
if (token.is_eof()) {
|
||||
PARSE_ERROR();
|
||||
log_parse_error();
|
||||
return rule;
|
||||
}
|
||||
|
||||
|
@ -191,7 +189,7 @@ Optional<QualifiedStyleRule> Parser::consume_a_qualified_rule()
|
|||
auto token = next_token();
|
||||
|
||||
if (token.is_eof()) {
|
||||
PARSE_ERROR();
|
||||
log_parse_error();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -251,7 +249,7 @@ StyleBlockRule Parser::consume_a_simple_block()
|
|||
}
|
||||
|
||||
if (token.is_eof()) {
|
||||
PARSE_ERROR();
|
||||
log_parse_error();
|
||||
return block;
|
||||
}
|
||||
|
||||
|
@ -278,7 +276,7 @@ StyleFunctionRule Parser::consume_a_function()
|
|||
}
|
||||
|
||||
if (token.is_eof()) {
|
||||
PARSE_ERROR();
|
||||
log_parse_error();
|
||||
return function;
|
||||
}
|
||||
|
||||
|
@ -316,7 +314,7 @@ Optional<StyleDeclarationRule> Parser::consume_a_declaration()
|
|||
auto colon = next_token();
|
||||
|
||||
if (!colon.is_colon()) {
|
||||
PARSE_ERROR();
|
||||
log_parse_error();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -402,7 +400,7 @@ Vector<DeclarationOrAtRule> Parser::consume_a_list_of_declarations()
|
|||
}
|
||||
}
|
||||
|
||||
PARSE_ERROR();
|
||||
log_parse_error();
|
||||
reconsume_current_input_token();
|
||||
auto peek = peek_token();
|
||||
if (!(peek.is_semicolon() || peek.is_eof())) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue