mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-05 01:10:24 +00:00
LibRegex: Put debug mode code block behind a flag
This block should be optimized out anyway, but putting the whole thing behind a flag makes the intent clearer.
This commit is contained in:
committed by
Tim Ledbetter
parent
4c491b8920
commit
1abc91ccc6
Notes:
github-actions[bot]
2025-11-26 14:35:13 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/1abc91ccc62 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6938 Reviewed-by: https://github.com/alimpfard ✅
@@ -178,17 +178,19 @@ RegexResult Matcher<Parser>::match(Vector<RegexStringView> const& views, Optiona
|
||||
for (auto const& view : views)
|
||||
const_cast<RegexStringView&>(view).set_unicode(unicode);
|
||||
|
||||
if (input.regex_options.has_flag_set(AllFlags::Internal_Stateful)) {
|
||||
if (views.size() > 1 && input.start_offset > views.first().length()) {
|
||||
dbgln_if(REGEX_DEBUG, "Started with start={}, goff={}, skip={}", input.start_offset, input.global_offset, lines_to_skip);
|
||||
for (auto const& view : views) {
|
||||
if (input.start_offset < view.length() + 1)
|
||||
break;
|
||||
++lines_to_skip;
|
||||
input.start_offset -= view.length() + 1;
|
||||
input.global_offset += view.length() + 1;
|
||||
if constexpr (REGEX_DEBUG) {
|
||||
if (input.regex_options.has_flag_set(AllFlags::Internal_Stateful)) {
|
||||
if (views.size() > 1 && input.start_offset > views.first().length()) {
|
||||
dbgln("Started with start={}, goff={}, skip={}", input.start_offset, input.global_offset, lines_to_skip);
|
||||
for (auto const& view : views) {
|
||||
if (input.start_offset < view.length() + 1)
|
||||
break;
|
||||
++lines_to_skip;
|
||||
input.start_offset -= view.length() + 1;
|
||||
input.global_offset += view.length() + 1;
|
||||
}
|
||||
dbgln("Ended with start={}, goff={}, skip={}", input.start_offset, input.global_offset, lines_to_skip);
|
||||
}
|
||||
dbgln_if(REGEX_DEBUG, "Ended with start={}, goff={}, skip={}", input.start_offset, input.global_offset, lines_to_skip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user