diff options
author | Andreas Kling <kling@serenityos.org> | 2021-04-21 23:02:27 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-21 23:49:02 +0200 |
commit | c68dcf45b661b4bc4a62fd9fa1f4945ba4760801 (patch) | |
tree | c21b949e1d9ee8926ec5a1a0e1f64785c6cc42c9 /Userland/Libraries/LibRegex | |
parent | 46209ee9d0110aa1dd84bbc6534f2cfe2d29ebcb (diff) | |
download | serenity-c68dcf45b661b4bc4a62fd9fa1f4945ba4760801.zip |
LibRegex: Convert String::format() => String::formatted()
Diffstat (limited to 'Userland/Libraries/LibRegex')
-rw-r--r-- | Userland/Libraries/LibRegex/RegexByteCode.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibRegex/RegexByteCode.h | 18 | ||||
-rw-r--r-- | Userland/Libraries/LibRegex/RegexDebug.h | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Libraries/LibRegex/RegexByteCode.cpp b/Userland/Libraries/LibRegex/RegexByteCode.cpp index 00578fb211..a2bd75dc27 100644 --- a/Userland/Libraries/LibRegex/RegexByteCode.cpp +++ b/Userland/Libraries/LibRegex/RegexByteCode.cpp @@ -692,7 +692,7 @@ ALWAYS_INLINE void OpCode_Compare::compare_character_range(const MatchInput& inp const String OpCode_Compare::arguments_string() const { - return String::format("argc=%lu, args=%lu ", arguments_count(), arguments_size()); + return String::formatted("argc={}, args={} ", arguments_count(), arguments_size()); } const Vector<String> OpCode_Compare::variable_arguments_to_string(Optional<MatchInput> input) const diff --git a/Userland/Libraries/LibRegex/RegexByteCode.h b/Userland/Libraries/LibRegex/RegexByteCode.h index 2b1419a003..e2990d80eb 100644 --- a/Userland/Libraries/LibRegex/RegexByteCode.h +++ b/Userland/Libraries/LibRegex/RegexByteCode.h @@ -537,7 +537,7 @@ public: const String to_string() const { - return String::format("[0x%02X] %s", (int)opcode_id(), name(opcode_id())); + return String::formatted("[0x{:02X}] {}", (int)opcode_id(), name(opcode_id())); } virtual const String arguments_string() const = 0; @@ -623,7 +623,7 @@ public: ALWAYS_INLINE ssize_t offset() const { return argument(0); } const String arguments_string() const override { - return String::format("offset=%zd [&%zu]", offset(), state().instruction_position + size() + offset()); + return String::formatted("offset={} [&{}]", offset(), state().instruction_position + size() + offset()); } }; @@ -639,7 +639,7 @@ public: ALWAYS_INLINE ssize_t offset() const { return argument(0); } const String arguments_string() const override { - return String::format("offset=%zd [&%zu], sp: %zu", offset(), state().instruction_position + size() + offset(), state().string_position); + return String::formatted("offset={} [&{}], sp: {}", offset(), state().instruction_position + size() + offset(), state().string_position); } }; @@ -655,7 +655,7 @@ public: ALWAYS_INLINE ssize_t offset() const { return argument(0); } const String arguments_string() const override { - return String::format("offset=%zd [&%zu], sp: %zu", offset(), state().instruction_position + size() + offset(), state().string_position); + return String::formatted("offset={} [&{}], sp: {}", offset(), state().instruction_position + size() + offset(), state().string_position); } }; @@ -694,7 +694,7 @@ public: ALWAYS_INLINE size_t size() const override { return 2; } ALWAYS_INLINE size_t arguments_count() const { return 1; } ALWAYS_INLINE BoundaryCheckType type() const { return static_cast<BoundaryCheckType>(argument(0)); } - const String arguments_string() const override { return String::format("kind=%lu (%s)", (long unsigned int)argument(0), boundary_check_type_name(type())); } + const String arguments_string() const override { return String::formatted("kind={} ({})", (long unsigned int)argument(0), boundary_check_type_name(type())); } }; class OpCode_SaveLeftCaptureGroup final : public OpCode { @@ -707,7 +707,7 @@ public: ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::SaveLeftCaptureGroup; } ALWAYS_INLINE size_t size() const override { return 2; } ALWAYS_INLINE size_t id() const { return argument(0); } - const String arguments_string() const override { return String::format("id=%lu", id()); } + const String arguments_string() const override { return String::formatted("id={}", id()); } }; class OpCode_SaveRightCaptureGroup final : public OpCode { @@ -720,7 +720,7 @@ public: ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::SaveRightCaptureGroup; } ALWAYS_INLINE size_t size() const override { return 2; } ALWAYS_INLINE size_t id() const { return argument(0); } - const String arguments_string() const override { return String::format("id=%lu", id()); } + const String arguments_string() const override { return String::formatted("id={}", id()); } }; class OpCode_SaveLeftNamedCaptureGroup final : public OpCode { @@ -736,7 +736,7 @@ public: ALWAYS_INLINE size_t length() const { return argument(1); } const String arguments_string() const override { - return String::format("name=%s, length=%lu", name().to_string().characters(), length()); + return String::formatted("name={}, length={}", name(), length()); } }; @@ -753,7 +753,7 @@ public: ALWAYS_INLINE size_t length() const { return argument(1); } const String arguments_string() const override { - return String::format("name=%s, length=%zu", name().to_string().characters(), length()); + return String::formatted("name={}, length={}", name(), length()); } }; diff --git a/Userland/Libraries/LibRegex/RegexDebug.h b/Userland/Libraries/LibRegex/RegexDebug.h index b080ad1ab3..19c028b9c7 100644 --- a/Userland/Libraries/LibRegex/RegexDebug.h +++ b/Userland/Libraries/LibRegex/RegexDebug.h @@ -30,7 +30,7 @@ #include "LibRegex/RegexMatcher.h" #include <AK/Debug.h> -#if REGEX_DEBUG +#if !REGEX_DEBUG namespace regex { @@ -87,7 +87,7 @@ public: recursion, opcode.to_string().characters(), opcode.arguments_string().characters(), - String::format("ip: %3lu, sp: %3lu", state.instruction_position, state.string_position).characters(), + String::formatted("ip: {:3}, sp: {:3}", state.instruction_position, state.string_position).characters(), newline ? "\n" : ""); if (newline && is<OpCode_Compare>(opcode)) { |