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