Move more parsing to core

This commit is contained in:
Victor Zverovich
2021-05-06 07:37:40 -07:00
parent 8e6390c32c
commit 23892caf53
2 changed files with 53 additions and 53 deletions
-53
View File
@@ -70,12 +70,6 @@
# define FMT_NOINLINE
#endif
#if FMT_GCC_VERSION
# define FMT_GCC_VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
#else
# define FMT_GCC_VISIBILITY_HIDDEN
#endif
#if FMT_MSC_VER
# define FMT_MSC_DEFAULT = default
#else
@@ -100,14 +94,6 @@
# define FMT_FALLTHROUGH
#endif
#ifndef FMT_MAYBE_UNUSED
# if FMT_HAS_CPP17_ATTRIBUTE(maybe_unused)
# define FMT_MAYBE_UNUSED [[maybe_unused]]
# else
# define FMT_MAYBE_UNUSED
# endif
#endif
#ifndef FMT_THROW
# if FMT_EXCEPTIONS
# if FMT_MSC_VER || FMT_NVCC
@@ -2615,45 +2601,6 @@ class dynamic_specs_handler
ParseContext& context_;
};
template <typename Char, typename IDHandler>
FMT_CONSTEXPR const Char* do_parse_arg_id(const Char* begin, const Char* end,
IDHandler&& handler) {
FMT_ASSERT(begin != end, "");
Char c = *begin;
if (c >= '0' && c <= '9') {
int index = 0;
if (c != '0')
index = parse_nonnegative_int(begin, end, handler);
else
++begin;
if (begin == end || (*begin != '}' && *begin != ':'))
handler.on_error("invalid format string");
else
handler(index);
return begin;
}
if (!is_name_start(c)) {
handler.on_error("invalid format string");
return begin;
}
auto it = begin;
do {
++it;
} while (it != end && (is_name_start(c = *it) || ('0' <= c && c <= '9')));
handler(basic_string_view<Char>(begin, to_unsigned(it - begin)));
return it;
}
template <typename Char, typename IDHandler>
FMT_CONSTEXPR_DECL FMT_INLINE const Char* parse_arg_id(const Char* begin,
const Char* end,
IDHandler&& handler) {
Char c = *begin;
if (c != '}' && c != ':') return do_parse_arg_id(begin, end, handler);
handler();
return begin;
}
template <typename OutputIt, typename Char, typename Context>
struct format_handler : detail::error_handler {
basic_format_parse_context<Char> parse_context;