Function neure::neu::whitespace
source · pub const fn whitespace() -> WhiteSpaceExpand description
Reference is_whitespace.
Example
use neure::prelude::*;
use neu::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let space = whitespace();
let space1 = space.repeat_times::<1>();
let space3 = space.repeat_times::<3>();
let mut ctx = CharsCtx::new(" \u{A0}abcd");
assert_eq!(ctx.try_mat(&space1)?, Span::new(0, 1));
assert_eq!(ctx.try_mat(&space3)?, Span::new(1, 4));
assert!(ctx.try_mat(&space1).is_err());
Ok(())
}