summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-08-18 07:22:52 -0400
committerAndreas Kling <kling@serenityos.org>2021-08-19 23:49:25 +0200
commit02e3633b7fded9f46c8fe642b93ccf6f1ab8fed2 (patch)
tree568bbd8148b34c53ca6cc4182d8eabb4dc138142
parente331656bb9032bc232584e721d7d4e611d2d42ca (diff)
downloadserenity-02e3633b7fded9f46c8fe642b93ccf6f1ab8fed2.zip
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.
-rw-r--r--AK/Format.cpp15
-rw-r--r--AK/Format.h16
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.cpp1
-rw-r--r--Userland/Applications/Mail/MailWidget.cpp1
-rw-r--r--Userland/Libraries/LibCrypto/ASN1/ASN1.cpp1
-rw-r--r--Userland/Libraries/LibRegex/RegexMatcher.h1
-rw-r--r--Userland/Libraries/LibRegex/RegexParser.cpp1
-rw-r--r--Userland/Libraries/LibWeb/CSS/Selector.cpp1
-rw-r--r--Userland/Shell/Parser.cpp1
-rw-r--r--Userland/Shell/Shell.cpp1
-rw-r--r--Userland/Utilities/tr.cpp1
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<size_t>::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 <AK/AllOf.h>
#include <AK/AnyOf.h>
#include <AK/Array.h>
-#include <AK/GenericLexer.h>
#include <AK/Optional.h>
#include <AK/StringView.h>
@@ -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 <AK/GenericLexer.h>
#include <AK/Singleton.h>
#include <AK/StringBuilder.h>
#include <Kernel/Debug.h>
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 <AK/Base64.h>
+#include <AK/GenericLexer.h>
#include <Applications/Mail/MailWindowGML.h>
#include <LibCore/ConfigFile.h>
#include <LibDesktop/Launcher.h>
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 <AK/GenericLexer.h>
#include <LibCrypto/ASN1/ASN1.h>
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 <AK/Forward.h>
+#include <AK/GenericLexer.h>
#include <AK/HashMap.h>
#include <AK/NonnullOwnPtrVector.h>
#include <AK/Types.h>
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 <AK/CharacterTypes.h>
+#include <AK/GenericLexer.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/StringUtils.h>
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 <AK/GenericLexer.h>
#include <AK/StringUtils.h>
#include <ctype.h>
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 <AK/AllOf.h>
+#include <AK/GenericLexer.h>
#include <AK/ScopeGuard.h>
#include <AK/ScopedValueRollback.h>
#include <AK/TemporaryChange.h>
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 <AK/CharacterTypes.h>
#include <AK/Debug.h>
#include <AK/Function.h>
+#include <AK/GenericLexer.h>
#include <AK/LexicalPath.h>
#include <AK/QuickSort.h>
#include <AK/ScopeGuard.h>
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 <AK/GenericLexer.h>
#include <AK/Optional.h>
#include <AK/String.h>
#include <LibCore/ArgsParser.h>