From 02e3633b7fded9f46c8fe642b93ccf6f1ab8fed2 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 18 Aug 2021 07:22:52 -0400 Subject: [PATCH] AK: Move FormatParser definition from header to implementation file This is primarily to be able to remove the GenericLexer include out of Format.h as well. A subsequent commit will add AK::Result to GenericLexer, which will cause naming conflicts with other structures named Result. This can be avoided (for now) by preventing nearly every file in the system from implicitly including GenericLexer. Other changes in this commit are to add the GenericLexer include to files where it is missing. --- AK/Format.cpp | 15 +++++++++++++++ AK/Format.h | 16 ---------------- Kernel/FileSystem/VirtualFileSystem.cpp | 1 + Userland/Applications/Mail/MailWidget.cpp | 1 + Userland/Libraries/LibCrypto/ASN1/ASN1.cpp | 1 + Userland/Libraries/LibRegex/RegexMatcher.h | 1 + Userland/Libraries/LibRegex/RegexParser.cpp | 1 + Userland/Libraries/LibWeb/CSS/Selector.cpp | 1 + Userland/Shell/Parser.cpp | 1 + Userland/Shell/Shell.cpp | 1 + Userland/Utilities/tr.cpp | 1 + 11 files changed, 24 insertions(+), 16 deletions(-) diff --git a/AK/Format.cpp b/AK/Format.cpp index a7dc73f4ff..f9316aff38 100644 --- a/AK/Format.cpp +++ b/AK/Format.cpp @@ -26,6 +26,21 @@ namespace AK { +class FormatParser : public GenericLexer { +public: + struct FormatSpecifier { + StringView flags; + size_t index; + }; + + explicit FormatParser(StringView input); + + StringView consume_literal(); + bool consume_number(size_t& value); + bool consume_specifier(FormatSpecifier& specifier); + bool consume_replacement_field(size_t& index); +}; + namespace { static constexpr size_t use_next_index = NumericLimits::max(); diff --git a/AK/Format.h b/AK/Format.h index 8c9f3184d1..e6013e3558 100644 --- a/AK/Format.h +++ b/AK/Format.h @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -121,21 +120,6 @@ struct TypeErasedParameter { void (*formatter)(TypeErasedFormatParams&, FormatBuilder&, FormatParser&, const void* value); }; -class FormatParser : public GenericLexer { -public: - struct FormatSpecifier { - StringView flags; - size_t index; - }; - - explicit FormatParser(StringView input); - - StringView consume_literal(); - bool consume_number(size_t& value); - bool consume_specifier(FormatSpecifier& specifier); - bool consume_replacement_field(size_t& index); -}; - class FormatBuilder { public: enum class Align { diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index 661e7ecbf6..3afe6bb43a 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include diff --git a/Userland/Applications/Mail/MailWidget.cpp b/Userland/Applications/Mail/MailWidget.cpp index 566025c30c..524832e6e5 100644 --- a/Userland/Applications/Mail/MailWidget.cpp +++ b/Userland/Applications/Mail/MailWidget.cpp @@ -6,6 +6,7 @@ #include "MailWidget.h" #include +#include #include #include #include diff --git a/Userland/Libraries/LibCrypto/ASN1/ASN1.cpp b/Userland/Libraries/LibCrypto/ASN1/ASN1.cpp index c7a2c65141..55d02516d0 100644 --- a/Userland/Libraries/LibCrypto/ASN1/ASN1.cpp +++ b/Userland/Libraries/LibCrypto/ASN1/ASN1.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include namespace Crypto::ASN1 { diff --git a/Userland/Libraries/LibRegex/RegexMatcher.h b/Userland/Libraries/LibRegex/RegexMatcher.h index 9b91fcff4d..e66aa8dc5b 100644 --- a/Userland/Libraries/LibRegex/RegexMatcher.h +++ b/Userland/Libraries/LibRegex/RegexMatcher.h @@ -12,6 +12,7 @@ #include "RegexParser.h" #include +#include #include #include #include diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp index 1a6310f375..c36979a097 100644 --- a/Userland/Libraries/LibRegex/RegexParser.cpp +++ b/Userland/Libraries/LibRegex/RegexParser.cpp @@ -8,6 +8,7 @@ #include "RegexParser.h" #include "RegexDebug.h" #include +#include #include #include #include diff --git a/Userland/Libraries/LibWeb/CSS/Selector.cpp b/Userland/Libraries/LibWeb/CSS/Selector.cpp index af669b44b0..a532df7dd9 100644 --- a/Userland/Libraries/LibWeb/CSS/Selector.cpp +++ b/Userland/Libraries/LibWeb/CSS/Selector.cpp @@ -5,6 +5,7 @@ */ #include "Selector.h" +#include #include #include diff --git a/Userland/Shell/Parser.cpp b/Userland/Shell/Parser.cpp index 0f3bd2b5b6..68ff39accf 100644 --- a/Userland/Shell/Parser.cpp +++ b/Userland/Shell/Parser.cpp @@ -7,6 +7,7 @@ #include "Parser.h" #include "Shell.h" #include +#include #include #include #include diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index b16e7fef37..4f7469dd16 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/Userland/Utilities/tr.cpp b/Userland/Utilities/tr.cpp index e9da1461ad..ae695d8003 100644 --- a/Userland/Utilities/tr.cpp +++ b/Userland/Utilities/tr.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include