MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / parse_hex_escape

Function parse_hex_escape

common/peg-parser.cpp:156–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154};
155
156static std::pair<uint32_t, size_t> parse_hex_escape(const std::string & str, size_t pos, int hex_count) {
157 if (pos + hex_count > str.length()) {
158 return {0, 0};
159 }
160
161 uint32_t value = 0;
162 for (int i = 0; i < hex_count; i++) {
163 char c = str[pos + i];
164 if (!is_hex_digit(c)) {
165 return {0, 0};
166 }
167 value <<= 4;
168 if ('a' <= c && c <= 'f') {
169 value += c - 'a' + 10;
170 } else if ('A' <= c && c <= 'F') {
171 value += c - 'A' + 10;
172 } else if ('0' <= c && c <= '9') {
173 value += c - '0';
174 } else {
175 break;
176 }
177 }
178 return {value, static_cast<size_t>(hex_count)};
179}
180
181static std::pair<uint32_t, size_t> parse_char_class_char(const std::string & content, size_t pos) {
182 if (content[pos] == '\\' && pos + 1 < content.length()) {

Callers 1

parse_char_class_charFunction · 0.85

Calls 2

is_hex_digitFunction · 0.85
lengthMethod · 0.80

Tested by

no test coverage detected