mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 17:31:58 -05:00
606963bfa2
Since it was intentionally removed from Format.h to untangle dependencies, this is a new small header that can be included by anyone needing custom format parsing.
28 lines
557 B
C++
28 lines
557 B
C++
/*
|
|
* Copyright (c) 2024, kleines Filmröllchen <filmroellchen@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/GenericLexer.h>
|
|
|
|
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);
|
|
};
|
|
|
|
}
|