static u32string prefix() {return u32string(U"kilo");}
static u32string prefix() {return u32string(U"hecto");}
static u32string symbol() {return u32string(1, U'k');}
static u32string symbol() {return u32string(U"da");}
static u32string prefix() {return u32string(U"deca");}
static u32string prefix() {return u32string(U"milli");}
static u32string prefix() {return u32string(U"centi");}
static u32string prefix() {return u32string(U"micro");}
static u32string prefix() {return u32string(U"nano");}
static u32string prefix() {return u32string(U"pico");}
static u32string prefix() {return u32string(U"femto");}
std::pair<bool, u32string> build_escaped_characters ( Iterator& current, const Iterator& end ) { std::string building; bool error = false; int to_read = 0; while (*current == '\\' && error == false) { ++current; char32_t c = *current; switch(c) { case 'U': to_read = 8; ++current; break; case 'u': to_read = 4; ++current; break; case 'x': to_read = 2; ++current; break; case 'n': building += "\n"; ++current; break; case 'r': building += "\r"; ++current; break; case 't': building += "\t"; ++current; break; case '\'': building += "\'"; ++current; break; case '\"': building += "\""; ++current; break; case '\\': building += "\\"; ++current; break; default: //invalid control character error = true; break; } //read the requested number of characters std::string chars; if (to_read > 0) { while (to_read > 0 && current != end && *current != '\'') { c = *current; if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) { chars += c; } else { break; } --to_read; ++current; } } //if we didn't read everything then error if (to_read != 0) { error = true; } else { uint32_t value = 0; for (char c : chars) { if (c >= '0' && c <= '9') { value = value * 16 + (c - '0'); } else { value = value * 16 + (c - 'A' + 10); } } //it was a byte if it was two characters, otherwise it was a whole //character if (chars.length() == 2) { building += char(value & 0xFF); } else { building += utf32_to_utf8(u32string(1, value)); } } } u32string u32result = utf8_to_utf32(building); return std::make_pair(!error, u32result); }