Skip to content

Commit 02e3633

Browse files
trflynn89awesomekling
authored andcommitted
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.
1 parent e331656 commit 02e3633

File tree

11 files changed

+24
-16
lines changed

11 files changed

+24
-16
lines changed

AK/Format.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@
2626

2727
namespace AK {
2828

29+
class FormatParser : public GenericLexer {
30+
public:
31+
struct FormatSpecifier {
32+
StringView flags;
33+
size_t index;
34+
};
35+
36+
explicit FormatParser(StringView input);
37+
38+
StringView consume_literal();
39+
bool consume_number(size_t& value);
40+
bool consume_specifier(FormatSpecifier& specifier);
41+
bool consume_replacement_field(size_t& index);
42+
};
43+
2944
namespace {
3045

3146
static constexpr size_t use_next_index = NumericLimits<size_t>::max();

AK/Format.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <AK/AllOf.h>
1212
#include <AK/AnyOf.h>
1313
#include <AK/Array.h>
14-
#include <AK/GenericLexer.h>
1514
#include <AK/Optional.h>
1615
#include <AK/StringView.h>
1716

@@ -121,21 +120,6 @@ struct TypeErasedParameter {
121120
void (*formatter)(TypeErasedFormatParams&, FormatBuilder&, FormatParser&, const void* value);
122121
};
123122

124-
class FormatParser : public GenericLexer {
125-
public:
126-
struct FormatSpecifier {
127-
StringView flags;
128-
size_t index;
129-
};
130-
131-
explicit FormatParser(StringView input);
132-
133-
StringView consume_literal();
134-
bool consume_number(size_t& value);
135-
bool consume_specifier(FormatSpecifier& specifier);
136-
bool consume_replacement_field(size_t& index);
137-
};
138-
139123
class FormatBuilder {
140124
public:
141125
enum class Align {

Kernel/FileSystem/VirtualFileSystem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: BSD-2-Clause
55
*/
66

7+
#include <AK/GenericLexer.h>
78
#include <AK/Singleton.h>
89
#include <AK/StringBuilder.h>
910
#include <Kernel/Debug.h>

Userland/Applications/Mail/MailWidget.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "MailWidget.h"
88
#include <AK/Base64.h>
9+
#include <AK/GenericLexer.h>
910
#include <Applications/Mail/MailWindowGML.h>
1011
#include <LibCore/ConfigFile.h>
1112
#include <LibDesktop/Launcher.h>

Userland/Libraries/LibCrypto/ASN1/ASN1.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: BSD-2-Clause
55
*/
66

7+
#include <AK/GenericLexer.h>
78
#include <LibCrypto/ASN1/ASN1.h>
89

910
namespace Crypto::ASN1 {

Userland/Libraries/LibRegex/RegexMatcher.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "RegexParser.h"
1313

1414
#include <AK/Forward.h>
15+
#include <AK/GenericLexer.h>
1516
#include <AK/HashMap.h>
1617
#include <AK/NonnullOwnPtrVector.h>
1718
#include <AK/Types.h>

Userland/Libraries/LibRegex/RegexParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "RegexParser.h"
99
#include "RegexDebug.h"
1010
#include <AK/CharacterTypes.h>
11+
#include <AK/GenericLexer.h>
1112
#include <AK/String.h>
1213
#include <AK/StringBuilder.h>
1314
#include <AK/StringUtils.h>

Userland/Libraries/LibWeb/CSS/Selector.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include "Selector.h"
8+
#include <AK/GenericLexer.h>
89
#include <AK/StringUtils.h>
910
#include <ctype.h>
1011

Userland/Shell/Parser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "Parser.h"
88
#include "Shell.h"
99
#include <AK/AllOf.h>
10+
#include <AK/GenericLexer.h>
1011
#include <AK/ScopeGuard.h>
1112
#include <AK/ScopedValueRollback.h>
1213
#include <AK/TemporaryChange.h>

Userland/Shell/Shell.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <AK/CharacterTypes.h>
1111
#include <AK/Debug.h>
1212
#include <AK/Function.h>
13+
#include <AK/GenericLexer.h>
1314
#include <AK/LexicalPath.h>
1415
#include <AK/QuickSort.h>
1516
#include <AK/ScopeGuard.h>

0 commit comments

Comments
 (0)