1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:07:45 +00:00

AK: Exclude GenericLexer String APIs from the Kernel

These APIs are only used by userland, and String is OOM-infallible,
so let's just ifdef it out of the Kernel.
This commit is contained in:
Idan Horowitz 2022-02-15 23:32:59 +02:00 committed by Andreas Kling
parent 410183a7b0
commit b22cb40565
2 changed files with 15 additions and 2 deletions

View file

@ -83,10 +83,12 @@ public:
return true;
}
#ifndef KERNEL
bool consume_specific(const String& next)
{
return consume_specific(StringView { next });
}
#endif
constexpr bool consume_specific(const char* next)
{
@ -115,14 +117,18 @@ public:
StringView consume_until(const char*);
StringView consume_until(StringView);
StringView consume_quoted_string(char escape_char = 0);
#ifndef KERNEL
String consume_and_unescape_string(char escape_char = '\\');
#endif
enum class UnicodeEscapeError {
MalformedUnicodeEscape,
UnicodeEscapeOverflow,
};
#ifndef KERNEL
Result<u32, UnicodeEscapeError> consume_escaped_code_point(bool combine_surrogate_pairs = true);
#endif
constexpr void ignore(size_t count = 1)
{
@ -212,8 +218,10 @@ protected:
size_t m_index { 0 };
private:
#ifndef KERNEL
Result<u32, UnicodeEscapeError> decode_code_point();
Result<u32, UnicodeEscapeError> decode_single_or_paired_surrogate(bool combine_surrogate_pairs);
#endif
};
constexpr auto is_any_of(StringView values)