#[inline]
pub fn is_digit(c: char) -> bool {
c.is_ascii_digit()
}
#[inline]
pub fn is_hex(c: char) -> bool {
c.is_ascii_hexdigit()
}
#[inline]
pub fn is_number_start(c: char) -> bool {
is_digit(c) || c == '-'
}
#[inline]
pub fn is_quote(c: char) -> bool {
matches!(
c,
'"' | '\'' | '\u{2018}' | '\u{2019}' | '\u{201C}' | '\u{201D}' | '\u{0060}' | '\u{00B4}'
)
}
#[inline]
pub fn is_double_quote_like(c: char) -> bool {
matches!(c, '"' | '\u{201C}' | '\u{201D}')
}
#[inline]
pub fn is_double_quote(c: char) -> bool {
c == '"'
}
#[inline]
pub fn is_single_quote_like(c: char) -> bool {
matches!(c, '\'' | '\u{2018}' | '\u{2019}' | '\u{0060}' | '\u{00B4}')
}
#[inline]
pub fn is_single_quote(c: char) -> bool {
c == '\''
}
#[inline]
pub fn is_unquoted_string_delimiter(c: char) -> bool {
matches!(c, ',' | '[' | ']' | '/' | '{' | '}' | '\n' | '+')
}
#[inline]
pub fn is_delimiter(c: char) -> bool {
matches!(
c,
',' | ':' | '[' | ']' | '/' | '{' | '}' | '(' | ')' | '\n' | '+'
)
}
#[inline]
pub fn is_start_of_value(c: char) -> bool {
is_quote(c) || matches!(c, '[' | '{' | '-' | '_') || c.is_ascii_alphanumeric()
}
#[inline]
pub fn is_url_char(c: char) -> bool {
c.is_ascii_alphanumeric()
|| matches!(
c,
'-' | '.'
| '_'
| '~'
| ':'
| '/'
| '?'
| '#'
| '@'
| '!'
| '$'
| '&'
| '\''
| '('
| ')'
| '*'
| '+'
| ';'
| '='
)
}
#[inline]
pub fn is_valid_string_character(c: char) -> bool {
c >= '\u{0020}'
}
#[inline]
pub fn is_special_whitespace(c: char) -> bool {
matches!(
c,
'\u{00A0}' | '\u{180E}' | '\u{2000}' | '\u{2001}' | '\u{2002}' | '\u{2003}' | '\u{2004}' | '\u{2005}' | '\u{2006}' | '\u{2007}' | '\u{2008}' | '\u{2009}' | '\u{200A}' | '\u{200B}' | '\u{202F}' | '\u{205F}' | '\u{3000}' | '\u{FEFF}' )
}
#[inline]
pub fn is_whitespace(c: char) -> bool {
c.is_ascii_whitespace() || is_special_whitespace(c)
}
#[inline]
pub fn is_whitespace_except_newline(c: char) -> bool {
matches!(c, ' ' | '\t' | '\r') || is_special_whitespace(c)
}
#[inline]
pub fn is_identifier_start(c: char) -> bool {
c.is_ascii_alphabetic() || c == '_' || c == '$'
}
#[inline]
pub fn is_identifier_char(c: char) -> bool {
c.is_ascii_alphanumeric() || c == '_' || c == '$'
}
pub fn strip_bom(input: &str) -> &str {
input.strip_prefix('\u{FEFF}').unwrap_or(input)
}