commit | def66371f19aff57099f6f96996878f925060e3c | [log] [tgz] |
---|---|---|
author | David Tolnay <dtolnay@gmail.com> | Mon Oct 24 21:51:32 2016 -0700 |
committer | David Tolnay <dtolnay@gmail.com> | Mon Oct 24 21:51:32 2016 -0700 |
tree | 39ff7329572c49c3e13595f2796798d8bdf325b2 | |
parent | 93413a5280b9a49db9ac6fbb22cd357393230695 [diff] [blame] |
Factor out handling of leading whitespace
diff --git a/src/space.rs b/src/space.rs index 36f9f0e..0e5cd89 100644 --- a/src/space.rs +++ b/src/space.rs
@@ -84,3 +84,10 @@ Some(_) | None => IResult::Done(input, ()), } } + +pub fn skip_whitespace(input: &str) -> &str { + match whitespace(input) { + IResult::Done(rest, _) => rest, + IResult::Error => input, + } +}