mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +00:00
AK+Everywhere: Turn bool keep_empty to an enum in split* functions
This commit is contained in:
parent
f485db2501
commit
3e8b5ac920
44 changed files with 96 additions and 81 deletions
|
@ -192,7 +192,7 @@ public:
|
|||
// line terminators to \n is easier than splitting using all different LT characters.
|
||||
String source_string = source.replace("\r\n"sv, "\n"sv, ReplaceMode::All).replace("\r"sv, "\n"sv, ReplaceMode::All).replace(LINE_SEPARATOR_STRING, "\n"sv, ReplaceMode::All).replace(PARAGRAPH_SEPARATOR_STRING, "\n"sv, ReplaceMode::All);
|
||||
StringBuilder builder;
|
||||
builder.append(source_string.split_view('\n', true)[position.value().line - 1]);
|
||||
builder.append(source_string.split_view('\n', SplitBehavior::KeepEmpty)[position.value().line - 1]);
|
||||
builder.append('\n');
|
||||
for (size_t i = 0; i < position.value().column - 1; ++i)
|
||||
builder.append(spacer);
|
||||
|
|
|
@ -965,7 +965,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_split)
|
|||
|
||||
// 19. Repeat, while q < size,
|
||||
while (next_search_from < string.length_in_code_units()) {
|
||||
// a. Perform ? Set(splitter, "lastIndex", 𝔽(q), true).
|
||||
// a. Perform ? Set(splitter, "lastIndex", 𝔽(q), SplitBehavior::KeepEmpty).
|
||||
TRY(splitter->set(vm.names.lastIndex, Value(next_search_from), Object::ShouldThrowExceptions::Yes));
|
||||
|
||||
// b. Let z be ? RegExpExec(splitter, S).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue