mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
Unicode: s/codepoint/code_point/g
Unicode calls them "code points" so let's follow their style.
This commit is contained in:
parent
b139fb9f38
commit
ea9ac3155d
45 changed files with 449 additions and 449 deletions
|
@ -834,7 +834,7 @@ NonnullRefPtr<StringLiteral> Parser::parse_string_literal(Token token)
|
|||
auto type = status == Token::StringValueStatus::MalformedUnicodeEscape ? "unicode" : "hexadecimal";
|
||||
message = String::format("Malformed %s escape sequence", type);
|
||||
} else if (status == Token::StringValueStatus::UnicodeEscapeOverflow) {
|
||||
message = "Unicode codepoint must not be greater than 0x10ffff in escape sequence";
|
||||
message = "Unicode code_points must not be greater than 0x10ffff in escape sequence";
|
||||
}
|
||||
|
||||
syntax_error(
|
||||
|
|
|
@ -69,7 +69,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringIteratorPrototype::next)
|
|||
}
|
||||
|
||||
StringBuilder builder;
|
||||
builder.append_codepoint(*utf8_iterator);
|
||||
builder.append_code_points(*utf8_iterator);
|
||||
++utf8_iterator;
|
||||
|
||||
return create_iterator_result_object(global_object, js_string(interpreter, builder.to_string()), false);
|
||||
|
|
|
@ -321,7 +321,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::substring)
|
|||
if (interpreter.argument_count() == 0)
|
||||
return js_string(interpreter, string);
|
||||
|
||||
// FIXME: index_start and index_end should index a UTF-16 codepoint view of the string.
|
||||
// FIXME: index_start and index_end should index a UTF-16 code_points view of the string.
|
||||
auto string_length = string.length();
|
||||
auto index_start = min(interpreter.argument(0).to_size_t(interpreter), string_length);
|
||||
if (interpreter.exception())
|
||||
|
@ -358,7 +358,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::includes)
|
|||
if (interpreter.exception())
|
||||
return {};
|
||||
|
||||
// FIXME: position should index a UTF-16 codepoint view of the string.
|
||||
// FIXME: position should index a UTF-16 code_points view of the string.
|
||||
size_t position = 0;
|
||||
if (interpreter.argument_count() >= 2) {
|
||||
position = interpreter.argument(1).to_size_t(interpreter);
|
||||
|
@ -385,7 +385,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::slice)
|
|||
if (interpreter.argument_count() == 0)
|
||||
return js_string(interpreter, string);
|
||||
|
||||
// FIXME: index_start and index_end should index a UTF-16 codepoint view of the string.
|
||||
// FIXME: index_start and index_end should index a UTF-16 code_points view of the string.
|
||||
auto string_length = static_cast<i32>(string.length());
|
||||
auto index_start = interpreter.argument(0).to_i32(interpreter);
|
||||
if (interpreter.exception())
|
||||
|
@ -437,7 +437,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::last_index_of)
|
|||
auto max_index = string.length() - search_string.length();
|
||||
auto from_index = max_index;
|
||||
if (interpreter.argument_count() >= 2) {
|
||||
// FIXME: from_index should index a UTF-16 codepoint view of the string.
|
||||
// FIXME: from_index should index a UTF-16 code_points view of the string.
|
||||
from_index = min(interpreter.argument(1).to_size_t(interpreter), max_index);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
|
|
|
@ -917,10 +917,10 @@ TriState abstract_relation(Interpreter& interpreter, bool left_first, Value lhs,
|
|||
if (y_string.starts_with(x_string))
|
||||
return TriState::True;
|
||||
|
||||
Utf8View x_codepoints { x_string };
|
||||
Utf8View y_codepoints { y_string };
|
||||
for (auto k = x_codepoints.begin(), l = y_codepoints.begin();
|
||||
k != x_codepoints.end() && l != y_codepoints.end();
|
||||
Utf8View x_code_pointss { x_string };
|
||||
Utf8View y_code_pointss { y_string };
|
||||
for (auto k = x_code_pointss.begin(), l = y_code_pointss.begin();
|
||||
k != x_code_pointss.end() && l != y_code_pointss.end();
|
||||
++k, ++l) {
|
||||
if (*k != *l) {
|
||||
if (*k < *l) {
|
||||
|
|
|
@ -136,7 +136,7 @@ String Token::string_value(StringValueStatus& status) const
|
|||
auto digit2 = m_value[++i];
|
||||
if (!isxdigit(digit1) || !isxdigit(digit2))
|
||||
return encoding_failure(StringValueStatus::MalformedHexEscape);
|
||||
builder.append_codepoint(hex2int(digit1) * 16 + hex2int(digit2));
|
||||
builder.append_code_points(hex2int(digit1) * 16 + hex2int(digit2));
|
||||
break;
|
||||
}
|
||||
case 'u': {
|
||||
|
@ -174,7 +174,7 @@ String Token::string_value(StringValueStatus& status) const
|
|||
}
|
||||
}
|
||||
|
||||
builder.append_codepoint(code_point);
|
||||
builder.append_code_points(code_point);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue