11namespace hi::inline
v1 {
13enum class graphic_character_t {
15 exclamation_mark = 0x01,
48[[nodiscard]]
constexpr graphic_character_t char_to_graphic_character(
char x)
noexcept
51 case '!':
return graphic_character_t::exclamation_mark;
52 case '"':
return graphic_character_t::double_quote;
53 case '#':
return graphic_character_t::hash;
54 case '$':
return graphic_character_t::dollar;
55 case '%':
return graphic_character_t::percent;
56 case '&':
return graphic_character_t::ampersand;
57 case '\'':
return graphic_character_t::single_quote;
58 case '(':
return graphic_character_t::open_paren;
59 case ')':
return graphic_character_t::close_paren;
60 case '*':
return graphic_character_t::star;
61 case '+':
return graphic_character_t::plus;
62 case ',':
return graphic_character_t::comma;
63 case '-':
return graphic_character_t::minus;
64 case '.':
return graphic_character_t::dot;
65 case '/':
return graphic_character_t::slash;
66 case ':':
return graphic_character_t::colon;
67 case ';':
return graphic_character_t::semi_colon;
68 case '<':
return graphic_character_t::less_than;
69 case '=':
return graphic_character_t::equal;
70 case '>':
return graphic_character_t::greater_than;
71 case '?':
return graphic_character_t::question_mark;
72 case '[':
return graphic_character_t::open_bracket;
73 case '\\':
return graphic_character_t::back_slash;
74 case ']':
return graphic_character_t::close_bracket;
75 case '^':
return graphic_character_t::carret;
76 case '_':
return graphic_character_t::underscore;
77 case '`':
return graphic_character_t::back_quote;
78 case '{':
return graphic_character_t::open_brace;
79 case '|':
return graphic_character_t::pipe;
80 case '}':
return graphic_character_t::close_brace;
81 case '~':
return graphic_character_t::tilde;
82 default:
return graphic_character_t::none;
86[[nodiscard]]
constexpr uint64_t operator_to_int(
char const *s)
noexcept
91 for (; *s !=
'\0'; s++) {
93 r |=
static_cast<uint64_t
>(char_to_graphic_character(*s));
103 switch (operator_to_int(str)) {
104 case operator_to_int(
"::"):
return {uint8_t{1},
true};
105 case operator_to_int(
"("):
return {uint8_t{2},
true};
106 case operator_to_int(
"["):
return {uint8_t{2},
true};
107 case operator_to_int(
"."):
return {uint8_t{2},
true};
108 case operator_to_int(
"->"):
return {uint8_t{2},
true};
109 case operator_to_int(
".*"):
return {uint8_t{4},
true};
110 case operator_to_int(
"->*"):
return {uint8_t{4},
true};
111 case operator_to_int(
"**"):
return {uint8_t{4},
true};
112 case operator_to_int(
"*"):
return {uint8_t{5},
true};
113 case operator_to_int(
"/"):
return {uint8_t{5},
true};
114 case operator_to_int(
"%"):
return {uint8_t{5},
true};
115 case operator_to_int(
"+"):
return {uint8_t{6},
true};
116 case operator_to_int(
"-"):
return {uint8_t{6},
true};
117 case operator_to_int(
"<<"):
return {uint8_t{7},
true};
118 case operator_to_int(
">>"):
return {uint8_t{7},
true};
119 case operator_to_int(
"<=>"):
return {uint8_t{8},
true};
120 case operator_to_int(
"<"):
return {uint8_t{9},
true};
121 case operator_to_int(
">"):
return {uint8_t{9},
true};
122 case operator_to_int(
"<="):
return {uint8_t{9},
true};
123 case operator_to_int(
">="):
return {uint8_t{9},
true};
124 case operator_to_int(
"=="):
return {uint8_t{10},
true};
125 case operator_to_int(
"!="):
return {uint8_t{10},
true};
126 case operator_to_int(
"&"):
return {uint8_t{11},
true};
127 case operator_to_int(
"^"):
return {uint8_t{12},
true};
128 case operator_to_int(
"|"):
return {uint8_t{13},
true};
129 case operator_to_int(
"&&"):
return {uint8_t{14},
true};
130 case operator_to_int(
"||"):
return {uint8_t{15},
true};
131 case operator_to_int(
"?"):
return {uint8_t{16},
false};
132 case operator_to_int(
"="):
return {uint8_t{16},
false};
133 case operator_to_int(
"+="):
return {uint8_t{16},
false};
134 case operator_to_int(
"-="):
return {uint8_t{16},
false};
135 case operator_to_int(
"*="):
return {uint8_t{16},
false};
136 case operator_to_int(
"/="):
return {uint8_t{16},
false};
137 case operator_to_int(
"%="):
return {uint8_t{16},
false};
138 case operator_to_int(
"<<="):
return {uint8_t{16},
false};
139 case operator_to_int(
">>="):
return {uint8_t{16},
false};
140 case operator_to_int(
"&="):
return {uint8_t{16},
false};
141 case operator_to_int(
"^="):
return {uint8_t{16},
false};
142 case operator_to_int(
"|="):
return {uint8_t{16},
false};
143 case operator_to_int(
","):
return {uint8_t{17},
true};
144 case operator_to_int(
"]"):
return {uint8_t{17},
true};
145 case operator_to_int(
")"):
return {uint8_t{17},
true};
146 case operator_to_int(
"!"):
return {uint8_t{18},
true};
#define hi_axiom_not_null(expression,...)
Assert if an expression is not nullptr.
Definition assert.hpp:272
DOXYGEN BUG.
Definition algorithm.hpp:13
std::pair< uint8_t, bool > operator_precedence(char const *str, bool binary) noexcept
Operator Precedence according to C++.
Definition operator.hpp:154
std::pair< uint8_t, bool > binary_operator_precedence(char const *str) noexcept
Binary Operator Precedence according to C++.
Definition operator.hpp:101