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:
parent
e331656bb9
commit
02e3633b7f
Notes:
sideshowbarker
2024-07-18 05:28:37 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/02e3633b7fd Pull-request: https://github.com/SerenityOS/serenity/pull/9499 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/davidot ✅
11 changed files with 24 additions and 16 deletions
|
@ -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();
|
||||
|
|
16
AK/Format.h
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 {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/GenericLexer.h>
|
||||
#include <LibCrypto/ASN1/ASN1.h>
|
||||
|
||||
namespace Crypto::ASN1 {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "Selector.h"
|
||||
#include <AK/GenericLexer.h>
|
||||
#include <AK/StringUtils.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue