Function neure::neu::ascii_whitespace

source ·
pub const fn ascii_whitespace() -> AsciiWhiteSpace
Expand description

Reference is_ascii_whitespace or is_ascii_whitespace.

Example

use neure::prelude::*;
use neu::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let space = ascii_whitespace();
    let space1 = space.repeat_times::<1>();
    let space3 = space.repeat_times::<3>();
    let mut ctx = CharsCtx::new("    w\u{A0}abcd");

    assert_eq!(ctx.try_mat(&space1)?, Span::new(0, 1));
    assert_eq!(ctx.try_mat(&space3)?, Span::new(1, 3));
    assert!(ctx.try_mat(&space1).is_err());
    Ok(())
}