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.
This commit is contained in:
Timothy Flynn 2021-08-18 07:22:52 -04:00 committed by Andreas Kling
parent e331656bb9
commit 02e3633b7f
11 changed files with 24 additions and 16 deletions

View file

@ -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();

View file

@ -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 {

View file

@ -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>

View file

@ -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>

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/GenericLexer.h>
#include <LibCrypto/ASN1/ASN1.h>
namespace Crypto::ASN1 {

View file

@ -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>

View file

@ -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>

View file

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

View file

@ -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>

View file

@ -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>

View file

@ -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>