diff --git a/AK/GenericLexer.cpp b/AK/GenericLexer.cpp index c5818f714b..e49d41e690 100644 --- a/AK/GenericLexer.cpp +++ b/AK/GenericLexer.cpp @@ -269,56 +269,14 @@ void GenericLexer::ignore_until(const char* stop) } // Ignore characters until `condition` return true -// We don't skip the stop character as it may not be a single value +// We don't skip the stop character as it may not be a unique value void GenericLexer::ignore_until(Condition condition) { while (!is_eof() && !condition(peek())) m_index++; } -bool is_control(char c) -{ - return (c >= 0 && c <= 31) || c == 127; -} - -bool is_whitespace(char c) -{ - return (c >= '\t' && c <= '\r') || c == ' '; -} - -bool is_lowercase(char c) -{ - return c >= 'a' && c <= 'z'; -} - -bool is_uppercase(char c) -{ - return c >= 'A' && c <= 'Z'; -} - -bool is_digit(char c) -{ - return c >= '0' && c <= '9'; -} - -bool is_punctuation(char c) -{ - return (c >= '!' && c <= '/') - || (c >= ':' && c <= '@') - || (c >= '[' && c <= '`') - || (c >= '{' && c <= '~'); -} - -bool is_printable(char c) -{ - return c >= ' ' && c <= '~'; -} - -bool is_graphic(char c) -{ - return c > ' ' && c <= '~'; -} - +// CType adapters bool is_alpha(char c) { return is_lowercase(c) || is_uppercase(c); @@ -329,6 +287,21 @@ bool is_alphanum(char c) return is_alpha(c) || is_digit(c); } +bool is_control(char c) +{ + return (c >= 0 && c <= 31) || c == 127; +} + +bool is_digit(char c) +{ + return c >= '0' && c <= '9'; +} + +bool is_graphic(char c) +{ + return c > ' ' && c <= '~'; +} + bool is_hex_digit(char c) { return is_digit(c) @@ -336,9 +309,9 @@ bool is_hex_digit(char c) || (c >= 'a' && c <= 'f'); } -bool is_quote(char c) +bool is_lowercase(char c) { - return c == '\'' || c == '"'; + return c >= 'a' && c <= 'z'; } bool is_path_separator(char c) @@ -346,4 +319,32 @@ bool is_path_separator(char c) return c == '/' || c == '\\'; } +bool is_printable(char c) +{ + return c >= ' ' && c <= '~'; +} + +bool is_punctuation(char c) +{ + return (c >= '!' && c <= '/') + || (c >= ':' && c <= '@') + || (c >= '[' && c <= '`') + || (c >= '{' && c <= '~'); +} + +bool is_quote(char c) +{ + return c == '\'' || c == '"'; +} + +bool is_uppercase(char c) +{ + return c >= 'A' && c <= 'Z'; +} + +bool is_whitespace(char c) +{ + return (c >= '\t' && c <= '\r') || c == ' '; +} + }