5using namespace std::literals;
10 auto n = plugin.size();
21 else if (
'a' <= c && c <=
'z')
23 else if (
'A' <= c && c <=
'Z')
25 else if (
'0' <= c && c <=
'9')
31 result = (result << 6_u64) | u;
34 return result << 16_u64;
40 u64 c = (plugin & 0xfc00000000000000_u64) >> 58_u64;
42 return driver.sym(result);
45 else if (2 <= c && c < 28)
46 result +=
'a' + ((char)c - 2);
47 else if (28 <= c && c < 54)
48 result +=
'A' + ((char)c - 28);
50 result +=
'0' + ((char)c - 54);
55 return driver.sym(result);
60 if (s[0] !=
'%')
return {};
63 auto dot = sv.find(
'.');
64 if (dot == std::string_view::npos)
return {};
66 auto plugin = driver.sym(
subview(sv, 0, dot));
67 if (!
mangle(plugin))
return {};
69 auto tag =
subview(sv, dot + 1);
70 if (
auto dot = tag.find(
'.'); dot != std::string_view::npos) {
71 auto sub = driver.sym(
subview(tag, dot + 1));
73 return {plugin, driver.sym(tag), sub};
76 return {plugin, driver.sym(tag), {}};
Some "global" variables needed all over the place.
std::string_view subview(std::string_view s, size_t i, size_t n=std::string_view::npos)
Like std::string::substr, but works on std::string_view instead.
static std::tuple< Sym, Sym, Sym > split(Driver &, Sym)
static constexpr size_t Max_Plugin_Size
static Sym demangle(Driver &, plugin_t plugin)
Reverts an Axiom::mangled string to a Sym.
static std::optional< plugin_t > mangle(Sym plugin)
Mangles s into a dense 48-bit representation.