1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 16:57:36 +00:00

Everywhere: Replace a bundle of dbg with dbgln.

These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
This commit is contained in:
asynts 2021-01-17 16:06:30 +01:00 committed by Andreas Kling
parent 6dc2c38fd0
commit 5c5665c1e7
8 changed files with 86 additions and 82 deletions

View file

@ -27,6 +27,7 @@
#include "RegexByteCode.h"
#include "AK/StringBuilder.h"
#include "RegexDebug.h"
#include <AK/Debug.h>
#include <ctype.h>
@ -369,10 +370,10 @@ ALWAYS_INLINE ExecutionResult OpCode_SaveRightNamedCaptureGroup::execute(const M
auto& map = output.named_capture_group_matches.at(input.match_index);
#ifdef REGEX_DEBUG
ASSERT(start_position + length <= input.view.length());
dbg() << "Save named capture group with name=" << capture_group_name << " and content: " << input.view.substring_view(start_position, length).to_string();
#endif
if constexpr (debug_regex) {
ASSERT(start_position + length <= input.view.length());
dbgln("Save named capture group with name={} and content='{}'", capture_group_name, input.view.substring_view(start_position, length));
}
ASSERT(start_position + length <= input.view.length());
auto view = input.view.substring_view(start_position, length);

View file

@ -289,3 +289,11 @@ struct MatchOutput {
}
using regex::RegexStringView;
template<>
struct AK::Formatter<regex::RegexStringView> : Formatter<StringView> {
void format(FormatBuilder& builder, const regex::RegexStringView& value)
{
return Formatter<StringView>::format(builder, { value.characters_without_null_termination(), value.length() });
}
};

View file

@ -27,6 +27,7 @@
#include "RegexMatcher.h"
#include "RegexDebug.h"
#include "RegexParser.h"
#include <AK/Debug.h>
#include <AK/ScopedValueRollback.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
@ -147,9 +148,7 @@ RegexResult Matcher<Parser>::match(const Vector<RegexStringView> views, Optional
for (auto& view : views) {
input.view = view;
#ifdef REGEX_DEBUG
dbg() << "[match] Starting match with view (" << view.length() << "): _" << view.to_string() << "_";
#endif
dbgln<debug_regex>("[match] Starting match with view ({}): _{}_", view.length(), view);
auto view_length = view.length();
size_t view_index = m_pattern.start_offset;
@ -215,10 +214,11 @@ RegexResult Matcher<Parser>::match(const Vector<RegexStringView> views, Optional
continue;
}
#ifdef REGEX_DEBUG
dbg() << "state.string_position: " << state.string_position << " view_index: " << view_index;
dbg() << "[match] Found a match (length = " << state.string_position - view_index << "): " << input.view.substring_view(view_index, state.string_position - view_index).to_string();
#endif
if constexpr (debug_regex) {
dbgln("state.string_position={}, view_index={}", state.string_position, view_index);
dbgln("[match] Found a match (length={}): '{}'", state.string_position - view_index, input.view.substring_view(view_index, state.string_position - view_index));
}
++match_count;
if (continue_search) {