LibRegex: Don't return empty vectors from RegexStringView::lines()
Instead, return a vector of one empty string.
This commit is contained in:
parent
c9d026d7bc
commit
aa20210119
Notes:
sideshowbarker
2024-07-17 20:13:49 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/aa202101198 Pull-request: https://github.com/SerenityOS/serenity/pull/12126 Reviewed-by: https://github.com/linusg ✅
1 changed files with 9 additions and 0 deletions
|
@ -172,6 +172,9 @@ public:
|
|||
return new_views;
|
||||
},
|
||||
[](Utf32View view) {
|
||||
if (view.is_empty())
|
||||
return Vector<RegexStringView> { view };
|
||||
|
||||
Vector<RegexStringView> views;
|
||||
u32 newline = '\n';
|
||||
while (!view.is_empty()) {
|
||||
|
@ -187,6 +190,9 @@ public:
|
|||
return views;
|
||||
},
|
||||
[](Utf16View view) {
|
||||
if (view.is_empty())
|
||||
return Vector<RegexStringView> { view };
|
||||
|
||||
Vector<RegexStringView> views;
|
||||
u16 newline = '\n';
|
||||
while (!view.is_empty()) {
|
||||
|
@ -202,6 +208,9 @@ public:
|
|||
return views;
|
||||
},
|
||||
[](Utf8View const& view) {
|
||||
if (view.is_empty())
|
||||
return Vector<RegexStringView> { view };
|
||||
|
||||
Vector<RegexStringView> views;
|
||||
auto it = view.begin();
|
||||
auto previous_newline_position_it = it;
|
||||
|
|
Loading…
Add table
Reference in a new issue