1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00

LibRegex+Everywhere: Make LibRegex more unicode-aware

This commit makes LibRegex (mostly) capable of operating on any of
the three main string views:
- StringView for raw strings
- Utf8View for utf-8 encoded strings
- Utf32View for raw unicode strings

As a result, regexps with unicode strings should be able to properly
handle utf-8 and not stop in the middle of a code point.
A future commit will update LibJS to use the correct type of string
depending on the flags.
This commit is contained in:
Ali Mohammad Pur 2021-07-18 05:07:01 +04:30 committed by Ali Mohammad Pur
parent e5af15a6e9
commit f364fcec5d
8 changed files with 310 additions and 207 deletions

View file

@ -359,7 +359,7 @@ String CppComprehensionEngine::document_path_from_include_path(const StringView&
if (!library_include.search(include_path, result))
return {};
auto path = result.capture_group_matches.at(0).at(0).view.u8view();
auto path = result.capture_group_matches.at(0).at(0).view.string_view();
return String::formatted("/usr/include/{}", path);
};
@ -368,7 +368,7 @@ String CppComprehensionEngine::document_path_from_include_path(const StringView&
if (!user_defined_include.search(include_path, result))
return {};
return result.capture_group_matches.at(0).at(0).view.u8view();
return result.capture_group_matches.at(0).at(0).view.string_view();
};
auto result = document_path_for_library_include(include_path);