25#include "../generator.hpp"
26#include "detail/language_tokens.hpp"
27#include "identifier.hpp"
35namespace essence::meta {
43 consteval auto get_enum_searching_range(T)
noexcept {
44 return std::pair<std::int64_t, std::int64_t>{-64, 64};
53 template <
typename T,
bool Short = true>
54 requires std::is_enum_v<T>
55 generator<std::pair<std::string_view, T>> probe_enum_names() {
56 static constexpr auto range = get_enum_searching_range(T{});
57 static constexpr auto min = range.first;
58 static constexpr auto max = range.second;
60 const auto origin = []<std::size_t... Is>(
61 std::index_sequence<Is...>) -> generator<std::pair<std::string_view, T>> {
62 (
co_yield std::pair{get_literal_string_v<T, static_cast<T>(min + Is),
65 .ensure_correctness =
false,
67 static_cast<T
>(min + Is)},
69 }(std::make_index_sequence<max - min + 1>{});
71 for (
auto&& item : origin) {
72 if (item.first.find(detail::language_tokens::right_parentheses.front()) == std::string_view::npos) {