Browse Source

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.
Timothy Flynn 3 years ago
parent
commit
02e3633b7f

+ 15 - 0
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();

+ 0 - 16
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 {

+ 1 - 0
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>

+ 1 - 0
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>

+ 1 - 0
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 {

+ 1 - 0
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>

+ 1 - 0
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>

+ 1 - 0
Userland/Libraries/LibWeb/CSS/Selector.cpp

@@ -5,6 +5,7 @@
  */
 
 #include "Selector.h"
+#include <AK/GenericLexer.h>
 #include <AK/StringUtils.h>
 #include <ctype.h>
 

+ 1 - 0
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>

+ 1 - 0
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>

+ 1 - 0
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>