use reborrow_generic::short::Rb;
use crate::back::RbBack;
use crate::error::ErrorSink;
use crate::error::std::Unexpected;
use crate::input::{In, Input};
pub const SPACE: fn(char) -> bool = is_space;
fn is_space(c: char) -> bool {
c.is_whitespace()
}
#[inline]
pub fn space<I, E, N, L>(mut i: In<I, N, L, E>) -> Option<char>
where
I: Input<Item = char>,
N: Rb,
L: RbBack,
E: ErrorSink<I::Pos>,
Unexpected<char>: Into<E::Error>,
{
i.one_of(SPACE)
}
#[inline]
pub fn ws<I, E, N, L>(mut i: In<I, N, L, E>) -> Option<()>
where
I: Input<Item = char>,
N: Rb,
L: RbBack,
E: ErrorSink<I::Pos>,
Unexpected<char>: Into<E::Error>,
{
i.many_skip(space)
}
#[inline]
pub fn ws1<I, E, N, L>(mut i: In<I, N, L, E>) -> Option<()>
where
I: Input<Item = char>,
N: Rb,
L: RbBack,
E: ErrorSink<I::Pos>,
Unexpected<char>: Into<E::Error>,
{
i.many1_skip(space)
}
pub const ASCII: fn(char) -> bool = is_ascii;
fn is_ascii(c: char) -> bool {
c.is_ascii()
}
#[inline]
pub fn ascii<I, E, N, L>(mut i: In<I, N, L, E>) -> Option<char>
where
I: Input<Item = char>,
N: Rb,
L: RbBack,
E: ErrorSink<I::Pos>,
Unexpected<char>: Into<E::Error>,
{
i.one_of(ASCII)
}
pub const ASCII_ALPHA: fn(char) -> bool = is_ascii_alpha;
fn is_ascii_alpha(c: char) -> bool {
c.is_ascii_alphabetic()
}
#[inline]
pub fn ascii_alpha<I, E, N, L>(mut i: In<I, N, L, E>) -> Option<char>
where
I: Input<Item = char>,
N: Rb,
L: RbBack,
E: ErrorSink<I::Pos>,
Unexpected<char>: Into<E::Error>,
{
i.one_of(ASCII_ALPHA)
}
pub const ASCII_DIGIT: fn(char) -> bool = is_ascii_digit;
fn is_ascii_digit(c: char) -> bool {
c.is_ascii_digit()
}
#[inline]
pub fn ascii_digit<I, E, N, L>(mut i: In<I, N, L, E>) -> Option<char>
where
I: Input<Item = char>,
N: Rb,
L: RbBack,
E: ErrorSink<I::Pos>,
Unexpected<char>: Into<E::Error>,
{
i.one_of(ASCII_DIGIT)
}
pub const ASCII_ALPHANUM: fn(char) -> bool = is_ascii_alphanumeric;
fn is_ascii_alphanumeric(c: char) -> bool {
c.is_ascii_alphanumeric()
}
#[inline]
pub fn ascii_alphanumeric<I, E, N, L>(mut i: In<I, N, L, E>) -> Option<char>
where
I: Input<Item = char>,
N: Rb,
L: RbBack,
E: ErrorSink<I::Pos>,
Unexpected<char>: Into<E::Error>,
{
i.one_of(ASCII_ALPHANUM)
}