parse_whitespace

Function parse_whitespace 

Source
pub fn parse_whitespace(input: &str) -> IResult<&str, ()>
Expand description

Parse whitespace until the first non-whitespace character

Whitespace is considered:

  • actual space
  • any comment(s)

assert_eq!(parse_whitespace("  \n  foo"), Ok(("foo", ())));
assert_eq!(parse_whitespace(" # test"), Ok(("", ())));
assert_eq!(parse_whitespace("# rest"), Ok(("", ())));
assert_eq!(parse_whitespace("  # test\n  \t# more\n  last\nthing"), Ok(("last\nthing", ())));

assert!(parse_whitespace("blah").is_err());