mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:04:59 +00:00
AK: Alphabetically sort the ctype adapters
This commit is contained in:
parent
66481ad279
commit
1ab6dd67e9
1 changed files with 47 additions and 46 deletions
|
@ -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 == ' ';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue