Factor out handling of leading whitespace
diff --git a/src/helper.rs b/src/helper.rs
index 5606fd0..bf19971 100644
--- a/src/helper.rs
+++ b/src/helper.rs
@@ -1,5 +1,5 @@
 use nom::IResult;
-use space::{whitespace, word_break};
+use space::{skip_whitespace, word_break};
 
 macro_rules! punct {
     ($i:expr, $punct:expr) => {
@@ -8,10 +8,7 @@
 }
 
 pub fn punct<'a>(input: &'a str, token: &'static str) -> IResult<&'a str, &'a str> {
-    let input = match whitespace(input) {
-        IResult::Done(rest, _) => rest,
-        IResult::Error => input,
-    };
+    let input = skip_whitespace(input);
     if input.starts_with(token) {
         IResult::Done(&input[token.len()..], token)
     } else {
diff --git a/src/lib.rs b/src/lib.rs
index 043e164..3af64bf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -150,10 +150,7 @@
                  -> Result<T, String> {
         match f(input) {
             IResult::Done(mut rest, t) => {
-                rest = match space::whitespace(rest) {
-                    IResult::Done(rest, _) => rest,
-                    IResult::Error => rest,
-                };
+                rest = space::skip_whitespace(rest);
                 if rest.is_empty() {
                     Ok(t)
                 } else if rest.len() == input.len() {
diff --git a/src/lit.rs b/src/lit.rs
index 6caba80..c4860bc 100644
--- a/src/lit.rs
+++ b/src/lit.rs
@@ -130,7 +130,7 @@
 pub mod parsing {
     use super::*;
     use escape::{cooked_char, cooked_string, raw_string};
-    use space::whitespace;
+    use space::skip_whitespace;
     use nom::IResult;
     use unicode_xid::UnicodeXID;
 
@@ -194,7 +194,6 @@
     ));
 
     named!(float -> Lit, do_parse!(
-        option!(whitespace) >>
         value: float_string >>
         suffix: alt!(
             tag!("f32") => { |_| FloatTy::F32 }
@@ -207,10 +206,7 @@
     ));
 
     named!(pub int -> (u64, IntTy), tuple!(
-        preceded!(
-            option!(whitespace),
-            digits
-        ),
+        digits,
         alt!(
             tag!("isize") => { |_| IntTy::Isize }
             |
@@ -242,7 +238,9 @@
         keyword!("false") => { |_| Lit::Bool(false) }
     ));
 
-    fn float_string(input: &str) -> IResult<&str, String> {
+    fn float_string(mut input: &str) -> IResult<&str, String> {
+        input = skip_whitespace(input);
+
         let mut chars = input.chars().peekable();
         match chars.next() {
             Some(ch) if ch >= '0' && ch <= '9' => {}
@@ -318,6 +316,8 @@
     }
 
     pub fn digits(mut input: &str) -> IResult<&str, u64> {
+        input = skip_whitespace(input);
+
         let base = if input.starts_with("0x") {
             input = &input[2..];
             16
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,
+    }
+}