diff --git a/src/util/format/formatter.h b/src/util/format/formatter.h index 6664a09..b6a84db 100644 --- a/src/util/format/formatter.h +++ b/src/util/format/formatter.h @@ -67,16 +67,16 @@ struct Formatter { constexpr void parse(Parser& parser) { if (std::is_integral_v) { - parser.parseSpecifier(specifier, Parser::SpecifierType::Integral); + parser.parseSpecifier(specifier, Parser::ParameterType::Integral); } else if (std::is_floating_point_v) { - parser.parseSpecifier(specifier, Parser::SpecifierType::FloatingPoint); + parser.parseSpecifier(specifier, Parser::ParameterType::FloatingPoint); } else if (std::is_same_v) { - parser.parseSpecifier(specifier, Parser::SpecifierType::Char); + parser.parseSpecifier(specifier, Parser::ParameterType::Char); } else if (std::is_same_v) { - parser.parseSpecifier(specifier, Parser::SpecifierType::String); + parser.parseSpecifier(specifier, Parser::ParameterType::String); } } @@ -143,7 +143,7 @@ struct Formatter { constexpr void parse(Parser& parser) { - parser.parseSpecifier(specifier, Parser::SpecifierType::Pointer); + parser.parseSpecifier(specifier, Parser::ParameterType::Pointer); } void format(Builder& builder, T* value) const diff --git a/src/util/format/parser.cpp b/src/util/format/parser.cpp index 33b68fb..6f69482 100644 --- a/src/util/format/parser.cpp +++ b/src/util/format/parser.cpp @@ -158,7 +158,7 @@ std::optional Parser::consumeIndex() VERIFY_NOT_REACHED(); } -void Parser::parseSpecifier(Specifier& specifier, SpecifierType type) +void Parser::parseSpecifier(Specifier& specifier, ParameterType type) { if (consumeSpecific('}') || isEOF()) { return; @@ -204,7 +204,7 @@ void Parser::parseSpecifier(Specifier& specifier, SpecifierType type) // Sign is only valid for numeric types if (peek0 == '+' || peek0 == '-' || peek0 == ' ') { VERIFY(state < State::AfterSign, "unexpected '%c' at this position", peek0); - VERIFY(type == SpecifierType::Integral || type == SpecifierType::FloatingPoint, + VERIFY(type == ParameterType::Integral || type == ParameterType::FloatingPoint, "sign option is only valid for numeric types"); state = State::AfterSign; specifier.sign = static_cast(peek0); @@ -213,7 +213,7 @@ void Parser::parseSpecifier(Specifier& specifier, SpecifierType type) // Alternative form is only valid for numeric types if (peek0 == '#') { VERIFY(state < State::AfterAlternativeForm, "unexpected '#' at this position"); - VERIFY(type == SpecifierType::Integral || type == SpecifierType::FloatingPoint, + VERIFY(type == ParameterType::Integral || type == ParameterType::FloatingPoint, "'#' option is only valid for numeric types"); state = State::AfterAlternativeForm; specifier.alternativeForm = true; @@ -223,7 +223,7 @@ void Parser::parseSpecifier(Specifier& specifier, SpecifierType type) if (peek0 == '0') { if (state < State::AfterWidth) { VERIFY(state < State::AfterZeroPadding, "unexpected '0' at this position"); - VERIFY(type == SpecifierType::Integral || type == SpecifierType::FloatingPoint, + VERIFY(type == ParameterType::Integral || type == ParameterType::FloatingPoint, "zero padding option is only valid for numeric types"); state = State::AfterZeroPadding; specifier.zeroPadding = true; diff --git a/src/util/format/parser.h b/src/util/format/parser.h index ba2321e..36bc237 100644 --- a/src/util/format/parser.h +++ b/src/util/format/parser.h @@ -24,7 +24,7 @@ public: Manual, // {0},{1} }; - enum class SpecifierType { + enum class ParameterType { Integral, FloatingPoint, Char, @@ -41,7 +41,7 @@ public: std::string_view consumeLiteral(); std::optional consumeIndex(); - void parseSpecifier(Specifier& specifier, SpecifierType type); + void parseSpecifier(Specifier& specifier, ParameterType type); private: ArgumentIndexingMode m_mode { ArgumentIndexingMode::Automatic };