Repository: Geal/nom
Pull request #1346 (2021-08-03 21:48:09)

:art: :rotating_light: cargo ftm and deprecated missing_doc_code_examples

Geal: Hi, could you please not do a formatting pass in an unrelated commit?

Patch:
diff --git a/Cargo.toml b/Cargo.toml
index 9764321..1b1bbff 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -81,9 +81,6 @@ name = "custom_errors"
 [[test]]
 name = "float"
 
-[[test]]
-name = "inference"
-
 [[test]]
 name = "ini"
 required-features = ["alloc"]
@@ -107,9 +104,6 @@ required-features = ["alloc"]
 name = "multiline"
 required-features = ["alloc"]
 
-[[test]]
-name = "named_args"
-
 [[test]]
 name = "overflow"
 
@@ -140,11 +134,6 @@ name = "ini"
 path = "benches/ini.rs"
 harness = false
 
-[[bench]]
-name = "ini_complete"
-path = "benches/ini_complete.rs"
-harness = false
-
 [[bench]]
 name = "ini_str"
 path = "benches/ini_str.rs"
diff --git a/README.md b/README.md
index 120c4c4..b2687ff 100644
--- a/README.md
+++ b/README.md
@@ -203,13 +203,6 @@ nom is available on [crates.io](https://crates.io/crates/nom) and can be include
 nom = "6"
 ```
 
-Then include it in your code like this:
-
-```rust,ignore
-#[macro_use]
-extern crate nom;
-```
-
 **NOTE: If you have existing code using nom below the 5.0 version, please take a look
 at the [upgrade documentation](https://github.com/Geal/nom/blob/master/doc/upgrading_to_nom_5.md)
 to handle the breaking changes.**
diff --git a/benches/http.rs b/benches/http.rs
index e17998b..c61f173 100644
--- a/benches/http.rs
+++ b/benches/http.rs
@@ -1,7 +1,5 @@
 #![cfg_attr(rustfmt, rustfmt_skip)]
 
-#[macro_use]
-extern crate nom;
 extern crate criterion;
 extern crate jemallocator;
 
@@ -9,7 +7,7 @@ extern crate jemallocator;
 static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
 
 use criterion::*;
-use nom::IResult;
+use nom::{IResult, bytes::complete::{tag, take_while1}, character::complete::{line_ending, char}, multi::many1};
 
 #[cfg_attr(rustfmt, rustfmt_skip)]
 #[derive(Debug)]
@@ -72,60 +70,46 @@ fn is_version(c: u8) -> bool {
   c >= b'0' && c <= b'9' || c == b'.'
 }
 
-named!(line_ending, alt!(tag!("\r\n") | tag!("\n")));
-
-#[cfg_attr(rustfmt, rustfmt_skip)]
 fn request_line(input: &[u8]) -> IResult<&[u8], Request> {
-  do_parse!(input,
-    method: take_while1!(is_token)     >>
-            take_while1!(is_space)     >>
-    url:    take_while1!(is_not_space) >>
-            take_while1!(is_space)     >>
-    version: http_version              >>
-    line_ending                        >>
+  let (input, method) = take_while1(is_token)(input)?;
+  let (input, _) = take_while1(is_space)(input)?;
+  let (input, uri) = take_while1(is_not_space)(input)?;
+  let (input, _) = take_while1(is_space)(input)?;
+  let (input, version) = http_version(input)?;
+  let (input, _) = line_ending(input)?;
 
-    (Request {
-        method: method,
-        uri:    url,
-        version: version,
-    }))
+  Ok((input, Request {method, uri, version}))
 }
 
-#[cfg_attr(rustfmt, rustfmt_skip)]
-named!(http_version, do_parse!(
-    tag!("HTTP/")                     >>
-    version: take_while1!(is_version) >>
+fn http_version(input: &[u8]) -> IResult<&[u8], &[u8]> {
+  let (input, _) = tag("HTTP/")(input)?;
+  let (input, version) = take_while1(is_version)(input)?;
 
-    (version)));
+  Ok((input, version))
+}
 
-#[cfg_attr(rustfmt, rustfmt_skip)]
-named!(message_header_value, do_parse!(
-          take_while1!(is_horizontal_space) >>
-    data: take_while1!(not_line_ending)     >>
-    line_ending                             >>
+fn message_header_value(input: &[u8]) -> IResult<&[u8], &[u8]> {
+  let (input, _) = take_while1(is_horizontal_space)(input)?;
+  let (input, data) = take_while1(not_line_ending)(input)?;
+  let (input, _) = line_ending(input)?;
 
-    (data)));
+  Ok((input, data))
+}
 
-#[cfg_attr(rustfmt, rustfmt_skip)]
 fn message_header(input: &[u8]) -> IResult<&[u8], Header> {
-  do_parse!(input,
-    name:   take_while1!(is_token)       >>
-            char!(':')                   >>
-    values: many1!(message_header_value) >>
+  let (input, name) = take_while1(is_token)(input)?;
+  let (input, _) = char(':')(input)?;
+  let (input, value) = many1(message_header_value)(input)?;
 
-    (Header {
-        name: name,
-        value: values,
-    }))
+  Ok((input, Header{ name, value }))
 }
 
 fn request(input: &[u8]) -> IResult<&[u8], (Request, Vec<Header>)> {
-  do_parse!(input,
-    req: request_line           >>
-    h:   many1!(message_header) >>
-         line_ending            >>
+  let (input, req) = request_line(input)?;
+  let (input, h) = many1(message_header)(input)?;
+  let (input, _) = line_ending(input)?;
 
-    (req, h))
+  Ok((input, (req, h)))
 }
 
 
@@ -183,15 +167,16 @@ Connection: keep-alive
 
 "[..];
 
-  c.bench(
-    "http",
-    Benchmark::new(
-      "parse",
-      move |b| {
-        b.iter(|| parse(data).unwrap());
-      },
-    ).throughput(Throughput::Bytes(data.len() as u64)),
-  );
+  let mut http_group = c.benchmark_group("http");
+  http_group.throughput(Throughput::Bytes(data.len() as u64));
+  http_group.bench_with_input(
+    BenchmarkId::new("parse", data.len()),
+     data,
+      |b, data| {
+    b.iter(|| parse(data).unwrap());
+  });
+
+  http_group.finish();
 }
 
 /*
diff --git a/benches/ini.rs b/benches/ini.rs
index f022e25..160eee9 100644
--- a/benches/ini.rs
+++ b/benches/ini.rs
@@ -1,5 +1,3 @@
-#[macro_use]
-extern crate nom;
 extern crate criterion;
 extern crate jemallocator;
 
@@ -13,8 +11,9 @@ use nom::{
   character::complete::{
     alphanumeric1 as alphanumeric, char, multispace1 as multispace, space1 as space,
   },
-  combinator::map_res,
-  sequence::delimited,
+  combinator::{map, map_res, opt},
+  multi::many0,
+  sequence::{delimited, pair, separated_pair, terminated, tuple},
   IResult,
 };
 use std::collections::HashMap;
@@ -27,208 +26,27 @@ fn category(i: &[u8]) -> IResult<&[u8], &str> {
   )(i)
 }
 
-named!(key_value    <&[u8],(&str,&str)>,
-  do_parse!(
-     key: map_res!(alphanumeric, str::from_utf8)
-  >>      opt!(space)
-  >>      char!('=')
-  >>      opt!(space)
-  >> val: map_res!(
-           take_while!(call!(|c| c != '\n' as u8 && c != ';' as u8)),
-           str::from_utf8
-         )
-  >>      opt!(pair!(char!(';'), take_while!(call!(|c| c != '\n' as u8))))
-  >>      (key, val)
-  )
-);
-
-named!(keys_and_values<&[u8], HashMap<&str, &str> >,
-  map!(
-    many0!(terminated!(key_value, opt!(multispace))),
-    |vec: Vec<_>| vec.into_iter().collect()
-  )
-);
-
-named!(category_and_keys<&[u8],(&str,HashMap<&str,&str>)>,
-  do_parse!(
-    category: category         >>
-              opt!(multispace) >>
-    keys: keys_and_values      >>
-    (category, keys)
-  )
-);
-
-named!(categories<&[u8], HashMap<&str, HashMap<&str,&str> > >,
-  map!(
-    many0!(
-      separated_pair!(
-        category,
-        opt!(multispace),
-        map!(
-          many0!(terminated!(key_value, opt!(multispace))),
-          |vec: Vec<_>| vec.into_iter().collect()
-        )
-      )
-    ),
-    |vec: Vec<_>| vec.into_iter().collect()
-  )
-);
-
-/*
-#[test]
-fn parse_category_test() {
-  let ini_file = &b"[category]
-
-parameter=value
-key = value2"[..];
-
-  let ini_without_category = &b"parameter=value
-key = value2"[..];
-
-  let res = category(ini_file);
-  println!("{:?}", res);
-  match res {
-    IResult::Done(i, o) => println!("i: {:?} | o: {:?}", str::from_utf8(i), o),
-    _ => println!("error")
-  }
-
-  assert_eq!(res, IResult::Done(ini_without_category, "category"));
+fn key_value(i: &[u8]) -> IResult<&[u8], (&str, &str)> {
+  let (i, key) = map_res(alphanumeric, str::from_utf8)(i)?;
+  let (i, _) = tuple((opt(space), char('='), opt(space)))(i)?;
+  let (i, val) = map_res(take_while(|c| c != b'\n' && c != b';'), str::from_utf8)(i)?;
+  let (i, _) = opt(pair(char(';'), take_while(|c| c != b'\n')))(i)?;
+  Ok((i, (key, val)))
 }
 
-#[test]
-fn parse_key_value_test() {
-  let ini_file = &b"parameter=value
-key = value2"[..];
-
-  let ini_without_key_value = &b"key = value2"[..];
-
-  let res = key_value(ini_file);
-  println!("{:?}", res);
-  match res {
-    IResult::Done(i, (o1, o2)) => println!("i: {:?} | o: ({:?},{:?})", str::from_utf8(i), o1, o2),
-    _ => println!("error")
-  }
-
-  assert_eq!(res, IResult::Done(ini_without_key_value, ("parameter", "value")));
-}
-
-
-#[test]
-fn parse_key_value_with_space_test() {
-  let ini_file = &b"parameter = value
-key = value2"[..];
-
-  let ini_without_key_value = &b"key = value2"[..];
-
-  let res = key_value(ini_file);
-  println!("{:?}", res);
-  match res {
-    IResult::Done(i, (o1, o2)) => println!("i: {:?} | o: ({:?},{:?})", str::from_utf8(i), o1, o2),
-    _ => println!("error")
-  }
-
-  assert_eq!(res, IResult::Done(ini_without_key_value, ("parameter", "value")));
-}
-
-#[test]
-fn parse_key_value_with_comment_test() {
-  let ini_file = &b"parameter=value;abc
-key = value2"[..];
-
-  let ini_without_key_value = &b"key = value2"[..];
-
-  let res = key_value(ini_file);
-  println!("{:?}", res);
-  match res {
-    IResult::Done(i, (o1, o2)) => println!("i: {:?} | o: ({:?},{:?})", str::from_utf8(i), o1, o2),
-    _ => println!("error")
-  }
-
-  assert_eq!(res, IResult::Done(ini_without_key_value, ("parameter", "value")));
-}
-
-#[test]
-fn parse_multiple_keys_and_values_test() {
-  let ini_file = &b"parameter=value;abc
-
-key = value2
-
-[category]"[..];
-
-  let ini_without_key_value = &b"[category]"[..];
-
-  let res = keys_and_values(ini_file);
-  println!("{:?}", res);
-  match res {
-    IResult::Done(i, ref o) => println!("i: {:?} | o: {:?}", str::from_utf8(i), o),
-    _ => println!("error")
-  }
-
-  let mut expected: HashMap<&str, &str> = HashMap::new();
-  expected.insert("parameter", "value");
-  expected.insert("key", "value2");
-  assert_eq!(res, IResult::Done(ini_without_key_value, expected));
-}
-
-#[test]
-fn parse_category_then_multiple_keys_and_values_test() {
-  //FIXME: there can be an empty line or a comment line after a category
-  let ini_file = &b"[abcd]
-parameter=value;abc
-
-key = value2
-
-[category]"[..];
-
-  let ini_after_parser = &b"[category]"[..];
-
-  let res = category_and_keys(ini_file);
-  println!("{:?}", res);
-  match res {
-    IResult::Done(i, ref o) => println!("i: {:?} | o: {:?}", str::from_utf8(i), o),
-    _ => println!("error")
-  }
-
-  let mut expected_h: HashMap<&str, &str> = HashMap::new();
-  expected_h.insert("parameter", "value");
-  expected_h.insert("key", "value2");
-  assert_eq!(res, IResult::Done(ini_after_parser, ("abcd", expected_h)));
-}
-
-#[test]
-fn parse_multiple_categories_test() {
-  let ini_file = &b"[abcd]
-
-parameter=value;abc
-
-key = value2
-
-[category]
-parameter3=value3
-key4 = value4
-\0"[..];
-
-  let ini_after_parser = &b"\0"[..];
-
-  let res = categories(ini_file);
-  //println!("{:?}", res);
-  match res {
-    IResult::Done(i, ref o) => println!("i: {:?} | o: {:?}", str::from_utf8(i), o),
-    _ => println!("error")
-  }
-
-  let mut expected_1: HashMap<&str, &str> = HashMap::new();
-  expected_1.insert("parameter", "value");
-  expected_1.insert("key", "value2");
-  let mut expected_2: HashMap<&str, &str> = HashMap::new();
-  expected_2.insert("parameter3", "value3");
-  expected_2.insert("key4", "value4");
-  let mut expected_h: HashMap<&str, HashMap<&str, &str>> = HashMap::new();
-  expected_h.insert("abcd",     expected_1);
-  expected_h.insert("category", expected_2);
-  assert_eq!(res, IResult::Done(ini_after_parser, expected_h));
+fn categories(i: &[u8]) -> IResult<&[u8], HashMap<&str, HashMap<&str, &str>>> {
+  map(
+    many0(separated_pair(
+      category,
+      opt(multispace),
+      map(
+        many0(terminated(key_value, opt(multispace))),
+        |vec: Vec<_>| vec.into_iter().collect(),
+      ),
+    )),
+    |vec: Vec<_>| vec.into_iter().collect(),
+  )(i)
 }
-*/
 
 fn bench_ini(c: &mut Criterion) {
   let str = "[owner]
@@ -241,13 +59,11 @@ port=143
 file=payroll.dat
 \0";
 
-  c.bench(
-    "bench ini",
-    Benchmark::new("parse", move |b| {
-      b.iter(|| categories(str.as_bytes()).unwrap());
-    })
-    .throughput(Throughput::Bytes(str.len() as u64)),
-  );
+  let mut group = c.benchmark_group("ini");
+  group.throughput(Throughput::Bytes(str.len() as u64));
+  group.bench_function(BenchmarkId::new("parse", str.len()), |b| {
+    b.iter(|| categories(str.as_bytes()).unwrap())
+  });
 }
 
 fn bench_ini_keys_and_values(c: &mut Criterion) {
@@ -256,27 +72,25 @@ port=143
 file=payroll.dat
 \0";
 
-  named!(acc<Vec<(&str, &str)>>, many0!(key_value));
+  fn acc(i: &[u8]) -> IResult<&[u8], Vec<(&str, &str)>> {
+    many0(key_value)(i)
+  }
 
-  c.bench(
-    "bench ini keys and values",
-    Benchmark::new("parse", move |b| {
-      b.iter(|| acc(str.as_bytes()).unwrap());
-    })
-    .throughput(Throughput::Bytes(str.len() as u64)),
-  );
+  let mut group = c.benchmark_group("ini keys and values");
+  group.throughput(Throughput::Bytes(str.len() as u64));
+  group.bench_function(BenchmarkId::new("parse", str.len()), |b| {
+    b.iter(|| acc(str.as_bytes()).unwrap())
+  });
 }
 
 fn bench_ini_key_value(c: &mut Criterion) {
   let str = "server=192.0.2.62\n";
 
-  c.bench(
-    "bench ini key value",
-    Benchmark::new("parse", move |b| {
-      b.iter(|| key_value(str.as_bytes()).unwrap());
-    })
-    .throughput(Throughput::Bytes(str.len() as u64)),
-  );
+  let mut group = c.benchmark_group("ini key value");
+  group.throughput(Throughput::Bytes(str.len() as u64));
+  group.bench_function(BenchmarkId::new("parse", str.len()), |b| {
+    b.iter(|| key_value(str.as_bytes()).unwrap())
+  });
 }
 
 criterion_group!(
diff --git a/benches/ini_complete.rs b/benches/ini_complete.rs
deleted file mode 100644
index a847ef4..0000000
--- a/benches/ini_complete.rs
+++ /dev/null
@@ -1,303 +0,0 @@
-#[macro_use]
-extern crate nom;
-extern crate criterion;
-extern crate jemallocator;
-
-#[global_allocator]
-static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
-
-use criterion::*;
-use nom::{
-  bytes::complete::take_while,
-  character::complete::{
-    alphanumeric1 as alphanumeric, char, multispace1 as multispace, space1 as space,
-  },
-  combinator::map_res,
-  sequence::delimited,
-  IResult,
-};
-use std::collections::HashMap;
-use std::str;
-
-/*
-named!(category<&[u8], &str>, map_res!(
-    delimited!(
-      char!('['),
-      take_while!(call!(|c| c != b']')),
-      char!(']')
-    ),
-    complete_byte_slice_to_str
-));
-
-fn complete_byte_slice_to_str<'a>(s: &'a [u8]) -> Result<&'a str, str::Utf8Error> {
-  str::from_utf8(s)
-}
-*/
-
-fn category(i: &[u8]) -> IResult<&[u8], &str> {
-  map_res(
-    delimited(char('['), take_while(|c| c != b']'), char(']')),
-    str::from_utf8,
-  )(i)
-}
-
-fn complete_byte_slice_to_str<'a>(s: &'a [u8]) -> Result<&'a str, str::Utf8Error> {
-  str::from_utf8(s)
-}
-
-named!(key_value    <&[u8],(&str,&str)>,
-  do_parse!(
-     key: map_res!(alphanumeric, complete_byte_slice_to_str)
-  >>      opt!(space)
-  >>      char!('=')
-  >>      opt!(space)
-  >> val: map_res!(
-           take_while!(call!(|c| c != b'\n' && c != b';')),
-           complete_byte_slice_to_str
-         )
-  >>      opt!(pair!(char!(';'), take_while!(call!(|c| c != b'\n'))))
-  >>      (key, val)
-  )
-);
-
-named!(keys_and_values<&[u8], HashMap<&str, &str> >,
-  map!(
-    many0!(terminated!(key_value, opt!(multispace))),
-    |vec: Vec<_>| vec.into_iter().collect()
-  )
-);
-
-named!(category_and_keys<&[u8],(&str,HashMap<&str,&str>)>,
-  do_parse!(
-    category: category         >>
-              opt!(multispace) >>
-    keys: keys_and_values      >>
-    (category, keys)
-  )
-);
-
-named!(categories<&[u8], HashMap<&str, HashMap<&str,&str> > >,
-  map!(
-    many0!(
-      separated_pair!(
-        category,
-        opt!(multispace),
-        map!(
-          many0!(terminated!(key_value, opt!(multispace))),
-          |vec: Vec<_>| vec.into_iter().collect()
-        )
-      )
-    ),
-    |vec: Vec<_>| vec.into_iter().collect()
-  )
-);
-
-#[test]
-fn parse_category_test() {
-  let ini_file = &b"[category]
-
-parameter=value
-key = value2"[..];
-
-  let ini_without_category = &b"\n\nparameter=value
-key = value2"[..];
-
-  let res = category(ini_file);
-  println!("{:?}", res);
-  match res {
-    Ok((i, o)) => println!("i: {:?} | o: {:?}", str::from_utf8(i), o),
-    _ => println!("error"),
-  }
-
-  assert_eq!(res, Ok((ini_without_category, "category")));
-}
-
-#[test]
-fn parse_key_value_test() {
-  let ini_file = &b"parameter=value
-key = value2"[..];
-
-  let ini_without_key_value = &b"\nkey = value2"[..];
-
-  let res = key_value(ini_file);
-  println!("{:?}", res);
-  match res {
-    Ok((i, (o1, o2))) => println!("i: {:?} | o: ({:?},{:?})", str::from_utf8(i), o1, o2),
-    _ => println!("error"),
-  }
-
-  assert_eq!(res, Ok((ini_without_key_value, ("parameter", "value"))));
-}
-
-#[test]
-fn parse_key_value_with_space_test() {
-  let ini_file = &b"parameter = value
-key = value2"[..];
-
-  let ini_without_key_value = &b"\nkey = value2"[..];
-
-  let res = key_value(ini_file);
-  println!("{:?}", res);
-  match res {
-    Ok((i, (o1, o2))) => println!("i: {:?} | o: ({:?},{:?})", str::from_utf8(i), o1, o2),
-    _ => println!("error"),
-  }
-
-  assert_eq!(res, Ok((ini_without_key_value, ("parameter", "value"))));
-}
-
-#[test]
-fn parse_key_value_with_comment_test() {
-  let ini_file = &b"parameter=value;abc
-key = value2"[..];
-
-  let ini_without_key_value = &b"\nkey = value2"[..];
-
-  let res = key_value(ini_file);
-  println!("{:?}", res);
-  match res {
-    Ok((i, (o1, o2))) => println!("i: {:?} | o: ({:?},{:?})", str::from_utf8(i.0), o1, o2),
-    _ => println!("error"),
-  }
-
-  assert_eq!(res, Ok((ini_without_key_value, ("parameter", "value"))));
-}
-
-#[test]
-fn parse_multiple_keys_and_values_test() {
-  let ini_file = &b"parameter=value;abc
-
-key = value2
-
-[category]"[..];
-
-  let ini_without_key_value = &b"[category]"[..];
-
-  let res = keys_and_values(ini_file);
-  println!("{:?}", res);
-  match res {
-    Ok((i, ref o)) => println!("i: {:?} | o: {:?}", str::from_utf8(i), o),
-    _ => println!("error"),
-  }
-
-  let mut expected: HashMap<&str, &str> = HashMap::new();
-  expected.insert("parameter", "value");
-  expected.insert("key", "value2");
-  assert_eq!(res, Ok((ini_without_key_value, expected)));
-}
-
-#[test]
-fn parse_category_then_multiple_keys_and_values_test() {
-  //FIXME: there can be an empty line or a comment line after a category
-  let ini_file = &b"[abcd]
-parameter=value;abc
-
-key = value2
-
-[category]"[..];
-
-  let ini_after_parser = &b"[category]"[..];
-
-  let res = category_and_keys(ini_file);
-  println!("{:?}", res);
-  match res {
-    Ok((i, ref o)) => println!("i: {:?} | o: {:?}", str::from_utf8(i), o),
-    _ => println!("error"),
-  }
-
-  let mut expected_h: HashMap<&str, &str> = HashMap::new();
-  expected_h.insert("parameter", "value");
-  expected_h.insert("key", "value2");
-  assert_eq!(res, Ok((ini_after_parser, ("abcd", expected_h))));
-}
-
-#[test]
-fn parse_multiple_categories_test() {
-  let ini_file = &b"[abcd]
-
-parameter=value;abc
-
-key = value2
-
-[category]
-parameter3=value3
-key4 = value4
-"[..];
-
-  let ini_after_parser = &b""[..];
-
-  let res = categories(ini_file);
-  //println!("{:?}", res);
-  match res {
-    Ok((i, ref o)) => println!("i: {:?} | o: {:?}", str::from_utf8(i), o),
-    _ => println!("error"),
-  }
-
-  let mut expected_1: HashMap<&str, &str> = HashMap::new();
-  expected_1.insert("parameter", "value");
-  expected_1.insert("key", "value2");
-  let mut expected_2: HashMap<&str, &str> = HashMap::new();
-  expected_2.insert("parameter3", "value3");
-  expected_2.insert("key4", "value4");
-  let mut expected_h: HashMap<&str, HashMap<&str, &str>> = HashMap::new();
-  expected_h.insert("abcd", expected_1);
-  expected_h.insert("category", expected_2);
-  assert_eq!(res, Ok((ini_after_parser, expected_h)));
-}
-
-fn bench_ini_complete(c: &mut Criterion) {
-  let s = "[owner]
-name=John Doe
-organization=Acme Widgets Inc.
-
-[database]
-server=192.0.2.62
-port=143
-file=payroll.dat
-";
-
-  c.bench(
-    "bench ini complete",
-    Benchmark::new("parse", move |b| {
-      b.iter(|| categories(s.as_bytes()).unwrap());
-    })
-    .throughput(Throughput::Bytes(s.len() as u64)),
-  );
-}
-
-fn bench_ini_complete_keys_and_values(c: &mut Criterion) {
-  let s = "server=192.0.2.62
-port=143
-file=payroll.dat
-";
-
-  named!(acc<&[u8], Vec<(&str,&str)> >, many0!(key_value));
-
-  c.bench(
-    "bench ini complete keys and values",
-    Benchmark::new("parse", move |b| {
-      b.iter(|| acc(s.as_bytes()).unwrap());
-    })
-    .throughput(Throughput::Bytes(s.len() as u64)),
-  );
-}
-
-fn bench_ini_complete_key_value(c: &mut Criterion) {
-  let s = "server=192.0.2.62\n";
-
-  c.bench(
-    "bench ini complete key value",
-    Benchmark::new("parse", move |b| {
-      b.iter(|| key_value(s.as_bytes()).unwrap());
-    })
-    .throughput(Throughput::Bytes(s.len() as u64)),
-  );
-}
-
-criterion_group!(
-  benches,
-  bench_ini_complete,
-  bench_ini_complete_keys_and_values,
-  bench_ini_complete_key_value
-);
-criterion_main!(benches);
diff --git a/benches/ini_str.rs b/benches/ini_str.rs
index 456dc55..044f679 100644
--- a/benches/ini_str.rs
+++ b/benches/ini_str.rs
@@ -1,18 +1,17 @@
-#[macro_use]
-extern crate nom;
 extern crate criterion;
 extern crate jemallocator;
 
-use criterion::*;
-
 #[global_allocator]
 static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
 
+use criterion::*;
+
 use nom::{
-  bytes::complete::{is_a, take_while},
+  bytes::complete::{is_a, tag, take_till, take_while},
   character::complete::{alphanumeric1 as alphanumeric, char, not_line_ending, space0 as space},
   combinator::opt,
-  sequence::{delimited, terminated},
+  multi::many0,
+  sequence::{delimited, pair, terminated, tuple},
   IResult,
 };
 
@@ -33,21 +32,19 @@ fn category(i: &str) -> IResult<&str, &str> {
   )(i)
 }
 
-named!(key_value    <&str,(&str,&str)>,
-  do_parse!(
-    key: alphanumeric                              >>
-         opt!(space)                               >>
-         tag!("=")                               >>
-         opt!(space)                               >>
-    val: take_till!(is_line_ending_or_comment)   >>
-         opt!(space)                               >>
-         opt!(pair!(tag!(";"), not_line_ending)) >>
-         opt!(space_or_line_ending)                >>
-    (key, val)
-  )
-);
-
-named!(keys_and_values_aggregator<&str, Vec<(&str, &str)> >, many0!(key_value));
+fn key_value(i: &str) -> IResult<&str, (&str, &str)> {
+  let (i, key) = alphanumeric(i)?;
+  let (i, _) = tuple((opt(space), tag("="), opt(space)))(i)?;
+  let (i, val) = take_till(is_line_ending_or_comment)(i)?;
+  let (i, _) = opt(space)(i)?;
+  let (i, _) = opt(pair(tag(";"), not_line_ending))(i)?;
+  let (i, _) = opt(space_or_line_ending)(i)?;
+  Ok((i, (key, val)))
+}
+
+fn keys_and_values_aggregator(i: &str) -> IResult<&str, Vec<(&str, &str)>> {
+  many0(key_value)(i)
+}
 
 fn keys_and_values(input: &str) -> IResult<&str, HashMap<&str, &str>> {
   match keys_and_values_aggregator(input) {
@@ -56,11 +53,13 @@ fn keys_and_values(input: &str) -> IResult<&str, HashMap<&str, &str>> {
   }
 }
 
-named!(category_and_keys<&str,(&str,HashMap<&str,&str>)>,
-  pair!(category, keys_and_values)
-);
+fn category_and_keys(i: &str) -> IResult<&str, (&str, HashMap<&str, &str>)> {
+  pair(category, keys_and_values)(i)
+}
 
-named!(categories_aggregator<&str, Vec<(&str, HashMap<&str,&str>)> >, many0!(category_and_keys));
+fn categories_aggregator(i: &str) -> IResult<&str, Vec<(&str, HashMap<&str, &str>)>> {
+  many0(category_and_keys)(i)
+}
 
 fn categories(input: &str) -> IResult<&str, HashMap<&str, HashMap<&str, &str>>> {
   match categories_aggregator(input) {
@@ -69,157 +68,6 @@ fn categories(input: &str) -> IResult<&str, HashMap<&str, HashMap<&str, &str>>>
   }
 }
 
-#[test]
-fn parse_category_test() {
-  let ini_file = "[category]
-
-parameter=value
-key = value2";
-
-  let ini_without_category = "parameter=value
-key = value2";
-
-  let res = category(ini_file);
-  println!("{:?}", res);
-  match res {
-    Ok((i, o)) => println!("i: {} | o: {:?}", i.0, o),
-    _ => println!("error"),
-  }
-
-  assert_eq!(res, Ok((ini_without_category, "category")));
-}
-
-#[test]
-fn parse_key_value_test() {
-  let ini_file = "parameter=value
-key = value2";
-
-  let ini_without_key_value = "key = value2";
-
-  let res = key_value(ini_file);
-  println!("{:?}", res);
-  match res {
-    Ok((i, (o1, o2))) => println!("i: {} | o: ({:?},{:?})", i.0, o1, o2),
-    _ => println!("error"),
-  }
-
-  assert_eq!(res, Ok((ini_without_key_value, ("parameter", "value"))));
-}
-
-#[test]
-fn parse_key_value_with_space_test() {
-  let ini_file = "parameter = value
-key = value2";
-
-  let ini_without_key_value = "key = value2";
-
-  let res = key_value(ini_file);
-  println!("{:?}", res);
-  match res {
-    Ok((i, (o1, o2))) => println!("i: {} | o: ({:?},{:?})", i.0, o1, o2),
-    _ => println!("error"),
-  }
-
-  assert_eq!(res, Ok((ini_without_key_value, ("parameter", "value"))));
-}
-
-#[test]
-fn parse_key_value_with_comment_test() {
-  let ini_file = "parameter=value;abc
-key = value2";
-
-  let ini_without_key_value = "key = value2";
-
-  let res = key_value(ini_file);
-  println!("{:?}", res);
-  match res {
-    Ok((i, (o1, o2))) => println!("i: {} | o: ({:?},{:?})", i.0, o1, o2),
-    _ => println!("error"),
-  }
-
-  assert_eq!(res, Ok((ini_without_key_value, ("parameter", "value"))));
-}
-
-#[test]
-fn parse_multiple_keys_and_values_test() {
-  let ini_file = "parameter=value;abc
-
-key = value2
-
-[category]";
-
-  let ini_without_key_value = "[category]";
-
-  let res = keys_and_values(ini_file);
-  println!("{:?}", res);
-  match res {
-    Ok((i, ref o)) => println!("i: {} | o: {:?}", i.0, o),
-    _ => println!("error"),
-  }
-
-  let mut expected: HashMap<&str, &str> = HashMap::new();
-  expected.insert("parameter", "value");
-  expected.insert("key", "value2");
-  assert_eq!(res, Ok((ini_without_key_value, expected)));
-}
-
-#[test]
-fn parse_category_then_multiple_keys_and_values_test() {
-  //FIXME: there can be an empty line or a comment line after a category
-  let ini_file = "[abcd]
-parameter=value;abc
-
-key = value2
-
-[category]";
-
-  let ini_after_parser = "[category]";
-
-  let res = category_and_keys(ini_file);
-  println!("{:?}", res);
-  match res {
-    Ok((i, ref o)) => println!("i: {} | o: {:?}", i.0, o),
-    _ => println!("error"),
-  }
-
-  let mut expected_h: HashMap<&str, &str> = HashMap::new();
-  expected_h.insert("parameter", "value");
-  expected_h.insert("key", "value2");
-  assert_eq!(res, Ok((ini_after_parser, ("abcd", expected_h))));
-}
-
-#[test]
-fn parse_multiple_categories_test() {
-  let ini_file = "[abcd]
-
-parameter=value;abc
-
-key = value2
-
-[category]
-parameter3=value3
-key4 = value4
-";
-
-  let res = categories(ini_file);
-  //println!("{:?}", res);
-  match res {
-    Ok((i, ref o)) => println!("i: {} | o: {:?}", i.0, o),
-    _ => println!("error"),
-  }
-
-  let mut expected_1: HashMap<&str, &str> = HashMap::new();
-  expected_1.insert("parameter", "value");
-  expected_1.insert("key", "value2");
-  let mut expected_2: HashMap<&str, &str> = HashMap::new();
-  expected_2.insert("parameter3", "value3");
-  expected_2.insert("key4", "value4");
-  let mut expected_h: HashMap<&str, HashMap<&str, &str>> = HashMap::new();
-  expected_h.insert("abcd", expected_1);
-  expected_h.insert("category", expected_2);
-  assert_eq!(res, Ok(("", expected_h)));
-}
-
 fn bench_ini_str(c: &mut Criterion) {
   let s = "[owner]
 name=John Doe
@@ -231,13 +79,11 @@ port=143
 file=payroll.dat
 ";
 
-  c.bench(
-    "bench ini str",
-    Benchmark::new("parse", move |b| {
-      b.iter(|| categories(s).unwrap());
-    })
-    .throughput(Throughput::Bytes(s.len() as u64)),
-  );
+  let mut group = c.benchmark_group("ini str");
+  group.throughput(Throughput::Bytes(s.len() as u64));
+  group.bench_function(BenchmarkId::new("parse", s.len()), |b| {
+    b.iter(|| categories(s).unwrap())
+  });
 }
 
 criterion_group!(benches, bench_ini_str);
diff --git a/src/bits/complete.rs b/src/bits/complete.rs
index 0b2f6f6..e9ad81a 100644
--- a/src/bits/complete.rs
+++ b/src/bits/complete.rs
@@ -142,6 +142,9 @@ mod test {
 
     let result: crate::IResult<(&[u8], usize), usize> = take(24usize)((input, 4));
 
-    assert_eq!(result, Ok((([0b11111111].as_ref(), 4), 0b1000110100111111111111)));
+    assert_eq!(
+      result,
+      Ok((([0b11111111].as_ref(), 4), 0b1000110100111111111111))
+    );
   }
 }
diff --git a/src/bits/macros.rs b/src/bits/macros.rs
deleted file mode 100644
index d39f457..0000000
--- a/src/bits/macros.rs
+++ /dev/null
@@ -1,265 +0,0 @@
-//! Bit level parsers and combinators
-//!
-//! Bit parsing is handled by tweaking the input in most macros.
-//! In byte level parsing, the input is generally a `&[u8]` passed from combinator
-//! to combinator as the slices are manipulated.
-//!
-//! Bit parsers take a `(&[u8], usize)` as input. The first part of the tuple is a byte slice,
-//! the second part is a bit offset in the first byte of the slice.
-//!
-//! By passing a pair like this, we can leverage most of the existing combinators, and avoid
-//! transforming the whole slice to a vector of booleans. This should make it easy
-//! to see a byte slice as a bit stream, and parse code points of arbitrary bit length.
-//!
-
-/// Transforms its byte slice input into a bit stream for the underlying parser. This allows the
-/// given bit stream parser to work on a byte slice input.
-///
-/// Signature:
-/// `bits!( parser ) => ( &[u8], (&[u8], usize) -> IResult<(&[u8], usize), T> ) -> IResult<&[u8], T>`
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err, Needed};
-/// # fn main() {
-///  named!( take_4_bits<u8>, bits!( take_bits!( 4u8 ) ) );
-///
-///  let input = vec![0xAB, 0xCD, 0xEF, 0x12];
-///  let sl    = &input[..];
-///
-///  assert_eq!(take_4_bits( sl ), Ok( (&sl[1..], 0xA) ));
-///  assert_eq!(take_4_bits( &b""[..] ), Err(Err::Incomplete(Needed::new(1))));
-/// # }
-#[macro_export(local_inner_macros)]
-macro_rules! bits (
-  ($i:expr, $submac:ident!( $($args:tt)* )) => ({
-    $crate::bits::bitsc($i, move |i| { $submac!(i, $($args)*) })
-  });
-  ($i:expr, $f:expr) => (
-    bits!($i, call!($f))
-  );
-);
-
-/// Counterpart to `bits`, `bytes!` transforms its bit stream input into a byte slice for the underlying
-/// parser, allowing byte-slice parsers to work on bit streams.
-///
-/// Signature:
-/// `bytes!( parser ) => ( (&[u8], usize), &[u8] -> IResult<&[u8], T> ) -> IResult<(&[u8], usize), T>`,
-///
-/// A partial byte remaining in the input will be ignored and the given parser will start parsing
-/// at the next full byte.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::combinator::rest;
-/// # use nom::error::{Error, ErrorKind};
-/// # fn main() {
-///
-/// named!( parse<(u8, u8, &[u8])>,  bits!( tuple!(
-///    take_bits!(4u8),
-///    take_bits!(8u8),
-///    bytes!(rest::<_, Error<_>>)
-/// )));
-///
-///  let input = &[0xde, 0xad, 0xbe, 0xaf];
-///
-///  assert_eq!(parse( input ), Ok(( &[][..], (0xd, 0xea, &[0xbe, 0xaf][..]) )));
-/// # }
-#[macro_export(local_inner_macros)]
-macro_rules! bytes (
-  ($i:expr, $submac:ident!( $($args:tt)* )) => ({
-    $crate::bits::bytesc($i, move |i| { $submac!(i, $($args)*) })
-  });
-  ($i:expr, $f:expr) => (
-    bytes!($i, call!($f))
-  );
-);
-
-/// Consumes the specified number of bits and returns them as the specified type.
-///
-/// Signature:
-/// `take_bits!(type, count) => ( (&[T], usize), U, usize) -> IResult<(&[T], usize), U>`
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-/// named!(bits_pair<(&[u8], usize), (u8, u8)>, pair!( take_bits!(4u8), take_bits!(4u8) ) );
-/// named!( take_pair<(u8, u8)>, bits!( bits_pair ) );
-///
-/// let input = vec![0xAB, 0xCD, 0xEF];
-/// let sl    = &input[..];
-///
-/// assert_eq!(take_pair( sl ),       Ok((&sl[1..], (0xA, 0xB))) );
-/// assert_eq!(take_pair( &sl[1..] ), Ok((&sl[2..], (0xC, 0xD))) );
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! take_bits (
-  ($i:expr, $count:expr) => (
-    {
-      let res: $crate::IResult<_, _> = $crate::bits::streaming::take($count)($i);
-      res
-    }
-  );
-);
-
-/// Matches the given bit pattern.
-///
-/// Signature:
-/// `tag_bits!(type, count, pattern) => ( (&[T], usize), U, usize, U) -> IResult<(&[T], usize), U>`
-///
-/// The caller must specify the number of bits to consume. The matched value is included in the
-/// result on success.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!( take_a<u8>, bits!( tag_bits!(4usize, 0xA) ) );
-///
-///  let input = vec![0xAB, 0xCD, 0xEF];
-///  let sl    = &input[..];
-///
-///  assert_eq!(take_a( sl ),       Ok((&sl[1..], 0xA)) );
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! tag_bits (
-  ($i:expr, $count:expr, $p: expr) => (
-    {
-      let res: $crate::IResult<_, _> = $crate::bits::streaming::tag($p, $count)($i);
-      res
-    }
-  )
-);
-
-#[cfg(test)]
-mod tests {
-  use crate::error::ErrorKind;
-  use crate::internal::{Err, IResult, Needed};
-  use crate::lib::std::ops::{AddAssign, Shl, Shr};
-
-  #[test]
-  fn take_bits() {
-    let input = [0b10_10_10_10, 0b11_11_00_00, 0b00_11_00_11];
-    let sl = &input[..];
-
-    assert_eq!(take_bits!((sl, 0), 0u8), Ok(((sl, 0), 0)));
-    assert_eq!(take_bits!((sl, 0), 8u8), Ok(((&sl[1..], 0), 170)));
-    assert_eq!(take_bits!((sl, 0), 3u8), Ok(((&sl[0..], 3), 5)));
-    assert_eq!(take_bits!((sl, 0), 6u8), Ok(((&sl[0..], 6), 42)));
-    assert_eq!(take_bits!((sl, 1), 1u8), Ok(((&sl[0..], 2), 0)));
-    assert_eq!(take_bits!((sl, 1), 2u8), Ok(((&sl[0..], 3), 1)));
-    assert_eq!(take_bits!((sl, 1), 3u8), Ok(((&sl[0..], 4), 2)));
-    assert_eq!(take_bits!((sl, 6), 3u8), Ok(((&sl[1..], 1), 5)));
-    assert_eq!(take_bits!((sl, 0), 10u8), Ok(((&sl[1..], 2), 683)));
-    assert_eq!(take_bits!((sl, 0), 8u8), Ok(((&sl[1..], 0), 170)));
-    assert_eq!(take_bits!((sl, 6), 10u8), Ok(((&sl[2..], 0), 752)));
-    assert_eq!(take_bits!((sl, 6), 11u8), Ok(((&sl[2..], 1), 1504)));
-    assert_eq!(take_bits!((sl, 0), 20u8), Ok(((&sl[2..], 4), 700_163)));
-    assert_eq!(take_bits!((sl, 4), 20u8), Ok(((&sl[3..], 0), 716_851)));
-    let r: IResult<_, u32> = take_bits!((sl, 4), 22u8);
-    assert_eq!(r, Err(Err::Incomplete(Needed::new(22))));
-  }
-
-  #[test]
-  fn tag_bits() {
-    let input = [0b10_10_10_10, 0b11_11_00_00, 0b00_11_00_11];
-    let sl = &input[..];
-
-    assert_eq!(tag_bits!((sl, 0), 3u8, 0b101), Ok(((&sl[0..], 3), 5)));
-    assert_eq!(tag_bits!((sl, 0), 4u8, 0b1010), Ok(((&sl[0..], 4), 10)));
-  }
-
-  named!(ch<(&[u8],usize),(u8,u8)>,
-    do_parse!(
-      tag_bits!(3u8, 0b101) >>
-      x: take_bits!(4u8)    >>
-      y: take_bits!(5u8)    >>
-      (x,y)
-    )
-  );
-
-  #[test]
-  fn chain_bits() {
-    let input = [0b10_10_10_10, 0b11_11_00_00, 0b00_11_00_11];
-    let sl = &input[..];
-    assert_eq!(ch((&input[..], 0)), Ok(((&sl[1..], 4), (5, 15))));
-    assert_eq!(ch((&input[..], 4)), Ok(((&sl[2..], 0), (7, 16))));
-    assert_eq!(ch((&input[..1], 0)), Err(Err::Incomplete(Needed::new(5))));
-  }
-
-  named!(ch_bytes<(u8, u8)>, bits!(ch));
-  #[test]
-  fn bits_to_bytes() {
-    let input = [0b10_10_10_10, 0b11_11_00_00, 0b00_11_00_11];
-    assert_eq!(ch_bytes(&input[..]), Ok((&input[2..], (5, 15))));
-    assert_eq!(ch_bytes(&input[..1]), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(
-      ch_bytes(&input[1..]),
-      Err(Err::Error(error_position!(&input[1..], ErrorKind::TagBits)))
-    );
-  }
-
-  named!(
-    bits_bytes_bs,
-    bits!(bytes!(
-      crate::combinator::rest::<_, crate::error::Error<&[u8]>>
-    ))
-  );
-  #[test]
-  fn bits_bytes() {
-    let input = [0b10_10_10_10];
-    assert_eq!(
-      bits_bytes_bs(&input[..]),
-      Ok((&[][..], &[0b10_10_10_10][..]))
-    );
-  }
-
-  #[derive(PartialEq, Debug)]
-  struct FakeUint(u32);
-
-  impl AddAssign for FakeUint {
-    fn add_assign(&mut self, other: FakeUint) {
-      *self = FakeUint(self.0 + other.0);
-    }
-  }
-
-  impl Shr<usize> for FakeUint {
-    type Output = FakeUint;
-
-    fn shr(self, shift: usize) -> FakeUint {
-      FakeUint(self.0 >> shift)
-    }
-  }
-
-  impl Shl<usize> for FakeUint {
-    type Output = FakeUint;
-
-    fn shl(self, shift: usize) -> FakeUint {
-      FakeUint(self.0 << shift)
-    }
-  }
-
-  impl From<u8> for FakeUint {
-    fn from(i: u8) -> FakeUint {
-      FakeUint(u32::from(i))
-    }
-  }
-
-  #[test]
-  fn non_privitive_type() {
-    let input = [0b10_10_10_10, 0b11_11_00_00, 0b00_11_00_11];
-    let sl = &input[..];
-
-    assert_eq!(
-      take_bits!((sl, 0), 20u8),
-      Ok(((&sl[2..], 4), FakeUint(700_163)))
-    );
-    assert_eq!(
-      take_bits!((sl, 4), 20u8),
-      Ok(((&sl[3..], 0), FakeUint(716_851)))
-    );
-    let r3: IResult<_, FakeUint> = take_bits!((sl, 4), 22u8);
-    assert_eq!(r3, Err(Err::Incomplete(Needed::new(22))));
-  }
-}
diff --git a/src/bits/mod.rs b/src/bits/mod.rs
index c5d1ac7..235b797 100644
--- a/src/bits/mod.rs
+++ b/src/bits/mod.rs
@@ -1,9 +1,6 @@
 //! Bit level parsers
 //!
 
-#[macro_use]
-mod macros;
-
 pub mod complete;
 pub mod streaming;
 
@@ -61,18 +58,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn bitsc<I, O, E1: ParseError<(I, usize)> + ErrorConvert<E2>, E2: ParseError<I>, P>(
-  input: I,
-  parser: P,
-) -> IResult<I, O, E2>
-where
-  I: Slice<RangeFrom<usize>>,
-  P: FnMut((I, usize)) -> IResult<(I, usize), O, E1>,
-{
-  bits(parser)(input)
-}
-
 /// Counterpart to `bits`, `bytes` transforms its bit stream input into a byte slice for the underlying
 /// parser, allowing byte-slice parsers to work on bit streams.
 ///
@@ -125,18 +110,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn bytesc<I, O, E1: ParseError<I> + ErrorConvert<E2>, E2: ParseError<(I, usize)>, P>(
-  input: (I, usize),
-  parser: P,
-) -> IResult<(I, usize), O, E2>
-where
-  I: Slice<RangeFrom<usize>> + Clone,
-  P: FnMut(I) -> IResult<I, O, E1>,
-{
-  bytes(parser)(input)
-}
-
 #[cfg(test)]
 mod test {
   use super::*;
diff --git a/src/branch/mod.rs b/src/branch/mod.rs
index fcb4df1..902d4e8 100644
--- a/src/branch/mod.rs
+++ b/src/branch/mod.rs
@@ -1,10 +1,5 @@
 //! Choice combinators
 
-//#[macro_use]
-//mod macros;
-
-#[doc(hidden)]
-#[macro_export(local_inner_macros)]
 macro_rules! succ (
   (0, $submac:ident ! ($($rest:tt)*)) => ($submac!(1, $($rest)*));
   (1, $submac:ident ! ($($rest:tt)*)) => ($submac!(2, $($rest)*));
diff --git a/src/bytes/complete.rs b/src/bytes/complete.rs
index 37824da..892edc4 100644
--- a/src/bytes/complete.rs
+++ b/src/bytes/complete.rs
@@ -543,29 +543,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn escapedc<Input, Error, F, G, O1, O2>(
-  i: Input,
-  normal: F,
-  control_char: char,
-  escapable: G,
-) -> IResult<Input, Input, Error>
-where
-  Input: Clone
-    + crate::traits::Offset
-    + InputLength
-    + InputTake
-    + InputTakeAtPosition
-    + Slice<RangeFrom<usize>>
-    + InputIter,
-  <Input as InputIter>::Item: crate::traits::AsChar,
-  F: Fn(Input) -> IResult<Input, O1, Error>,
-  G: Fn(Input) -> IResult<Input, O2, Error>,
-  Error: ParseError<Input>,
-{
-  escaped(normal, control_char, escapable)(i)
-}
-
 /// Matches a byte string with escaped characters.
 ///
 /// * The first argument matches the normal characters (it must not match the control character)
@@ -681,34 +658,6 @@ where
   }
 }
 
-#[doc(hidden)]
-#[cfg(feature = "alloc")]
-#[cfg_attr(feature = "docsrs", doc(cfg(feature = "alloc")))]
-pub fn escaped_transformc<Input, Error, F, G, O1, O2, ExtendItem, Output>(
-  i: Input,
-  normal: F,
-  control_char: char,
-  transform: G,
-) -> IResult<Input, Output, Error>
-where
-  Input: Clone
-    + crate::traits::Offset
-    + InputLength
-    + InputTake
-    + InputTakeAtPosition
-    + Slice<RangeFrom<usize>>
-    + InputIter,
-  Input: crate::traits::ExtendInto<Item = ExtendItem, Extender = Output>,
-  O1: crate::traits::ExtendInto<Item = ExtendItem, Extender = Output>,
-  O2: crate::traits::ExtendInto<Item = ExtendItem, Extender = Output>,
-  <Input as InputIter>::Item: crate::traits::AsChar,
-  F: Fn(Input) -> IResult<Input, O1, Error>,
-  G: Fn(Input) -> IResult<Input, O2, Error>,
-  Error: ParseError<Input>,
-{
-  escaped_transform(normal, control_char, transform)(i)
-}
-
 #[cfg(test)]
 mod tests {
   use super::*;
diff --git a/src/bytes/macros.rs b/src/bytes/macros.rs
deleted file mode 100644
index 17719f9..0000000
--- a/src/bytes/macros.rs
+++ /dev/null
@@ -1,1000 +0,0 @@
-//! Byte level parsers and combinators
-//!
-#[allow(unused_variables)]
-
-/// `tag!(&[T]: nom::AsBytes) => &[T] -> IResult<&[T], &[T]>`
-/// declares a byte array as a suite to recognize.
-///
-/// Consumes the recognized characters.
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!(x, tag!("abcd"));
-///  let r = x(&b"abcdefgh"[..]);
-///  assert_eq!(r, Ok((&b"efgh"[..], &b"abcd"[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! tag (
-  ($i:expr, $tag: expr) => ({
-    $crate::bytes::streaming::tag($tag)($i)
-  });
-);
-
-/// `tag_no_case!(&[T]) => &[T] -> IResult<&[T], &[T]>`
-/// declares a case insensitive ascii string as a suite to recognize.
-///
-/// Consumes the recognized characters.
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!(test, tag_no_case!("ABcd"));
-///
-///  let r = test(&b"aBCdefgh"[..]);
-///  assert_eq!(r, Ok((&b"efgh"[..], &b"aBCd"[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! tag_no_case (
-  ($i:expr, $tag: expr) => ({
-    $crate::bytes::streaming::tag_no_case($tag)($i)
-  });
-);
-
-/// `is_not!(&[T:AsBytes]) => &[T] -> IResult<&[T], &[T]>`
-/// returns the longest list of bytes that do not appear in the provided array.
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!( not_space, is_not!( " \t\r\n" ) );
-///
-///  let r = not_space(&b"abcdefgh\nijkl"[..]);
-///  assert_eq!(r, Ok((&b"\nijkl"[..], &b"abcdefgh"[..])));
-///  # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! is_not (
-  ($input:expr, $arr:expr) => ({
-    $crate::bytes::streaming::is_not($arr)($input)
-  });
-);
-
-/// `is_a!(&[T]) => &[T] -> IResult<&[T], &[T]>`
-/// returns the longest list of bytes that appear in the provided array.
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!(abcd, is_a!( "abcd" ));
-///
-///  let r1 = abcd(&b"aaaaefgh"[..]);
-///  assert_eq!(r1, Ok((&b"efgh"[..], &b"aaaa"[..])));
-///
-///  let r2 = abcd(&b"dcbaefgh"[..]);
-///  assert_eq!(r2, Ok((&b"efgh"[..], &b"dcba"[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! is_a (
-  ($input:expr, $arr:expr) => ({
-    $crate::bytes::streaming::is_a($arr)($input)
-  });
-);
-
-/// `escaped!(T -> IResult<T, T>, U, T -> IResult<T, T>) => T -> IResult<T, T> where T: InputIter,
-/// U: AsChar`
-/// matches a byte string with escaped characters.
-///
-/// * The first argument matches the normal characters (it must not accept the control character)
-/// * The second argument is the control character (like `\` in most languages)
-/// * The third argument matches the escaped characters
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::character::complete::digit1;
-/// # fn main() {
-///  named!(esc, escaped!(call!(digit1), '\\', one_of!("\"n\\")));
-///  assert_eq!(esc(&b"123;"[..]), Ok((&b";"[..], &b"123"[..])));
-///  assert_eq!(esc(&b"12\\\"34;"[..]), Ok((&b";"[..], &b"12\\\"34"[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! escaped (
-  ($i:expr, $submac1:ident!( $($args:tt)* ), $control_char: expr, $submac2:ident!( $($args2:tt)*) ) => (
-    {
-     escaped!($i, |i| $submac1!(i, $($args)*), $control_char,  |i| $submac2!(i, $($args2)*))
-    }
-  );
-  ($i:expr, $normal:expr, $control_char: expr, $submac2:ident!( $($args2:tt)*) ) => (
-    {
-     escaped!($i, $normal, $control_char,  |i| $submac2!(i, $($args2)*))
-    }
-  );
-  ($i:expr, $submac1:ident!( $($args:tt)* ), $control_char: expr, $escapable:expr ) => (
-    {
-     escaped!($i, |i| $submac1!(i, $($args)*), $control_char,  $escapable)
-    }
-  );
-  ($i:expr, $normal:expr, $control_char: expr, $escapable:expr) => (
-    {
-      $crate::bytes::complete::escapedc($i, $normal, $control_char, $escapable)
-    }
-  );
-);
-
-/// `escaped_transform!(&[T] -> IResult<&[T], &[T]>, T, &[T] -> IResult<&[T], &[T]>) => &[T] -> IResult<&[T], Vec<T>>`
-/// matches a byte string with escaped characters.
-///
-/// * The first argument matches the normal characters (it must not match the control character)
-/// * The second argument is the control character (like `\` in most languages)
-/// * The third argument matches the escaped characters and transforms them
-///
-/// As an example, the chain `abc\tdef` could be `abc    def` (it also consumes the control character).
-/// # Example
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::character::complete::alpha1;
-/// # use nom::lib::std::str::from_utf8;
-/// # fn main() {
-/// fn to_s(i:Vec<u8>) -> String {
-///   String::from_utf8_lossy(&i).into_owned()
-/// }
-///
-///  named!(transform < String >,
-///    map!(
-///      escaped_transform!(call!(alpha1), '\\',
-///        alt!(
-///            tag!("\\")       => { |_| &b"\\"[..] }
-///          | tag!("\"")       => { |_| &b"\""[..] }
-///          | tag!("n")        => { |_| &b"\n"[..] }
-///        )
-///      ), to_s
-///    )
-///  );
-///  assert_eq!(transform(&b"ab\\\"cd"[..]), Ok((&b""[..], String::from("ab\"cd"))));
-/// # }
-/// ```
-#[cfg(feature = "alloc")]
-#[cfg_attr(feature = "docsrs", doc(cfg(feature = "alloc")))]
-#[macro_export(local_inner_macros)]
-macro_rules! escaped_transform (
-  ($i:expr, $submac1:ident!( $($args:tt)* ), $control_char: expr, $submac2:ident!( $($args2:tt)*) ) => (
-    {
-     escaped_transform!($i, |i| $submac1!(i, $($args)*), $control_char,  |i| $submac2!(i, $($args2)*))
-    }
-  );
-  ($i:expr, $normal:expr, $control_char: expr, $submac2:ident!( $($args2:tt)*) ) => (
-    {
-     escaped_transform!($i, $normal, $control_char,  |i| $submac2!(i, $($args2)*))
-    }
-  );
-  ($i:expr, $submac1:ident!( $($args:tt)* ), $control_char: expr, $transform:expr ) => (
-    {
-     escaped_transform!($i, |i| $submac1!(i, $($args)*), $control_char,  $transform)
-    }
-  );
-  ($i:expr, $normal:expr, $control_char: expr, $transform:expr) => (
-    {
-      $crate::bytes::complete::escaped_transformc($i, $normal, $control_char, $transform)
-    }
-  );
-);
-
-/// `take_while!(T -> bool) => &[T] -> IResult<&[T], &[T]>`
-/// returns the longest list of bytes until the provided function fails.
-///
-/// The argument is either a function `T -> bool` or a macro returning a `bool`.
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::character::is_alphanumeric;
-/// # fn main() {
-///  named!( alpha, take_while!( is_alphanumeric ) );
-///
-///  let r = alpha(&b"abcd\nefgh"[..]);
-///  assert_eq!(r, Ok((&b"\nefgh"[..], &b"abcd"[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! take_while (
-  ($input:expr, $submac:ident!( $($args:tt)* )) => ({
-    let res: $crate::IResult<_, _, _> = take_while!($input, (|c| $submac!(c, $($args)*)));
-    res
-  });
-  ($input:expr, $f:expr) => (
-    $crate::bytes::streaming::take_while($f)($input)
-  );
-);
-
-/// `take_while1!(T -> bool) => &[T] -> IResult<&[T], &[T]>`
-/// returns the longest (non empty) list of bytes until the provided function fails.
-///
-/// The argument is either a function `&[T] -> bool` or a macro returning a `bool`.
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err,error::ErrorKind};
-/// # use nom::character::is_alphanumeric;
-/// # fn main() {
-///  named!( alpha, take_while1!( is_alphanumeric ) );
-///
-///  let r = alpha(&b"abcd\nefgh"[..]);
-///  assert_eq!(r, Ok((&b"\nefgh"[..], &b"abcd"[..])));
-///  let r = alpha(&b"\nefgh"[..]);
-///  assert_eq!(r, Err(Err::Error(error_position!(&b"\nefgh"[..], ErrorKind::TakeWhile1))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! take_while1 (
-  ($input:expr, $submac:ident!( $($args:tt)* )) => ({
-    let res: $crate::IResult<_, _, _> = take_while1!($input, (|c| $submac!(c, $($args)*)));
-    res
-  });
-  ($input:expr, $f:expr) => (
-    $crate::bytes::streaming::take_while1($f)($input)
-  );
-);
-
-/// `take_while_m_n!(m: usize, n: usize, T -> bool) => &[T] -> IResult<&[T], &[T]>`
-/// returns a list of bytes or characters for which the provided function returns true.
-/// The returned list's size will be at least m, and at most n.
-///
-/// The argument is either a function `T -> bool` or a macro returning a `bool`.
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::character::is_alphanumeric;
-/// # fn main() {
-///  named!( alpha, take_while_m_n!(3, 6, is_alphanumeric ) );
-///
-///  let r = alpha(&b"abcd\nefgh"[..]);
-///  assert_eq!(r, Ok((&b"\nefgh"[..], &b"abcd"[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! take_while_m_n (
-  ($input:expr, $m:expr, $n: expr, $submac:ident!( $($args:tt)* )) => ({
-    let res: $crate::IResult<_, _, _> = take_while_m_n!($input, $m, $n, (|c| $submac!(c, $($args)*)));
-    res
-  });
-  ($input:expr, $m:expr, $n:expr, $f:expr) => (
-    $crate::bytes::streaming::take_while_m_n($m, $n, $f)($input)
-  );
-);
-
-/// `take_till!(T -> bool) => &[T] -> IResult<&[T], &[T]>`
-/// returns the longest list of bytes until the provided function succeeds.
-///
-/// The argument is either a function `&[T] -> bool` or a macro returning a `bool`.
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!( till_colon, take_till!(|ch| ch == b':') );
-///
-///  let r = till_colon(&b"abcd:efgh"[..]);
-///  assert_eq!(r, Ok((&b":efgh"[..], &b"abcd"[..])));
-///  let r2 = till_colon(&b":abcdefgh"[..]); // empty match is allowed
-///  assert_eq!(r2, Ok((&b":abcdefgh"[..], &b""[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! take_till (
-  ($input:expr, $submac:ident!( $($args:tt)* )) => ({
-    let res: $crate::IResult<_, _, _> = take_till!($input, (|c| $submac!(c, $($args)*)));
-    res
-  });
-  ($input:expr, $f:expr) => (
-    $crate::bytes::streaming::take_till($f)($input)
-  );
-);
-
-/// `take_till1!(T -> bool) => &[T] -> IResult<&[T], &[T]>`
-/// returns the longest non empty list of bytes until the provided function succeeds.
-///
-/// The argument is either a function `&[T] -> bool` or a macro returning a `bool`.
-///
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err, error::ErrorKind};
-/// # fn main() {
-///  named!( till1_colon, take_till1!(|ch| ch == b':') );
-///
-///  let r = till1_colon(&b"abcd:efgh"[..]);
-///  assert_eq!(r, Ok((&b":efgh"[..], &b"abcd"[..])));
-///
-///  let r2 = till1_colon(&b":abcdefgh"[..]); // empty match is error
-///  assert_eq!(r2, Err(Err::Error(error_position!(&b":abcdefgh"[..], ErrorKind::TakeTill1))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! take_till1 (
-  ($input:expr, $submac:ident!( $($args:tt)* )) => ({
-    let res: $crate::IResult<_, _, _> = take_till1!($input, (|c| $submac!(c, $($args)*)));
-    res
-  });
-  ($input:expr, $f:expr) => (
-    $crate::bytes::streaming::take_till1($f)($input)
-  );
-);
-
-/// `take!(nb) => &[T] -> IResult<&[T], &[T]>`
-/// generates a parser consuming the specified number of bytes.
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  // Desmond parser
-///  named!(take5, take!( 5 ) );
-///
-///  let a = b"abcdefgh";
-///
-///  assert_eq!(take5(&a[..]), Ok((&b"fgh"[..], &b"abcde"[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! take (
-  ($i:expr, $count:expr) => ({
-    let c = $count as usize;
-    let res: $crate::IResult<_,_,_> = $crate::bytes::streaming::take(c)($i);
-    res
-  });
-);
-
-/// `take_str!(nb) => &[T] -> IResult<&[T], &str>`
-/// same as `take!` but returning a `&str`.
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!(take5( &[u8] ) -> &str, take_str!( 5 ) );
-///
-///  let a = b"abcdefgh";
-///
-///  assert_eq!(take5(&a[..]), Ok((&b"fgh"[..], "abcde")));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! take_str (
- ( $i:expr, $size:expr ) => (
-    {
-      let input: &[u8] = $i;
-
-      map_res!(input, take!($size), $crate::lib::std::str::from_utf8)
-    }
-  );
-);
-
-/// `take_until!(tag) => &[T] -> IResult<&[T], &[T]>`
-/// consumes data until it finds the specified tag.
-///
-/// The remainder still contains the tag.
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!(x, take_until!("foo"));
-///  let r = x(&b"abcd foo efgh"[..]);
-///  assert_eq!(r, Ok((&b"foo efgh"[..], &b"abcd "[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! take_until (
-  ($i:expr, $substr:expr) => ({
-    let res: $crate::IResult<_,_,_> = $crate::bytes::streaming::take_until($substr)($i);
-    res
-  });
-);
-
-/// `take_until1!(tag) => &[T] -> IResult<&[T], &[T]>`
-/// consumes data (at least one byte) until it finds the specified tag.
-///
-/// The remainder still contains the tag.
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!(x, take_until1!("foo"));
-///
-///  let r = x(&b"abcd foo efgh"[..]);
-///
-///  assert_eq!(r, Ok((&b"foo efgh"[..], &b"abcd "[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! take_until1 (
-  ($i:expr, $substr:expr) => (
-    {
-      use $crate::lib::std::result::Result::*;
-      use $crate::lib::std::option::Option::*;
-      use $crate::{Err,Needed,IResult,error::ErrorKind};
-      use $crate::InputLength;
-      use $crate::FindSubstring;
-      use $crate::InputTake;
-      let input = $i;
-
-      let res: IResult<_,_> = match input.find_substring($substr) {
-        None => {
-          Err(Err::Incomplete(Needed::new(1 + $substr.input_len())))
-        },
-        Some(0) => {
-          let e = ErrorKind::TakeUntil;
-          Err(Err::Error(error_position!($i, e)))
-        },
-        Some(index) => {
-          Ok($i.take_split(index))
-        },
-      };
-      res
-    }
-  );
-);
-
-#[cfg(test)]
-mod tests {
-  use crate::character::is_alphabetic;
-  use crate::character::streaming::{
-    alpha1 as alpha, alphanumeric1 as alphanumeric, digit1 as digit, hex_digit1 as hex_digit,
-    multispace1 as multispace, oct_digit1 as oct_digit, space1 as space,
-  };
-  use crate::bytes::complete::{escaped_transform, tag};
-  use crate::error::ErrorKind;
-  use crate::internal::{Err, IResult, Needed};
-  use crate::branch::alt;
-  use crate::combinator::{map, value};
-  #[cfg(feature = "alloc")]
-  use crate::lib::std::string::String;
-  #[cfg(feature = "alloc")]
-  use crate::lib::std::vec::Vec;
-
-  #[cfg(feature = "alloc")]
-  macro_rules! one_of (
-    ($i:expr, $inp: expr) => (
-      {
-        use $crate::Err;
-        use $crate::Slice;
-        use $crate::AsChar;
-        use $crate::FindToken;
-        use $crate::InputIter;
-
-        match ($i).iter_elements().next().map(|c| {
-          $inp.find_token(c)
-        }) {
-          None        => Err::<_,_>(Err::Incomplete(Needed::new(1))),
-          Some(false) => Err(Err::Error(error_position!($i, ErrorKind::OneOf))),
-          //the unwrap should be safe here
-          Some(true)  => Ok(($i.slice(1..), $i.iter_elements().next().unwrap().as_char()))
-        }
-      }
-    );
-  );
-
-  #[test]
-  fn is_a() {
-    named!(a_or_b, is_a!(&b"ab"[..]));
-
-    let a = &b"abcd"[..];
-    assert_eq!(a_or_b(a), Ok((&b"cd"[..], &b"ab"[..])));
-
-    let b = &b"bcde"[..];
-    assert_eq!(a_or_b(b), Ok((&b"cde"[..], &b"b"[..])));
-
-    let c = &b"cdef"[..];
-    assert_eq!(
-      a_or_b(c),
-      Err(Err::Error(error_position!(c, ErrorKind::IsA)))
-    );
-
-    let d = &b"bacdef"[..];
-    assert_eq!(a_or_b(d), Ok((&b"cdef"[..], &b"ba"[..])));
-  }
-
-  #[test]
-  fn is_not() {
-    named!(a_or_b, is_not!(&b"ab"[..]));
-
-    let a = &b"cdab"[..];
-    assert_eq!(a_or_b(a), Ok((&b"ab"[..], &b"cd"[..])));
-
-    let b = &b"cbde"[..];
-    assert_eq!(a_or_b(b), Ok((&b"bde"[..], &b"c"[..])));
-
-    let c = &b"abab"[..];
-    assert_eq!(
-      a_or_b(c),
-      Err(Err::Error(error_position!(c, ErrorKind::IsNot)))
-    );
-
-    let d = &b"cdefba"[..];
-    assert_eq!(a_or_b(d), Ok((&b"ba"[..], &b"cdef"[..])));
-
-    let e = &b"e"[..];
-    assert_eq!(a_or_b(e), Err(Err::Incomplete(Needed::new(1))));
-  }
-
-  #[cfg(feature = "alloc")]
-  #[allow(unused_variables)]
-  #[test]
-  fn escaping() {
-    named!(esc, escaped!(call!(alpha), '\\', one_of!("\"n\\")));
-    assert_eq!(esc(&b"abcd;"[..]), Ok((&b";"[..], &b"abcd"[..])));
-    assert_eq!(esc(&b"ab\\\"cd;"[..]), Ok((&b";"[..], &b"ab\\\"cd"[..])));
-    assert_eq!(esc(&b"\\\"abcd;"[..]), Ok((&b";"[..], &b"\\\"abcd"[..])));
-    assert_eq!(esc(&b"\\n;"[..]), Ok((&b";"[..], &b"\\n"[..])));
-    assert_eq!(esc(&b"ab\\\"12"[..]), Ok((&b"12"[..], &b"ab\\\""[..])));
-    assert_eq!(
-      esc(&b"AB\\"[..]),
-      Err(Err::Error(error_position!(
-        &b"AB\\"[..],
-        ErrorKind::Escaped
-      )))
-    );
-    assert_eq!(
-      esc(&b"AB\\A"[..]),
-      Err(Err::Error(error_node_position!(
-        &b"AB\\A"[..],
-        ErrorKind::Escaped,
-        error_position!(&b"A"[..], ErrorKind::OneOf)
-      )))
-    );
-
-    named!(esc2, escaped!(call!(digit), '\\', one_of!("\"n\\")));
-    assert_eq!(esc2(&b"12\\nnn34"[..]), Ok((&b"nn34"[..], &b"12\\n"[..])));
-  }
-
-  #[cfg(feature = "alloc")]
-  #[test]
-  fn escaping_str() {
-    named!(esc<&str, &str>, escaped!(call!(alpha), '\\', one_of!("\"n\\")));
-    assert_eq!(esc("abcd;"), Ok((";", "abcd")));
-    assert_eq!(esc("ab\\\"cd;"), Ok((";", "ab\\\"cd")));
-    assert_eq!(esc("\\\"abcd;"), Ok((";", "\\\"abcd")));
-    assert_eq!(esc("\\n;"), Ok((";", "\\n")));
-    assert_eq!(esc("ab\\\"12"), Ok(("12", "ab\\\"")));
-    assert_eq!(
-      esc("AB\\"),
-      Err(Err::Error(error_position!("AB\\", ErrorKind::Escaped)))
-    );
-    assert_eq!(
-      esc("AB\\A"),
-      Err(Err::Error(error_node_position!(
-        "AB\\A",
-        ErrorKind::Escaped,
-        error_position!("A", ErrorKind::OneOf)
-      )))
-    );
-
-    named!(esc2<&str, &str>, escaped!(call!(digit), '\\', one_of!("\"n\\")));
-    assert_eq!(esc2("12\\nnn34"), Ok(("nn34", "12\\n")));
-
-    named!(esc3<&str, &str>, escaped!(call!(alpha), '\u{241b}', one_of!("\"n")));
-    assert_eq!(esc3("ab␛ncd;"), Ok((";", "ab␛ncd")));
-  }
-
-  #[cfg(feature = "alloc")]
-  fn to_s(i: Vec<u8>) -> String {
-    String::from_utf8_lossy(&i).into_owned()
-  }
-
-  #[cfg(feature = "alloc")]
-  #[test]
-  fn escape_transform() {
-    fn esc(i: &[u8]) -> IResult<&[u8], String> {
-        map(
-            escaped_transform(alpha, '\\',
-                          alt((
-                            value(&b"\\"[..], tag("\\")),
-                            value(&b"\""[..], tag("\"")),
-                            value(&b"\n"[..], tag("n")),
-                          ))),
-            to_s)(i)
-    }
-
-    assert_eq!(esc(&b"abcd;"[..]), Ok((&b";"[..], String::from("abcd"))));
-    assert_eq!(
-      esc(&b"ab\\\"cd;"[..]),
-      Ok((&b";"[..], String::from("ab\"cd")))
-    );
-    assert_eq!(
-      esc(&b"\\\"abcd;"[..]),
-      Ok((&b";"[..], String::from("\"abcd")))
-    );
-    assert_eq!(esc(&b"\\n;"[..]), Ok((&b";"[..], String::from("\n"))));
-    assert_eq!(
-      esc(&b"ab\\\"12"[..]),
-      Ok((&b"12"[..], String::from("ab\"")))
-    );
-    assert_eq!(
-      esc(&b"AB\\"[..]),
-      Err(Err::Error(error_position!(
-        &b"\\"[..],
-        ErrorKind::EscapedTransform
-      )))
-    );
-    assert_eq!(
-      esc(&b"AB\\A"[..]),
-      Err(Err::Error(error_node_position!(
-        &b"AB\\A"[..],
-        ErrorKind::EscapedTransform,
-        error_position!(&b"A"[..], ErrorKind::Tag)
-      )))
-    );
-
-    fn esc2(i: &[u8]) -> IResult<&[u8], String> {
-        map(
-            escaped_transform(alpha, '&',
-                          alt((
-                            value("è".as_bytes(), tag("egrave;")),
-                            value("à".as_bytes(), tag("agrave;"))
-                          ))),
-            to_s)(i)
-    }
-    assert_eq!(
-      esc2(&b"ab&egrave;DEF;"[..]),
-      Ok((&b";"[..], String::from("abèDEF")))
-    );
-    assert_eq!(
-      esc2(&b"ab&egrave;D&agrave;EF;"[..]),
-      Ok((&b";"[..], String::from("abèDàEF")))
-    );
-  }
-
-  #[cfg(feature = "std")]
-  #[test]
-  fn escape_transform_str() {
-    fn esc(i: &str) -> IResult<&str, String> {
-        escaped_transform(alpha, '\\',
-                          alt((
-                            value("\\", tag("\\")),
-                            value("\"", tag("\"")),
-                            value("\n", tag("n")),
-                          )))(i)
-    }
-
-    assert_eq!(esc("abcd;"), Ok((";", String::from("abcd"))));
-    assert_eq!(esc("ab\\\"cd;"), Ok((";", String::from("ab\"cd"))));
-    assert_eq!(esc("\\\"abcd;"), Ok((";", String::from("\"abcd"))));
-    assert_eq!(esc("\\n;"), Ok((";", String::from("\n"))));
-    assert_eq!(esc("ab\\\"12"), Ok(("12", String::from("ab\""))));
-    assert_eq!(
-      esc("AB\\"),
-      Err(Err::Error(error_position!(
-        "\\",
-        ErrorKind::EscapedTransform
-      )))
-    );
-    assert_eq!(
-      esc("AB\\A"),
-      Err(Err::Error(error_node_position!(
-        "AB\\A",
-        ErrorKind::EscapedTransform,
-        error_position!("A", ErrorKind::Tag)
-      )))
-    );
-
-    fn esc2(i: &str) -> IResult<&str, String> {
-        escaped_transform(alpha, '&',
-                          alt((
-                            value("è", tag("egrave;")),
-                            value("à", tag("agrave;"))
-                          )))(i)
-    }
-    assert_eq!(esc2("ab&egrave;DEF;"), Ok((";", String::from("abèDEF"))));
-    assert_eq!(
-      esc2("ab&egrave;D&agrave;EF;"),
-      Ok((";", String::from("abèDàEF")))
-    );
-
-    fn esc3(i: &str) -> IResult<&str, String> {
-        escaped_transform(alpha, '␛',
-                          alt((
-                            value("\0", tag("0")),
-                            value("\n", tag("n"))
-                          )))(i)
-    }
-    assert_eq!(esc3("a␛0bc␛n"), Ok(("", String::from("a\0bc\n"))));
-  }
-
-  #[test]
-  fn take_str_test() {
-    let a = b"omnomnom";
-
-    let res: IResult<_, _, (&[u8], ErrorKind)> = take_str!(&a[..], 5u32);
-    assert_eq!(res, Ok((&b"nom"[..], "omnom")));
-
-    let res: IResult<_, _, (&[u8], ErrorKind)> = take_str!(&a[..], 9u32);
-    assert_eq!(res, Err(Err::Incomplete(Needed::new(1))));
-  }
-
-  #[test]
-  fn take_until_incomplete() {
-    named!(y, take_until!("end"));
-    assert_eq!(y(&b"nd"[..]), Err(Err::Incomplete(Needed::Unknown)));
-    assert_eq!(y(&b"123"[..]), Err(Err::Incomplete(Needed::Unknown)));
-    assert_eq!(y(&b"123en"[..]), Err(Err::Incomplete(Needed::Unknown)));
-  }
-
-  #[test]
-  fn take_until_incomplete_s() {
-    named!(ys<&str, &str>, take_until!("end"));
-    assert_eq!(ys("123en"), Err(Err::Incomplete(Needed::Unknown)));
-  }
-
-  #[test]
-  fn recognize() {
-    named!(
-      x,
-      recognize!(delimited!(tag!("<!--"), take!(5usize), tag!("-->")))
-    );
-    let r = x(&b"<!-- abc --> aaa"[..]);
-    assert_eq!(r, Ok((&b" aaa"[..], &b"<!-- abc -->"[..])));
-
-    let semicolon = &b";"[..];
-
-    named!(ya, recognize!(alpha));
-    let ra = ya(&b"abc;"[..]);
-    assert_eq!(ra, Ok((semicolon, &b"abc"[..])));
-
-    named!(yd, recognize!(digit));
-    let rd = yd(&b"123;"[..]);
-    assert_eq!(rd, Ok((semicolon, &b"123"[..])));
-
-    named!(yhd, recognize!(hex_digit));
-    let rhd = yhd(&b"123abcDEF;"[..]);
-    assert_eq!(rhd, Ok((semicolon, &b"123abcDEF"[..])));
-
-    named!(yod, recognize!(oct_digit));
-    let rod = yod(&b"1234567;"[..]);
-    assert_eq!(rod, Ok((semicolon, &b"1234567"[..])));
-
-    named!(yan, recognize!(alphanumeric));
-    let ran = yan(&b"123abc;"[..]);
-    assert_eq!(ran, Ok((semicolon, &b"123abc"[..])));
-
-    named!(ys, recognize!(space));
-    let rs = ys(&b" \t;"[..]);
-    assert_eq!(rs, Ok((semicolon, &b" \t"[..])));
-
-    named!(yms, recognize!(multispace));
-    let rms = yms(&b" \t\r\n;"[..]);
-    assert_eq!(rms, Ok((semicolon, &b" \t\r\n"[..])));
-  }
-
-  #[test]
-  fn take_while() {
-    named!(f, take_while!(is_alphabetic));
-    let a = b"";
-    let b = b"abcd";
-    let c = b"abcd123";
-    let d = b"123";
-
-    assert_eq!(f(&a[..]), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(f(&b[..]), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(f(&c[..]), Ok((&d[..], &b[..])));
-    assert_eq!(f(&d[..]), Ok((&d[..], &a[..])));
-  }
-
-  #[test]
-  fn take_while1() {
-    named!(f, take_while1!(is_alphabetic));
-    let a = b"";
-    let b = b"abcd";
-    let c = b"abcd123";
-    let d = b"123";
-
-    assert_eq!(f(&a[..]), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(f(&b[..]), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(f(&c[..]), Ok((&b"123"[..], &b[..])));
-    assert_eq!(
-      f(&d[..]),
-      Err(Err::Error(error_position!(&d[..], ErrorKind::TakeWhile1)))
-    );
-  }
-
-  #[test]
-  fn take_while_m_n() {
-    named!(x, take_while_m_n!(2, 4, is_alphabetic));
-    let a = b"";
-    let b = b"a";
-    let c = b"abc";
-    let d = b"abc123";
-    let e = b"abcde";
-    let f = b"123";
-
-    assert_eq!(x(&a[..]), Err(Err::Incomplete(Needed::new(2))));
-    assert_eq!(x(&b[..]), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(x(&c[..]), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(x(&d[..]), Ok((&b"123"[..], &c[..])));
-    assert_eq!(x(&e[..]), Ok((&b"e"[..], &b"abcd"[..])));
-    assert_eq!(
-      x(&f[..]),
-      Err(Err::Error(error_position!(&f[..], ErrorKind::TakeWhileMN)))
-    );
-  }
-
-  #[test]
-  fn take_till() {
-    named!(f, take_till!(is_alphabetic));
-    let a = b"";
-    let b = b"abcd";
-    let c = b"123abcd";
-    let d = b"123";
-
-    assert_eq!(f(&a[..]), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(f(&b[..]), Ok((&b"abcd"[..], &b""[..])));
-    assert_eq!(f(&c[..]), Ok((&b"abcd"[..], &b"123"[..])));
-    assert_eq!(f(&d[..]), Err(Err::Incomplete(Needed::new(1))));
-  }
-
-  #[test]
-  fn take_till1() {
-    named!(f, take_till1!(is_alphabetic));
-    let a = b"";
-    let b = b"abcd";
-    let c = b"123abcd";
-    let d = b"123";
-
-    assert_eq!(f(&a[..]), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(
-      f(&b[..]),
-      Err(Err::Error(error_position!(&b[..], ErrorKind::TakeTill1)))
-    );
-    assert_eq!(f(&c[..]), Ok((&b"abcd"[..], &b"123"[..])));
-    assert_eq!(f(&d[..]), Err(Err::Incomplete(Needed::new(1))));
-  }
-
-  #[test]
-  fn take_while_utf8() {
-    named!(f<&str,&str>, take_while!(|c:char| { c != '點' }));
-
-    assert_eq!(f(""), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(f("abcd"), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(f("abcd點"), Ok(("點", "abcd")));
-    assert_eq!(f("abcd點a"), Ok(("點a", "abcd")));
-
-    named!(g<&str,&str>, take_while!(|c:char| { c == '點' }));
-
-    assert_eq!(g(""), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(g("點abcd"), Ok(("abcd", "點")));
-    assert_eq!(g("點點點a"), Ok(("a", "點點點")));
-  }
-
-  #[test]
-  fn take_till_utf8() {
-    named!(f<&str,&str>, take_till!(|c:char| { c == '點' }));
-
-    assert_eq!(f(""), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(f("abcd"), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(f("abcd點"), Ok(("點", "abcd")));
-    assert_eq!(f("abcd點a"), Ok(("點a", "abcd")));
-
-    named!(g<&str,&str>, take_till!(|c:char| { c != '點' }));
-
-    assert_eq!(g(""), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(g("點abcd"), Ok(("abcd", "點")));
-    assert_eq!(g("點點點a"), Ok(("a", "點點點")));
-  }
-
-  #[test]
-  fn take_utf8() {
-    named!(f<&str,&str>, take!(3));
-
-    assert_eq!(f(""), Err(Err::Incomplete(Needed::Unknown)));
-    assert_eq!(f("ab"), Err(Err::Incomplete(Needed::Unknown)));
-    assert_eq!(f("點"), Err(Err::Incomplete(Needed::Unknown)));
-    assert_eq!(f("ab點cd"), Ok(("cd", "ab點")));
-    assert_eq!(f("a點bcd"), Ok(("cd", "a點b")));
-    assert_eq!(f("a點b"), Ok(("", "a點b")));
-
-    named!(g<&str,&str>, take_while!(|c:char| { c == '點' }));
-
-    assert_eq!(g(""), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(g("點abcd"), Ok(("abcd", "點")));
-    assert_eq!(g("點點點a"), Ok(("a", "點點點")));
-  }
-
-  #[test]
-  fn take_while_m_n_utf8() {
-    named!(parser<&str, &str>, take_while_m_n!(1, 1, |c| c == 'A' || c == '😃'));
-    assert_eq!(parser("A!"), Ok(("!", "A")));
-    assert_eq!(parser("😃!"), Ok(("!", "😃")));
-  }
-
-  #[test]
-  fn take_while_m_n_utf8_full_match() {
-    named!(parser<&str, &str>, take_while_m_n!(1, 1, |c: char| c.is_alphabetic()));
-    assert_eq!(parser("øn"), Ok(("n", "ø")));
-  }
-
-  #[cfg(nightly)]
-  use test::Bencher;
-
-  #[cfg(nightly)]
-  #[bench]
-  fn take_while_bench(b: &mut Bencher) {
-    named!(f, take_while!(is_alphabetic));
-    b.iter(|| f(&b"abcdefghijklABCDEejfrfrjgro12aa"[..]));
-  }
-
-  #[test]
-  #[cfg(feature = "std")]
-  fn recognize_take_while() {
-    use crate::character::is_alphanumeric;
-    named!(x, take_while!(is_alphanumeric));
-    named!(y, recognize!(x));
-    assert_eq!(x(&b"ab."[..]), Ok((&b"."[..], &b"ab"[..])));
-    println!("X: {:?}", x(&b"ab"[..]));
-    assert_eq!(y(&b"ab."[..]), Ok((&b"."[..], &b"ab"[..])));
-  }
-
-  #[test]
-  fn length_bytes() {
-    use crate::{
-        number::streaming::le_u8,
-        bytes::streaming::tag,
-        multi::length_data
-    };
-
-    fn x(i: &[u8]) -> IResult<&[u8], &[u8]> {
-        length_data(le_u8)(i)
-    }
-    assert_eq!(x(b"\x02..>>"), Ok((&b">>"[..], &b".."[..])));
-    assert_eq!(x(b"\x02.."), Ok((&[][..], &b".."[..])));
-    assert_eq!(x(b"\x02."), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(x(b"\x02"), Err(Err::Incomplete(Needed::new(2))));
-
-    fn y(i: &[u8]) -> IResult<&[u8], &[u8]> {
-        let (i, _) = tag("magic")(i)?;
-        length_data(le_u8)(i)
-    }
-    assert_eq!(y(b"magic\x02..>>"), Ok((&b">>"[..], &b".."[..])));
-    assert_eq!(y(b"magic\x02.."), Ok((&[][..], &b".."[..])));
-    assert_eq!(y(b"magic\x02."), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(y(b"magic\x02"), Err(Err::Incomplete(Needed::new(2))));
-  }
-
-  #[cfg(feature = "alloc")]
-  #[test]
-  fn case_insensitive() {
-    named!(test, tag_no_case!("ABcd"));
-    assert_eq!(test(&b"aBCdefgh"[..]), Ok((&b"efgh"[..], &b"aBCd"[..])));
-    assert_eq!(test(&b"abcdefgh"[..]), Ok((&b"efgh"[..], &b"abcd"[..])));
-    assert_eq!(test(&b"ABCDefgh"[..]), Ok((&b"efgh"[..], &b"ABCD"[..])));
-    assert_eq!(test(&b"ab"[..]), Err(Err::Incomplete(Needed::new(2))));
-    assert_eq!(
-      test(&b"Hello"[..]),
-      Err(Err::Error(error_position!(&b"Hello"[..], ErrorKind::Tag)))
-    );
-    assert_eq!(
-      test(&b"Hel"[..]),
-      Err(Err::Error(error_position!(&b"Hel"[..], ErrorKind::Tag)))
-    );
-
-    named!(test2<&str, &str>, tag_no_case!("ABcd"));
-    assert_eq!(test2("aBCdefgh"), Ok(("efgh", "aBCd")));
-    assert_eq!(test2("abcdefgh"), Ok(("efgh", "abcd")));
-    assert_eq!(test2("ABCDefgh"), Ok(("efgh", "ABCD")));
-    assert_eq!(test2("ab"), Err(Err::Incomplete(Needed::new(2))));
-    assert_eq!(
-      test2("Hello"),
-      Err(Err::Error(error_position!(&"Hello"[..], ErrorKind::Tag)))
-    );
-    assert_eq!(
-      test2("Hel"),
-      Err(Err::Error(error_position!(&"Hel"[..], ErrorKind::Tag)))
-    );
-  }
-
-  #[test]
-  fn tag_fixed_size_array() {
-    named!(test, tag!([0x42]));
-    named!(test2, tag!(&[0x42]));
-    let input = [0x42, 0x00];
-    assert_eq!(test(&input), Ok((&b"\x00"[..], &b"\x42"[..])));
-    assert_eq!(test2(&input), Ok((&b"\x00"[..], &b"\x42"[..])));
-  }
-}
diff --git a/src/bytes/mod.rs b/src/bytes/mod.rs
index 64fb00d..7bc2d15 100644
--- a/src/bytes/mod.rs
+++ b/src/bytes/mod.rs
@@ -1,6 +1,6 @@
 //! Parsers recognizing bytes streams
 
-#[macro_use]
-mod macros;
 pub mod complete;
 pub mod streaming;
+#[cfg(test)]
+mod tests;
diff --git a/src/bytes/streaming.rs b/src/bytes/streaming.rs
index f3f8b2c..a166545 100644
--- a/src/bytes/streaming.rs
+++ b/src/bytes/streaming.rs
@@ -558,29 +558,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn escapedc<Input, Error, F, G, O1, O2>(
-  i: Input,
-  normal: F,
-  control_char: char,
-  escapable: G,
-) -> IResult<Input, Input, Error>
-where
-  Input: Clone
-    + crate::traits::Offset
-    + InputLength
-    + InputTake
-    + InputTakeAtPosition
-    + Slice<RangeFrom<usize>>
-    + InputIter,
-  <Input as InputIter>::Item: crate::traits::AsChar,
-  F: Fn(Input) -> IResult<Input, O1, Error>,
-  G: Fn(Input) -> IResult<Input, O2, Error>,
-  Error: ParseError<Input>,
-{
-  escaped(normal, control_char, escapable)(i)
-}
-
 /// Matches a byte string with escaped characters.
 ///
 /// * The first argument matches the normal characters (it must not match the control character)
@@ -685,31 +662,3 @@ where
     Err(Err::Incomplete(Needed::Unknown))
   }
 }
-
-#[doc(hidden)]
-#[cfg(feature = "alloc")]
-#[cfg_attr(feature = "docsrs", doc(cfg(feature = "alloc")))]
-pub fn escaped_transformc<Input, Error, F, G, O1, O2, ExtendItem, Output>(
-  i: Input,
-  normal: F,
-  control_char: char,
-  transform: G,
-) -> IResult<Input, Output, Error>
-where
-  Input: Clone
-    + crate::traits::Offset
-    + InputLength
-    + InputTake
-    + InputTakeAtPosition
-    + Slice<RangeFrom<usize>>
-    + InputIter,
-  Input: crate::traits::ExtendInto<Item = ExtendItem, Extender = Output>,
-  O1: crate::traits::ExtendInto<Item = ExtendItem, Extender = Output>,
-  O2: crate::traits::ExtendInto<Item = ExtendItem, Extender = Output>,
-  <Input as InputIter>::Item: crate::traits::AsChar,
-  F: Fn(Input) -> IResult<Input, O1, Error>,
-  G: Fn(Input) -> IResult<Input, O2, Error>,
-  Error: ParseError<Input>,
-{
-  escaped_transform(normal, control_char, transform)(i)
-}
diff --git a/src/character/macros.rs b/src/character/macros.rs
deleted file mode 100644
index ba99645..0000000
--- a/src/character/macros.rs
+++ /dev/null
@@ -1,112 +0,0 @@
-/// Character level parsers
-
-/// Matches one of the provided characters.
-///
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-/// named!(simple<char>, one_of!(&b"abc"[..]));
-/// assert_eq!(simple(b"a123"), Ok((&b"123"[..], 'a')));
-///
-/// named!(a_or_b<&str, char>, one_of!("ab汉"));
-/// assert_eq!(a_or_b("汉jiosfe"), Ok(("jiosfe", '汉')));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! one_of (
-  ($i:expr, $inp: expr) => ( $crate::character::streaming::one_of($inp)($i) );
-);
-
-/// Matches anything but the provided characters.
-///
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err,error::ErrorKind};
-/// # fn main() {
-/// named!(no_letter_a<char>, none_of!(&b"abc"[..]));
-/// assert_eq!(no_letter_a(b"123"), Ok((&b"23"[..], '1')));
-///
-/// named!(err_on_single_quote<char>, none_of!(&b"'"[..]));
-/// assert_eq!(err_on_single_quote(b"'jiosfe"), Err(Err::Error(error_position!(&b"'jiosfe"[..], ErrorKind::NoneOf))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! none_of (
-  ($i:expr, $inp: expr) => ( $crate::character::streaming::none_of($inp)($i) );
-);
-
-/// Matches one character: `char!(char) => &[u8] -> IResult<&[u8], char>`.
-///
-/// # Example
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err,error::ErrorKind};
-/// # fn main() {
-/// named!(match_letter_a<char>, char!('a'));
-/// assert_eq!(match_letter_a(b"abc"), Ok((&b"bc"[..],'a')));
-///
-/// assert_eq!(match_letter_a(b"123cdef"), Err(Err::Error(error_position!(&b"123cdef"[..], ErrorKind::Char))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! char (
-  ($i:expr, $c: expr) => ( $crate::character::streaming::char($c)($i) );
-);
-
-#[cfg(test)]
-mod tests {
-  use crate::error::ErrorKind;
-  use crate::internal::Err;
-
-  #[test]
-  fn one_of() {
-    named!(f<char>, one_of!("ab"));
-
-    let a = &b"abcd"[..];
-    assert_eq!(f(a), Ok((&b"bcd"[..], 'a')));
-
-    let b = &b"cde"[..];
-    assert_eq!(f(b), Err(Err::Error(error_position!(b, ErrorKind::OneOf))));
-
-    named!(utf8(&str) -> char,
-      one_of!("+\u{FF0B}"));
-
-    assert!(utf8("+").is_ok());
-    assert!(utf8("\u{FF0B}").is_ok());
-  }
-
-  #[test]
-  fn none_of() {
-    named!(f<char>, none_of!("ab"));
-
-    let a = &b"abcd"[..];
-    assert_eq!(f(a), Err(Err::Error(error_position!(a, ErrorKind::NoneOf))));
-
-    let b = &b"cde"[..];
-    assert_eq!(f(b), Ok((&b"de"[..], 'c')));
-  }
-
-  #[test]
-  fn char() {
-    named!(f<char>, char!('c'));
-
-    let a = &b"abcd"[..];
-    assert_eq!(f(a), Err(Err::Error(error_position!(a, ErrorKind::Char))));
-
-    let b = &b"cde"[..];
-    assert_eq!(f(b), Ok((&b"de"[..], 'c')));
-  }
-
-  #[test]
-  fn char_str() {
-    named!(f<&str, char>, char!('c'));
-
-    let a = &"abcd"[..];
-    assert_eq!(f(a), Err(Err::Error(error_position!(a, ErrorKind::Char))));
-
-    let b = &"cde"[..];
-    assert_eq!(f(b), Ok((&"de"[..], 'c')));
-  }
-}
diff --git a/src/character/mod.rs b/src/character/mod.rs
index 4c70f6e..2c5d3bc 100644
--- a/src/character/mod.rs
+++ b/src/character/mod.rs
@@ -2,8 +2,8 @@
 //!
 //! Functions recognizing specific characters
 
-#[macro_use]
-mod macros;
+#[cfg(test)]
+mod tests;
 
 pub mod complete;
 pub mod streaming;
diff --git a/src/combinator/macros.rs b/src/combinator/macros.rs
deleted file mode 100644
index 11ece16..0000000
--- a/src/combinator/macros.rs
+++ /dev/null
@@ -1,1226 +0,0 @@
-//! Macro combinators
-//!
-//! Macros are used to make combination easier,
-//! since they often do not depend on the type
-//! of the data they manipulate or return.
-//!
-//! There is a trick to make them easier to assemble,
-//! combinators are defined like this:
-//!
-//! ```ignore
-//! macro_rules! tag (
-//!   ($i:expr, $inp: expr) => (
-//!     {
-//!       ...
-//!     }
-//!   );
-//! );
-//! ```
-//!
-//! But when used in other combinators, are used
-//! like this:
-//!
-//! ```ignore
-//! named!(my_function, tag!("abcd"));
-//! ```
-//!
-//! Internally, other combinators will rewrite
-//! that call to pass the input as first argument:
-//!
-//! ```ignore
-//! macro_rules! named (
-//!   ($name:ident, $submac:ident!( $($args:tt)* )) => (
-//!     fn $name<'a>( i: &'a [u8] ) -> IResult<'a,&[u8], &[u8]> {
-//!       $submac!(i, $($args)*)
-//!     }
-//!   );
-//! );
-//! ```
-//!
-//! If you want to call a combinator directly, you can
-//! do it like this:
-//!
-//! ```ignore
-//! let res = { tag!(input, "abcd"); }
-//! ```
-//!
-//! Combinators must have a specific variant for
-//! non-macro arguments. Example: Passing a function
-//! to `take_while!` instead of another combinator.
-//!
-//! ```ignore
-//! macro_rules! take_while(
-//!   ($input:expr, $submac:ident!( $($args:tt)* )) => (
-//!     {
-//!       ...
-//!     }
-//!   );
-//!
-//!   // wrap the function in a macro to pass it to the main implementation
-//!   ($input:expr, $f:expr) => (
-//!     take_while!($input, call!($f));
-//!   );
-//! );
-//! ```
-#[allow(unused_variables)]
-
-/// Makes a function from a parser combination
-///
-/// The type can be set up if the compiler needs
-/// more information.
-///
-/// Function-like declaration:
-/// ```
-/// # use nom::{named, tag};
-/// named!(my_function( &[u8] ) -> &[u8], tag!("abcd"));
-/// ```
-/// Alternative declaration. First type parameter is input, second is output:
-/// ```
-/// # use nom::{named, tag};
-/// named!(my_function<&[u8], &[u8]>, tag!("abcd"));
-/// ```
-/// This one will have `&[u8]` as input type, `&[u8]` as output type:
-/// ```
-/// # use nom::{named, tag};
-/// named!(my_function, tag!("abcd"));
-/// ```
-/// Will use `&[u8]` as output type:
-/// ```
-/// # use nom::{named, tag};
-/// named!(my_function<&[u8]>, tag!("abcd"));
-/// ```
-/// Prefix them with 'pub' to make the functions public:
-/// ```
-/// # use nom::{named, tag};
-/// named!(pub my_function, tag!("abcd"));
-/// ```
-/// Prefix them with 'pub(crate)' to make the functions public within the crate:
-/// ```
-/// # use nom::{named, tag};
-/// named!(pub(crate) my_function, tag!("abcd"));
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! named (
-    (#$($args:tt)*) => (
-        named_attr!(#$($args)*);
-    );
-    ($vis:vis $name:ident( $i:ty ) -> $o:ty, $submac:ident!( $($args:tt)* )) => (
-        $vis fn $name( i: $i ) -> $crate::IResult<$i, $o, $crate::error::Error<$i>> {
-            $submac!(i, $($args)*)
-        }
-    );
-    ($vis:vis $name:ident<$i:ty,$o:ty,$e:ty>, $submac:ident!( $($args:tt)* )) => (
-        $vis fn $name( i: $i ) -> $crate::IResult<$i, $o, $e> {
-            $submac!(i, $($args)*)
-        }
-    );
-    ($vis:vis $name:ident<$i:ty,$o:ty>, $submac:ident!( $($args:tt)* )) => (
-        $vis fn $name( i: $i ) -> $crate::IResult<$i, $o, $crate::error::Error<$i>> {
-            $submac!(i, $($args)*)
-        }
-    );
-    ($vis:vis $name:ident<$o:ty>, $submac:ident!( $($args:tt)* )) => (
-        $vis fn $name( i: &[u8] ) -> $crate::IResult<&[u8], $o, $crate::error::Error<&[u8]>> {
-            $submac!(i, $($args)*)
-        }
-    );
-    ($vis:vis $name:ident, $submac:ident!( $($args:tt)* )) => (
-        $vis fn $name( i: &[u8] ) -> $crate::IResult<&[u8], &[u8], $crate::error::Error<&[u8]>> {
-            $submac!(i, $($args)*)
-        }
-    );
-);
-
-/// Makes a function from a parser combination with arguments.
-///
-/// ```ignore
-/// //takes [`&[u8]`] as input
-/// named_args!(tagged(open_tag: &[u8], close_tag: &[u8])<&str>,
-///   delimited!(tag!(open_tag), map_res!(take!(4), str::from_utf8), tag!(close_tag))
-/// );
-
-/// //takes `&str` as input
-/// named_args!(tagged(open_tag: &str, close_tag: &str)<&str, &str>,
-///   delimited!(tag!(open_tag), take!(4), tag!(close_tag))
-/// );
-/// ```
-///
-/// Note: If using arguments that way gets hard to read, it is always
-/// possible to write the equivalent parser definition manually, like
-/// this:
-///
-/// ```ignore
-/// fn tagged(input: &[u8], open_tag: &[u8], close_tag: &[u8]) -> IResult<&[u8], &str> {
-///   // the first combinator in the tree gets the input as argument. It is then
-///   // passed from one combinator to the next through macro rewriting
-///   delimited!(input,
-///     tag!(open_tag), take!(4), tag!(close_tag)
-///   )
-/// );
-/// ```
-///
-#[macro_export(local_inner_macros)]
-macro_rules! named_args {
-    ($vis:vis $func_name:ident ( $( $arg:ident : $typ:ty ),* ) < $return_type:ty > , $submac:ident!( $($args:tt)* ) ) => {
-        $vis fn $func_name(input: &[u8], $( $arg : $typ ),*) -> $crate::IResult<&[u8], $return_type> {
-            $submac!(input, $($args)*)
-        }
-    };
-
-    ($vis:vis $func_name:ident < 'a > ( $( $arg:ident : $typ:ty ),* ) < $return_type:ty > , $submac:ident!( $($args:tt)* ) ) => {
-        $vis fn $func_name<'this_is_probably_unique_i_hope_please, 'a>(
-          input: &'this_is_probably_unique_i_hope_please [u8], $( $arg : $typ ),*) ->
-          $crate::IResult<&'this_is_probably_unique_i_hope_please [u8], $return_type>
-        {
-          $submac!(input, $($args)*)
-        }
-    };
-
-    ($vis:vis $func_name:ident ( $( $arg:ident : $typ:ty ),* ) < $input_type:ty, $return_type:ty > , $submac:ident!( $($args:tt)* ) ) => {
-        $vis fn $func_name(input: $input_type, $( $arg : $typ ),*) -> $crate::IResult<$input_type, $return_type> {
-            $submac!(input, $($args)*)
-        }
-    };
-
-    ($vis:vis $func_name:ident < 'a > ( $( $arg:ident : $typ:ty ),* ) < $input_type:ty, $return_type:ty > , $submac:ident!( $($args:tt)* ) ) => {
-        $vis fn $func_name<'a>(
-          input: $input_type, $( $arg : $typ ),*)
-          -> $crate::IResult<$input_type, $return_type>
-        {
-            $submac!(input, $($args)*)
-        }
-    };
-}
-
-/// Makes a function from a parser combination, with attributes.
-///
-/// The usage of this macro is almost identical to `named!`, except that
-/// you also pass attributes to be attached to the generated function.
-/// This is ideal for adding documentation to your parser.
-///
-/// Create my_function as if you wrote it with the doc comment /// My Func:
-/// ```
-/// # use nom::{named_attr, tag};
-/// named_attr!(#[doc = "My Func"], my_function( &[u8] ) -> &[u8], tag!("abcd"));
-/// ```
-/// Also works for pub functions, and multiple lines:
-/// ```
-/// # use nom::{named_attr, tag};
-/// named_attr!(#[doc = "My Func\nRecognise abcd"], pub my_function, tag!("abcd"));
-/// ```
-/// Multiple attributes can be passed if required:
-/// ```
-/// # use nom::{named_attr, tag};
-/// named_attr!(#[doc = "My Func"] #[inline(always)], pub my_function, tag!("abcd"));
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! named_attr (
-    ($(#[$attr:meta])*, $vis:vis $name:ident( $i:ty ) -> $o:ty, $submac:ident!( $($args:tt)* )) => (
-        $(#[$attr])*
-        $vis fn $name( i: $i ) -> $crate::IResult<$i,$o, $crate::error::Error<$i>> {
-            $submac!(i, $($args)*)
-        }
-    );
-    ($(#[$attr:meta])*, $vis:vis $name:ident<$i:ty,$o:ty,$e:ty>, $submac:ident!( $($args:tt)* )) => (
-        $(#[$attr])*
-        $vis fn $name( i: $i ) -> $crate::IResult<$i, $o, $e> {
-            $submac!(i, $($args)*)
-        }
-    );
-    ($(#[$attr:meta])*, $vis:vis $name:ident<$i:ty,$o:ty>, $submac:ident!( $($args:tt)* )) => (
-        $(#[$attr])*
-        $vis fn $name( i: $i ) -> $crate::IResult<$i, $o, $crate::error::Error<$i>> {
-            $submac!(i, $($args)*)
-        }
-    );
-    ($(#[$attr:meta])*, $vis:vis $name:ident<$o:ty>, $submac:ident!( $($args:tt)* )) => (
-        $(#[$attr])*
-        $vis fn $name( i: &[u8] ) -> $crate::IResult<&[u8], $o, $crate::error::Error<&[u8]>> {
-            $submac!(i, $($args)*)
-        }
-    );
-    ($(#[$attr:meta])*, $vis:vis $name:ident, $submac:ident!( $($args:tt)* )) => (
-        $(#[$attr])*
-        $vis fn $name<'a>( i: &'a [u8] ) -> $crate::IResult<&[u8], &[u8], $crate::error::Error<&[u8]>> {
-            $submac!(i, $($args)*)
-        }
-    );
-);
-
-/// Used to wrap common expressions and function as macros.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::IResult;
-/// # fn main() {
-///   fn take_wrapper(input: &[u8], i: u8) -> IResult<&[u8], &[u8]> { take!(input, i * 10) }
-///
-///   // will make a parser taking 20 bytes
-///   named!(parser, call!(take_wrapper, 2));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! call (
-  ($i:expr, $fun:expr) => ( $fun( $i ) );
-  ($i:expr, $fun:expr, $($args:expr),* ) => ( $fun( $i, $($args),* ) );
-);
-
-//FIXME: error rewrite
-/// Prevents backtracking if the child parser fails.
-///
-/// This parser will do an early return instead of sending
-/// its result to the parent parser.
-///
-/// If another `return_error!` combinator is present in the parent
-/// chain, the error will be wrapped and another early
-/// return will be made.
-///
-/// This makes it easy to build report on which parser failed,
-/// where it failed in the input, and the chain of parsers
-/// that led it there.
-///
-/// Additionally, the error chain contains number identifiers
-/// that can be matched to provide useful error messages.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::Err;
-/// # use nom::error::ErrorKind;
-/// # fn main() {
-///     named!(err_test<&[u8], &[u8]>, alt!(
-///       tag!("abcd") |
-///       preceded!(tag!("efgh"), return_error!(ErrorKind::Eof,
-///           do_parse!(
-///                  tag!("ijkl")                                        >>
-///             res: return_error!(ErrorKind::Tag, tag!("mnop")) >>
-///             (res)
-///           )
-///         )
-///       )
-///     ));
-///     let a = &b"efghblah"[..];
-///     let b = &b"efghijklblah"[..];
-///     let c = &b"efghijklmnop"[..];
-///
-///     let blah = &b"blah"[..];
-///
-///     let res_a = err_test(a);
-///     let res_b = err_test(b);
-///     let res_c = err_test(c);
-///     assert_eq!(res_a, Err(Err::Failure(error_node_position!(blah, ErrorKind::Eof, error_position!(blah, ErrorKind::Tag)))));
-///     assert_eq!(res_b, Err(Err::Failure(error_node_position!(&b"ijklblah"[..], ErrorKind::Eof,
-///       error_node_position!(blah, ErrorKind::Tag, error_position!(blah, ErrorKind::Tag))))
-///     ));
-/// # }
-/// ```
-///
-#[macro_export(local_inner_macros)]
-macro_rules! return_error (
-  ($i:expr, $code:expr, $submac:ident!( $($args:tt)* )) => (
-    {
-      use $crate::lib::std::result::Result::*;
-      use $crate::Err;
-
-      let i_ = $i.clone();
-      let cl = || {
-        $submac!(i_, $($args)*)
-      };
-
-      match cl() {
-        Err(Err::Incomplete(x)) => Err(Err::Incomplete(x)),
-        Ok((i, o))              => Ok((i, o)),
-        Err(Err::Error(e)) | Err(Err::Failure(e)) => {
-          return Err(Err::Failure($crate::error::append_error($i, $code, e)))
-        }
-      }
-    }
-  );
-  ($i:expr, $code:expr, $f:expr) => (
-    return_error!($i, $code, call!($f));
-  );
-  ($i:expr, $submac:ident!( $($args:tt)* )) => (
-    {
-      use $crate::lib::std::result::Result::*;
-      use $crate::Err;
-
-      let i_ = $i.clone();
-      let cl = || {
-        $submac!(i_, $($args)*)
-      };
-
-      match cl() {
-        Err(Err::Incomplete(x)) => Err(Err::Incomplete(x)),
-        Ok((i, o))              => Ok((i, o)),
-        Err(Err::Error(e)) | Err(Err::Failure(e)) => {
-          return Err(Err::Failure(e))
-        }
-      }
-    }
-  );
-  ($i:expr, $f:expr) => (
-    return_error!($i, call!($f));
-  );
-);
-
-//FIXME: error rewrite
-/// Add an error if the child parser fails.
-///
-/// While `return_error!` does an early return and avoids backtracking,
-/// `add_return_error!` backtracks normally. It just provides more context
-/// for an error.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use std::collections;
-/// # use nom::Err;
-/// # use nom::error::ErrorKind;
-/// # fn main() {
-///     named!(err_test, add_return_error!(ErrorKind::Tag, tag!("abcd")));
-///
-///     let a = &b"efghblah"[..];
-///     let res_a = err_test(a);
-///     assert_eq!(res_a, Err(Err::Error(error_node_position!(a, ErrorKind::Tag, error_position!(a, ErrorKind::Tag)))));
-/// # }
-/// ```
-///
-#[macro_export(local_inner_macros)]
-macro_rules! add_return_error (
-  ($i:expr, $code:expr, $submac:ident!( $($args:tt)* )) => (
-    {
-      use $crate::lib::std::result::Result::*;
-      use $crate::{Err,error::ErrorKind};
-
-      match $submac!($i, $($args)*) {
-        Ok((i, o)) => Ok((i, o)),
-        Err(Err::Error(e)) => {
-          Err(Err::Error(error_node_position!($i, $code, e)))
-        },
-        Err(Err::Failure(e)) => {
-          Err(Err::Failure(error_node_position!($i, $code, e)))
-        },
-        Err(e) => Err(e),
-      }
-    }
-  );
-  ($i:expr, $code:expr, $f:expr) => (
-    add_return_error!($i, $code, call!($f));
-  );
-);
-
-/// Replaces a `Incomplete` returned by the child parser
-/// with an `Error`.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use std::collections;
-/// # use nom::Err;
-/// # use nom::error::ErrorKind;
-/// # fn main() {
-///     named!(take_5, complete!(take!(5)));
-///
-///     let a = &b"abcd"[..];
-///     let res_a = take_5(a);
-///     assert_eq!(res_a, Err(Err::Error(error_position!(a, ErrorKind::Complete))));
-/// # }
-/// ```
-///
-#[macro_export(local_inner_macros)]
-macro_rules! complete (
-  ($i:expr, $submac:ident!( $($args:tt)* )) => (
-    $crate::combinator::completec($i, move |i| { $submac!(i, $($args)*) })
-  );
-  ($i:expr, $f:expr) => (
-    complete!($i, call!($f));
-  );
-);
-
-/// A bit like `std::try!`, this macro will return the remaining input and
-/// parsed value if the child parser returned `Ok`, and will do an early
-/// return for the `Err` side.
-///
-/// This can provide more flexibility than `do_parse!` if needed.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::Err;
-/// # use nom::error::ErrorKind;
-/// # use nom::IResult;
-///
-///  fn take_add(input:&[u8], size: u8) -> IResult<&[u8], &[u8]> {
-///    let (i1, length)     = try_parse!(input, map_opt!(nom::number::streaming::be_u8, |sz| size.checked_add(sz)));
-///    let (i2, data)   = try_parse!(i1, take!(length));
-///    return Ok((i2, data));
-///  }
-/// # fn main() {
-/// let arr1 = [1, 2, 3, 4, 5];
-/// let r1 = take_add(&arr1[..], 1);
-/// assert_eq!(r1, Ok((&[4,5][..], &[2,3][..])));
-///
-/// let arr2 = [0xFE, 2, 3, 4, 5];
-/// // size is overflowing
-/// let r1 = take_add(&arr2[..], 42);
-/// assert_eq!(r1, Err(Err::Error(error_position!(&[254, 2,3,4,5][..], ErrorKind::MapOpt))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! try_parse (
-  ($i:expr, $submac:ident!( $($args:tt)* )) => ({
-    use $crate::lib::std::result::Result::*;
-
-    match $submac!($i, $($args)*) {
-      Ok((i,o)) => (i,o),
-      Err(e)    => return Err(e),
-    }
-    });
-  ($i:expr, $f:expr) => (
-    try_parse!($i, call!($f))
-  );
-);
-
-/// `map!(I -> IResult<I, O>, O -> P) => I -> IResult<I, P>`
-///
-/// Maps a function on the result of a parser.
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err,error::ErrorKind, IResult};
-/// use nom::character::complete::digit1;
-/// # fn main() {
-///
-/// named!(parse<&str, usize>, map!(digit1, |s| s.len()));
-///
-/// // the parser will count how many characters were returned by digit1
-/// assert_eq!(parse("123456"), Ok(("", 6)));
-///
-/// // this will fail if digit1 fails
-/// assert_eq!(parse("abc"), Err(Err::Error(error_position!("abc", ErrorKind::Digit))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! map(
-  // Internal parser, do not use directly
-  (__impl $i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
-    $crate::combinator::mapc($i, move |i| {$submac!(i, $($args)*)}, $g)
-  );
-  ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
-    map!(__impl $i, $submac!($($args)*), $g);
-  );
-  ($i:expr, $f:expr, $g:expr) => (
-    map!(__impl $i, call!($f), $g);
-  );
-);
-
-/// `map_res!(I -> IResult<I, O>, O -> Result<P>) => I -> IResult<I, P>`
-/// maps a function returning a `Result` on the output of a parser.
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err,error::ErrorKind, IResult};
-/// use nom::character::complete::digit1;
-/// # fn main() {
-///
-/// named!(parse<&str, u8>, map_res!(digit1, |s: &str| s.parse::<u8>()));
-///
-/// // the parser will convert the result of digit1 to a number
-/// assert_eq!(parse("123"), Ok(("", 123)));
-///
-/// // this will fail if digit1 fails
-/// assert_eq!(parse("abc"), Err(Err::Error(error_position!("abc", ErrorKind::Digit))));
-///
-/// // this will fail if the mapped function fails (a `u8` is too small to hold `123456`)
-/// assert_eq!(parse("123456"), Err(Err::Error(error_position!("123456", ErrorKind::MapRes))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! map_res (
-  // Internal parser, do not use directly
-  (__impl $i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => (
-    $crate::combinator::map_resc($i, move |i| {$submac!(i, $($args)*)}, move |i| {$submac2!(i, $($args2)*)})
-  );
-  ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
-    map_res!(__impl $i, $submac!($($args)*), call!($g));
-  );
-  ($i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => (
-    map_res!(__impl $i, $submac!($($args)*), $submac2!($($args2)*));
-  );
-  ($i:expr, $f:expr, $g:expr) => (
-    map_res!(__impl $i, call!($f), call!($g));
-  );
-  ($i:expr, $f:expr, $submac:ident!( $($args:tt)* )) => (
-    map_res!(__impl $i, call!($f), $submac!($($args)*));
-  );
-);
-
-/// `map_opt!(I -> IResult<I, O>, O -> Option<P>) => I -> IResult<I, P>`
-/// maps a function returning an `Option` on the output of a parser.
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err,error::{Error, ErrorKind}, IResult};
-/// use nom::character::complete::digit1;
-/// # fn main() {
-///
-/// named!(parser<&str, u8>, map_opt!(digit1, |s: &str| s.parse::<u8>().ok()));
-///
-/// // the parser will convert the result of digit1 to a number
-/// assert_eq!(parser("123"), Ok(("", 123)));
-///
-/// // this will fail if digit1 fails
-/// assert_eq!(parser("abc"), Err(Err::Error(Error::new("abc", ErrorKind::Digit))));
-///
-/// // this will fail if the mapped function fails (a `u8` is too small to hold `123456`)
-/// assert_eq!(parser("123456"), Err(Err::Error(Error::new("123456", ErrorKind::MapOpt))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! map_opt (
-  // Internal parser, do not use directly
-  (__impl $i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => (
-    $crate::combinator::map_optc($i, move |i| {$submac!(i, $($args)*)}, move |i| {$submac2!(i, $($args2)*)})
-  );
-  ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
-    map_opt!(__impl $i, $submac!($($args)*), call!($g));
-  );
-  ($i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => (
-    map_opt!(__impl $i, $submac!($($args)*), $submac2!($($args2)*));
-  );
-  ($i:expr, $f:expr, $g:expr) => (
-    map_opt!(__impl $i, call!($f), call!($g));
-  );
-  ($i:expr, $f:expr, $submac:ident!( $($args:tt)* )) => (
-    map_opt!(__impl $i, call!($f), $submac!($($args)*));
-  );
-);
-
-/// `parse_to!(O) => I -> IResult<I, O>`
-/// Uses the `parse` method from `std::str::FromStr` to convert the current
-/// input to the specified type.
-///
-/// This will completely consume the input.
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err,error::{Error, ErrorKind}, IResult};
-/// use nom::character::complete::digit1;
-/// # fn main() {
-///
-/// named!(parser<&str, u8>, parse_to!(u8));
-///
-/// assert_eq!(parser("123"), Ok(("", 123)));
-///
-/// assert_eq!(parser("abc"), Err(Err::Error(Error::new("abc", ErrorKind::ParseTo))));
-///
-/// // this will fail if the mapped function fails (a `u8` is too small to hold `123456`)
-/// assert_eq!(parser("123456"), Err(Err::Error(Error::new("123456", ErrorKind::ParseTo))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! parse_to (
-  ($i:expr, $t:ty ) => (
-    {
-      use $crate::lib::std::result::Result::*;
-      use $crate::lib::std::option::Option;
-      use $crate::lib::std::option::Option::*;
-      use $crate::{Err,error::ErrorKind};
-
-      use $crate::ParseTo;
-      use $crate::Slice;
-      use $crate::InputLength;
-
-      let res: Option<$t> = ($i).parse_to();
-      match res {
-        Some(output) => Ok(($i.slice($i.input_len()..), output)),
-        None         => Err(Err::Error($crate::error::make_error($i, ErrorKind::ParseTo)))
-      }
-    }
-  );
-);
-
-/// `verify!(I -> IResult<I, O>, O -> bool) => I -> IResult<I, O>`
-/// returns the result of the child parser if it satisfies a verification function.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!(check<u32>, verify!(nom::number::streaming::be_u32, |val: &u32| *val < 3));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! verify (
-  ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
-    $crate::combinator::verifyc($i, |i| $submac!(i, $($args)*), $g)
-  );
-  ($i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => (
-    $crate::combinator::verifyc($i, |i| $submac!(i, $($args)*), |&o| $submac2!(o, $($args2)*))
-  );
-  ($i:expr, $f:expr, $g:expr) => (
-    $crate::combinator::verify($f, $g)($i)
-  );
-  ($i:expr, $f:expr, $submac:ident!( $($args:tt)* )) => (
-    $crate::combinator::verify($f, |&o| $submac!(o, $($args)*))($i)
-  );
-);
-
-/// `value!(T, R -> IResult<R, S> ) => R -> IResult<R, T>`
-///
-/// or `value!(T) => R -> IResult<R, T>`
-///
-/// If the child parser was successful, return the value.
-/// If no child parser is provided, always return the value.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!(x<u8>, value!(42, delimited!(tag!("<!--"), take!(5), tag!("-->"))));
-///  named!(y<u8>, delimited!(tag!("<!--"), value!(42), tag!("-->")));
-///  let r = x(&b"<!-- abc --> aaa"[..]);
-///  assert_eq!(r, Ok((&b" aaa"[..], 42)));
-///
-///  let r2 = y(&b"<!----> aaa"[..]);
-///  assert_eq!(r2, Ok((&b" aaa"[..], 42)));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! value (
-  ($i:expr, $res:expr, $submac:ident!( $($args:tt)* )) => (
-    $crate::combinator::valuec($i, $res, |i| $submac!(i, $($args)*))
-  );
-  ($i:expr, $res:expr, $f:expr) => (
-    $crate::combinator::valuec($i, $res, $f)
-  );
-  ($i:expr, $res:expr) => (
-    Ok(($i, $res))
-  );
-);
-
-/// `opt!(I -> IResult<I,O>) => I -> IResult<I, Option<O>>`
-/// make the underlying parser optional.
-///
-/// Returns an `Option` of the returned type. This parser returns `Some(result)` if the child parser
-/// succeeds, `None` if it fails, and `Incomplete` if it did not have enough data to decide.
-///
-/// *Warning*: if you are using `opt` for some kind of optional ending token (like an end of line),
-/// you should combine it with `complete` to make sure it works.
-///
-/// As an example, `opt!(tag!("\r\n"))` will return `Incomplete` if it receives an empty input,
-/// because `tag` does not have enough input to decide.
-/// On the contrary, `opt!(complete!(tag!("\r\n")))` would return `None` as produced value,
-/// since `complete!` transforms an `Incomplete` in an `Error`.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!( o<&[u8], Option<&[u8]> >, opt!( tag!( "abcd" ) ) );
-///
-///  let a = b"abcdef";
-///  let b = b"bcdefg";
-///  assert_eq!(o(&a[..]), Ok((&b"ef"[..], Some(&b"abcd"[..]))));
-///  assert_eq!(o(&b[..]), Ok((&b"bcdefg"[..], None)));
-///  # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! opt(
-  ($i:expr, $submac:ident!( $($args:tt)* )) => (
-    {
-      $crate::combinator::optc($i, |i| $submac!(i, $($args)*))
-    }
-  );
-  ($i:expr, $f:expr) => (
-    $crate::combinator::opt($f)($i)
-  );
-);
-
-/// `opt_res!(I -> IResult<I,O>) => I -> IResult<I, Result<nom::Err,O>>`
-/// make the underlying parser optional.
-///
-/// Returns a `Result`, with `Err` containing the parsing error.
-///
-/// ```ignore
-/// # #[macro_use] extern crate nom;
-/// # use nom::ErrorKind;
-/// # fn main() {
-///  named!( o<&[u8], Result<&[u8], nom::Err<&[u8]> > >, opt_res!( tag!( "abcd" ) ) );
-///
-///  let a = b"abcdef";
-///  let b = b"bcdefg";
-///  assert_eq!(o(&a[..]), Ok((&b"ef"[..], Ok(&b"abcd"[..])));
-///  assert_eq!(o(&b[..]), Ok((&b"bcdefg"[..], Err(error_position!(&b[..], ErrorKind::Tag))));
-///  # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! opt_res (
-  ($i:expr, $submac:ident!( $($args:tt)* )) => (
-    {
-      use $crate::lib::std::result::Result::*;
-      use $crate::Err;
-
-      let i_ = $i.clone();
-      match $submac!(i_, $($args)*) {
-        Ok((i,o))          => Ok((i,  Ok(o))),
-        Err(Err::Error(e)) => Ok(($i, Err(Err::Error(e)))),
-        // in case of failure, we return a real error
-        Err(e)             => Err(e)
-      }
-    }
-  );
-  ($i:expr, $f:expr) => (
-    opt_res!($i, call!($f));
-  );
-);
-
-/// `cond!(bool, I -> IResult<I,O>) => I -> IResult<I, Option<O>>`
-/// Conditional combinator
-///
-/// Wraps another parser and calls it if the
-/// condition is met. This combinator returns
-/// an Option of the return type of the child
-/// parser.
-///
-/// This is especially useful if a parser depends
-/// on the value returned by a preceding parser in
-/// a `do_parse!`.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::IResult;
-/// # fn main() {
-///  fn f_true(i: &[u8]) -> IResult<&[u8], Option<&[u8]>> {
-///    cond!(i, true, tag!("abcd"))
-///  }
-///
-///  fn f_false(i: &[u8]) -> IResult<&[u8], Option<&[u8]>> {
-///    cond!(i, false, tag!("abcd"))
-///  }
-///
-///  let a = b"abcdef";
-///  assert_eq!(f_true(&a[..]), Ok((&b"ef"[..], Some(&b"abcd"[..]))));
-///
-///  assert_eq!(f_false(&a[..]), Ok((&b"abcdef"[..], None)));
-///  # }
-/// ```
-///
-#[macro_export(local_inner_macros)]
-macro_rules! cond(
-  ($i:expr, $cond:expr, $submac:ident!( $($args:tt)* )) => (
-    $crate::combinator::condc($i, $cond, |i|  $submac!(i, $($args)*) )
-  );
-  ($i:expr, $cond:expr, $f:expr) => (
-    $crate::combinator::cond($cond, $f)($i)
-  );
-);
-
-/// `peek!(I -> IResult<I,O>) => I -> IResult<I, O>`
-/// returns a result without consuming the input.
-///
-/// The embedded parser may return `Err(Err::Incomplete)`.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!(ptag, peek!( tag!( "abcd" ) ) );
-///
-///  let r = ptag(&b"abcdefgh"[..]);
-///  assert_eq!(r, Ok((&b"abcdefgh"[..], &b"abcd"[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! peek(
-  ($i:expr, $submac:ident!( $($args:tt)* )) => (
-    $crate::combinator::peekc($i, |i| $submac!(i, $($args)*))
-  );
-  ($i:expr, $f:expr) => (
-    $crate::combinator::peek($f)($i)
-  );
-);
-
-/// `not!(I -> IResult<I,O>) => I -> IResult<I, ()>`
-/// returns a result only if the embedded parser returns `Error` or `Err(Err::Incomplete)`.
-/// Does not consume the input.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::Err;
-/// # use nom::error::ErrorKind;
-/// # fn main() {
-/// named!(not_e, do_parse!(
-///     res: tag!("abc")      >>
-///          not!(char!('e')) >>
-///     (res)
-/// ));
-///
-/// let r = not_e(&b"abcd"[..]);
-/// assert_eq!(r, Ok((&b"d"[..], &b"abc"[..])));
-///
-/// let r2 = not_e(&b"abce"[..]);
-/// assert_eq!(r2, Err(Err::Error(error_position!(&b"e"[..], ErrorKind::Not))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! not(
-  ($i:expr, $submac:ident!( $($args:tt)* )) => (
-    $crate::combinator::notc($i, |i| $submac!(i, $($args)*))
-  );
-  ($i:expr, $f:expr) => (
-    $crate::combinator::not($f)($i)
-  );
-);
-
-/// `tap!(name: I -> IResult<I,O> => { block }) => I -> IResult<I, O>`
-/// allows access to the parser's result without affecting it.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use std::str;
-/// # fn main() {
-///  named!(ptag, tap!(res: tag!( "abcd" ) => { println!("recognized {}", str::from_utf8(res).unwrap()) } ) );
-///
-///  let r = ptag(&b"abcdefgh"[..]);
-///  assert_eq!(r, Ok((&b"efgh"[..], &b"abcd"[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! tap (
-  ($i:expr, $name:ident : $submac:ident!( $($args:tt)* ) => $e:expr) => (
-    {
-      use $crate::lib::std::result::Result::*;
-      use $crate::{Err,Needed,IResult};
-
-      match $submac!($i, $($args)*) {
-        Ok((i,o)) => {
-          let $name = o;
-          $e;
-          Ok((i, $name))
-        },
-        Err(e)    => Err(Err::convert(e)),
-      }
-    }
-  );
-  ($i:expr, $name: ident: $f:expr => $e:expr) => (
-    tap!($i, $name: call!($f) => $e);
-  );
-);
-
-/// `eof!()` returns its input if it is at the end of input data.
-///
-/// When we're at the end of the data, this combinator
-/// will succeed.
-///
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use std::str;
-/// # use nom::{Err, error::{Error ,ErrorKind}};
-/// # fn main() {
-///  named!(parser, eof!());
-///
-///  assert_eq!(parser(&b"abc"[..]), Err(Err::Error(Error::new(&b"abc"[..], ErrorKind::Eof))));
-///  assert_eq!(parser(&b""[..]), Ok((&b""[..], &b""[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! eof (
-  ($i:expr,) => (
-    {
-      use $crate::lib::std::result::Result::*;
-      use $crate::{Err,error::ErrorKind};
-
-      use $crate::InputLength;
-      if ($i).input_len() == 0 {
-        let clone = $i.clone();
-        Ok(($i, clone))
-      } else {
-        Err(Err::Error(error_position!($i, ErrorKind::Eof)))
-      }
-    }
-  );
-);
-
-/// `exact!()` will fail if the child parser does not consume the whole data.
-///
-/// TODO: example
-#[macro_export(local_inner_macros)]
-macro_rules! exact (
-  ($i:expr, $submac:ident!( $($args:tt)* )) => ({
-      terminated!($i, $submac!( $($args)*), eof!())
-  });
-  ($i:expr, $f:expr) => (
-    exact!($i, call!($f));
-  );
-);
-
-/// `recognize!(I -> IResult<I, O> ) => I -> IResult<I, I>`
-/// if the child parser was successful, return the consumed input as produced value.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///  named!(x, recognize!(delimited!(tag!("<!--"), take!(5), tag!("-->"))));
-///  let r = x(&b"<!-- abc --> aaa"[..]);
-///  assert_eq!(r, Ok((&b" aaa"[..], &b"<!-- abc -->"[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! recognize (
-  ($i:expr, $submac:ident!( $($args:tt)* )) => (
-    $crate::combinator::recognizec($i, |i| $submac!(i, $($args)*))
-  );
-  ($i:expr, $f:expr) => (
-    $crate::combinator::recognize($f)($i)
-  );
-);
-
-/// `into!(I -> IResult<I, O1, E1>) => I -> IResult<I, O2, E2>`
-/// automatically converts the child parser's result to another type
-///
-/// it will be able to convert the output value and the error value
-/// as long as the `Into` implementations are available
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::IResult;
-/// # fn main() {
-///  named!(parse_to_str<&str, &str>, take!(4));
-///  named!(parse_to_vec<&str, Vec<u8>>, into!(parse_to_str));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! into (
-  ($i:expr, $submac:ident!( $($args:tt)* )) => (
-    $crate::combinator::intoc($i, |i| $submac!(i, $($args)*))
-  );
-  ($i:expr, $f:expr) => (
-    $crate::combinator::intoc($i, $f)
-  );
-);
-
-#[cfg(test)]
-mod tests {
-  use crate::error::ErrorKind;
-  use crate::error::ParseError;
-  use crate::internal::{Err, IResult, Needed};
-  #[cfg(feature = "alloc")]
-  use crate::lib::std::boxed::Box;
-
-  // reproduce the tag and take macros, because of module import order
-  macro_rules! tag (
-    ($i:expr, $tag: expr) => ({
-      use $crate::lib::std::result::Result::*;
-      use $crate::{Err,Needed,IResult,error::ErrorKind};
-      use $crate::{Compare,CompareResult,InputLength,Slice};
-
-      let res: IResult<_,_> = match ($i).compare($tag) {
-        CompareResult::Ok => {
-          let blen = $tag.input_len();
-          Ok(($i.slice(blen..), $i.slice(..blen)))
-        },
-        CompareResult::Incomplete => {
-          Err(Err::Incomplete(Needed::new($tag.input_len() - $i.input_len())))
-        },
-        CompareResult::Error => {
-          let e:ErrorKind = ErrorKind::Tag;
-          Err(Err::Error($crate::error::make_error($i, e)))
-        }
-      };
-      res
-      });
-  );
-
-  macro_rules! take(
-    ($i:expr, $count:expr) => (
-      {
-        let cnt = $count as usize;
-        let res:IResult<&[u8],&[u8]> = if $i.len() < cnt {
-          Err($crate::Err::Incomplete($crate::Needed::new(cnt - $i.len())))
-        } else {
-          Ok((&$i[cnt..],&$i[0..cnt]))
-        };
-        res
-      }
-    );
-  );
-
-  mod pub_named_mod {
-    named!(pub tst, tag!("abcd"));
-  }
-
-  #[test]
-  fn pub_named_test() {
-    let a = &b"abcd"[..];
-    let res = pub_named_mod::tst(a);
-    assert_eq!(res, Ok((&b""[..], a)));
-  }
-
-  mod pub_crate_named_mod {
-    named!(pub(crate) tst, tag!("abcd"));
-  }
-
-  #[test]
-  fn pub_crate_named_test() {
-    let a = &b"abcd"[..];
-    let res = pub_crate_named_mod::tst(a);
-    assert_eq!(res, Ok((&b""[..], a)));
-  }
-
-  #[test]
-  fn apply_test() {
-    fn sum2(a: u8, b: u8) -> u8 {
-      a + b
-    }
-    fn sum3(a: u8, b: u8, c: u8) -> u8 {
-      a + b + c
-    }
-    let a = call!(1, sum2, 2);
-    let b = call!(1, sum3, 2, 3);
-
-    assert_eq!(a, 3);
-    assert_eq!(b, 6);
-  }
-
-  #[test]
-  fn opt() {
-    named!(opt_abcd<&[u8],Option<&[u8]> >, opt!(tag!("abcd")));
-
-    let a = &b"abcdef"[..];
-    let b = &b"bcdefg"[..];
-    let c = &b"ab"[..];
-    assert_eq!(opt_abcd(a), Ok((&b"ef"[..], Some(&b"abcd"[..]))));
-    assert_eq!(opt_abcd(b), Ok((&b"bcdefg"[..], None)));
-    assert_eq!(opt_abcd(c), Err(Err::Incomplete(Needed::new(2))));
-  }
-
-  #[test]
-  fn opt_res() {
-    named!(opt_res_abcd<&[u8], Result<&[u8], Err<crate::error::Error<&[u8]>>> >, opt_res!(tag!("abcd")));
-
-    let a = &b"abcdef"[..];
-    let b = &b"bcdefg"[..];
-    let c = &b"ab"[..];
-    assert_eq!(opt_res_abcd(a), Ok((&b"ef"[..], Ok(&b"abcd"[..]))));
-    assert_eq!(
-      opt_res_abcd(b),
-      Ok((
-        &b"bcdefg"[..],
-        Err(Err::Error(error_position!(b, ErrorKind::Tag)))
-      ))
-    );
-    assert_eq!(opt_res_abcd(c), Err(Err::Incomplete(Needed::new(2))));
-  }
-
-  use crate::lib::std::convert::From;
-  #[derive(Debug, PartialEq)]
-  pub struct CustomError(&'static str);
-  impl<I> From<(I, ErrorKind)> for CustomError {
-    fn from(_: (I, ErrorKind)) -> Self {
-      CustomError("test")
-    }
-  }
-  impl<I> From<crate::error::Error<I>> for CustomError {
-    fn from(_: crate::error::Error<I>) -> Self {
-      CustomError("test")
-    }
-  }
-
-  impl<I> ParseError<I> for CustomError {
-    fn from_error_kind(_: I, _: ErrorKind) -> Self {
-      CustomError("from_error_kind")
-    }
-
-    fn append(_: I, _: ErrorKind, _: CustomError) -> Self {
-      CustomError("append")
-    }
-  }
-
-  #[test]
-  #[cfg(feature = "alloc")]
-  fn cond() {
-    fn f_true(i: &[u8]) -> IResult<&[u8], Option<&[u8]>, CustomError> {
-      fix_error!(i, CustomError, cond!(true, tag!("abcd")))
-    }
-
-    fn f_false(i: &[u8]) -> IResult<&[u8], Option<&[u8]>, CustomError> {
-      fix_error!(i, CustomError, cond!(false, tag!("abcd")))
-    }
-
-    assert_eq!(f_true(&b"abcdef"[..]), Ok((&b"ef"[..], Some(&b"abcd"[..]))));
-    assert_eq!(f_true(&b"ab"[..]), Err(Err::Incomplete(Needed::new(2))));
-    assert_eq!(f_true(&b"xxx"[..]), Err(Err::Error(CustomError("test"))));
-
-    assert_eq!(f_false(&b"abcdef"[..]), Ok((&b"abcdef"[..], None)));
-    assert_eq!(f_false(&b"ab"[..]), Ok((&b"ab"[..], None)));
-    assert_eq!(f_false(&b"xxx"[..]), Ok((&b"xxx"[..], None)));
-  }
-
-  #[test]
-  #[cfg(feature = "alloc")]
-  fn cond_wrapping() {
-    // Test that cond!() will wrap a given identifier in the call!() macro.
-    named!(tag_abcd, tag!("abcd"));
-    fn f_true(i: &[u8]) -> IResult<&[u8], Option<&[u8]>, CustomError> {
-      fix_error!(i, CustomError, cond!(true, tag_abcd))
-    }
-
-    fn f_false(i: &[u8]) -> IResult<&[u8], Option<&[u8]>, CustomError> {
-      fix_error!(i, CustomError, cond!(false, tag_abcd))
-    }
-
-    assert_eq!(f_true(&b"abcdef"[..]), Ok((&b"ef"[..], Some(&b"abcd"[..]))));
-    assert_eq!(f_true(&b"ab"[..]), Err(Err::Incomplete(Needed::new(2))));
-    assert_eq!(f_true(&b"xxx"[..]), Err(Err::Error(CustomError("test"))));
-
-    assert_eq!(f_false(&b"abcdef"[..]), Ok((&b"abcdef"[..], None)));
-    assert_eq!(f_false(&b"ab"[..]), Ok((&b"ab"[..], None)));
-    assert_eq!(f_false(&b"xxx"[..]), Ok((&b"xxx"[..], None)));
-  }
-
-  #[test]
-  fn peek() {
-    named!(peek_tag<&[u8],&[u8]>, peek!(tag!("abcd")));
-
-    assert_eq!(peek_tag(&b"abcdef"[..]), Ok((&b"abcdef"[..], &b"abcd"[..])));
-    assert_eq!(peek_tag(&b"ab"[..]), Err(Err::Incomplete(Needed::new(2))));
-    assert_eq!(
-      peek_tag(&b"xxx"[..]),
-      Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
-    );
-  }
-
-  #[test]
-  fn not() {
-    named!(not_aaa<()>, not!(tag!("aaa")));
-    assert_eq!(
-      not_aaa(&b"aaa"[..]),
-      Err(Err::Error(error_position!(&b"aaa"[..], ErrorKind::Not)))
-    );
-    assert_eq!(not_aaa(&b"aa"[..]), Err(Err::Incomplete(Needed::new(1))));
-    assert_eq!(not_aaa(&b"abcd"[..]), Ok((&b"abcd"[..], ())));
-  }
-
-  #[test]
-  fn verify() {
-    named!(test, verify!(take!(5), |slice: &[u8]| slice[0] == b'a'));
-    assert_eq!(test(&b"bcd"[..]), Err(Err::Incomplete(Needed::new(2))));
-    assert_eq!(
-      test(&b"bcdefg"[..]),
-      Err(Err::Error(error_position!(
-        &b"bcdefg"[..],
-        ErrorKind::Verify
-      )))
-    );
-    assert_eq!(test(&b"abcdefg"[..]), Ok((&b"fg"[..], &b"abcde"[..])));
-  }
-
-  #[test]
-  fn parse_to() {
-    let res: IResult<_, _, (&str, ErrorKind)> = parse_to!("ab", usize);
-
-    assert_eq!(
-      res,
-      Err(Err::Error(error_position!("ab", ErrorKind::ParseTo)))
-    );
-
-    let res: IResult<_, _, (&str, ErrorKind)> = parse_to!("42", usize);
-
-    assert_eq!(res, Ok(("", 42)));
-    //assert_eq!(ErrorKind::convert(ErrorKind::ParseTo), ErrorKind::ParseTo::<u64>);
-  }
-}
diff --git a/src/combinator/mod.rs b/src/combinator/mod.rs
index 4792d0b..9645d9a 100644
--- a/src/combinator/mod.rs
+++ b/src/combinator/mod.rs
@@ -16,8 +16,8 @@ use crate::lib::std::ops::{Range, RangeFrom, RangeTo};
 use crate::traits::{AsChar, InputIter, InputLength, InputTakeAtPosition, ParseTo};
 use crate::traits::{Compare, CompareResult, Offset, Slice};
 
-#[macro_use]
-mod macros;
+#[cfg(test)]
+mod tests;
 
 /// Return the remaining input.
 ///
@@ -82,15 +82,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn mapc<I, O1, O2, E, F, G>(input: I, first: F, second: G) -> IResult<I, O2, E>
-where
-  F: Fn(I) -> IResult<I, O1, E>,
-  G: Fn(O1) -> O2,
-{
-  map(first, second).parse(input)
-}
-
 /// Applies a function returning a `Result` over the result of a parser.
 ///
 /// ```rust
@@ -130,19 +121,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn map_resc<I: Clone, O1, O2, E: FromExternalError<I, E2>, E2, F, G>(
-  input: I,
-  first: F,
-  second: G,
-) -> IResult<I, O2, E>
-where
-  F: Fn(I) -> IResult<I, O1, E>,
-  G: Fn(O1) -> Result<O2, E2>,
-{
-  map_res(first, second)(input)
-}
-
 /// Applies a function returning an `Option` over the result of a parser.
 ///
 /// ```rust
@@ -182,19 +160,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn map_optc<I: Clone, O1, O2, E: ParseError<I>, F, G>(
-  input: I,
-  first: F,
-  second: G,
-) -> IResult<I, O2, E>
-where
-  F: Fn(I) -> IResult<I, O1, E>,
-  G: Fn(O1) -> Option<O2>,
-{
-  map_opt(first, second)(input)
-}
-
 /// Applies a parser over the result of another one.
 ///
 /// ```rust
@@ -227,19 +192,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn map_parserc<I, O1, O2, E: ParseError<I>, F, G>(
-  input: I,
-  first: F,
-  second: G,
-) -> IResult<I, O2, E>
-where
-  F: Fn(I) -> IResult<I, O1, E>,
-  G: Fn(O1) -> IResult<O1, O2, E>,
-{
-  map_parser(first, second)(input)
-}
-
 /// Creates a new parser from the output of the first parser, then apply that parser over the rest of the input.
 ///
 /// ```rust
@@ -302,14 +254,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn optc<I: Clone, O, E: ParseError<I>, F>(input: I, f: F) -> IResult<I, Option<O>, E>
-where
-  F: Fn(I) -> IResult<I, O, E>,
-{
-  opt(f)(input)
-}
-
 /// Calls the parser if the condition is met.
 ///
 /// ```rust
@@ -348,14 +292,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn condc<I, O, E: ParseError<I>, F>(input: I, b: bool, f: F) -> IResult<I, Option<O>, E>
-where
-  F: Fn(I) -> IResult<I, O, E>,
-{
-  cond(b, f)(input)
-}
-
 /// Tries to apply its parser without consuming the input.
 ///
 /// ```rust
@@ -384,14 +320,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn peekc<I: Clone, O, E: ParseError<I>, F>(input: I, f: F) -> IResult<I, O, E>
-where
-  F: Fn(I) -> IResult<I, O, E>,
-{
-  peek(f)(input)
-}
-
 /// returns its input if it is at the end of input data
 ///
 /// When we're at the end of the data, this combinator
@@ -446,14 +374,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn completec<I: Clone, O, E: ParseError<I>, F>(input: I, f: F) -> IResult<I, O, E>
-where
-  F: Fn(I) -> IResult<I, O, E>,
-{
-  complete(f)(input)
-}
-
 /// Succeeds if all the input has been consumed by its child parser.
 ///
 /// ```rust
@@ -526,21 +446,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn verifyc<I: Clone, O1, O2, E: ParseError<I>, F, G>(
-  input: I,
-  first: F,
-  second: G,
-) -> IResult<I, O1, E>
-where
-  F: Fn(I) -> IResult<I, O1, E>,
-  G: Fn(&O2) -> bool,
-  O1: Borrow<O2>,
-  O2: ?Sized,
-{
-  verify(first, second)(input)
-}
-
 /// Returns the provided value if the child parser succeeds.
 ///
 /// ```rust
@@ -566,18 +471,6 @@ where
   move |input: I| parser.parse(input).map(|(i, _)| (i, val.clone()))
 }
 
-#[doc(hidden)]
-pub fn valuec<I, O1: Clone, O2, E: ParseError<I>, F>(
-  input: I,
-  val: O1,
-  parser: F,
-) -> IResult<I, O1, E>
-where
-  F: Fn(I) -> IResult<I, O2, E>,
-{
-  value(val, parser)(input)
-}
-
 /// Succeeds if the child parser returns an error.
 ///
 /// ```rust
@@ -607,14 +500,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn notc<I: Clone, O, E: ParseError<I>, F>(input: I, parser: F) -> IResult<I, (), E>
-where
-  F: Fn(I) -> IResult<I, O, E>,
-{
-  not(parser)(input)
-}
-
 /// If the child parser was successful, return the consumed input as produced value.
 ///
 /// ```rust
@@ -649,17 +534,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn recognizec<I: Clone + Offset + Slice<RangeTo<usize>>, O, E: ParseError<I>, F>(
-  input: I,
-  parser: F,
-) -> IResult<I, I, E>
-where
-  F: Fn(I) -> IResult<I, O, E>,
-{
-  recognize(parser)(input)
-}
-
 /// if the child parser was successful, return the consumed input with the output
 /// as a tuple. Functions similarly to [recognize](fn.recognize.html) except it
 /// returns the parser output as well.
@@ -717,16 +591,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn consumedc<I, O, E: ParseError<I>, F>(input: I, parser: F) -> IResult<I, (I, O), E>
-where
-  I: Clone + Offset + Slice<RangeTo<usize>>,
-  E: ParseError<E>,
-  F: Fn(I) -> IResult<I, O, E>,
-{
-  consumed(parser)(input)
-}
-
 /// transforms an error to failure
 ///
 /// ```rust
@@ -752,14 +616,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn cutc<I, O, E: ParseError<I>, F>(input: I, parser: F) -> IResult<I, O, E>
-where
-  F: Fn(I) -> IResult<I, O, E>,
-{
-  cut(parser)(input)
-}
-
 /// automatically converts the child parser's result to another type
 ///
 /// it will be able to convert the output value and the error value
@@ -800,18 +656,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn intoc<I, O1, O2, E1, E2, F>(input: I, parser: F) -> IResult<I, O2, E2>
-where
-  O1: Into<O2>,
-  E1: Into<E2>,
-  E1: ParseError<I>,
-  E2: ParseError<I>,
-  F: Parser<I, O1, E1>,
-{
-  into(parser)(input)
-}
-
 /// Creates an iterator from input data and a parser.
 ///
 /// Call the iterator's [ParserIterator::finish] method to get the remaining input if successful,
@@ -928,209 +772,3 @@ enum State<E> {
 pub fn success<I, O: Clone, E: ParseError<I>>(val: O) -> impl Fn(I) -> IResult<I, O, E> {
   move |input: I| Ok((input, val.clone()))
 }
-
-#[cfg(test)]
-mod tests {
-  use super::*;
-  use crate::bytes::complete::take;
-  use crate::error::ParseError;
-  use crate::internal::{Err, IResult, Needed};
-  use crate::number::complete::u8;
-
-  macro_rules! assert_parse(
-    ($left: expr, $right: expr) => {
-      let res: $crate::IResult<_, _, (_, ErrorKind)> = $left;
-      assert_eq!(res, $right);
-    };
-  );
-
-  /*#[test]
-  fn t1() {
-    let v1:Vec<u8> = vec![1,2,3];
-    let v2:Vec<u8> = vec![4,5,6];
-    let d = Ok((&v1[..], &v2[..]));
-    let res = d.flat_map(print);
-    assert_eq!(res, Ok((&v2[..], ())));
-  }*/
-
-  #[test]
-  fn eof_on_slices() {
-    let not_over: &[u8] = &b"Hello, world!"[..];
-    let is_over: &[u8] = &b""[..];
-
-    let res_not_over = eof(not_over);
-    assert_parse!(
-      res_not_over,
-      Err(Err::Error(error_position!(not_over, ErrorKind::Eof)))
-    );
-
-    let res_over = eof(is_over);
-    assert_parse!(res_over, Ok((is_over, is_over)));
-  }
-
-  #[test]
-  fn eof_on_strs() {
-    let not_over: &str = "Hello, world!";
-    let is_over: &str = "";
-
-    let res_not_over = eof(not_over);
-    assert_parse!(
-      res_not_over,
-      Err(Err::Error(error_position!(not_over, ErrorKind::Eof)))
-    );
-
-    let res_over = eof(is_over);
-    assert_parse!(res_over, Ok((is_over, is_over)));
-  }
-
-  /*
-  #[test]
-  fn end_of_input() {
-      let not_over = &b"Hello, world!"[..];
-      let is_over = &b""[..];
-      named!(eof_test, eof!());
-
-      let res_not_over = eof_test(not_over);
-      assert_eq!(res_not_over, Err(Err::Error(error_position!(not_over, ErrorKind::Eof))));
-
-      let res_over = eof_test(is_over);
-      assert_eq!(res_over, Ok((is_over, is_over)));
-  }
-  */
-
-  #[test]
-  fn rest_on_slices() {
-    let input: &[u8] = &b"Hello, world!"[..];
-    let empty: &[u8] = &b""[..];
-    assert_parse!(rest(input), Ok((empty, input)));
-  }
-
-  #[test]
-  fn rest_on_strs() {
-    let input: &str = "Hello, world!";
-    let empty: &str = "";
-    assert_parse!(rest(input), Ok((empty, input)));
-  }
-
-  #[test]
-  fn rest_len_on_slices() {
-    let input: &[u8] = &b"Hello, world!"[..];
-    assert_parse!(rest_len(input), Ok((input, input.len())));
-  }
-
-  use crate::lib::std::convert::From;
-  impl From<u32> for CustomError {
-    fn from(_: u32) -> Self {
-      CustomError
-    }
-  }
-
-  impl<I> ParseError<I> for CustomError {
-    fn from_error_kind(_: I, _: ErrorKind) -> Self {
-      CustomError
-    }
-
-    fn append(_: I, _: ErrorKind, _: CustomError) -> Self {
-      CustomError
-    }
-  }
-
-  struct CustomError;
-  #[allow(dead_code)]
-  fn custom_error(input: &[u8]) -> IResult<&[u8], &[u8], CustomError> {
-    //fix_error!(input, CustomError, alphanumeric)
-    crate::character::streaming::alphanumeric1(input)
-  }
-
-  #[test]
-  fn test_flat_map() {
-    let input: &[u8] = &[3, 100, 101, 102, 103, 104][..];
-    assert_parse!(
-      flat_map(u8, take)(input),
-      Ok((&[103, 104][..], &[100, 101, 102][..]))
-    );
-  }
-
-  #[test]
-  fn test_map_opt() {
-    let input: &[u8] = &[50][..];
-    assert_parse!(
-      map_opt(u8, |u| if u < 20 { Some(u) } else { None })(input),
-      Err(Err::Error((&[50][..], ErrorKind::MapOpt)))
-    );
-    assert_parse!(
-      map_opt(u8, |u| if u > 20 { Some(u) } else { None })(input),
-      Ok((&[][..], 50))
-    );
-  }
-
-  #[test]
-  fn test_map_parser() {
-    let input: &[u8] = &[100, 101, 102, 103, 104][..];
-    assert_parse!(
-      map_parser(take(4usize), take(2usize))(input),
-      Ok((&[104][..], &[100, 101][..]))
-    );
-  }
-
-  #[test]
-  fn test_all_consuming() {
-    let input: &[u8] = &[100, 101, 102][..];
-    assert_parse!(
-      all_consuming(take(2usize))(input),
-      Err(Err::Error((&[102][..], ErrorKind::Eof)))
-    );
-    assert_parse!(
-      all_consuming(take(3usize))(input),
-      Ok((&[][..], &[100, 101, 102][..]))
-    );
-  }
-
-  #[test]
-  #[allow(unused)]
-  fn test_verify_ref() {
-    use crate::bytes::complete::take;
-
-    let mut parser1 = verify(take(3u8), |s: &[u8]| s == &b"abc"[..]);
-
-    assert_eq!(parser1(&b"abcd"[..]), Ok((&b"d"[..], &b"abc"[..])));
-    assert_eq!(
-      parser1(&b"defg"[..]),
-      Err(Err::Error((&b"defg"[..], ErrorKind::Verify)))
-    );
-
-    fn parser2(i: &[u8]) -> IResult<&[u8], u32> {
-      verify(crate::number::streaming::be_u32, |val: &u32| *val < 3)(i)
-    }
-  }
-
-  #[test]
-  #[cfg(feature = "alloc")]
-  fn test_verify_alloc() {
-    use crate::bytes::complete::take;
-    let mut parser1 = verify(map(take(3u8), |s: &[u8]| s.to_vec()), |s: &[u8]| {
-      s == &b"abc"[..]
-    });
-
-    assert_eq!(parser1(&b"abcd"[..]), Ok((&b"d"[..], (&b"abc").to_vec())));
-    assert_eq!(
-      parser1(&b"defg"[..]),
-      Err(Err::Error((&b"defg"[..], ErrorKind::Verify)))
-    );
-  }
-
-  #[test]
-  #[cfg(feature = "std")]
-  fn test_into() {
-    use crate::bytes::complete::take;
-    use crate::{
-      error::{Error, ParseError},
-      Err,
-    };
-
-    let mut parser = into(take::<_, _, Error<_>>(3u8));
-    let result: IResult<&[u8], Vec<u8>> = parser(&b"abcdefg"[..]);
-
-    assert_eq!(result, Ok((&b"defg"[..], vec![97, 98, 99])));
-  }
-}
diff --git a/src/error.rs b/src/error.rs
index a5aa678..240b3b5 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -411,7 +411,6 @@ pub enum ErrorKind {
   Verify,
   TakeTill1,
   TakeWhileMN,
-  ParseTo,
   TooLarge,
   Many0Count,
   Many1Count,
@@ -471,12 +470,11 @@ pub fn error_to_u32(e: &ErrorKind) -> u32 {
     ErrorKind::Verify                    => 66,
     ErrorKind::TakeTill1                 => 67,
     ErrorKind::TakeWhileMN               => 69,
-    ErrorKind::ParseTo                   => 70,
-    ErrorKind::TooLarge                  => 71,
-    ErrorKind::Many0Count                => 72,
-    ErrorKind::Many1Count                => 73,
-    ErrorKind::Float                     => 74,
-    ErrorKind::Satisfy                   => 75,
+    ErrorKind::TooLarge                  => 70,
+    ErrorKind::Many0Count                => 71,
+    ErrorKind::Many1Count                => 72,
+    ErrorKind::Float                     => 73,
+    ErrorKind::Satisfy                   => 74,
   }
 }
 
@@ -533,7 +531,6 @@ impl ErrorKind {
       ErrorKind::Verify                    => "predicate verification",
       ErrorKind::TakeTill1                 => "TakeTill1",
       ErrorKind::TakeWhileMN               => "TakeWhileMN",
-      ErrorKind::ParseTo                   => "Parse string to the specified type",
       ErrorKind::TooLarge                  => "Needed data size is too large",
       ErrorKind::Many0Count                => "Count occurrence of >=0 patterns",
       ErrorKind::Many1Count                => "Count occurrence of >=1 patterns",
@@ -564,104 +561,6 @@ macro_rules! error_node_position(
   });
 );
 
-//FIXME: error rewrite
-/// translate parser result from IResult<I,O,u32> to IResult<I,O,E> with a custom type
-///
-/// ```
-/// # //FIXME
-/// # #[macro_use] extern crate nom;
-/// # use nom::IResult;
-/// # use std::convert::From;
-/// # use nom::Err;
-/// # use nom::error::ErrorKind;
-/// # fn main() {
-/// #    /*
-/// #    // will add a Custom(42) error to the error chain
-/// #    named!(err_test, add_return_error!(ErrorKind::Custom(42u32), tag!("abcd")));
-/// #
-/// #    #[derive(Debug,Clone,PartialEq)]
-/// #    pub struct ErrorStr(String);
-/// #
-/// #    // Convert to IResult<&[u8], &[u8], ErrorStr>
-/// #    impl From<u32> for ErrorStr {
-/// #      fn from(i: u32) -> Self {
-/// #        ErrorStr(format!("custom error code: {}", i))
-/// #      }
-/// #    }
-/// #
-/// #    named!(parser<&[u8], &[u8], ErrorStr>,
-/// #        fix_error!(ErrorStr, err_test)
-/// #      );
-/// #
-/// #    let a = &b"efghblah"[..];
-/// #    assert_eq!(parser(a), Err(Err::Error(Context::Code(a, ErrorKind::Custom(ErrorStr("custom error code: 42".to_string()))))));
-/// # */
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! fix_error (
-  ($i:expr, $t:ty, $submac:ident!( $($args:tt)* )) => (
-    {
-      use $crate::lib::std::result::Result::*;
-      use $crate::Err;
-
-      match $submac!($i, $($args)*) {
-        Ok((i,o)) => Ok((i,o)),
-        Err(e) => {
-          let e2 = match e {
-            Err::Error(err) => {
-              Err::Error(err.into())
-            },
-            Err::Failure(err) => {
-              Err::Failure(err.into())
-            },
-            Err::Incomplete(e) => Err::Incomplete(e),
-          };
-          Err(e2)
-        }
-      }
-    }
-  );
-  ($i:expr, $t:ty, $f:expr) => (
-    fix_error!($i, $t, call!($f));
-  );
-);
-
-/// `flat_map!(R -> IResult<R,S>, S -> IResult<S,T>) => R -> IResult<R, T>`
-///
-/// Combines a parser `R -> IResult<R,S>` and
-/// a parser `S -> IResult<S,T>` to return another
-/// parser `R -> IResult<R,T>`
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err, error::{Error, ErrorKind}};
-/// use nom::number::complete::recognize_float;
-///
-/// named!(parser<&str, f64>, flat_map!(recognize_float, parse_to!(f64)));
-///
-/// assert_eq!(parser("123.45;"), Ok((";", 123.45)));
-/// assert_eq!(parser("abc"), Err(Err::Error(Error::new("abc", ErrorKind::Char))));
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! flat_map(
-  ($i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => (
-    flat_map!(__impl $i, $submac!($($args)*), $submac2!($($args2)*));
-  );
-  ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
-    flat_map!(__impl $i, $submac!($($args)*), call!($g));
-  );
-  ($i:expr, $f:expr, $submac:ident!( $($args:tt)* )) => (
-    flat_map!(__impl $i, call!($f), $submac!($($args)*));
-  );
-  ($i:expr, $f:expr, $g:expr) => (
-    flat_map!(__impl $i, call!($f), call!($g));
-  );
-  (__impl $i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => (
-    $crate::combinator::map_parserc($i, move |i| {$submac!(i, $($args)*)}, move |i| {$submac2!(i, $($args2)*)})
-  );
-);
-
 #[cfg(test)]
 #[cfg(feature = "alloc")]
 mod tests {
diff --git a/src/internal.rs b/src/internal.rs
index fd683c0..d8f27ba 100644
--- a/src/internal.rs
+++ b/src/internal.rs
@@ -46,7 +46,7 @@ impl<I, O, E> Finish<I, O, E> for IResult<I, O, E> {
 
 /// Contains information on needed data if a parser returned `Incomplete`
 #[derive(Debug, PartialEq, Eq, Clone, Copy)]
-#[allow(missing_doc_code_examples)]
+#[allow(rustdoc::missing_doc_code_examples)]
 pub enum Needed {
   /// Needs more data, but we do not know how much
   Unknown,
@@ -93,7 +93,7 @@ impl Needed {
 /// to try other parsers, you were already in the right branch, so the data is invalid
 ///
 #[derive(Debug, Clone, PartialEq)]
-#[allow(missing_doc_code_examples)]
+#[allow(rustdoc::missing_doc_code_examples)]
 pub enum Err<E> {
   /// There was not enough data
   Incomplete(Needed),
@@ -299,7 +299,7 @@ impl<'a, I, O, E> Parser<I, O, E> for Box<dyn Parser<I, O, E> + 'a> {
 }
 
 /// Implementation of `Parser::map`
-#[allow(missing_doc_code_examples)]
+#[allow(rustdoc::missing_doc_code_examples)]
 pub struct Map<F, G, O1> {
   f: F,
   g: G,
@@ -316,7 +316,7 @@ impl<'a, I, O1, O2, E, F: Parser<I, O1, E>, G: Fn(O1) -> O2> Parser<I, O2, E> fo
 }
 
 /// Implementation of `Parser::flat_map`
-#[allow(missing_doc_code_examples)]
+#[allow(rustdoc::missing_doc_code_examples)]
 pub struct FlatMap<F, G, O1> {
   f: F,
   g: G,
@@ -333,7 +333,7 @@ impl<'a, I, O1, O2, E, F: Parser<I, O1, E>, G: Fn(O1) -> H, H: Parser<I, O2, E>>
 }
 
 /// Implementation of `Parser::and_then`
-#[allow(missing_doc_code_examples)]
+#[allow(rustdoc::missing_doc_code_examples)]
 pub struct AndThen<F, G, O1> {
   f: F,
   g: G,
@@ -351,7 +351,7 @@ impl<'a, I, O1, O2, E, F: Parser<I, O1, E>, G: Parser<O1, O2, E>> Parser<I, O2,
 }
 
 /// Implementation of `Parser::and`
-#[allow(missing_doc_code_examples)]
+#[allow(rustdoc::missing_doc_code_examples)]
 pub struct And<F, G> {
   f: F,
   g: G,
@@ -368,7 +368,7 @@ impl<'a, I, O1, O2, E, F: Parser<I, O1, E>, G: Parser<I, O2, E>> Parser<I, (O1,
 }
 
 /// Implementation of `Parser::or`
-#[allow(missing_doc_code_examples)]
+#[allow(rustdoc::missing_doc_code_examples)]
 pub struct Or<F, G> {
   f: F,
   g: G,
@@ -389,7 +389,7 @@ impl<'a, I: Clone, O, E: crate::error::ParseError<I>, F: Parser<I, O, E>, G: Par
 }
 
 /// Implementation of `Parser::into`
-#[allow(missing_doc_code_examples)]
+#[allow(rustdoc::missing_doc_code_examples)]
 pub struct Into<F, O1, O2: From<O1>, E1, E2: From<E1>> {
   f: F,
   phantom_out1: core::marker::PhantomData<O1>,
diff --git a/src/lib.rs b/src/lib.rs
index ba5b03f..443fccb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,8 +6,6 @@
 //! ## Example
 //!
 //! ```rust
-//! extern crate nom;
-//!
 //! use nom::{
 //!   IResult,
 //!   bytes::complete::{tag, take_while_m_n},
@@ -55,8 +53,7 @@
 //! The code is available on [Github](https://github.com/Geal/nom)
 //!
 //! There are a few [guides](https://github.com/Geal/nom/tree/master/doc) with more details
-//! about [the design of nom macros](https://github.com/Geal/nom/blob/master/doc/how_nom_macros_work.md),
-//! [how to write parsers](https://github.com/Geal/nom/blob/master/doc/making_a_new_parser_from_scratch.md),
+//! about [how to write parsers](https://github.com/Geal/nom/blob/master/doc/making_a_new_parser_from_scratch.md),
 //! or the [error management system](https://github.com/Geal/nom/blob/master/doc/error_management.md).
 //! You can also check out the [recipes] module that contains examples of common patterns.
 //!
@@ -111,9 +108,6 @@
 //! Here is another parser, written without using nom's combinators this time:
 //!
 //! ```rust
-//! #[macro_use]
-//! extern crate nom;
-//!
 //! use nom::{IResult, Err, Needed};
 //!
 //! # fn main() {
@@ -130,7 +124,7 @@
 //! This function takes a byte array as input, and tries to consume 4 bytes.
 //! Writing all the parsers manually, like this, is dangerous, despite Rust's
 //! safety features. There are still a lot of mistakes one can make. That's why
-//! nom provides a list of function and macros to help in developing parsers.
+//! nom provides a list of functions to help in developing parsers.
 //!
 //! With functions, you would write it like this:
 //!
@@ -141,24 +135,6 @@
 //! }
 //! ```
 //!
-//! With macros, you would write it like this:
-//!
-//! ```rust
-//! #[macro_use]
-//! extern crate nom;
-//!
-//! # fn main() {
-//! named!(take4, take!(4));
-//! # }
-//! ```
-//!
-//! nom has used macros for combinators from versions 1 to 4, and from version
-//! 5, it proposes new combinators as functions, but still allows the macros style
-//! (macros have been rewritten to use the functions under the hood).
-//! For new parsers, we recommend using the functions instead of macros, since
-//! rustc messages will be much easier to understand.
-//!
-//!
 //! A parser in nom is a function which, for an input type `I`, an output type `O`
 //! and an optional error type `E`, will have the following signature:
 //!
@@ -253,7 +229,6 @@
 //! **`many0`** applies a parser 0 or more times, and returns a vector of the aggregated results:
 //!
 //! ```rust
-//! # #[macro_use] extern crate nom;
 //! # #[cfg(feature = "alloc")]
 //! # fn main() {
 //! use nom::{IResult, multi::many0, bytes::complete::tag};
@@ -274,7 +249,7 @@
 //! # fn main() {}
 //! ```
 //!
-//! Here are some basic combining macros available:
+//! Here are some basic combinators available:
 //!
 //! - **`opt`**: Will make the parser optional (if it returns the `O` type, the new parser returns `Option<O>`)
 //! - **`many0`**: Will apply the parser 0 or more times (if it returns the `O` type, the new parser returns `Vec<O>`)
@@ -286,7 +261,6 @@
 //! Example with `tuple`:
 //!
 //! ```rust
-//! # #[macro_use] extern crate nom;
 //! # fn main() {
 //! use nom::{error::ErrorKind, Needed,
 //! number::streaming::be_u16,
@@ -312,7 +286,6 @@
 //! thanks to the `?` operator:
 //!
 //! ```rust
-//! # #[macro_use] extern crate nom;
 //! # fn main() {
 //! use nom::{IResult, bytes::complete::tag};
 //!
@@ -406,7 +379,7 @@
 #![cfg_attr(feature = "docsrs", feature(doc_cfg))]
 #![cfg_attr(feature = "docsrs", feature(extended_key_value_attributes))]
 #![deny(missing_docs)]
-#![warn(missing_doc_code_examples)]
+#![warn(rustdoc::missing_doc_code_examples)]
 
 #[cfg(feature = "alloc")]
 #[macro_use]
@@ -424,12 +397,12 @@ doc_comment::doctest!("../README.md");
 
 /// Lib module to re-export everything needed from `std` or `core`/`alloc`. This is how `serde` does
 /// it, albeit there it is not public.
-#[allow(missing_doc_code_examples)]
+#[allow(rustdoc::missing_doc_code_examples)]
 pub mod lib {
   /// `std` facade allowing `std`/`core` to be interchangeable. Reexports `alloc` crate optionally,
   /// as well as `core` or `std`
   #[cfg(not(feature = "std"))]
-  #[allow(missing_doc_code_examples)]
+  #[allow(rustdoc::missing_doc_code_examples)]
   /// internal std exports for no_std compatibility
   pub mod std {
     #[doc(hidden)]
@@ -451,7 +424,7 @@ pub mod lib {
   }
 
   #[cfg(feature = "std")]
-  #[allow(missing_doc_code_examples)]
+  #[allow(rustdoc::missing_doc_code_examples)]
   /// internal std exports for no_std compatibility
   pub mod std {
     #[doc(hidden)]
diff --git a/src/multi/mod.rs b/src/multi/mod.rs
index 4d1e283..99061d5 100644
--- a/src/multi/mod.rs
+++ b/src/multi/mod.rs
@@ -61,18 +61,6 @@ where
     }
   }
 }
-// this implementation is used for type inference issues in macros
-#[doc(hidden)]
-#[cfg(feature = "alloc")]
-#[cfg_attr(feature = "docsrs", doc(cfg(feature = "alloc")))]
-pub fn many0c<I, O, E, F>(input: I, f: F) -> IResult<I, Vec<O>, E>
-where
-  I: Clone + PartialEq,
-  F: Fn(I) -> IResult<I, O, E>,
-  E: ParseError<I>,
-{
-  many0(f)(input)
-}
 
 /// Runs the embedded parser until it fails and
 /// returns the results in a `Vec`. Fails if
@@ -134,19 +122,6 @@ where
   }
 }
 
-// this implementation is used for type inference issues in macros
-#[doc(hidden)]
-#[cfg(feature = "alloc")]
-#[cfg_attr(feature = "docsrs", doc(cfg(feature = "alloc")))]
-pub fn many1c<I, O, E, F>(input: I, f: F) -> IResult<I, Vec<O>, E>
-where
-  I: Clone + PartialEq,
-  F: Fn(I) -> IResult<I, O, E>,
-  E: ParseError<I>,
-{
-  many1(f)(input)
-}
-
 /// Applies the parser `f` until the parser `g` produces
 /// a result. Returns a pair consisting of the results of
 /// `f` in a `Vec` and the result of `g`.
@@ -203,20 +178,6 @@ where
   }
 }
 
-// this implementation is used for type inference issues in macros
-#[doc(hidden)]
-#[cfg(feature = "alloc")]
-#[cfg_attr(feature = "docsrs", doc(cfg(feature = "alloc")))]
-pub fn many_tillc<I, O, P, E, F, G>(i: I, f: F, g: G) -> IResult<I, (Vec<O>, P), E>
-where
-  I: Clone + PartialEq,
-  F: Fn(I) -> IResult<I, O, E>,
-  G: Fn(I) -> IResult<I, P, E>,
-  E: ParseError<I>,
-{
-  many_till(f, g)(i)
-}
-
 /// Alternates between two parsers to produce
 /// a list of elements.
 /// # Arguments
@@ -285,20 +246,6 @@ where
   }
 }
 
-// this implementation is used for type inference issues in macros
-#[doc(hidden)]
-#[cfg(feature = "alloc")]
-#[cfg_attr(feature = "docsrs", doc(cfg(feature = "alloc")))]
-pub fn separated_list0c<I, O, O2, E, F, G>(i: I, sep: G, f: F) -> IResult<I, Vec<O>, E>
-where
-  I: Clone + PartialEq,
-  F: Fn(I) -> IResult<I, O, E>,
-  G: Fn(I) -> IResult<I, O2, E>,
-  E: ParseError<I>,
-{
-  separated_list0(sep, f)(i)
-}
-
 /// Alternates between two parsers to produce
 /// a list of elements. Fails if the element
 /// parser does not produce at least one element.
@@ -368,20 +315,6 @@ where
   }
 }
 
-// this implementation is used for type inference issues in macros
-#[doc(hidden)]
-#[cfg(feature = "alloc")]
-#[cfg_attr(feature = "docsrs", doc(cfg(feature = "alloc")))]
-pub fn separated_list1c<I, O, O2, E, F, G>(i: I, sep: G, f: F) -> IResult<I, Vec<O>, E>
-where
-  I: Clone + PartialEq,
-  F: Fn(I) -> IResult<I, O, E>,
-  G: Fn(I) -> IResult<I, O2, E>,
-  E: ParseError<I>,
-{
-  separated_list1(sep, f)(i)
-}
-
 /// Repeats the embedded parser `n` times or until it fails
 /// and returns the results in a `Vec`. Fails if the
 /// embedded parser does not succeed at least `m` times.
@@ -448,18 +381,6 @@ where
   }
 }
 
-// this implementation is used for type inference issues in macros
-#[doc(hidden)]
-#[cfg(feature = "alloc")]
-pub fn many_m_nc<I, O, E, F>(i: I, m: usize, n: usize, f: F) -> IResult<I, Vec<O>, E>
-where
-  I: Clone + PartialEq,
-  F: Fn(I) -> IResult<I, O, E>,
-  E: ParseError<I>,
-{
-  many_m_n(m, n, f)(i)
-}
-
 /// Repeats the embedded parser until it fails
 /// and returns the number of successful iterations.
 /// # Arguments
@@ -510,16 +431,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn many0_countc<I, O, E, F>(i: I, f: F) -> IResult<I, usize, E>
-where
-  I: Clone + PartialEq,
-  F: Fn(I) -> IResult<I, O, E>,
-  E: ParseError<I>,
-{
-  many0_count(f)(i)
-}
-
 /// Repeats the embedded parser until it fails
 /// and returns the number of successful iterations.
 /// Fails if the embedded parser does not succeed
@@ -576,16 +487,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn many1_countc<I, O, E, F>(i: I, f: F) -> IResult<I, usize, E>
-where
-  I: Clone + PartialEq,
-  F: Fn(I) -> IResult<I, O, E>,
-  E: ParseError<I>,
-{
-  many1_count(f)(i)
-}
-
 /// Runs the embedded parser a specified number
 /// of times. Returns the results in a `Vec`.
 /// # Arguments
@@ -759,18 +660,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn fold_many0c<I, O, E, F, G, R>(i: I, f: F, init: R, g: G) -> IResult<I, R, E>
-where
-  I: Clone + PartialEq,
-  F: Fn(I) -> IResult<I, O, E>,
-  G: FnMut(R, O) -> R,
-  E: ParseError<I>,
-  R: Clone,
-{
-  fold_many0(f, init, g)(i)
-}
-
 /// Applies a parser until it fails and accumulates
 /// the results using a given function and initial value.
 /// Fails if the embedded parser does not succeed at least
@@ -848,18 +737,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn fold_many1c<I, O, E, F, G, R>(i: I, f: F, init: R, g: G) -> IResult<I, R, E>
-where
-  I: Clone + PartialEq,
-  F: Fn(I) -> IResult<I, O, E>,
-  G: FnMut(R, O) -> R,
-  E: ParseError<I>,
-  R: Clone,
-{
-  fold_many1(f, init, g)(i)
-}
-
 /// Applies a parser `n` times or until it fails and accumulates
 /// the results using a given function and initial value.
 /// Fails if the embedded parser does not succeed at least `m`
@@ -939,25 +816,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn fold_many_m_nc<I, O, E, F, G, R>(
-  input: I,
-  min: usize,
-  max: usize,
-  parse: F,
-  init: R,
-  fold: G,
-) -> IResult<I, R, E>
-where
-  I: Clone + PartialEq,
-  F: Fn(I) -> IResult<I, O, E>,
-  G: Fn(R, O) -> R,
-  E: ParseError<I>,
-  R: Clone,
-{
-  fold_many_m_n(min, max, parse, init, fold)(input)
-}
-
 /// Gets a number from the parser and returns a
 /// subslice of the input of that size.
 /// If the parser returns `Incomplete`,
@@ -1052,18 +910,6 @@ where
   }
 }
 
-#[doc(hidden)]
-pub fn length_valuec<I, O, N, E, F, G>(i: I, f: F, g: G) -> IResult<I, O, E>
-where
-  I: Clone + InputLength + InputTake,
-  N: ToUsize,
-  F: Fn(I) -> IResult<I, N, E>,
-  G: Fn(I) -> IResult<I, O, E>,
-  E: ParseError<I>,
-{
-  length_value(f, g)(i)
-}
-
 /// Gets a number from the first parser,
 /// then applies the second parser that many times.
 /// # Arguments
diff --git a/src/number/complete.rs b/src/number/complete.rs
index ffebf23..354f292 100644
--- a/src/number/complete.rs
+++ b/src/number/complete.rs
@@ -11,6 +11,26 @@ use crate::sequence::{pair, tuple};
 use crate::traits::{AsChar, InputIter, InputLength, InputTakeAtPosition};
 use crate::traits::{Offset, Slice};
 
+#[doc(hidden)]
+macro_rules! map(
+  // Internal parser, do not use directly
+  (__impl $i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
+    $crate::combinator::map(move |i| {$submac!(i, $($args)*)}, $g).parse($i)
+  );
+  ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
+    map!(__impl $i, $submac!($($args)*), $g)
+  );
+  ($i:expr, $f:expr, $g:expr) => (
+    map!(__impl $i, call!($f), $g)
+  );
+);
+
+#[doc(hidden)]
+macro_rules! call (
+  ($i:expr, $fun:expr) => ( $fun( $i ) );
+  ($i:expr, $fun:expr, $($args:expr),* ) => ( $fun( $i, $($args),* ) );
+);
+
 /// Recognizes an unsigned 1 byte integer.
 ///
 /// *Complete version*: Returns an error if there is not enough input data.
@@ -1900,4 +1920,87 @@ mod tests {
       Err(Err::Failure(("", ErrorKind::Digit)))
     );
   }
+
+  #[test]
+  fn configurable_endianness() {
+    use crate::number::Endianness;
+
+    fn be_tst16(i: &[u8]) -> IResult<&[u8], u16> {
+      u16(Endianness::Big)(i)
+    }
+    fn le_tst16(i: &[u8]) -> IResult<&[u8], u16> {
+      u16(Endianness::Little)(i)
+    }
+    assert_eq!(be_tst16(&[0x80, 0x00]), Ok((&b""[..], 32_768_u16)));
+    assert_eq!(le_tst16(&[0x80, 0x00]), Ok((&b""[..], 128_u16)));
+
+    fn be_tst32(i: &[u8]) -> IResult<&[u8], u32> {
+      u32(Endianness::Big)(i)
+    }
+    fn le_tst32(i: &[u8]) -> IResult<&[u8], u32> {
+      u32(Endianness::Little)(i)
+    }
+    assert_eq!(
+      be_tst32(&[0x12, 0x00, 0x60, 0x00]),
+      Ok((&b""[..], 302_014_464_u32))
+    );
+    assert_eq!(
+      le_tst32(&[0x12, 0x00, 0x60, 0x00]),
+      Ok((&b""[..], 6_291_474_u32))
+    );
+
+    fn be_tst64(i: &[u8]) -> IResult<&[u8], u64> {
+      u64(Endianness::Big)(i)
+    }
+    fn le_tst64(i: &[u8]) -> IResult<&[u8], u64> {
+      u64(Endianness::Little)(i)
+    }
+    assert_eq!(
+      be_tst64(&[0x12, 0x00, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]),
+      Ok((&b""[..], 1_297_142_246_100_992_000_u64))
+    );
+    assert_eq!(
+      le_tst64(&[0x12, 0x00, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]),
+      Ok((&b""[..], 36_028_874_334_666_770_u64))
+    );
+
+    fn be_tsti16(i: &[u8]) -> IResult<&[u8], i16> {
+      i16(Endianness::Big)(i)
+    }
+    fn le_tsti16(i: &[u8]) -> IResult<&[u8], i16> {
+      i16(Endianness::Little)(i)
+    }
+    assert_eq!(be_tsti16(&[0x00, 0x80]), Ok((&b""[..], 128_i16)));
+    assert_eq!(le_tsti16(&[0x00, 0x80]), Ok((&b""[..], -32_768_i16)));
+
+    fn be_tsti32(i: &[u8]) -> IResult<&[u8], i32> {
+      i32(Endianness::Big)(i)
+    }
+    fn le_tsti32(i: &[u8]) -> IResult<&[u8], i32> {
+      i32(Endianness::Little)(i)
+    }
+    assert_eq!(
+      be_tsti32(&[0x00, 0x12, 0x60, 0x00]),
+      Ok((&b""[..], 1_204_224_i32))
+    );
+    assert_eq!(
+      le_tsti32(&[0x00, 0x12, 0x60, 0x00]),
+      Ok((&b""[..], 6_296_064_i32))
+    );
+
+    fn be_tsti64(i: &[u8]) -> IResult<&[u8], i64> {
+      i64(Endianness::Big)(i)
+    }
+    fn le_tsti64(i: &[u8]) -> IResult<&[u8], i64> {
+      i64(Endianness::Little)(i)
+    }
+    assert_eq!(
+      be_tsti64(&[0x00, 0xFF, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]),
+      Ok((&b""[..], 71_881_672_479_506_432_i64))
+    );
+    assert_eq!(
+      le_tsti64(&[0x00, 0xFF, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]),
+      Ok((&b""[..], 36_028_874_334_732_032_i64))
+    );
+  }
 }
diff --git a/src/number/macros.rs b/src/number/macros.rs
deleted file mode 100644
index 27fdcce..0000000
--- a/src/number/macros.rs
+++ /dev/null
@@ -1,265 +0,0 @@
-//! Parsers recognizing numbers
-
-/// If the parameter is `nom::number::Endianness::Big`, parse a big endian u16 integer,
-/// otherwise a little endian u16 integer.
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err, Needed};
-/// use nom::number::Endianness;
-///
-/// # fn main() {
-/// named!(be<u16>, u16!(Endianness::Big));
-///
-/// assert_eq!(be(b"\x00\x01abcd"), Ok((&b"abcd"[..], 0x0001)));
-/// assert_eq!(be(b"\x01"), Err(Err::Incomplete(Needed::new(1))));
-///
-/// named!(le<u16>, u16!(Endianness::Little));
-///
-/// assert_eq!(le(b"\x00\x01abcd"), Ok((&b"abcd"[..], 0x0100)));
-/// assert_eq!(le(b"\x01"), Err(Err::Incomplete(Needed::new(1))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! u16 ( ($i:expr, $e:expr) => ( {if $crate::number::Endianness::Big == $e { $crate::number::streaming::be_u16($i) } else { $crate::number::streaming::le_u16($i) } } ););
-
-/// If the parameter is `nom::number::Endianness::Big`, parse a big endian u32 integer,
-/// otherwise a little endian u32 integer.
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err, Needed};
-/// use nom::number::Endianness;
-///
-/// # fn main() {
-/// named!(be<u32>, u32!(Endianness::Big));
-///
-/// assert_eq!(be(b"\x00\x01\x02\x03abcd"), Ok((&b"abcd"[..], 0x00010203)));
-/// assert_eq!(be(b"\x01"), Err(Err::Incomplete(Needed::new(3))));
-///
-/// named!(le<u32>, u32!(Endianness::Little));
-///
-/// assert_eq!(le(b"\x00\x01\x02\x03abcd"), Ok((&b"abcd"[..], 0x03020100)));
-/// assert_eq!(le(b"\x01"), Err(Err::Incomplete(Needed::new(3))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! u32 ( ($i:expr, $e:expr) => ( {if $crate::number::Endianness::Big == $e { $crate::number::streaming::be_u32($i) } else { $crate::number::streaming::le_u32($i) } } ););
-
-/// If the parameter is `nom::number::Endianness::Big`, parse a big endian u64 integer,
-/// otherwise a little endian u64 integer.
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err, Needed};
-/// use nom::number::Endianness;
-///
-/// # fn main() {
-/// named!(be<u64>, u64!(Endianness::Big));
-///
-/// assert_eq!(be(b"\x00\x01\x02\x03\x04\x05\x06\x07abcd"), Ok((&b"abcd"[..], 0x0001020304050607)));
-/// assert_eq!(be(b"\x01"), Err(Err::Incomplete(Needed::new(7))));
-///
-/// named!(le<u64>, u64!(Endianness::Little));
-///
-/// assert_eq!(le(b"\x00\x01\x02\x03\x04\x05\x06\x07abcd"), Ok((&b"abcd"[..], 0x0706050403020100)));
-/// assert_eq!(le(b"\x01"), Err(Err::Incomplete(Needed::new(7))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! u64 ( ($i:expr, $e:expr) => ( {if $crate::number::Endianness::Big == $e { $crate::number::streaming::be_u64($i) } else { $crate::number::streaming::le_u64($i) } } ););
-
-/// If the parameter is `nom::number::Endianness::Big`, parse a big endian u128 integer,
-/// otherwise a little endian u128 integer.
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err, Needed};
-/// use nom::number::Endianness;
-///
-/// # fn main() {
-/// named!(be<u128>, u128!(Endianness::Big));
-///
-/// assert_eq!(be(b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15abcd"), Ok((&b"abcd"[..], 0x00010203040506070809101112131415)));
-/// assert_eq!(be(b"\x01"), Err(Err::Incomplete(Needed::new(15))));
-///
-/// named!(le<u128>, u128!(Endianness::Little));
-///
-/// assert_eq!(le(b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15abcd"), Ok((&b"abcd"[..], 0x15141312111009080706050403020100)));
-/// assert_eq!(le(b"\x01"), Err(Err::Incomplete(Needed::new(15))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-#[cfg(stable_i128)]
-macro_rules! u128 ( ($i:expr, $e:expr) => ( {if $crate::number::Endianness::Big == $e { $crate::number::streaming::be_u128($i) } else { $crate::number::streaming::le_u128($i) } } ););
-
-/// If the parameter is `nom::number::Endianness::Big`, parse a big endian i16 integer,
-/// otherwise a little endian i16 integer.
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err, Needed};
-/// use nom::number::Endianness;
-///
-/// # fn main() {
-/// named!(be<i16>, i16!(Endianness::Big));
-///
-/// assert_eq!(be(b"\x00\x01abcd"), Ok((&b"abcd"[..], 0x0001)));
-/// assert_eq!(be(b"\x01"), Err(Err::Incomplete(Needed::new(1))));
-///
-/// named!(le<i16>, i16!(Endianness::Little));
-///
-/// assert_eq!(le(b"\x00\x01abcd"), Ok((&b"abcd"[..], 0x0100)));
-/// assert_eq!(le(b"\x01"), Err(Err::Incomplete(Needed::new(1))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! i16 ( ($i:expr, $e:expr) => ( {if $crate::number::Endianness::Big == $e { $crate::number::streaming::be_i16($i) } else { $crate::number::streaming::le_i16($i) } } ););
-
-/// If the parameter is `nom::number::Endianness::Big`, parse a big endian i32 integer,
-/// otherwise a little endian i32 integer.
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err, Needed};
-/// use nom::number::Endianness;
-///
-/// # fn main() {
-/// named!(be<i32>, i32!(Endianness::Big));
-///
-/// assert_eq!(be(b"\x00\x01\x02\x03abcd"), Ok((&b"abcd"[..], 0x00010203)));
-/// assert_eq!(be(b"\x01"), Err(Err::Incomplete(Needed::new(3))));
-///
-/// named!(le<i32>, i32!(Endianness::Little));
-///
-/// assert_eq!(le(b"\x00\x01\x02\x03abcd"), Ok((&b"abcd"[..], 0x03020100)));
-/// assert_eq!(le(b"\x01"), Err(Err::Incomplete(Needed::new(3))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! i32 ( ($i:expr, $e:expr) => ( {if $crate::number::Endianness::Big == $e { $crate::number::streaming::be_i32($i) } else { $crate::number::streaming::le_i32($i) } } ););
-
-/// If the parameter is `nom::number::Endianness::Big`, parse a big endian i64 integer,
-/// otherwise a little endian i64 integer.
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err, Needed};
-/// use nom::number::Endianness;
-///
-/// # fn main() {
-/// named!(be<i64>, i64!(Endianness::Big));
-///
-/// assert_eq!(be(b"\x00\x01\x02\x03\x04\x05\x06\x07abcd"), Ok((&b"abcd"[..], 0x0001020304050607)));
-/// assert_eq!(be(b"\x01"), Err(Err::Incomplete(Needed::new(7))));
-///
-/// named!(le<i64>, i64!(Endianness::Little));
-///
-/// assert_eq!(le(b"\x00\x01\x02\x03\x04\x05\x06\x07abcd"), Ok((&b"abcd"[..], 0x0706050403020100)));
-/// assert_eq!(le(b"\x01"), Err(Err::Incomplete(Needed::new(7))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! i64 ( ($i:expr, $e:expr) => ( {if $crate::number::Endianness::Big == $e { $crate::number::streaming::be_i64($i) } else { $crate::number::streaming::le_i64($i) } } ););
-
-/// If the parameter is `nom::number::Endianness::Big`, parse a big endian i64 integer,
-/// otherwise a little endian i64 integer.
-///
-/// ```rust
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err, Needed};
-/// use nom::number::Endianness;
-///
-/// # fn main() {
-/// named!(be<i128>, i128!(Endianness::Big));
-///
-/// assert_eq!(be(b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15abcd"), Ok((&b"abcd"[..], 0x00010203040506070809101112131415)));
-/// assert_eq!(be(b"\x01"), Err(Err::Incomplete(Needed::new(15))));
-///
-/// named!(le<i128>, i128!(Endianness::Little));
-///
-/// assert_eq!(le(b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15abcd"), Ok((&b"abcd"[..], 0x15141312111009080706050403020100)));
-/// assert_eq!(le(b"\x01"), Err(Err::Incomplete(Needed::new(15))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-#[cfg(stable_i128)]
-macro_rules! i128 ( ($i:expr, $e:expr) => ( {if $crate::number::Endianness::Big == $e { $crate::number::streaming::be_i128($i) } else { $crate::number::streaming::le_i128($i) } } ););
-
-#[cfg(test)]
-mod tests {
-  use crate::number::Endianness;
-
-  #[test]
-  fn configurable_endianness() {
-    named!(be_tst16<u16>, u16!(Endianness::Big));
-    named!(le_tst16<u16>, u16!(Endianness::Little));
-    assert_eq!(be_tst16(&[0x80, 0x00]), Ok((&b""[..], 32_768_u16)));
-    assert_eq!(le_tst16(&[0x80, 0x00]), Ok((&b""[..], 128_u16)));
-
-    named!(be_tst32<u32>, u32!(Endianness::Big));
-    named!(le_tst32<u32>, u32!(Endianness::Little));
-    assert_eq!(
-      be_tst32(&[0x12, 0x00, 0x60, 0x00]),
-      Ok((&b""[..], 302_014_464_u32))
-    );
-    assert_eq!(
-      le_tst32(&[0x12, 0x00, 0x60, 0x00]),
-      Ok((&b""[..], 6_291_474_u32))
-    );
-
-    named!(be_tst64<u64>, u64!(Endianness::Big));
-    named!(le_tst64<u64>, u64!(Endianness::Little));
-    assert_eq!(
-      be_tst64(&[0x12, 0x00, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]),
-      Ok((&b""[..], 1_297_142_246_100_992_000_u64))
-    );
-    assert_eq!(
-      le_tst64(&[0x12, 0x00, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]),
-      Ok((&b""[..], 36_028_874_334_666_770_u64))
-    );
-
-    named!(be_tsti16<i16>, i16!(Endianness::Big));
-    named!(le_tsti16<i16>, i16!(Endianness::Little));
-    assert_eq!(be_tsti16(&[0x00, 0x80]), Ok((&b""[..], 128_i16)));
-    assert_eq!(le_tsti16(&[0x00, 0x80]), Ok((&b""[..], -32_768_i16)));
-
-    named!(be_tsti32<i32>, i32!(Endianness::Big));
-    named!(le_tsti32<i32>, i32!(Endianness::Little));
-    assert_eq!(
-      be_tsti32(&[0x00, 0x12, 0x60, 0x00]),
-      Ok((&b""[..], 1_204_224_i32))
-    );
-    assert_eq!(
-      le_tsti32(&[0x00, 0x12, 0x60, 0x00]),
-      Ok((&b""[..], 6_296_064_i32))
-    );
-
-    named!(be_tsti64<i64>, i64!(Endianness::Big));
-    named!(le_tsti64<i64>, i64!(Endianness::Little));
-    assert_eq!(
-      be_tsti64(&[0x00, 0xFF, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]),
-      Ok((&b""[..], 71_881_672_479_506_432_i64))
-    );
-    assert_eq!(
-      le_tsti64(&[0x00, 0xFF, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]),
-      Ok((&b""[..], 36_028_874_334_732_032_i64))
-    );
-  }
-
-  //FIXME
-  /*
-  #[test]
-  #[cfg(feature = "std")]
-  fn manual_configurable_endianness_test() {
-    let x = 1;
-    let int_parse: Box<Fn(&[u8]) -> IResult<&[u8], u16, (&[u8], ErrorKind)>> = if x == 2 {
-      Box::new(be_u16)
-    } else {
-      Box::new(le_u16)
-    };
-    println!("{:?}", int_parse(&b"3"[..]));
-    assert_eq!(int_parse(&[0x80, 0x00]), Ok((&b""[..], 128_u16)));
-  }
-  */
-}
diff --git a/src/number/mod.rs b/src/number/mod.rs
index 6ab2cd5..58c3d51 100644
--- a/src/number/mod.rs
+++ b/src/number/mod.rs
@@ -1,8 +1,5 @@
 //! Parsers recognizing numbers
 
-#[macro_use]
-mod macros;
-
 pub mod complete;
 pub mod streaming;
 
diff --git a/src/number/streaming.rs b/src/number/streaming.rs
index f502519..83b5eff 100644
--- a/src/number/streaming.rs
+++ b/src/number/streaming.rs
@@ -10,6 +10,26 @@ use crate::sequence::{pair, tuple};
 use crate::traits::{AsChar, InputIter, InputLength, InputTakeAtPosition};
 use crate::traits::{Offset, Slice};
 
+#[doc(hidden)]
+macro_rules! map(
+  // Internal parser, do not use directly
+  (__impl $i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
+    $crate::combinator::map(move |i| {$submac!(i, $($args)*)}, $g).parse($i)
+  );
+  ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
+    map!(__impl $i, $submac!($($args)*), $g)
+  );
+  ($i:expr, $f:expr, $g:expr) => (
+    map!(__impl $i, call!($f), $g)
+  );
+);
+
+#[doc(hidden)]
+macro_rules! call (
+  ($i:expr, $fun:expr) => ( $fun( $i ) );
+  ($i:expr, $fun:expr, $($args:expr),* ) => ( $fun( $i, $($args),* ) );
+);
+
 /// Recognizes an unsigned 1 byte integer.
 ///
 /// *Streaming version*: Will return `Err(nom::Err::Incomplete(_))` if there is not enough data.
@@ -1983,4 +2003,87 @@ mod tests {
       Err(Err::Incomplete(Needed::new(1)))
     );
   }
+
+  #[test]
+  fn configurable_endianness() {
+    use crate::number::Endianness;
+
+    fn be_tst16(i: &[u8]) -> IResult<&[u8], u16> {
+      u16(Endianness::Big)(i)
+    }
+    fn le_tst16(i: &[u8]) -> IResult<&[u8], u16> {
+      u16(Endianness::Little)(i)
+    }
+    assert_eq!(be_tst16(&[0x80, 0x00]), Ok((&b""[..], 32_768_u16)));
+    assert_eq!(le_tst16(&[0x80, 0x00]), Ok((&b""[..], 128_u16)));
+
+    fn be_tst32(i: &[u8]) -> IResult<&[u8], u32> {
+      u32(Endianness::Big)(i)
+    }
+    fn le_tst32(i: &[u8]) -> IResult<&[u8], u32> {
+      u32(Endianness::Little)(i)
+    }
+    assert_eq!(
+      be_tst32(&[0x12, 0x00, 0x60, 0x00]),
+      Ok((&b""[..], 302_014_464_u32))
+    );
+    assert_eq!(
+      le_tst32(&[0x12, 0x00, 0x60, 0x00]),
+      Ok((&b""[..], 6_291_474_u32))
+    );
+
+    fn be_tst64(i: &[u8]) -> IResult<&[u8], u64> {
+      u64(Endianness::Big)(i)
+    }
+    fn le_tst64(i: &[u8]) -> IResult<&[u8], u64> {
+      u64(Endianness::Little)(i)
+    }
+    assert_eq!(
+      be_tst64(&[0x12, 0x00, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]),
+      Ok((&b""[..], 1_297_142_246_100_992_000_u64))
+    );
+    assert_eq!(
+      le_tst64(&[0x12, 0x00, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]),
+      Ok((&b""[..], 36_028_874_334_666_770_u64))
+    );
+
+    fn be_tsti16(i: &[u8]) -> IResult<&[u8], i16> {
+      i16(Endianness::Big)(i)
+    }
+    fn le_tsti16(i: &[u8]) -> IResult<&[u8], i16> {
+      i16(Endianness::Little)(i)
+    }
+    assert_eq!(be_tsti16(&[0x00, 0x80]), Ok((&b""[..], 128_i16)));
+    assert_eq!(le_tsti16(&[0x00, 0x80]), Ok((&b""[..], -32_768_i16)));
+
+    fn be_tsti32(i: &[u8]) -> IResult<&[u8], i32> {
+      i32(Endianness::Big)(i)
+    }
+    fn le_tsti32(i: &[u8]) -> IResult<&[u8], i32> {
+      i32(Endianness::Little)(i)
+    }
+    assert_eq!(
+      be_tsti32(&[0x00, 0x12, 0x60, 0x00]),
+      Ok((&b""[..], 1_204_224_i32))
+    );
+    assert_eq!(
+      le_tsti32(&[0x00, 0x12, 0x60, 0x00]),
+      Ok((&b""[..], 6_296_064_i32))
+    );
+
+    fn be_tsti64(i: &[u8]) -> IResult<&[u8], i64> {
+      i64(Endianness::Big)(i)
+    }
+    fn le_tsti64(i: &[u8]) -> IResult<&[u8], i64> {
+      i64(Endianness::Little)(i)
+    }
+    assert_eq!(
+      be_tsti64(&[0x00, 0xFF, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]),
+      Ok((&b""[..], 71_881_672_479_506_432_i64))
+    );
+    assert_eq!(
+      le_tsti64(&[0x00, 0xFF, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]),
+      Ok((&b""[..], 36_028_874_334_732_032_i64))
+    );
+  }
 }
diff --git a/src/sequence/macros.rs b/src/sequence/macros.rs
deleted file mode 100644
index a2bfb2c..0000000
--- a/src/sequence/macros.rs
+++ /dev/null
@@ -1,920 +0,0 @@
-/// `tuple!(I->IResult<I,A>, I->IResult<I,B>, ... I->IResult<I,X>) => I -> IResult<I, (A, B, ..., X)>`
-/// chains parsers and assemble the sub results in a tuple.
-///
-/// The input type `I` must implement `nom::InputLength`.
-///
-/// This combinator will count how much data is consumed by every child parser
-/// and take it into account if there is not enough data.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::error::ErrorKind;
-/// # use nom::number::streaming::be_u16;
-/// // the return type depends of the children parsers
-/// named!(parser<&[u8], (u16, &[u8], &[u8]) >,
-///   tuple!(
-///     be_u16 ,
-///     take!(3),
-///     tag!("fg")
-///   )
-/// );
-///
-/// # fn main() {
-/// assert_eq!(
-///   parser(&b"abcdefgh"[..]),
-///   Ok((
-///     &b"h"[..],
-///     (0x6162u16, &b"cde"[..], &b"fg"[..])
-///   ))
-/// );
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! tuple (
-  ($i:expr, $($rest:tt)*) => (
-    {
-      tuple_parser!($i, (), $($rest)*)
-    }
-  );
-);
-
-/// Internal parser, do not use directly.
-#[doc(hidden)]
-#[macro_export(local_inner_macros)]
-macro_rules! tuple_parser (
-  ($i:expr, ($($parsed:tt),*), $e:path, $($rest:tt)*) => (
-    tuple_parser!($i, ($($parsed),*), call!($e), $($rest)*);
-  );
-  ($i:expr, (), $submac:ident!( $($args:tt)* ), $($rest:tt)*) => (
-    {
-      let i_ = $i.clone();
-
-      ( $submac!(i_, $($args)*) ).and_then(|(i,o)| {
-        let i_ = i.clone();
-        tuple_parser!(i_, (o), $($rest)*)
-      })
-    }
-  );
-  ($i:expr, ($($parsed:tt)*), $submac:ident!( $($args:tt)* ), $($rest:tt)*) => (
-    {
-      let i_ = $i.clone();
-
-      ( $submac!(i_, $($args)*) ).and_then(|(i,o)| {
-        let i_ = i.clone();
-        tuple_parser!(i_, ($($parsed)* , o), $($rest)*)
-      })
-    }
-  );
-  ($i:expr, ($($parsed:tt),*), $e:path) => (
-    tuple_parser!($i, ($($parsed),*), call!($e));
-  );
-  ($i:expr, (), $submac:ident!( $($args:tt)* )) => (
-    {
-      let i_ = $i.clone();
-      ( $submac!(i_, $($args)*) ).map(|(i,o)| (i, (o)))
-    }
-  );
-  ($i:expr, ($($parsed:expr),*), $submac:ident!( $($args:tt)* )) => (
-    {
-      let i_ = $i.clone();
-      ( $submac!(i_, $($args)*) ).map(|(i,o)| (i, ($($parsed),* , o)))
-    }
-  );
-  ($i:expr, ($($parsed:expr),*)) => (
-    {
-      $crate::lib::std::result::Result::Ok(($i, ($($parsed),*)))
-    }
-  );
-);
-
-/// `pair!(I -> IResult<I,O>, I -> IResult<I,P>) => I -> IResult<I, (O,P)>`
-/// `pair` returns a tuple of the results of its two child parsers if both succeed.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::Err;
-/// # use nom::error::{Error, ErrorKind};
-/// # use nom::character::complete::{alpha1, digit1};
-/// named!(parser<&str, (&str, &str)>, pair!(alpha1, digit1));
-///
-/// # fn main() {
-/// assert_eq!(parser("abc123"), Ok(("", ("abc", "123"))));
-/// assert_eq!(parser("123abc"), Err(Err::Error(Error::new("123abc", ErrorKind::Alpha))));
-/// assert_eq!(parser("abc;123"), Err(Err::Error(Error::new(";123", ErrorKind::Digit))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! pair(
-  ($i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => (
-    pair!($i, |i| $submac!(i, $($args)*), |i| $submac2!(i, $($args2)*))
-  );
-
-  ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
-    pair!($i, |i| $submac!(i, $($args)*), $g);
-  );
-
-  ($i:expr, $f:expr, $submac:ident!( $($args:tt)* )) => (
-    pair!($i, $f, |i| $submac!(i, $($args)*));
-  );
-
-  ($i:expr, $f:expr, $g:expr) => (
-    $crate::sequence::pairc($i, $f, $g)
-  );
-);
-
-/// `separated_pair!(I -> IResult<I,O>, I -> IResult<I, T>, I -> IResult<I,P>) => I -> IResult<I, (O,P)>`
-/// `separated_pair(X,sep,Y)` returns a tuple of its first and third child parsers
-/// if all 3 succeed.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::Err;
-/// # use nom::error::{Error, ErrorKind};
-/// # use nom::character::complete::{alpha1, digit1};
-/// named!(parser<&str, (&str, &str)>, separated_pair!(alpha1, char!(','), digit1));
-///
-/// # fn main() {
-/// assert_eq!(parser("abc,123"), Ok(("", ("abc", "123"))));
-/// assert_eq!(parser("123,abc"), Err(Err::Error(Error::new("123,abc", ErrorKind::Alpha))));
-/// assert_eq!(parser("abc;123"), Err(Err::Error(Error::new(";123", ErrorKind::Char))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! separated_pair(
-  ($i:expr, $submac:ident!( $($args:tt)* ), $($rest:tt)*) => (
-    separated_pair!($i, |i| $submac!(i, $($args)*), $($rest)*)
-  );
-  ($i:expr, $f:expr, $submac:ident!( $($args:tt)* ), $($rest:tt)*) => (
-    separated_pair!($i, $f, |i| $submac!(i, $($args)*), $($rest)*)
-  );
-  ($i:expr, $f:expr, $g:expr, $submac:ident!( $($args:tt)* )) => (
-    separated_pair!($i, $f, $g, |i| $submac!(i, $($args)*))
-  );
-  ($i:expr, $f:expr, $g:expr, $h:expr) => (
-    $crate::sequence::separated_pairc($i, $f, $g, $h)
-  );
-);
-
-/// `preceded!(I -> IResult<I,T>, I -> IResult<I,O>) => I -> IResult<I, O>`
-/// `preceded` returns the result of its second parser if both succeed.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::Err;
-/// # use nom::error::{Error, ErrorKind};
-/// # use nom::character::complete::{alpha1};
-/// named!(parser<&str, &str>, preceded!(char!('-'), alpha1));
-///
-/// # fn main() {
-/// assert_eq!(parser("-abc"), Ok(("", "abc")));
-/// assert_eq!(parser("abc"), Err(Err::Error(Error::new("abc", ErrorKind::Char))));
-/// assert_eq!(parser("-123"), Err(Err::Error(Error::new("123", ErrorKind::Alpha))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! preceded(
-  ($i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => (
-    preceded!($i, |i| $submac!(i, $($args)*), |i| $submac2!(i, $($args2)*))
-  );
-
-  ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
-    preceded!($i, |i| $submac!(i, $($args)*), $g);
-  );
-
-  ($i:expr, $f:expr, $submac:ident!( $($args:tt)* )) => (
-    preceded!($i, $f, |i| $submac!(i, $($args)*));
-  );
-
-  ($i:expr, $f:expr, $g:expr) => (
-    $crate::sequence::precededc($i, $f, $g)
-  );
-);
-
-/// `terminated!(I -> IResult<I,O>, I -> IResult<I,T>) => I -> IResult<I, O>`
-/// `terminated` returns the result of its first parser if both succeed.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::Err;
-/// # use nom::error::{Error, ErrorKind};
-/// # use nom::character::complete::{alpha1};
-/// named!(parser<&str, &str>, terminated!(alpha1, char!(';')));
-///
-/// # fn main() {
-/// assert_eq!(parser("abc;"), Ok(("", "abc")));
-/// assert_eq!(parser("abc,"), Err(Err::Error(Error::new(",", ErrorKind::Char))));
-/// assert_eq!(parser("123;"), Err(Err::Error(Error::new("123;", ErrorKind::Alpha))));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! terminated(
-  ($i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => (
-    terminated!($i, |i| $submac!(i, $($args)*), |i| $submac2!(i, $($args2)*))
-  );
-
-  ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => (
-    terminated!($i, |i| $submac!(i, $($args)*), $g);
-  );
-
-  ($i:expr, $f:expr, $submac:ident!( $($args:tt)* )) => (
-    terminated!($i, $f, |i| $submac!(i, $($args)*));
-  );
-
-  ($i:expr, $f:expr, $g:expr) => (
-    $crate::sequence::terminatedc($i, $f, $g)
-  );
-);
-
-/// `delimited!(I -> IResult<I,T>, I -> IResult<I,O>, I -> IResult<I,U>) => I -> IResult<I, O>`
-/// `delimited(opening, X, closing)` returns X.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::character::complete::{alpha1};
-/// named!(parens,
-///     delimited!(
-///         tag!("("),
-///         alpha1,
-///         tag!(")")
-///     )
-/// );
-///
-/// # fn main() {
-/// let input = &b"(test)"[..];
-/// assert_eq!(parens(input), Ok((&b""[..], &b"test"[..])));
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! delimited(
-  ($i:expr, $submac:ident!( $($args:tt)* ), $($rest:tt)*) => (
-    delimited!($i, |i| $submac!(i, $($args)*), $($rest)*)
-  );
-  ($i:expr, $f:expr, $submac:ident!( $($args:tt)* ), $($rest:tt)*) => (
-    delimited!($i, $f, |i| $submac!(i, $($args)*), $($rest)*)
-  );
-  ($i:expr, $f:expr, $g:expr, $submac:ident!( $($args:tt)* )) => (
-    delimited!($i, $f, $g, |i| $submac!(i, $($args)*))
-  );
-  ($i:expr, $f:expr, $g:expr, $h:expr) => (
-    $crate::sequence::delimitedc($i, $f, $g, $h)
-  );
-);
-
-/// `do_parse!(I->IResult<I,A> >> I->IResult<I,B> >> ... I->IResult<I,X> , ( O ) ) => I -> IResult<I, O>`
-/// `do_parse` applies sub parsers in a sequence.
-/// It can store intermediary results and make them available
-/// for later parsers.
-///
-/// The input type `I` must implement `nom::InputLength`.
-///
-/// This combinator will count how much data is consumed by every child parser
-/// and take it into account if there is not enough data.
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # use nom::{Err,Needed};
-/// use nom::number::streaming::be_u8;
-///
-/// // this parser implements a common pattern in binary formats,
-/// // the TAG-LENGTH-VALUE, where you first recognize a specific
-/// // byte slice, then the next bytes indicate the length of
-/// // the data, then you take that slice and return it
-/// //
-/// // here, we match the tag 42, take the length in the next byte
-/// // and store it in `length`, then use `take!` with `length`
-/// // to obtain the subslice that we store in `bytes`, then return
-/// // `bytes`
-/// // you can use other macro combinators inside do_parse (like the `tag`
-/// // one here), or a function (like `be_u8` here), but you cannot use a
-/// // module path (like `nom::be_u8`) there, because of limitations in macros
-/// named!(tag_length_value,
-///   do_parse!(
-///     tag!( &[ 42u8 ][..] ) >>
-///     length: be_u8         >>
-///     bytes:  take!(length) >>
-///     (bytes)
-///   )
-/// );
-///
-/// # fn main() {
-/// let a: Vec<u8>        = vec!(42, 2, 3, 4, 5);
-/// let result_a: Vec<u8> = vec!(3, 4);
-/// let rest_a: Vec<u8>   = vec!(5);
-/// assert_eq!(tag_length_value(&a[..]), Ok((&rest_a[..], &result_a[..])));
-///
-/// // here, the length is 5, but there are only 3 bytes afterwards (3, 4 and 5),
-/// // so the parser will tell you that you need 7 bytes: one for the tag,
-/// // one for the length, then 5 bytes
-/// let b: Vec<u8>     = vec!(42, 5, 3, 4, 5);
-/// assert_eq!(tag_length_value(&b[..]), Err(Err::Incomplete(Needed::new(2))));
-/// # }
-/// ```
-///
-/// the result is a tuple, so you can return multiple sub results, like
-/// this:
-/// `do_parse!(I->IResult<I,A> >> I->IResult<I,B> >> ... I->IResult<I,X> , ( O, P ) ) => I -> IResult<I, (O,P)>`
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// use nom::number::streaming::be_u8;
-/// named!(tag_length_value<(u8, &[u8])>,
-///   do_parse!(
-///     tag!( &[ 42u8 ][..] ) >>
-///     length: be_u8         >>
-///     bytes:  take!(length) >>
-///     (length, bytes)
-///   )
-/// );
-///
-/// # fn main() {
-/// # }
-/// ```
-///
-#[macro_export(local_inner_macros)]
-macro_rules! do_parse (
-  (__impl $i:expr, ( $($rest:expr),* )) => (
-    $crate::lib::std::result::Result::Ok(($i, ( $($rest),* )))
-  );
-
-  (__impl $i:expr, $field:ident : $submac:ident!( $($args:tt)* ) ) => (
-    do_parse!(__impl $i, $submac!( $($args)* ))
-  );
-
-  (__impl $i:expr, $submac:ident!( $($args:tt)* ) ) => (
-    nom_compile_error!("do_parse is missing the return value. A do_parse call must end
-      with a return value between parenthesis, as follows:
-
-      do_parse!(
-        a: tag!(\"abcd\") >>
-        b: tag!(\"efgh\") >>
-
-        ( Value { a: a, b: b } )
-    ");
-  );
-
-  (__impl $i:expr, $field:ident : $submac:ident!( $($args:tt)* ) ~ $($rest:tt)* ) => (
-    nom_compile_error!("do_parse uses >> as separator, not ~");
-  );
-  (__impl $i:expr, $submac:ident!( $($args:tt)* ) ~ $($rest:tt)* ) => (
-    nom_compile_error!("do_parse uses >> as separator, not ~");
-  );
-  (__impl $i:expr, $field:ident : $e:ident ~ $($rest:tt)*) => (
-    do_parse!(__impl $i, $field: call!($e) ~ $($rest)*);
-  );
-  (__impl $i:expr, $e:ident ~ $($rest:tt)*) => (
-    do_parse!(__impl $i, call!($e) ~ $($rest)*);
-  );
-
-  (__impl $i:expr, $e:ident >> $($rest:tt)*) => (
-    do_parse!(__impl $i, call!($e) >> $($rest)*);
-  );
-  (__impl $i:expr, $submac:ident!( $($args:tt)* ) >> $($rest:tt)*) => (
-    {
-      use $crate::lib::std::result::Result::*;
-
-      let i_ = $i.clone();
-      match $submac!(i_, $($args)*) {
-        Err(e) => Err(e),
-        Ok((i,_))     => {
-          let i_ = i.clone();
-          do_parse!(__impl i_, $($rest)*)
-        },
-      }
-    }
-  );
-
-  (__impl $i:expr, $field:ident : $e:ident >> $($rest:tt)*) => (
-    do_parse!(__impl $i, $field: call!($e) >> $($rest)*);
-  );
-
-  (__impl $i:expr, $field:ident : $submac:ident!( $($args:tt)* ) >> $($rest:tt)*) => (
-    {
-      use $crate::lib::std::result::Result::*;
-
-      let i_ = $i.clone();
-      match  $submac!(i_, $($args)*) {
-        Err(e) => Err(e),
-        Ok((i,o))     => {
-          let $field = o;
-          let i_ = i.clone();
-          do_parse!(__impl i_, $($rest)*)
-        },
-      }
-    }
-  );
-
-  // ending the chain
-  (__impl $i:expr, $e:ident >> ( $($rest:tt)* )) => (
-    do_parse!(__impl $i, call!($e) >> ( $($rest)* ));
-  );
-
-  (__impl $i:expr, $submac:ident!( $($args:tt)* ) >> ( $($rest:tt)* )) => ({
-    use $crate::lib::std::result::Result::*;
-
-    match $submac!($i, $($args)*) {
-      Err(e) => Err(e),
-      Ok((i,_))     => {
-        do_parse!(__finalize i, $($rest)*)
-      },
-    }
-  });
-
-  (__impl $i:expr, $field:ident : $e:ident >> ( $($rest:tt)* )) => (
-    do_parse!(__impl $i, $field: call!($e) >> ( $($rest)* ) );
-  );
-
-  (__impl $i:expr, $field:ident : $submac:ident!( $($args:tt)* ) >> ( $($rest:tt)* )) => ({
-    use $crate::lib::std::result::Result::*;
-
-    match $submac!($i, $($args)*) {
-      Err(e) => Err(e),
-      Ok((i,o))     => {
-        let $field = o;
-        do_parse!(__finalize i, $($rest)*)
-      },
-    }
-  });
-
-  (__finalize $i:expr, ( $o: expr )) => ({
-    use $crate::lib::std::result::Result::Ok;
-    Ok(($i, $o))
-  });
-
-  (__finalize $i:expr, ( $($rest:tt)* )) => ({
-    use $crate::lib::std::result::Result::Ok;
-    Ok(($i, ( $($rest)* )))
-  });
-
-  ($i:expr, $($rest:tt)*) => (
-    {
-      do_parse!(__impl $i, $($rest)*)
-    }
-  );
-  ($submac:ident!( $($args:tt)* ) >> $($rest:tt)* ) => (
-    nom_compile_error!("if you are using do_parse outside of a named! macro, you must
-        pass the input data as first argument, like this:
-
-        let res = do_parse!(input,
-          a: tag!(\"abcd\") >>
-          b: tag!(\"efgh\") >>
-          ( Value { a: a, b: b } )
-        );");
-  );
-  ($e:ident! >> $($rest:tt)* ) => (
-    do_parse!( call!($e) >> $($rest)*);
-  );
-);
-
-#[doc(hidden)]
-#[macro_export]
-macro_rules! nom_compile_error (
-  (( $($args:tt)* )) => ( compile_error!($($args)*) );
-);
-
-#[cfg(test)]
-mod tests {
-  use crate::error::ErrorKind;
-  use crate::internal::{Err, IResult, Needed};
-  use crate::number::streaming::be_u16;
-
-  // reproduce the tag and take macros, because of module import order
-  macro_rules! tag (
-    ($i:expr, $inp: expr) => (
-      {
-        #[inline(always)]
-        fn as_bytes<T: $crate::AsBytes>(b: &T) -> &[u8] {
-          b.as_bytes()
-        }
-
-        let expected = $inp;
-        let bytes    = as_bytes(&expected);
-
-        tag_bytes!($i,bytes)
-      }
-    );
-  );
-
-  macro_rules! tag_bytes (
-    ($i:expr, $bytes: expr) => (
-      {
-        use $crate::lib::std::cmp::min;
-
-        let len = $i.len();
-        let blen = $bytes.len();
-        let m   = min(len, blen);
-        let reduced = &$i[..m];
-        let b       = &$bytes[..m];
-
-        let res: IResult<_,_,_> = if reduced != b {
-          Err($crate::Err::Error(error_position!($i, $crate::error::ErrorKind::Tag)))
-        } else if m < blen {
-          Err($crate::Err::Incomplete(Needed::new(blen)))
-        } else {
-          Ok((&$i[blen..], reduced))
-        };
-        res
-      }
-    );
-  );
-
-  macro_rules! take (
-    ($i:expr, $count:expr) => (
-      {
-        let cnt = $count as usize;
-        let res:IResult<&[u8],&[u8],_> = if $i.len() < cnt {
-          Err($crate::Err::Incomplete(Needed::new(cnt)))
-        } else {
-          Ok((&$i[cnt..],&$i[0..cnt]))
-        };
-        res
-      }
-    );
-  );
-
-  #[derive(PartialEq, Eq, Debug)]
-  struct B {
-    a: u8,
-    b: u8,
-  }
-
-  #[derive(PartialEq, Eq, Debug)]
-  struct C {
-    a: u8,
-    b: Option<u8>,
-  }
-
-  /*FIXME: convert code examples to new error management
-  use util::{add_error_pattern, error_to_list, print_error};
-
-  #[cfg(feature = "std")]
-  #[rustfmt::skip]
-  fn error_to_string<P: Clone + PartialEq>(e: &Context<P, u32>) -> &'static str {
-    let v: Vec<(P, ErrorKind<u32>)> = error_to_list(e);
-    // do it this way if you can use slice patterns
-    //match &v[..] {
-    //  [ErrorKind::Custom(42), ErrorKind::Tag]                         => "missing `ijkl` tag",
-    //  [ErrorKind::Custom(42), ErrorKind::Custom(128), ErrorKind::Tag] => "missing `mnop` tag after `ijkl`",
-    //  _            => "unrecognized error"
-    //}
-
-    let collected: Vec<ErrorKind<u32>> = v.iter().map(|&(_, ref e)| e.clone()).collect();
-    if &collected[..] == [ErrorKind::Custom(42), ErrorKind::Tag] {
-      "missing `ijkl` tag"
-    } else if &collected[..] == [ErrorKind::Custom(42), ErrorKind::Custom(128), ErrorKind::Tag] {
-      "missing `mnop` tag after `ijkl`"
-    } else {
-      "unrecognized error"
-    }
-  }
-
-  // do it this way if you can use box patterns
-  //use $crate::lib::std::str;
-  //fn error_to_string(e:Err) -> String
-  //  match e {
-  //    NodePosition(ErrorKind::Custom(42), i1, box Position(ErrorKind::Tag, i2)) => {
-  //      format!("missing `ijkl` tag, found '{}' instead", str::from_utf8(i2).unwrap())
-  //    },
-  //    NodePosition(ErrorKind::Custom(42), i1, box NodePosition(ErrorKind::Custom(128), i2,  box Position(ErrorKind::Tag, i3))) => {
-  //      format!("missing `mnop` tag after `ijkl`, found '{}' instead", str::from_utf8(i3).unwrap())
-  //    },
-  //    _ => "unrecognized error".to_string()
-  //  }
-  //}
-  */
-
-  #[rustfmt::skip]
-  #[allow(unused_variables)]
-  #[test]
-  fn add_err() {
-    named!(err_test,
-      preceded!(
-        tag!("efgh"),
-        add_return_error!(
-          //ErrorKind::Custom(42u32),
-          ErrorKind::Char,
-          do_parse!(
-                 tag!("ijkl")                                     >>
-            //res: add_return_error!(ErrorKind::Custom(128u32), tag!("mnop")) >>
-            res: add_return_error!(ErrorKind::Eof, tag!("mnop")) >>
-            (res)
-          )
-        )
-      )
-    );
-    let a = &b"efghblah"[..];
-    let b = &b"efghijklblah"[..];
-    let c = &b"efghijklmnop"[..];
-
-    let blah = &b"blah"[..];
-
-    let res_a = err_test(a);
-    let res_b = err_test(b);
-    let res_c = err_test(c);
-    assert_eq!(res_a,
-               Err(Err::Error(error_node_position!(blah,
-                                                   //ErrorKind::Custom(42u32),
-                                                   ErrorKind::Eof,
-                                                   error_position!(blah, ErrorKind::Tag)))));
-    //assert_eq!(res_b, Err(Err::Error(error_node_position!(&b"ijklblah"[..], ErrorKind::Custom(42u32),
-    //  error_node_position!(blah, ErrorKind::Custom(128u32), error_position!(blah, ErrorKind::Tag))))));
-    assert_eq!(res_b, Err(Err::Error(error_node_position!(&b"ijklblah"[..], ErrorKind::Eof,
-      error_node_position!(blah, ErrorKind::Eof, error_position!(blah, ErrorKind::Tag))))));
-    assert_eq!(res_c, Ok((&b""[..], &b"mnop"[..])));
-  }
-
-  #[rustfmt::skip]
-  #[test]
-  fn complete() {
-    named!(err_test,
-      do_parse!(
-             tag!("ijkl")            >>
-        res: complete!(tag!("mnop")) >>
-        (res)
-      )
-    );
-    let a = &b"ijklmn"[..];
-
-    let res_a = err_test(a);
-    assert_eq!(res_a,
-               Err(Err::Error(error_position!(&b"mn"[..], ErrorKind::Complete))));
-  }
-
-  #[test]
-  fn pair() {
-    named!(tag_abc, tag!("abc"));
-    named!(tag_def, tag!("def"));
-    named!( pair_abc_def<&[u8],(&[u8], &[u8])>, pair!(tag_abc, tag_def) );
-
-    assert_eq!(
-      pair_abc_def(&b"abcdefghijkl"[..]),
-      Ok((&b"ghijkl"[..], (&b"abc"[..], &b"def"[..])))
-    );
-    assert_eq!(
-      pair_abc_def(&b"ab"[..]),
-      Err(Err::Incomplete(Needed::new(3)))
-    );
-    assert_eq!(
-      pair_abc_def(&b"abcd"[..]),
-      Err(Err::Incomplete(Needed::new(3)))
-    );
-    assert_eq!(
-      pair_abc_def(&b"xxx"[..]),
-      Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
-    );
-    assert_eq!(
-      pair_abc_def(&b"xxxdef"[..]),
-      Err(Err::Error(error_position!(&b"xxxdef"[..], ErrorKind::Tag)))
-    );
-    assert_eq!(
-      pair_abc_def(&b"abcxxx"[..]),
-      Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
-    );
-  }
-
-  #[test]
-  fn separated_pair() {
-    named!(tag_abc, tag!("abc"));
-    named!(tag_def, tag!("def"));
-    named!(tag_separator, tag!(","));
-    named!( sep_pair_abc_def<&[u8],(&[u8], &[u8])>, separated_pair!(tag_abc, tag_separator, tag_def) );
-
-    assert_eq!(
-      sep_pair_abc_def(&b"abc,defghijkl"[..]),
-      Ok((&b"ghijkl"[..], (&b"abc"[..], &b"def"[..])))
-    );
-    assert_eq!(
-      sep_pair_abc_def(&b"ab"[..]),
-      Err(Err::Incomplete(Needed::new(3)))
-    );
-    assert_eq!(
-      sep_pair_abc_def(&b"abc,d"[..]),
-      Err(Err::Incomplete(Needed::new(3)))
-    );
-    assert_eq!(
-      sep_pair_abc_def(&b"xxx"[..]),
-      Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
-    );
-    assert_eq!(
-      sep_pair_abc_def(&b"xxx,def"[..]),
-      Err(Err::Error(error_position!(&b"xxx,def"[..], ErrorKind::Tag)))
-    );
-    assert_eq!(
-      sep_pair_abc_def(&b"abc,xxx"[..]),
-      Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
-    );
-  }
-
-  #[test]
-  fn preceded() {
-    named!(tag_abcd, tag!("abcd"));
-    named!(tag_efgh, tag!("efgh"));
-    named!( preceded_abcd_efgh<&[u8], &[u8]>, preceded!(tag_abcd, tag_efgh) );
-
-    assert_eq!(
-      preceded_abcd_efgh(&b"abcdefghijkl"[..]),
-      Ok((&b"ijkl"[..], &b"efgh"[..]))
-    );
-    assert_eq!(
-      preceded_abcd_efgh(&b"ab"[..]),
-      Err(Err::Incomplete(Needed::new(4)))
-    );
-    assert_eq!(
-      preceded_abcd_efgh(&b"abcde"[..]),
-      Err(Err::Incomplete(Needed::new(4)))
-    );
-    assert_eq!(
-      preceded_abcd_efgh(&b"xxx"[..]),
-      Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
-    );
-    assert_eq!(
-      preceded_abcd_efgh(&b"xxxxdef"[..]),
-      Err(Err::Error(error_position!(&b"xxxxdef"[..], ErrorKind::Tag)))
-    );
-    assert_eq!(
-      preceded_abcd_efgh(&b"abcdxxx"[..]),
-      Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
-    );
-  }
-
-  #[test]
-  fn terminated() {
-    named!(tag_abcd, tag!("abcd"));
-    named!(tag_efgh, tag!("efgh"));
-    named!( terminated_abcd_efgh<&[u8], &[u8]>, terminated!(tag_abcd, tag_efgh) );
-
-    assert_eq!(
-      terminated_abcd_efgh(&b"abcdefghijkl"[..]),
-      Ok((&b"ijkl"[..], &b"abcd"[..]))
-    );
-    assert_eq!(
-      terminated_abcd_efgh(&b"ab"[..]),
-      Err(Err::Incomplete(Needed::new(4)))
-    );
-    assert_eq!(
-      terminated_abcd_efgh(&b"abcde"[..]),
-      Err(Err::Incomplete(Needed::new(4)))
-    );
-    assert_eq!(
-      terminated_abcd_efgh(&b"xxx"[..]),
-      Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
-    );
-    assert_eq!(
-      terminated_abcd_efgh(&b"xxxxdef"[..]),
-      Err(Err::Error(error_position!(&b"xxxxdef"[..], ErrorKind::Tag)))
-    );
-    assert_eq!(
-      terminated_abcd_efgh(&b"abcdxxxx"[..]),
-      Err(Err::Error(error_position!(&b"xxxx"[..], ErrorKind::Tag)))
-    );
-  }
-
-  #[test]
-  fn delimited() {
-    named!(tag_abc, tag!("abc"));
-    named!(tag_def, tag!("def"));
-    named!(tag_ghi, tag!("ghi"));
-    named!( delimited_abc_def_ghi<&[u8], &[u8]>, delimited!(tag_abc, tag_def, tag_ghi) );
-
-    assert_eq!(
-      delimited_abc_def_ghi(&b"abcdefghijkl"[..]),
-      Ok((&b"jkl"[..], &b"def"[..]))
-    );
-    assert_eq!(
-      delimited_abc_def_ghi(&b"ab"[..]),
-      Err(Err::Incomplete(Needed::new(3)))
-    );
-    assert_eq!(
-      delimited_abc_def_ghi(&b"abcde"[..]),
-      Err(Err::Incomplete(Needed::new(3)))
-    );
-    assert_eq!(
-      delimited_abc_def_ghi(&b"abcdefgh"[..]),
-      Err(Err::Incomplete(Needed::new(3)))
-    );
-    assert_eq!(
-      delimited_abc_def_ghi(&b"xxx"[..]),
-      Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
-    );
-    assert_eq!(
-      delimited_abc_def_ghi(&b"xxxdefghi"[..]),
-      Err(Err::Error(error_position!(
-        &b"xxxdefghi"[..],
-        ErrorKind::Tag
-      ),))
-    );
-    assert_eq!(
-      delimited_abc_def_ghi(&b"abcxxxghi"[..]),
-      Err(Err::Error(error_position!(&b"xxxghi"[..], ErrorKind::Tag)))
-    );
-    assert_eq!(
-      delimited_abc_def_ghi(&b"abcdefxxx"[..]),
-      Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
-    );
-  }
-
-  #[test]
-  fn tuple_test() {
-    named!(tuple_3<&[u8], (u16, &[u8], &[u8]) >,
-    tuple!( be_u16 , take!(3), tag!("fg") ) );
-
-    assert_eq!(
-      tuple_3(&b"abcdefgh"[..]),
-      Ok((&b"h"[..], (0x6162u16, &b"cde"[..], &b"fg"[..])))
-    );
-    assert_eq!(tuple_3(&b"abcd"[..]), Err(Err::Incomplete(Needed::new(3))));
-    assert_eq!(tuple_3(&b"abcde"[..]), Err(Err::Incomplete(Needed::new(2))));
-    assert_eq!(
-      tuple_3(&b"abcdejk"[..]),
-      Err(Err::Error(error_position!(&b"jk"[..], ErrorKind::Tag)))
-    );
-  }
-
-  #[test]
-  fn do_parse() {
-    fn ret_int1(i: &[u8]) -> IResult<&[u8], u8> {
-      Ok((i, 1))
-    }
-    fn ret_int2(i: &[u8]) -> IResult<&[u8], u8> {
-      Ok((i, 2))
-    }
-
-    //trace_macros!(true);
-    named!(do_parser<&[u8], (u8, u8)>,
-      do_parse!(
-        tag!("abcd")       >>
-        opt!(tag!("abcd")) >>
-        aa: ret_int1       >>
-        tag!("efgh")       >>
-        bb: ret_int2       >>
-        tag!("efgh")       >>
-        (aa, bb)
-      )
-    );
-    //named!(do_parser<&[u8], (u8, u8)>,
-    //  do_parse!(
-    //    tag!("abcd") >> aa: ret_int1 >> tag!("efgh") >> bb: ret_int2 >> tag!("efgh") >> (aa, bb)
-    //  )
-    //);
-
-    //trace_macros!(false);
-
-    assert_eq!(
-      do_parser(&b"abcdabcdefghefghX"[..]),
-      Ok((&b"X"[..], (1, 2)))
-    );
-    assert_eq!(do_parser(&b"abcdefghefghX"[..]), Ok((&b"X"[..], (1, 2))));
-    assert_eq!(
-      do_parser(&b"abcdab"[..]),
-      Err(Err::Incomplete(Needed::new(4)))
-    );
-    assert_eq!(
-      do_parser(&b"abcdefghef"[..]),
-      Err(Err::Incomplete(Needed::new(4)))
-    );
-  }
-
-  #[rustfmt::skip]
-  #[test]
-  fn do_parse_dependency() {
-    use crate::number::streaming::be_u8;
-
-    named!(length_value,
-      do_parse!(
-        length: be_u8         >>
-        bytes:  take!(length) >>
-        (bytes)
-      )
-    );
-
-    let a = [2u8, 3, 4, 5];
-    let res_a = [3u8, 4];
-    assert_eq!(length_value(&a[..]), Ok((&a[3..], &res_a[..])));
-    let b = [5u8, 3, 4, 5];
-    assert_eq!(length_value(&b[..]), Err(Err::Incomplete(Needed::new(5))));
-  }
-
-  /*
-  named!(does_not_compile,
-    do_parse!(
-      length: be_u8         >>
-      bytes:  take!(length)
-    )
-  );
-  named!(does_not_compile_either,
-    do_parse!(
-      length: be_u8         ~
-      bytes:  take!(length) ~
-      ( () )
-    )
-  );
-  fn still_does_not_compile() {
-    let data = b"abcd";
-
-    let res = do_parse!(
-      tag!("abcd") >>
-      tag!("efgh") >>
-      ( () )
-    );
-  }
-  */
-}
diff --git a/src/sequence/mod.rs b/src/sequence/mod.rs
index 3d76725..bf5dcfd 100644
--- a/src/sequence/mod.rs
+++ b/src/sequence/mod.rs
@@ -1,7 +1,7 @@
 //! Combinators applying parsers in sequence
 
-#[macro_use]
-mod macros;
+#[cfg(test)]
+mod tests;
 
 use crate::error::ParseError;
 use crate::internal::{IResult, Parser};
@@ -39,20 +39,6 @@ where
   }
 }
 
-// this implementation is used for type inference issues in macros
-#[doc(hidden)]
-pub fn pairc<I, O1, O2, E: ParseError<I>, F, G>(
-  input: I,
-  first: F,
-  second: G,
-) -> IResult<I, (O1, O2), E>
-where
-  F: Fn(I) -> IResult<I, O1, E>,
-  G: Fn(I) -> IResult<I, O2, E>,
-{
-  pair(first, second)(input)
-}
-
 /// Matches an object from the first parser and discards it,
 /// then gets an object from the second parser.
 ///
@@ -86,20 +72,6 @@ where
   }
 }
 
-// this implementation is used for type inference issues in macros
-#[doc(hidden)]
-pub fn precededc<I, O1, O2, E: ParseError<I>, F, G>(
-  input: I,
-  first: F,
-  second: G,
-) -> IResult<I, O2, E>
-where
-  F: Fn(I) -> IResult<I, O1, E>,
-  G: Fn(I) -> IResult<I, O2, E>,
-{
-  preceded(first, second)(input)
-}
-
 /// Gets an object from the first parser,
 /// then matches an object from the second parser and discards it.
 ///
@@ -133,20 +105,6 @@ where
   }
 }
 
-// this implementation is used for type inference issues in macros
-#[doc(hidden)]
-pub fn terminatedc<I, O1, O2, E: ParseError<I>, F, G>(
-  input: I,
-  first: F,
-  second: G,
-) -> IResult<I, O1, E>
-where
-  F: Fn(I) -> IResult<I, O1, E>,
-  G: Fn(I) -> IResult<I, O2, E>,
-{
-  terminated(first, second)(input)
-}
-
 /// Gets an object from the first parser,
 /// then matches an object from the sep_parser and discards it,
 /// then gets another object from the second parser.
@@ -185,22 +143,6 @@ where
   }
 }
 
-// this implementation is used for type inference issues in macros
-#[doc(hidden)]
-pub fn separated_pairc<I, O1, O2, O3, E: ParseError<I>, F, G, H>(
-  input: I,
-  first: F,
-  sep: G,
-  second: H,
-) -> IResult<I, (O1, O3), E>
-where
-  F: Fn(I) -> IResult<I, O1, E>,
-  G: Fn(I) -> IResult<I, O2, E>,
-  H: Fn(I) -> IResult<I, O3, E>,
-{
-  separated_pair(first, sep, second)(input)
-}
-
 /// Matches an object from the first parser and discards it,
 /// then gets an object from the second parser,
 /// and finally matches an object from the third parser and discards it.
@@ -239,22 +181,6 @@ where
   }
 }
 
-// this implementation is used for type inference issues in macros
-#[doc(hidden)]
-pub fn delimitedc<I, O1, O2, O3, E: ParseError<I>, F, G, H>(
-  input: I,
-  first: F,
-  second: G,
-  third: H,
-) -> IResult<I, O2, E>
-where
-  F: Fn(I) -> IResult<I, O1, E>,
-  G: Fn(I) -> IResult<I, O2, E>,
-  H: Fn(I) -> IResult<I, O3, E>,
-{
-  delimited(first, second, third)(input)
-}
-
 /// Helper trait for the tuple combinator.
 ///
 /// This trait is implemented for tuples of parsers of up to 21 elements.
@@ -337,21 +263,3 @@ pub fn tuple<I, O, E: ParseError<I>, List: Tuple<I, O, E>>(
 ) -> impl FnMut(I) -> IResult<I, O, E> {
   move |i: I| l.parse(i)
 }
-
-#[cfg(test)]
-mod tests {
-  use super::*;
-
-  #[test]
-  fn single_element_tuples() {
-    use crate::character::complete::alpha1;
-    use crate::{error::ErrorKind, Err};
-
-    let mut parser = tuple((alpha1,));
-    assert_eq!(parser("abc123def"), Ok(("123def", ("abc",))));
-    assert_eq!(
-      parser("123def"),
-      Err(Err::Error(("123def", ErrorKind::Alpha)))
-    );
-  }
-}
diff --git a/src/str.rs b/src/str.rs
index 444c962..e8d38c6 100644
--- a/src/str.rs
+++ b/src/str.rs
@@ -1,12 +1,11 @@
 #[cfg(test)]
 mod test {
+  #[cfg(feature = "alloc")]
+  use crate::{branch::alt, bytes::complete::tag_no_case, combinator::recognize, multi::many1};
   use crate::{
-      Err, IResult,
-      error::{self, ErrorKind},
-      bytes::complete::tag,
-      branch::alt,
-      combinator::recognize,
-      multi::many1,
+    bytes::complete::{is_a, is_not, tag, take, take_till, take_until},
+    error::{self, ErrorKind},
+    Err, IResult,
   };
 
   #[test]
@@ -14,7 +13,7 @@ mod test {
     const INPUT: &str = "Hello World!";
     const TAG: &str = "Hello";
     fn test(input: &str) -> IResult<&str, &str> {
-      tag!(input, TAG)
+      tag(TAG)(input)
     }
 
     match test(INPUT) {
@@ -38,10 +37,12 @@ mod test {
 
   #[test]
   fn tagtr_incomplete() {
+    use crate::bytes::streaming::tag;
+
     const INPUT: &str = "Hello";
     const TAG: &str = "Hello World!";
 
-    let res: IResult<_, _, error::Error<_>> = tag!(INPUT, TAG);
+    let res: IResult<_, _, error::Error<_>> = tag(TAG)(INPUT);
     match res {
       Err(Err::Incomplete(_)) => (),
       other => {
@@ -59,7 +60,7 @@ mod test {
     const INPUT: &str = "Hello World!";
     const TAG: &str = "Random"; // TAG must be closer than INPUT.
 
-    let res: IResult<_, _, error::Error<_>> = tag!(INPUT, TAG);
+    let res: IResult<_, _, error::Error<_>> = tag(TAG)(INPUT);
     match res {
       Err(Err::Error(_)) => (),
       other => {
@@ -77,7 +78,7 @@ mod test {
     const CONSUMED: &str = "βèƒôřèÂßÇ";
     const LEFTOVER: &str = "áƒƭèř";
 
-    let res: IResult<_, _, error::Error<_>> = take!(INPUT, 9);
+    let res: IResult<_, _, error::Error<_>> = take(9_usize)(INPUT);
     match res {
       Ok((extra, output)) => {
         assert!(
@@ -107,7 +108,7 @@ mod test {
     const CONSUMED: &str = "βèƒôřè";
     const LEFTOVER: &str = "ÂßÇ∂áƒƭèř";
 
-    let res: IResult<_, _, (_, ErrorKind)> = take_until!(INPUT, FIND);
+    let res: IResult<_, _, (_, ErrorKind)> = take_until(FIND)(INPUT);
     match res {
       Ok((extra, output)) => {
         assert!(
@@ -134,9 +135,11 @@ mod test {
 
   #[test]
   fn take_s_incomplete() {
+    use crate::bytes::streaming::take;
+
     const INPUT: &str = "βèƒôřèÂßÇá";
 
-    let res: IResult<_, _, (_, ErrorKind)> = take!(INPUT, 13);
+    let res: IResult<_, _, (_, ErrorKind)> = take(13_usize)(INPUT);
     match res {
       Err(Err::Incomplete(_)) => (),
       other => panic!(
@@ -155,7 +158,11 @@ mod test {
 
   #[test]
   fn take_while() {
-    named!(f<&str,&str>, take_while!(is_alphabetic));
+    use crate::bytes::streaming::take_while;
+
+    fn f(i: &str) -> IResult<&str, &str> {
+      take_while(is_alphabetic)(i)
+    }
     let a = "";
     let b = "abcd";
     let c = "abcd123";
@@ -169,7 +176,11 @@ mod test {
 
   #[test]
   fn take_while1() {
-    named!(f<&str,&str>, take_while1!(is_alphabetic));
+    use crate::bytes::streaming::take_while1;
+
+    fn f(i: &str) -> IResult<&str, &str> {
+      take_while1(is_alphabetic)(i)
+    }
     let a = "";
     let b = "abcd";
     let c = "abcd123";
@@ -193,7 +204,7 @@ mod test {
       c == 'á'
     }
     fn test(input: &str) -> IResult<&str, &str> {
-      take_till!(input, till_s)
+      take_till(till_s)(input)
     }
     match test(INPUT) {
       Ok((extra, output)) => {
@@ -219,6 +230,8 @@ mod test {
 
   #[test]
   fn take_while_succeed_none() {
+    use crate::bytes::complete::take_while;
+
     const INPUT: &str = "βèƒôřèÂßÇáƒƭèř";
     const CONSUMED: &str = "";
     const LEFTOVER: &str = "βèƒôřèÂßÇáƒƭèř";
@@ -226,7 +239,7 @@ mod test {
       c == '9'
     }
     fn test(input: &str) -> IResult<&str, &str> {
-      take_while!(input, while_s)
+      take_while(while_s)(input)
     }
     match test(INPUT) {
       Ok((extra, output)) => {
@@ -257,7 +270,7 @@ mod test {
     const CONSUMED: &str = "βèƒôřèÂßÇ";
     const LEFTOVER: &str = "áƒƭèř";
     fn test(input: &str) -> IResult<&str, &str> {
-      is_not!(input, AVOID)
+      is_not(AVOID)(input)
     }
     match test(INPUT) {
       Ok((extra, output)) => {
@@ -283,6 +296,8 @@ mod test {
 
   #[test]
   fn take_while_succeed_some() {
+    use crate::bytes::complete::take_while;
+
     const INPUT: &str = "βèƒôřèÂßÇáƒƭèř";
     const CONSUMED: &str = "βèƒôřèÂßÇ";
     const LEFTOVER: &str = "áƒƭèř";
@@ -298,7 +313,7 @@ mod test {
         || c == 'Ç'
     }
     fn test(input: &str) -> IResult<&str, &str> {
-      take_while!(input, while_s)
+      take_while(while_s)(input)
     }
     match test(INPUT) {
       Ok((extra, output)) => {
@@ -327,7 +342,7 @@ mod test {
     const INPUT: &str = "βèƒôřèÂßÇáƒƭèř";
     const AVOID: &str = "βúçƙ¥";
     fn test(input: &str) -> IResult<&str, &str> {
-      is_not!(input, AVOID)
+      is_not(AVOID)(input)
     }
     match test(INPUT) {
       Err(Err::Error(_)) => (),
@@ -340,6 +355,8 @@ mod test {
 
   #[test]
   fn take_while1_succeed() {
+    use crate::bytes::complete::take_while1;
+
     const INPUT: &str = "βèƒôřèÂßÇáƒƭèř";
     const CONSUMED: &str = "βèƒôřèÂßÇ";
     const LEFTOVER: &str = "áƒƭèř";
@@ -355,7 +372,7 @@ mod test {
         || c == 'Ç'
     }
     fn test(input: &str) -> IResult<&str, &str> {
-      take_while1!(input, while1_s)
+      take_while1(while1_s)(input)
     }
     match test(INPUT) {
       Ok((extra, output)) => {
@@ -381,10 +398,12 @@ mod test {
 
   #[test]
   fn take_until_incomplete() {
+    use crate::bytes::streaming::take_until;
+
     const INPUT: &str = "βèƒôřè";
     const FIND: &str = "βèƒôřèÂßÇ";
 
-    let res: IResult<_, _, (_, ErrorKind)> = take_until!(INPUT, FIND);
+    let res: IResult<_, _, (_, ErrorKind)> = take_until(FIND)(INPUT);
     match res {
       Err(Err::Incomplete(_)) => (),
       other => panic!(
@@ -402,7 +421,7 @@ mod test {
     const CONSUMED: &str = "βèƒôřèÂßÇ";
     const LEFTOVER: &str = "áƒƭèř";
     fn test(input: &str) -> IResult<&str, &str> {
-      is_a!(input, MATCH)
+      is_a(MATCH)(input)
     }
     match test(INPUT) {
       Ok((extra, output)) => {
@@ -428,12 +447,14 @@ mod test {
 
   #[test]
   fn take_while1_fail() {
+    use crate::bytes::complete::take_while1;
+
     const INPUT: &str = "βèƒôřèÂßÇáƒƭèř";
     fn while1_s(c: char) -> bool {
       c == '9'
     }
     fn test(input: &str) -> IResult<&str, &str> {
-      take_while1!(input, while1_s)
+      take_while1(while1_s)(input)
     }
     match test(INPUT) {
       Err(Err::Error(_)) => (),
@@ -450,7 +471,7 @@ mod test {
     const INPUT: &str = "βèƒôřèÂßÇáƒƭèř";
     const MATCH: &str = "Ûñℓúçƙ¥";
     fn test(input: &str) -> IResult<&str, &str> {
-      is_a!(input, MATCH)
+      is_a(MATCH)(input)
     }
     match test(INPUT) {
       Err(Err::Error(_)) => (),
@@ -463,10 +484,12 @@ mod test {
 
   #[test]
   fn take_until_error() {
+    use crate::bytes::streaming::take_until;
+
     const INPUT: &str = "βèƒôřèÂßÇáƒƭèř";
     const FIND: &str = "Ráñδô₥";
 
-    let res: IResult<_, _, (_, ErrorKind)> = take_until!(INPUT, FIND);
+    let res: IResult<_, _, (_, ErrorKind)> = take_until(FIND)(INPUT);
     match res {
       Err(Err::Incomplete(_)) => (),
       other => panic!(
@@ -484,9 +507,8 @@ mod test {
     let b = "ababcd";
 
     fn f(i: &str) -> IResult<&str, &str> {
-        recognize(many1(alt((tag("a"), tag("b")))))(i)
+      recognize(many1(alt((tag("a"), tag("b")))))(i)
     }
-    //named!(f <&str,&str>, recognize!(many1!(complete!(alt!( tag!("a") | tag!("b") )))));
 
     assert_eq!(f(&a[..]), Ok((&a[6..], &a[..])));
     assert_eq!(f(&b[..]), Ok((&b[4..], &b[..4])));
@@ -494,9 +516,9 @@ mod test {
 
   #[test]
   fn utf8_indexing() {
-    named!(dot(&str) -> &str,
-      tag!(".")
-    );
+    fn dot(i: &str) -> IResult<&str, &str> {
+      tag(".")(i)
+    }
 
     let _ = dot("點");
   }
@@ -504,14 +526,11 @@ mod test {
   #[cfg(feature = "alloc")]
   #[test]
   fn case_insensitive() {
-    named!(test<&str,&str>, tag_no_case!("ABcd"));
+    fn test(i: &str) -> IResult<&str, &str> {
+      tag_no_case("ABcd")(i)
+    }
     assert_eq!(test("aBCdefgh"), Ok(("efgh", "aBCd")));
     assert_eq!(test("abcdefgh"), Ok(("efgh", "abcd")));
     assert_eq!(test("ABCDefgh"), Ok(("efgh", "ABCD")));
-
-    named!(test2<&str,&str>, tag_no_case!("ABcd"));
-    assert_eq!(test2("aBCdefgh"), Ok(("efgh", "aBCd")));
-    assert_eq!(test2("abcdefgh"), Ok(("efgh", "abcd")));
-    assert_eq!(test2("ABCDefgh"), Ok(("efgh", "ABCD")));
   }
 }
diff --git a/src/traits.rs b/src/traits.rs
index b24be2f..b81687b 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -14,7 +14,6 @@ use crate::lib::std::string::String;
 #[cfg(feature = "alloc")]
 use crate::lib::std::vec::Vec;
 
-
 /// Abstract method to calculate the input length
 pub trait InputLength {
   /// Calculates the input length, as indicated by its name,
@@ -45,7 +44,6 @@ impl<'a> InputLength for (&'a [u8], usize) {
   }
 }
 
-
 /// Useful functions to calculate the offset between slices and show a hexdump of a slice
 pub trait Offset {
   /// Offset between the first byte of self and the first byte of the argument
diff --git a/src/util.rs b/src/util.rs
index c48f808..07bc5e6 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -1,8 +1,3 @@
-#[cfg(feature = "std")]
-use crate::internal::IResult;
-#[cfg(feature = "std")]
-use std::fmt::Debug;
-
 #[cfg(feature = "std")]
 #[cfg_attr(feature = "docsrs", doc(cfg(feature = "std")))]
 /// Helper trait to show a byte slice as a hex dump
@@ -79,140 +74,3 @@ impl HexDisplay for str {
     self.as_bytes().to_hex_from(chunk_size, from)
   }
 }
-
-#[doc(hidden)]
-#[macro_export]
-macro_rules! nom_line (
-  () => (line!());
-);
-
-#[doc(hidden)]
-#[macro_export]
-macro_rules! nom_println (
-  ($($args:tt)*) => (println!($($args)*));
-);
-
-#[doc(hidden)]
-#[macro_export]
-macro_rules! nom_stringify (
-  ($($args:tt)*) => (stringify!($($args)*));
-);
-
-/// Prints a message if the parser fails.
-///
-/// The message prints the `Error` or `Incomplete`
-/// and the parser's calling code
-///
-/// ```
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///    named!(f, dbg_basic!( tag!( "abcd" ) ) );
-///
-///    let a = &b"efgh"[..];
-///
-///    // Will print the following message:
-///    // Error(Position(0, [101, 102, 103, 104])) at l.5 by ' tag ! ( "abcd" ) '
-///    f(a);
-/// # }
-/// ```
-#[macro_export(local_inner_macros)]
-macro_rules! dbg_basic (
-  ($i: expr, $submac:ident!( $($args:tt)* )) => (
-    {
-      use $crate::lib::std::result::Result::*;
-      let l = nom_line!();
-      match $submac!($i, $($args)*) {
-        Err(e) => {
-          nom_println!("Err({:?}) at l.{} by ' {} '", e, l, nom_stringify!($submac!($($args)*)));
-          Err(e)
-        },
-        a => a,
-      }
-    }
-  );
-
-  ($i:expr, $f:ident) => (
-      dbg_basic!($i, call!($f));
-  );
-);
-
-/// Prints a message and the input if the parser fails.
-///
-/// The message prints the `Error` or `Incomplete`
-/// and the parser's calling code.
-///
-/// It also displays the input in hexdump format
-///
-/// ```rust
-/// use nom::{IResult, dbg_dmp, bytes::complete::tag};
-///
-/// fn f(i: &[u8]) -> IResult<&[u8], &[u8]> {
-///   dbg_dmp(tag("abcd"), "tag")(i)
-/// }
-///
-///   let a = &b"efghijkl"[..];
-///
-/// // Will print the following message:
-/// // Error(Position(0, [101, 102, 103, 104, 105, 106, 107, 108])) at l.5 by ' tag ! ( "abcd" ) '
-/// // 00000000        65 66 67 68 69 6a 6b 6c         efghijkl
-/// f(a);
-/// ```
-#[cfg(feature = "std")]
-#[cfg_attr(feature = "docsrs", doc(cfg(feature = "std")))]
-pub fn dbg_dmp<'a, F, O, E: Debug>(
-  f: F,
-  context: &'static str,
-) -> impl Fn(&'a [u8]) -> IResult<&'a [u8], O, E>
-where
-  F: Fn(&'a [u8]) -> IResult<&'a [u8], O, E>,
-{
-  move |i: &'a [u8]| match f(i) {
-    Err(e) => {
-      println!("{}: Error({:?}) at:\n{}", context, e, i.to_hex(8));
-      Err(e)
-    }
-    a => a,
-  }
-}
-
-/// Prints a message and the input if the parser fails.
-///
-/// The message prints the `Error` or `Incomplete`
-/// and the parser's calling code.
-///
-/// It also displays the input in hexdump format
-///
-/// ```ignore
-/// # #[macro_use] extern crate nom;
-/// # fn main() {
-///    named!(f, dbg_dmp!( tag!( "abcd" ) ) );
-///
-///    let a = &b"efghijkl"[..];
-///
-///    // Will print the following message:
-///    // Error(Position(0, [101, 102, 103, 104, 105, 106, 107, 108])) at l.5 by ' tag ! ( "abcd" ) '
-///    // 00000000        65 66 67 68 69 6a 6b 6c         efghijkl
-///    f(a);
-/// # }
-#[macro_export(local_inner_macros)]
-#[cfg(feature = "std")]
-#[cfg_attr(feature = "docsrs", doc(cfg(feature = "std")))]
-macro_rules! dbg_dmp (
-  ($i: expr, $submac:ident!( $($args:tt)* )) => (
-    {
-      use $crate::HexDisplay;
-      let l = nom_line!();
-      match $submac!($i, $($args)*) {
-        Err(e) => {
-          nom_println!("Error({:?}) at l.{} by ' {} '\n{}", e, l, nom_stringify!($submac!($($args)*)), $i.to_hex(8));
-          Err(e)
-        },
-        a => a,
-      }
-    }
-  );
-
-  ($i:expr, $f:ident) => (
-      dbg_dmp!($i, call!($f));
-  );
-);


Test patch:
diff --git a/src/branch/tests.rs b/src/branch/tests.rs
index 2cebd86..ecd4440 100644
--- a/src/branch/tests.rs
+++ b/src/branch/tests.rs
@@ -1,9 +1,9 @@
+use crate::branch::{alt, permutation};
+use crate::bytes::streaming::tag;
 use crate::error::ErrorKind;
 use crate::internal::{Err, IResult, Needed};
 #[cfg(feature = "alloc")]
 use crate::{
-  branch::{alt, permutation},
-  bytes::streaming::tag,
   error::ParseError,
   lib::std::{
     fmt::Debug,
diff --git a/src/bytes/tests.rs b/src/bytes/tests.rs
new file mode 100644
index 0000000..d6ad7e5
--- /dev/null
+++ b/src/bytes/tests.rs
@@ -0,0 +1,640 @@
+#[cfg(feature = "alloc")]
+use crate::branch::alt;
+#[cfg(feature = "alloc")]
+use crate::bytes::complete::tag;
+#[cfg(feature = "alloc")]
+use crate::bytes::complete::{escaped, escaped_transform};
+use crate::character::is_alphabetic;
+use crate::character::streaming::{
+  alpha1 as alpha, alphanumeric1 as alphanumeric, digit1 as digit, hex_digit1 as hex_digit,
+  multispace1 as multispace, oct_digit1 as oct_digit, space1 as space,
+};
+#[cfg(feature = "alloc")]
+use crate::combinator::{map, value};
+use crate::error::ErrorKind;
+use crate::internal::{Err, IResult, Needed};
+#[cfg(feature = "alloc")]
+use crate::lib::std::string::String;
+#[cfg(feature = "alloc")]
+use crate::lib::std::vec::Vec;
+
+#[test]
+fn is_a() {
+  use crate::bytes::streaming::is_a;
+
+  fn a_or_b(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    is_a("ab")(i)
+  }
+
+  let a = &b"abcd"[..];
+  assert_eq!(a_or_b(a), Ok((&b"cd"[..], &b"ab"[..])));
+
+  let b = &b"bcde"[..];
+  assert_eq!(a_or_b(b), Ok((&b"cde"[..], &b"b"[..])));
+
+  let c = &b"cdef"[..];
+  assert_eq!(
+    a_or_b(c),
+    Err(Err::Error(error_position!(c, ErrorKind::IsA)))
+  );
+
+  let d = &b"bacdef"[..];
+  assert_eq!(a_or_b(d), Ok((&b"cdef"[..], &b"ba"[..])));
+}
+
+#[test]
+fn is_not() {
+  use crate::bytes::streaming::is_not;
+
+  fn a_or_b(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    is_not("ab")(i)
+  }
+
+  let a = &b"cdab"[..];
+  assert_eq!(a_or_b(a), Ok((&b"ab"[..], &b"cd"[..])));
+
+  let b = &b"cbde"[..];
+  assert_eq!(a_or_b(b), Ok((&b"bde"[..], &b"c"[..])));
+
+  let c = &b"abab"[..];
+  assert_eq!(
+    a_or_b(c),
+    Err(Err::Error(error_position!(c, ErrorKind::IsNot)))
+  );
+
+  let d = &b"cdefba"[..];
+  assert_eq!(a_or_b(d), Ok((&b"ba"[..], &b"cdef"[..])));
+
+  let e = &b"e"[..];
+  assert_eq!(a_or_b(e), Err(Err::Incomplete(Needed::new(1))));
+}
+
+#[cfg(feature = "alloc")]
+#[allow(unused_variables)]
+#[test]
+fn escaping() {
+  use crate::character::streaming::one_of;
+
+  fn esc(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    escaped(alpha, '\\', one_of("\"n\\"))(i)
+  }
+  assert_eq!(esc(&b"abcd;"[..]), Ok((&b";"[..], &b"abcd"[..])));
+  assert_eq!(esc(&b"ab\\\"cd;"[..]), Ok((&b";"[..], &b"ab\\\"cd"[..])));
+  assert_eq!(esc(&b"\\\"abcd;"[..]), Ok((&b";"[..], &b"\\\"abcd"[..])));
+  assert_eq!(esc(&b"\\n;"[..]), Ok((&b";"[..], &b"\\n"[..])));
+  assert_eq!(esc(&b"ab\\\"12"[..]), Ok((&b"12"[..], &b"ab\\\""[..])));
+  assert_eq!(
+    esc(&b"AB\\"[..]),
+    Err(Err::Error(error_position!(
+      &b"AB\\"[..],
+      ErrorKind::Escaped
+    )))
+  );
+  assert_eq!(
+    esc(&b"AB\\A"[..]),
+    Err(Err::Error(error_node_position!(
+      &b"AB\\A"[..],
+      ErrorKind::Escaped,
+      error_position!(&b"A"[..], ErrorKind::OneOf)
+    )))
+  );
+
+  fn esc2(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    escaped(digit, '\\', one_of("\"n\\"))(i)
+  }
+  assert_eq!(esc2(&b"12\\nnn34"[..]), Ok((&b"nn34"[..], &b"12\\n"[..])));
+}
+
+#[cfg(feature = "alloc")]
+#[test]
+fn escaping_str() {
+  use crate::character::streaming::one_of;
+
+  fn esc(i: &str) -> IResult<&str, &str> {
+    escaped(alpha, '\\', one_of("\"n\\"))(i)
+  }
+  assert_eq!(esc("abcd;"), Ok((";", "abcd")));
+  assert_eq!(esc("ab\\\"cd;"), Ok((";", "ab\\\"cd")));
+  assert_eq!(esc("\\\"abcd;"), Ok((";", "\\\"abcd")));
+  assert_eq!(esc("\\n;"), Ok((";", "\\n")));
+  assert_eq!(esc("ab\\\"12"), Ok(("12", "ab\\\"")));
+  assert_eq!(
+    esc("AB\\"),
+    Err(Err::Error(error_position!("AB\\", ErrorKind::Escaped)))
+  );
+  assert_eq!(
+    esc("AB\\A"),
+    Err(Err::Error(error_node_position!(
+      "AB\\A",
+      ErrorKind::Escaped,
+      error_position!("A", ErrorKind::OneOf)
+    )))
+  );
+
+  fn esc2(i: &str) -> IResult<&str, &str> {
+    escaped(digit, '\\', one_of("\"n\\"))(i)
+  }
+  assert_eq!(esc2("12\\nnn34"), Ok(("nn34", "12\\n")));
+
+  fn esc3(i: &str) -> IResult<&str, &str> {
+    escaped(alpha, '\u{241b}', one_of("\"n"))(i)
+  }
+  assert_eq!(esc3("ab␛ncd;"), Ok((";", "ab␛ncd")));
+}
+
+#[cfg(feature = "alloc")]
+fn to_s(i: Vec<u8>) -> String {
+  String::from_utf8_lossy(&i).into_owned()
+}
+
+#[cfg(feature = "alloc")]
+#[test]
+fn escape_transform() {
+  fn esc(i: &[u8]) -> IResult<&[u8], String> {
+    map(
+      escaped_transform(
+        alpha,
+        '\\',
+        alt((
+          value(&b"\\"[..], tag("\\")),
+          value(&b"\""[..], tag("\"")),
+          value(&b"\n"[..], tag("n")),
+        )),
+      ),
+      to_s,
+    )(i)
+  }
+
+  assert_eq!(esc(&b"abcd;"[..]), Ok((&b";"[..], String::from("abcd"))));
+  assert_eq!(
+    esc(&b"ab\\\"cd;"[..]),
+    Ok((&b";"[..], String::from("ab\"cd")))
+  );
+  assert_eq!(
+    esc(&b"\\\"abcd;"[..]),
+    Ok((&b";"[..], String::from("\"abcd")))
+  );
+  assert_eq!(esc(&b"\\n;"[..]), Ok((&b";"[..], String::from("\n"))));
+  assert_eq!(
+    esc(&b"ab\\\"12"[..]),
+    Ok((&b"12"[..], String::from("ab\"")))
+  );
+  assert_eq!(
+    esc(&b"AB\\"[..]),
+    Err(Err::Error(error_position!(
+      &b"\\"[..],
+      ErrorKind::EscapedTransform
+    )))
+  );
+  assert_eq!(
+    esc(&b"AB\\A"[..]),
+    Err(Err::Error(error_node_position!(
+      &b"AB\\A"[..],
+      ErrorKind::EscapedTransform,
+      error_position!(&b"A"[..], ErrorKind::Tag)
+    )))
+  );
+
+  fn esc2(i: &[u8]) -> IResult<&[u8], String> {
+    map(
+      escaped_transform(
+        alpha,
+        '&',
+        alt((
+          value("è".as_bytes(), tag("egrave;")),
+          value("à".as_bytes(), tag("agrave;")),
+        )),
+      ),
+      to_s,
+    )(i)
+  }
+  assert_eq!(
+    esc2(&b"ab&egrave;DEF;"[..]),
+    Ok((&b";"[..], String::from("abèDEF")))
+  );
+  assert_eq!(
+    esc2(&b"ab&egrave;D&agrave;EF;"[..]),
+    Ok((&b";"[..], String::from("abèDàEF")))
+  );
+}
+
+#[cfg(feature = "std")]
+#[test]
+fn escape_transform_str() {
+  fn esc(i: &str) -> IResult<&str, String> {
+    escaped_transform(
+      alpha,
+      '\\',
+      alt((
+        value("\\", tag("\\")),
+        value("\"", tag("\"")),
+        value("\n", tag("n")),
+      )),
+    )(i)
+  }
+
+  assert_eq!(esc("abcd;"), Ok((";", String::from("abcd"))));
+  assert_eq!(esc("ab\\\"cd;"), Ok((";", String::from("ab\"cd"))));
+  assert_eq!(esc("\\\"abcd;"), Ok((";", String::from("\"abcd"))));
+  assert_eq!(esc("\\n;"), Ok((";", String::from("\n"))));
+  assert_eq!(esc("ab\\\"12"), Ok(("12", String::from("ab\""))));
+  assert_eq!(
+    esc("AB\\"),
+    Err(Err::Error(error_position!(
+      "\\",
+      ErrorKind::EscapedTransform
+    )))
+  );
+  assert_eq!(
+    esc("AB\\A"),
+    Err(Err::Error(error_node_position!(
+      "AB\\A",
+      ErrorKind::EscapedTransform,
+      error_position!("A", ErrorKind::Tag)
+    )))
+  );
+
+  fn esc2(i: &str) -> IResult<&str, String> {
+    escaped_transform(
+      alpha,
+      '&',
+      alt((value("è", tag("egrave;")), value("à", tag("agrave;")))),
+    )(i)
+  }
+  assert_eq!(esc2("ab&egrave;DEF;"), Ok((";", String::from("abèDEF"))));
+  assert_eq!(
+    esc2("ab&egrave;D&agrave;EF;"),
+    Ok((";", String::from("abèDàEF")))
+  );
+
+  fn esc3(i: &str) -> IResult<&str, String> {
+    escaped_transform(
+      alpha,
+      '␛',
+      alt((value("\0", tag("0")), value("\n", tag("n")))),
+    )(i)
+  }
+  assert_eq!(esc3("a␛0bc␛n"), Ok(("", String::from("a\0bc\n"))));
+}
+
+#[test]
+fn take_until_incomplete() {
+  use crate::bytes::streaming::take_until;
+  fn y(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    take_until("end")(i)
+  }
+  assert_eq!(y(&b"nd"[..]), Err(Err::Incomplete(Needed::Unknown)));
+  assert_eq!(y(&b"123"[..]), Err(Err::Incomplete(Needed::Unknown)));
+  assert_eq!(y(&b"123en"[..]), Err(Err::Incomplete(Needed::Unknown)));
+}
+
+#[test]
+fn take_until_incomplete_s() {
+  use crate::bytes::streaming::take_until;
+  fn ys(i: &str) -> IResult<&str, &str> {
+    take_until("end")(i)
+  }
+  assert_eq!(ys("123en"), Err(Err::Incomplete(Needed::Unknown)));
+}
+
+#[test]
+fn recognize() {
+  use crate::bytes::streaming::{tag, take};
+  use crate::combinator::recognize;
+  use crate::sequence::delimited;
+
+  fn x(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    recognize(delimited(tag("<!--"), take(5_usize), tag("-->")))(i)
+  }
+  let r = x(&b"<!-- abc --> aaa"[..]);
+  assert_eq!(r, Ok((&b" aaa"[..], &b"<!-- abc -->"[..])));
+
+  let semicolon = &b";"[..];
+
+  fn ya(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    recognize(alpha)(i)
+  }
+  let ra = ya(&b"abc;"[..]);
+  assert_eq!(ra, Ok((semicolon, &b"abc"[..])));
+
+  fn yd(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    recognize(digit)(i)
+  }
+  let rd = yd(&b"123;"[..]);
+  assert_eq!(rd, Ok((semicolon, &b"123"[..])));
+
+  fn yhd(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    recognize(hex_digit)(i)
+  }
+  let rhd = yhd(&b"123abcDEF;"[..]);
+  assert_eq!(rhd, Ok((semicolon, &b"123abcDEF"[..])));
+
+  fn yod(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    recognize(oct_digit)(i)
+  }
+  let rod = yod(&b"1234567;"[..]);
+  assert_eq!(rod, Ok((semicolon, &b"1234567"[..])));
+
+  fn yan(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    recognize(alphanumeric)(i)
+  }
+  let ran = yan(&b"123abc;"[..]);
+  assert_eq!(ran, Ok((semicolon, &b"123abc"[..])));
+
+  fn ys(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    recognize(space)(i)
+  }
+  let rs = ys(&b" \t;"[..]);
+  assert_eq!(rs, Ok((semicolon, &b" \t"[..])));
+
+  fn yms(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    recognize(multispace)(i)
+  }
+  let rms = yms(&b" \t\r\n;"[..]);
+  assert_eq!(rms, Ok((semicolon, &b" \t\r\n"[..])));
+}
+
+#[test]
+fn take_while() {
+  use crate::bytes::streaming::take_while;
+
+  fn f(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    take_while(is_alphabetic)(i)
+  }
+  let a = b"";
+  let b = b"abcd";
+  let c = b"abcd123";
+  let d = b"123";
+
+  assert_eq!(f(&a[..]), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(f(&b[..]), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(f(&c[..]), Ok((&d[..], &b[..])));
+  assert_eq!(f(&d[..]), Ok((&d[..], &a[..])));
+}
+
+#[test]
+fn take_while1() {
+  use crate::bytes::streaming::take_while1;
+
+  fn f(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    take_while1(is_alphabetic)(i)
+  }
+  let a = b"";
+  let b = b"abcd";
+  let c = b"abcd123";
+  let d = b"123";
+
+  assert_eq!(f(&a[..]), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(f(&b[..]), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(f(&c[..]), Ok((&b"123"[..], &b[..])));
+  assert_eq!(
+    f(&d[..]),
+    Err(Err::Error(error_position!(&d[..], ErrorKind::TakeWhile1)))
+  );
+}
+
+#[test]
+fn take_while_m_n() {
+  use crate::bytes::streaming::take_while_m_n;
+
+  fn x(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    take_while_m_n(2, 4, is_alphabetic)(i)
+  }
+  let a = b"";
+  let b = b"a";
+  let c = b"abc";
+  let d = b"abc123";
+  let e = b"abcde";
+  let f = b"123";
+
+  assert_eq!(x(&a[..]), Err(Err::Incomplete(Needed::new(2))));
+  assert_eq!(x(&b[..]), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(x(&c[..]), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(x(&d[..]), Ok((&b"123"[..], &c[..])));
+  assert_eq!(x(&e[..]), Ok((&b"e"[..], &b"abcd"[..])));
+  assert_eq!(
+    x(&f[..]),
+    Err(Err::Error(error_position!(&f[..], ErrorKind::TakeWhileMN)))
+  );
+}
+
+#[test]
+fn take_till() {
+  use crate::bytes::streaming::take_till;
+
+  fn f(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    take_till(is_alphabetic)(i)
+  }
+  let a = b"";
+  let b = b"abcd";
+  let c = b"123abcd";
+  let d = b"123";
+
+  assert_eq!(f(&a[..]), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(f(&b[..]), Ok((&b"abcd"[..], &b""[..])));
+  assert_eq!(f(&c[..]), Ok((&b"abcd"[..], &b"123"[..])));
+  assert_eq!(f(&d[..]), Err(Err::Incomplete(Needed::new(1))));
+}
+
+#[test]
+fn take_till1() {
+  use crate::bytes::streaming::take_till1;
+
+  fn f(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    take_till1(is_alphabetic)(i)
+  }
+  let a = b"";
+  let b = b"abcd";
+  let c = b"123abcd";
+  let d = b"123";
+
+  assert_eq!(f(&a[..]), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(
+    f(&b[..]),
+    Err(Err::Error(error_position!(&b[..], ErrorKind::TakeTill1)))
+  );
+  assert_eq!(f(&c[..]), Ok((&b"abcd"[..], &b"123"[..])));
+  assert_eq!(f(&d[..]), Err(Err::Incomplete(Needed::new(1))));
+}
+
+#[test]
+fn take_while_utf8() {
+  use crate::bytes::streaming::take_while;
+
+  fn f(i: &str) -> IResult<&str, &str> {
+    take_while(|c| c != '點')(i)
+  }
+
+  assert_eq!(f(""), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(f("abcd"), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(f("abcd點"), Ok(("點", "abcd")));
+  assert_eq!(f("abcd點a"), Ok(("點a", "abcd")));
+
+  fn g(i: &str) -> IResult<&str, &str> {
+    take_while(|c| c == '點')(i)
+  }
+
+  assert_eq!(g(""), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(g("點abcd"), Ok(("abcd", "點")));
+  assert_eq!(g("點點點a"), Ok(("a", "點點點")));
+}
+
+#[test]
+fn take_till_utf8() {
+  use crate::bytes::streaming::take_till;
+
+  fn f(i: &str) -> IResult<&str, &str> {
+    take_till(|c| c == '點')(i)
+  }
+
+  assert_eq!(f(""), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(f("abcd"), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(f("abcd點"), Ok(("點", "abcd")));
+  assert_eq!(f("abcd點a"), Ok(("點a", "abcd")));
+
+  fn g(i: &str) -> IResult<&str, &str> {
+    take_till(|c| c != '點')(i)
+  }
+
+  assert_eq!(g(""), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(g("點abcd"), Ok(("abcd", "點")));
+  assert_eq!(g("點點點a"), Ok(("a", "點點點")));
+}
+
+#[test]
+fn take_utf8() {
+  use crate::bytes::streaming::{take, take_while};
+
+  fn f(i: &str) -> IResult<&str, &str> {
+    take(3_usize)(i)
+  }
+
+  assert_eq!(f(""), Err(Err::Incomplete(Needed::Unknown)));
+  assert_eq!(f("ab"), Err(Err::Incomplete(Needed::Unknown)));
+  assert_eq!(f("點"), Err(Err::Incomplete(Needed::Unknown)));
+  assert_eq!(f("ab點cd"), Ok(("cd", "ab點")));
+  assert_eq!(f("a點bcd"), Ok(("cd", "a點b")));
+  assert_eq!(f("a點b"), Ok(("", "a點b")));
+
+  fn g(i: &str) -> IResult<&str, &str> {
+    take_while(|c| c == '點')(i)
+  }
+
+  assert_eq!(g(""), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(g("點abcd"), Ok(("abcd", "點")));
+  assert_eq!(g("點點點a"), Ok(("a", "點點點")));
+}
+
+#[test]
+fn take_while_m_n_utf8() {
+  use crate::bytes::streaming::take_while_m_n;
+
+  fn parser(i: &str) -> IResult<&str, &str> {
+    take_while_m_n(1, 1, |c| c == 'A' || c == '😃')(i)
+  }
+  assert_eq!(parser("A!"), Ok(("!", "A")));
+  assert_eq!(parser("😃!"), Ok(("!", "😃")));
+}
+
+#[test]
+fn take_while_m_n_utf8_full_match() {
+  use crate::bytes::streaming::take_while_m_n;
+
+  fn parser(i: &str) -> IResult<&str, &str> {
+    take_while_m_n(1, 1, |c: char| c.is_alphabetic())(i)
+  }
+  assert_eq!(parser("øn"), Ok(("n", "ø")));
+}
+
+#[test]
+#[cfg(feature = "std")]
+fn recognize_take_while() {
+  use crate::bytes::streaming::take_while;
+  use crate::character::is_alphanumeric;
+  use crate::combinator::recognize;
+
+  fn x(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    take_while(is_alphanumeric)(i)
+  }
+  fn y(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    recognize(x)(i)
+  }
+  assert_eq!(x(&b"ab."[..]), Ok((&b"."[..], &b"ab"[..])));
+  println!("X: {:?}", x(&b"ab"[..]));
+  assert_eq!(y(&b"ab."[..]), Ok((&b"."[..], &b"ab"[..])));
+}
+
+#[test]
+fn length_bytes() {
+  use crate::{bytes::streaming::tag, multi::length_data, number::streaming::le_u8};
+
+  fn x(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    length_data(le_u8)(i)
+  }
+  assert_eq!(x(b"\x02..>>"), Ok((&b">>"[..], &b".."[..])));
+  assert_eq!(x(b"\x02.."), Ok((&[][..], &b".."[..])));
+  assert_eq!(x(b"\x02."), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(x(b"\x02"), Err(Err::Incomplete(Needed::new(2))));
+
+  fn y(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    let (i, _) = tag("magic")(i)?;
+    length_data(le_u8)(i)
+  }
+  assert_eq!(y(b"magic\x02..>>"), Ok((&b">>"[..], &b".."[..])));
+  assert_eq!(y(b"magic\x02.."), Ok((&[][..], &b".."[..])));
+  assert_eq!(y(b"magic\x02."), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(y(b"magic\x02"), Err(Err::Incomplete(Needed::new(2))));
+}
+
+#[cfg(feature = "alloc")]
+#[test]
+fn case_insensitive() {
+  use crate::bytes::streaming::tag_no_case;
+
+  fn test(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    tag_no_case("ABcd")(i)
+  }
+  assert_eq!(test(&b"aBCdefgh"[..]), Ok((&b"efgh"[..], &b"aBCd"[..])));
+  assert_eq!(test(&b"abcdefgh"[..]), Ok((&b"efgh"[..], &b"abcd"[..])));
+  assert_eq!(test(&b"ABCDefgh"[..]), Ok((&b"efgh"[..], &b"ABCD"[..])));
+  assert_eq!(test(&b"ab"[..]), Err(Err::Incomplete(Needed::new(2))));
+  assert_eq!(
+    test(&b"Hello"[..]),
+    Err(Err::Error(error_position!(&b"Hello"[..], ErrorKind::Tag)))
+  );
+  assert_eq!(
+    test(&b"Hel"[..]),
+    Err(Err::Error(error_position!(&b"Hel"[..], ErrorKind::Tag)))
+  );
+
+  fn test2(i: &str) -> IResult<&str, &str> {
+    tag_no_case("ABcd")(i)
+  }
+  assert_eq!(test2("aBCdefgh"), Ok(("efgh", "aBCd")));
+  assert_eq!(test2("abcdefgh"), Ok(("efgh", "abcd")));
+  assert_eq!(test2("ABCDefgh"), Ok(("efgh", "ABCD")));
+  assert_eq!(test2("ab"), Err(Err::Incomplete(Needed::new(2))));
+  assert_eq!(
+    test2("Hello"),
+    Err(Err::Error(error_position!(&"Hello"[..], ErrorKind::Tag)))
+  );
+  assert_eq!(
+    test2("Hel"),
+    Err(Err::Error(error_position!(&"Hel"[..], ErrorKind::Tag)))
+  );
+}
+
+#[test]
+fn tag_fixed_size_array() {
+  use crate::bytes::streaming::tag;
+
+  fn test(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    tag([0x42])(i)
+  }
+  fn test2(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    tag(&[0x42])(i)
+  }
+  let input = [0x42, 0x00];
+  assert_eq!(test(&input), Ok((&b"\x00"[..], &b"\x42"[..])));
+  assert_eq!(test2(&input), Ok((&b"\x00"[..], &b"\x42"[..])));
+}
diff --git a/src/character/tests.rs b/src/character/tests.rs
new file mode 100644
index 0000000..64c2a1c
--- /dev/null
+++ b/src/character/tests.rs
@@ -0,0 +1,62 @@
+use super::streaming::*;
+use crate::error::ErrorKind;
+use crate::internal::{Err, IResult};
+
+#[test]
+fn one_of_test() {
+  fn f(i: &[u8]) -> IResult<&[u8], char> {
+    one_of("ab")(i)
+  }
+
+  let a = &b"abcd"[..];
+  assert_eq!(f(a), Ok((&b"bcd"[..], 'a')));
+
+  let b = &b"cde"[..];
+  assert_eq!(f(b), Err(Err::Error(error_position!(b, ErrorKind::OneOf))));
+
+  fn utf8(i: &str) -> IResult<&str, char> {
+    one_of("+\u{FF0B}")(i)
+  }
+
+  assert!(utf8("+").is_ok());
+  assert!(utf8("\u{FF0B}").is_ok());
+}
+
+#[test]
+fn none_of_test() {
+  fn f(i: &[u8]) -> IResult<&[u8], char> {
+    none_of("ab")(i)
+  }
+
+  let a = &b"abcd"[..];
+  assert_eq!(f(a), Err(Err::Error(error_position!(a, ErrorKind::NoneOf))));
+
+  let b = &b"cde"[..];
+  assert_eq!(f(b), Ok((&b"de"[..], 'c')));
+}
+
+#[test]
+fn char_byteslice() {
+  fn f(i: &[u8]) -> IResult<&[u8], char> {
+    char('c')(i)
+  }
+
+  let a = &b"abcd"[..];
+  assert_eq!(f(a), Err(Err::Error(error_position!(a, ErrorKind::Char))));
+
+  let b = &b"cde"[..];
+  assert_eq!(f(b), Ok((&b"de"[..], 'c')));
+}
+
+#[test]
+fn char_str() {
+  fn f(i: &str) -> IResult<&str, char> {
+    char('c')(i)
+  }
+
+  let a = &"abcd"[..];
+  assert_eq!(f(a), Err(Err::Error(error_position!(a, ErrorKind::Char))));
+
+  let b = &"cde"[..];
+  assert_eq!(f(b), Ok((&"de"[..], 'c')));
+}
diff --git a/src/combinator/tests.rs b/src/combinator/tests.rs
new file mode 100644
index 0000000..b8c1c6c
--- /dev/null
+++ b/src/combinator/tests.rs
@@ -0,0 +1,266 @@
+use super::*;
+use crate::bytes::complete::take;
+use crate::bytes::streaming::tag;
+use crate::error::ErrorKind;
+use crate::error::ParseError;
+use crate::internal::{Err, IResult, Needed};
+#[cfg(feature = "alloc")]
+use crate::lib::std::boxed::Box;
+use crate::number::complete::u8;
+
+macro_rules! assert_parse(
+  ($left: expr, $right: expr) => {
+    let res: $crate::IResult<_, _, (_, ErrorKind)> = $left;
+    assert_eq!(res, $right);
+  };
+);
+
+/*#[test]
+fn t1() {
+  let v1:Vec<u8> = vec![1,2,3];
+  let v2:Vec<u8> = vec![4,5,6];
+  let d = Ok((&v1[..], &v2[..]));
+  let res = d.flat_map(print);
+  assert_eq!(res, Ok((&v2[..], ())));
+}*/
+
+#[test]
+fn eof_on_slices() {
+  let not_over: &[u8] = &b"Hello, world!"[..];
+  let is_over: &[u8] = &b""[..];
+
+  let res_not_over = eof(not_over);
+  assert_parse!(
+    res_not_over,
+    Err(Err::Error(error_position!(not_over, ErrorKind::Eof)))
+  );
+
+  let res_over = eof(is_over);
+  assert_parse!(res_over, Ok((is_over, is_over)));
+}
+
+#[test]
+fn eof_on_strs() {
+  let not_over: &str = "Hello, world!";
+  let is_over: &str = "";
+
+  let res_not_over = eof(not_over);
+  assert_parse!(
+    res_not_over,
+    Err(Err::Error(error_position!(not_over, ErrorKind::Eof)))
+  );
+
+  let res_over = eof(is_over);
+  assert_parse!(res_over, Ok((is_over, is_over)));
+}
+
+/*
+#[test]
+fn end_of_input() {
+    let not_over = &b"Hello, world!"[..];
+    let is_over = &b""[..];
+    named!(eof_test, eof!());
+
+    let res_not_over = eof_test(not_over);
+    assert_eq!(res_not_over, Err(Err::Error(error_position!(not_over, ErrorKind::Eof))));
+
+    let res_over = eof_test(is_over);
+    assert_eq!(res_over, Ok((is_over, is_over)));
+}
+*/
+
+#[test]
+fn rest_on_slices() {
+  let input: &[u8] = &b"Hello, world!"[..];
+  let empty: &[u8] = &b""[..];
+  assert_parse!(rest(input), Ok((empty, input)));
+}
+
+#[test]
+fn rest_on_strs() {
+  let input: &str = "Hello, world!";
+  let empty: &str = "";
+  assert_parse!(rest(input), Ok((empty, input)));
+}
+
+#[test]
+fn rest_len_on_slices() {
+  let input: &[u8] = &b"Hello, world!"[..];
+  assert_parse!(rest_len(input), Ok((input, input.len())));
+}
+
+use crate::lib::std::convert::From;
+impl From<u32> for CustomError {
+  fn from(_: u32) -> Self {
+    CustomError
+  }
+}
+
+impl<I> ParseError<I> for CustomError {
+  fn from_error_kind(_: I, _: ErrorKind) -> Self {
+    CustomError
+  }
+
+  fn append(_: I, _: ErrorKind, _: CustomError) -> Self {
+    CustomError
+  }
+}
+
+struct CustomError;
+#[allow(dead_code)]
+fn custom_error(input: &[u8]) -> IResult<&[u8], &[u8], CustomError> {
+  //fix_error!(input, CustomError, alphanumeric)
+  crate::character::streaming::alphanumeric1(input)
+}
+
+#[test]
+fn test_flat_map() {
+  let input: &[u8] = &[3, 100, 101, 102, 103, 104][..];
+  assert_parse!(
+    flat_map(u8, take)(input),
+    Ok((&[103, 104][..], &[100, 101, 102][..]))
+  );
+}
+
+#[test]
+fn test_map_opt() {
+  let input: &[u8] = &[50][..];
+  assert_parse!(
+    map_opt(u8, |u| if u < 20 { Some(u) } else { None })(input),
+    Err(Err::Error((&[50][..], ErrorKind::MapOpt)))
+  );
+  assert_parse!(
+    map_opt(u8, |u| if u > 20 { Some(u) } else { None })(input),
+    Ok((&[][..], 50))
+  );
+}
+
+#[test]
+fn test_map_parser() {
+  let input: &[u8] = &[100, 101, 102, 103, 104][..];
+  assert_parse!(
+    map_parser(take(4usize), take(2usize))(input),
+    Ok((&[104][..], &[100, 101][..]))
+  );
+}
+
+#[test]
+fn test_all_consuming() {
+  let input: &[u8] = &[100, 101, 102][..];
+  assert_parse!(
+    all_consuming(take(2usize))(input),
+    Err(Err::Error((&[102][..], ErrorKind::Eof)))
+  );
+  assert_parse!(
+    all_consuming(take(3usize))(input),
+    Ok((&[][..], &[100, 101, 102][..]))
+  );
+}
+
+#[test]
+#[allow(unused)]
+fn test_verify_ref() {
+  use crate::bytes::complete::take;
+
+  let mut parser1 = verify(take(3u8), |s: &[u8]| s == &b"abc"[..]);
+
+  assert_eq!(parser1(&b"abcd"[..]), Ok((&b"d"[..], &b"abc"[..])));
+  assert_eq!(
+    parser1(&b"defg"[..]),
+    Err(Err::Error((&b"defg"[..], ErrorKind::Verify)))
+  );
+
+  fn parser2(i: &[u8]) -> IResult<&[u8], u32> {
+    verify(crate::number::streaming::be_u32, |val: &u32| *val < 3)(i)
+  }
+}
+
+#[test]
+#[cfg(feature = "alloc")]
+fn test_verify_alloc() {
+  use crate::bytes::complete::take;
+  let mut parser1 = verify(map(take(3u8), |s: &[u8]| s.to_vec()), |s: &[u8]| {
+    s == &b"abc"[..]
+  });
+
+  assert_eq!(parser1(&b"abcd"[..]), Ok((&b"d"[..], (&b"abc").to_vec())));
+  assert_eq!(
+    parser1(&b"defg"[..]),
+    Err(Err::Error((&b"defg"[..], ErrorKind::Verify)))
+  );
+}
+
+#[test]
+#[cfg(feature = "std")]
+fn test_into() {
+  use crate::bytes::complete::take;
+  use crate::{
+    error::{Error, ParseError},
+    Err,
+  };
+
+  let mut parser = into(take::<_, _, Error<_>>(3u8));
+  let result: IResult<&[u8], Vec<u8>> = parser(&b"abcdefg"[..]);
+
+  assert_eq!(result, Ok((&b"defg"[..], vec![97, 98, 99])));
+}
+
+#[test]
+fn opt_test() {
+  fn opt_abcd(i: &[u8]) -> IResult<&[u8], Option<&[u8]>> {
+    opt(tag("abcd"))(i)
+  }
+
+  let a = &b"abcdef"[..];
+  let b = &b"bcdefg"[..];
+  let c = &b"ab"[..];
+  assert_eq!(opt_abcd(a), Ok((&b"ef"[..], Some(&b"abcd"[..]))));
+  assert_eq!(opt_abcd(b), Ok((&b"bcdefg"[..], None)));
+  assert_eq!(opt_abcd(c), Err(Err::Incomplete(Needed::new(2))));
+}
+
+#[test]
+fn peek_test() {
+  fn peek_tag(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    peek(tag("abcd"))(i)
+  }
+
+  assert_eq!(peek_tag(&b"abcdef"[..]), Ok((&b"abcdef"[..], &b"abcd"[..])));
+  assert_eq!(peek_tag(&b"ab"[..]), Err(Err::Incomplete(Needed::new(2))));
+  assert_eq!(
+    peek_tag(&b"xxx"[..]),
+    Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
+  );
+}
+
+#[test]
+fn not_test() {
+  fn not_aaa(i: &[u8]) -> IResult<&[u8], ()> {
+    not(tag("aaa"))(i)
+  }
+
+  assert_eq!(
+    not_aaa(&b"aaa"[..]),
+    Err(Err::Error(error_position!(&b"aaa"[..], ErrorKind::Not)))
+  );
+  assert_eq!(not_aaa(&b"aa"[..]), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(not_aaa(&b"abcd"[..]), Ok((&b"abcd"[..], ())));
+}
+
+#[test]
+fn verify_test() {
+  use crate::bytes::streaming::take;
+
+  fn test(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    verify(take(5u8), |slice: &[u8]| slice[0] == b'a')(i)
+  }
+  assert_eq!(test(&b"bcd"[..]), Err(Err::Incomplete(Needed::new(2))));
+  assert_eq!(
+    test(&b"bcdefg"[..]),
+    Err(Err::Error(error_position!(
+      &b"bcdefg"[..],
+      ErrorKind::Verify
+    )))
+  );
+  assert_eq!(test(&b"abcdefg"[..]), Ok((&b"fg"[..], &b"abcde"[..])));
+}
diff --git a/src/multi/tests.rs b/src/multi/tests.rs
index 3c02873..0ce46d2 100644
--- a/src/multi/tests.rs
+++ b/src/multi/tests.rs
@@ -1,9 +1,4 @@
-use super::{
-  count, fold_many0, fold_many1, fold_many_m_n, length_count, length_data, length_value, many0,
-  many0_count, many1, many1_count, many_m_n, many_till, separated_list0, separated_list1,
-};
-#[cfg(feature = "alloc")]
-use crate::lib::std::vec::Vec;
+use super::{length_data, length_value, many0_count, many1_count};
 use crate::{
   bytes::streaming::tag,
   character::streaming::digit1 as digit,
@@ -13,6 +8,14 @@ use crate::{
   number::streaming::{be_u16, be_u8},
   sequence::{pair, tuple},
 };
+#[cfg(feature = "alloc")]
+use crate::{
+  lib::std::vec::Vec,
+  multi::{
+    count, fold_many0, fold_many1, fold_many_m_n, length_count, many0, many1, many_m_n, many_till,
+    separated_list0, separated_list1,
+  },
+};
 
 #[test]
 #[cfg(feature = "alloc")]
@@ -326,13 +329,11 @@ impl<I> ParseError<I> for NilError {
   }
 }
 
-named!(pub number<u32>, map_res!(
-  map_res!(
-    digit,
-    str::from_utf8
-  ),
-  FromStr::from_str
-));
+fn number(i: &[u8]) -> IResult<&[u8], u32> {
+  use crate::combinator::map_res;
+
+  map_res(map_res(digit, str::from_utf8), FromStr::from_str)(i)
+}
 
 #[test]
 #[cfg(feature = "alloc")]
diff --git a/src/sequence/tests.rs b/src/sequence/tests.rs
new file mode 100644
index 0000000..201579b
--- /dev/null
+++ b/src/sequence/tests.rs
@@ -0,0 +1,274 @@
+use super::*;
+use crate::bytes::streaming::{tag, take};
+use crate::error::ErrorKind;
+use crate::internal::{Err, IResult, Needed};
+use crate::number::streaming::be_u16;
+
+#[test]
+fn single_element_tuples() {
+  use crate::character::complete::alpha1;
+  use crate::{error::ErrorKind, Err};
+
+  let mut parser = tuple((alpha1,));
+  assert_eq!(parser("abc123def"), Ok(("123def", ("abc",))));
+  assert_eq!(
+    parser("123def"),
+    Err(Err::Error(("123def", ErrorKind::Alpha)))
+  );
+}
+
+#[derive(PartialEq, Eq, Debug)]
+struct B {
+  a: u8,
+  b: u8,
+}
+
+#[derive(PartialEq, Eq, Debug)]
+struct C {
+  a: u8,
+  b: Option<u8>,
+}
+
+/*FIXME: convert code examples to new error management
+use util::{add_error_pattern, error_to_list, print_error};
+
+#[cfg(feature = "std")]
+#[rustfmt::skip]
+fn error_to_string<P: Clone + PartialEq>(e: &Context<P, u32>) -> &'static str {
+  let v: Vec<(P, ErrorKind<u32>)> = error_to_list(e);
+  // do it this way if you can use slice patterns
+  //match &v[..] {
+  //  [ErrorKind::Custom(42), ErrorKind::Tag]                         => "missing `ijkl` tag",
+  //  [ErrorKind::Custom(42), ErrorKind::Custom(128), ErrorKind::Tag] => "missing `mnop` tag after `ijkl`",
+  //  _            => "unrecognized error"
+  //}
+
+  let collected: Vec<ErrorKind<u32>> = v.iter().map(|&(_, ref e)| e.clone()).collect();
+  if &collected[..] == [ErrorKind::Custom(42), ErrorKind::Tag] {
+    "missing `ijkl` tag"
+  } else if &collected[..] == [ErrorKind::Custom(42), ErrorKind::Custom(128), ErrorKind::Tag] {
+    "missing `mnop` tag after `ijkl`"
+  } else {
+    "unrecognized error"
+  }
+}
+
+// do it this way if you can use box patterns
+//use $crate::lib::std::str;
+//fn error_to_string(e:Err) -> String
+//  match e {
+//    NodePosition(ErrorKind::Custom(42), i1, box Position(ErrorKind::Tag, i2)) => {
+//      format!("missing `ijkl` tag, found '{}' instead", str::from_utf8(i2).unwrap())
+//    },
+//    NodePosition(ErrorKind::Custom(42), i1, box NodePosition(ErrorKind::Custom(128), i2,  box Position(ErrorKind::Tag, i3))) => {
+//      format!("missing `mnop` tag after `ijkl`, found '{}' instead", str::from_utf8(i3).unwrap())
+//    },
+//    _ => "unrecognized error".to_string()
+//  }
+//}
+*/
+
+#[test]
+fn complete() {
+  use crate::bytes::complete::tag;
+  fn err_test(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    let (i, _) = tag("ijkl")(i)?;
+    tag("mnop")(i)
+  }
+  let a = &b"ijklmn"[..];
+
+  let res_a = err_test(a);
+  assert_eq!(
+    res_a,
+    Err(Err::Error(error_position!(&b"mn"[..], ErrorKind::Tag)))
+  );
+}
+
+#[test]
+fn pair_test() {
+  fn pair_abc_def(i: &[u8]) -> IResult<&[u8], (&[u8], &[u8])> {
+    pair(tag("abc"), tag("def"))(i)
+  }
+
+  assert_eq!(
+    pair_abc_def(&b"abcdefghijkl"[..]),
+    Ok((&b"ghijkl"[..], (&b"abc"[..], &b"def"[..])))
+  );
+  assert_eq!(
+    pair_abc_def(&b"ab"[..]),
+    Err(Err::Incomplete(Needed::new(1)))
+  );
+  assert_eq!(
+    pair_abc_def(&b"abcd"[..]),
+    Err(Err::Incomplete(Needed::new(2)))
+  );
+  assert_eq!(
+    pair_abc_def(&b"xxx"[..]),
+    Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
+  );
+  assert_eq!(
+    pair_abc_def(&b"xxxdef"[..]),
+    Err(Err::Error(error_position!(&b"xxxdef"[..], ErrorKind::Tag)))
+  );
+  assert_eq!(
+    pair_abc_def(&b"abcxxx"[..]),
+    Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
+  );
+}
+
+#[test]
+fn separated_pair_test() {
+  fn sep_pair_abc_def(i: &[u8]) -> IResult<&[u8], (&[u8], &[u8])> {
+    separated_pair(tag("abc"), tag(","), tag("def"))(i)
+  }
+
+  assert_eq!(
+    sep_pair_abc_def(&b"abc,defghijkl"[..]),
+    Ok((&b"ghijkl"[..], (&b"abc"[..], &b"def"[..])))
+  );
+  assert_eq!(
+    sep_pair_abc_def(&b"ab"[..]),
+    Err(Err::Incomplete(Needed::new(1)))
+  );
+  assert_eq!(
+    sep_pair_abc_def(&b"abc,d"[..]),
+    Err(Err::Incomplete(Needed::new(2)))
+  );
+  assert_eq!(
+    sep_pair_abc_def(&b"xxx"[..]),
+    Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
+  );
+  assert_eq!(
+    sep_pair_abc_def(&b"xxx,def"[..]),
+    Err(Err::Error(error_position!(&b"xxx,def"[..], ErrorKind::Tag)))
+  );
+  assert_eq!(
+    sep_pair_abc_def(&b"abc,xxx"[..]),
+    Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
+  );
+}
+
+#[test]
+fn preceded_test() {
+  fn preceded_abcd_efgh(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    preceded(tag("abcd"), tag("efgh"))(i)
+  }
+
+  assert_eq!(
+    preceded_abcd_efgh(&b"abcdefghijkl"[..]),
+    Ok((&b"ijkl"[..], &b"efgh"[..]))
+  );
+  assert_eq!(
+    preceded_abcd_efgh(&b"ab"[..]),
+    Err(Err::Incomplete(Needed::new(2)))
+  );
+  assert_eq!(
+    preceded_abcd_efgh(&b"abcde"[..]),
+    Err(Err::Incomplete(Needed::new(3)))
+  );
+  assert_eq!(
+    preceded_abcd_efgh(&b"xxx"[..]),
+    Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
+  );
+  assert_eq!(
+    preceded_abcd_efgh(&b"xxxxdef"[..]),
+    Err(Err::Error(error_position!(&b"xxxxdef"[..], ErrorKind::Tag)))
+  );
+  assert_eq!(
+    preceded_abcd_efgh(&b"abcdxxx"[..]),
+    Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
+  );
+}
+
+#[test]
+fn terminated_test() {
+  fn terminated_abcd_efgh(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    terminated(tag("abcd"), tag("efgh"))(i)
+  }
+
+  assert_eq!(
+    terminated_abcd_efgh(&b"abcdefghijkl"[..]),
+    Ok((&b"ijkl"[..], &b"abcd"[..]))
+  );
+  assert_eq!(
+    terminated_abcd_efgh(&b"ab"[..]),
+    Err(Err::Incomplete(Needed::new(2)))
+  );
+  assert_eq!(
+    terminated_abcd_efgh(&b"abcde"[..]),
+    Err(Err::Incomplete(Needed::new(3)))
+  );
+  assert_eq!(
+    terminated_abcd_efgh(&b"xxx"[..]),
+    Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
+  );
+  assert_eq!(
+    terminated_abcd_efgh(&b"xxxxdef"[..]),
+    Err(Err::Error(error_position!(&b"xxxxdef"[..], ErrorKind::Tag)))
+  );
+  assert_eq!(
+    terminated_abcd_efgh(&b"abcdxxxx"[..]),
+    Err(Err::Error(error_position!(&b"xxxx"[..], ErrorKind::Tag)))
+  );
+}
+
+#[test]
+fn delimited_test() {
+  fn delimited_abc_def_ghi(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    delimited(tag("abc"), tag("def"), tag("ghi"))(i)
+  }
+
+  assert_eq!(
+    delimited_abc_def_ghi(&b"abcdefghijkl"[..]),
+    Ok((&b"jkl"[..], &b"def"[..]))
+  );
+  assert_eq!(
+    delimited_abc_def_ghi(&b"ab"[..]),
+    Err(Err::Incomplete(Needed::new(1)))
+  );
+  assert_eq!(
+    delimited_abc_def_ghi(&b"abcde"[..]),
+    Err(Err::Incomplete(Needed::new(1)))
+  );
+  assert_eq!(
+    delimited_abc_def_ghi(&b"abcdefgh"[..]),
+    Err(Err::Incomplete(Needed::new(1)))
+  );
+  assert_eq!(
+    delimited_abc_def_ghi(&b"xxx"[..]),
+    Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
+  );
+  assert_eq!(
+    delimited_abc_def_ghi(&b"xxxdefghi"[..]),
+    Err(Err::Error(error_position!(
+      &b"xxxdefghi"[..],
+      ErrorKind::Tag
+    ),))
+  );
+  assert_eq!(
+    delimited_abc_def_ghi(&b"abcxxxghi"[..]),
+    Err(Err::Error(error_position!(&b"xxxghi"[..], ErrorKind::Tag)))
+  );
+  assert_eq!(
+    delimited_abc_def_ghi(&b"abcdefxxx"[..]),
+    Err(Err::Error(error_position!(&b"xxx"[..], ErrorKind::Tag)))
+  );
+}
+
+#[test]
+fn tuple_test() {
+  fn tuple_3(i: &[u8]) -> IResult<&[u8], (u16, &[u8], &[u8])> {
+    tuple((be_u16, take(3u8), tag("fg")))(i)
+  }
+
+  assert_eq!(
+    tuple_3(&b"abcdefgh"[..]),
+    Ok((&b"h"[..], (0x6162u16, &b"cde"[..], &b"fg"[..])))
+  );
+  assert_eq!(tuple_3(&b"abcd"[..]), Err(Err::Incomplete(Needed::new(1))));
+  assert_eq!(tuple_3(&b"abcde"[..]), Err(Err::Incomplete(Needed::new(2))));
+  assert_eq!(
+    tuple_3(&b"abcdejk"[..]),
+    Err(Err::Error(error_position!(&b"jk"[..], ErrorKind::Tag)))
+  );
+}
diff --git a/tests/custom_errors.rs b/tests/custom_errors.rs
index ad14ee5..2021713 100644
--- a/tests/custom_errors.rs
+++ b/tests/custom_errors.rs
@@ -1,15 +1,14 @@
 #![allow(dead_code)]
-#![cfg_attr(feature = "cargo-clippy", allow(block_in_if_condition_stmt))]
-
-#[macro_use]
-extern crate nom;
 
+use nom::bytes::streaming::tag;
 use nom::character::streaming::digit1 as digit;
+use nom::combinator::verify;
 use nom::error::{ErrorKind, ParseError};
+#[cfg(feature = "alloc")]
+use nom::multi::count;
+use nom::sequence::terminated;
 use nom::IResult;
 
-use std::convert::From;
-
 #[derive(Debug)]
 pub struct CustomError(String);
 
@@ -31,19 +30,19 @@ impl<'a> ParseError<&'a str> for CustomError {
 
 fn test1(input: &str) -> IResult<&str, &str, CustomError> {
   //fix_error!(input, CustomError, tag!("abcd"))
-  tag!(input, "abcd")
+  tag("abcd")(input)
 }
 
 fn test2(input: &str) -> IResult<&str, &str, CustomError> {
   //terminated!(input, test1, fix_error!(CustomError, digit))
-  terminated!(input, test1, digit)
+  terminated(test1, digit)(input)
 }
 
 fn test3(input: &str) -> IResult<&str, &str, CustomError> {
-  verify!(input, test1, |s: &str| { s.starts_with("abcd") })
+  verify(test1, |s: &str| s.starts_with("abcd"))(input)
 }
 
 #[cfg(feature = "alloc")]
 fn test4(input: &str) -> IResult<&str, Vec<&str>, CustomError> {
-  count!(input, test1, 4)
+  count(test1, 4)(input)
 }
diff --git a/tests/inference.rs b/tests/inference.rs
deleted file mode 100644
index 4555d7a..0000000
--- a/tests/inference.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-//! test type inference issues in parsee compilation
-//#![feature(trace_macros)]
-#![allow(dead_code)]
-#![allow(unused_comparisons)]
-#![allow(unused_variables)]
-#![allow(unused_imports)]
-
-#[macro_use]
-extern crate nom;
-
-use nom::character::{is_digit, streaming::alpha1 as alpha};
-use std::str;
-
-// issue #617
-named!(multi<&[u8], () >, fold_many0!( take_while1!( is_digit ), (), |_, _| {}));
-
-// issue #561
-#[cfg(feature = "alloc")]
-named!(
-  value<Vec<Vec<&str>>>,
-  do_parse!(
-    first_line: map_res!(is_not!("\n"), std::str::from_utf8)
-      >> rest:
-        many_m_n!(
-          0,
-          1,
-          separated_list0!(
-            tag!("\n\t"),
-            map_res!(take_while!(call!(|c| c != b'\n')), std::str::from_utf8)
-          )
-        )
-      >> (rest)
-  )
-);
-
-// issue #534
-#[cfg(feature = "alloc")]
-fn wrap_suffix(input: &Option<Vec<&[u8]>>) -> Option<String> {
-  if input.is_some() {
-    // I've tried both of the lines below individually and get the same error.
-    Some("hello".to_string())
-  //Some(str::from_utf8(u).expect("Found invalid UTF-8").to_string())
-  } else {
-    None
-  }
-}
-
-#[cfg(feature = "alloc")]
-named!(parse_suffix<&[u8],Option<String>>,do_parse!(
-  u: opt!(many1!(alt!(
-    complete!(tag!("%")) | complete!(tag!("#"))  | complete!(tag!("@")) | complete!(alpha)
-  ))) >>
-  (wrap_suffix(&u))
-));
diff --git a/tests/issues.rs b/tests/issues.rs
index 3ffc271..79c3493 100644
--- a/tests/issues.rs
+++ b/tests/issues.rs
@@ -2,15 +2,7 @@
 #![allow(dead_code)]
 #![cfg_attr(feature = "cargo-clippy", allow(redundant_closure))]
 
-#[macro_use]
-extern crate nom;
-
-use nom::{
-  character::{is_digit, streaming::space1 as space},
-  error::ErrorKind,
-  number::streaming::le_u64,
-  Err, IResult, Needed,
-};
+use nom::{error::ErrorKind, Err, IResult, Needed};
 
 #[allow(dead_code)]
 struct Range {
@@ -26,78 +18,36 @@ pub fn take_char(input: &[u8]) -> IResult<&[u8], char> {
   }
 }
 
-//trace_macros!(true);
-
-#[allow(dead_code)]
-named!(range<&[u8], Range>,
-    alt!(
-        do_parse!(
-            start: take_char >>
-            tag!("-")        >>
-            end: take_char   >>
-            (Range {
-                start: start,
-                end:   end,
-            })
-        ) |
-        map!(
-            take_char,
-            |c| {
-                Range {
-                    start: c,
-                    end:   c,
-                }
-            }
-        )
-    )
-);
-
-#[allow(dead_code)]
-named!(literal<&[u8], Vec<char> >,
-    map!(
-        many1!(take_char),
-        |cs| {
-          cs
-        }
-    )
-);
-
-#[test]
-fn issue_58() {
-  let _ = range(&b"abcd"[..]);
-  let _ = literal(&b"abcd"[..]);
-}
-
-//trace_macros!(false);
-
 #[cfg(feature = "std")]
 mod parse_int {
   use nom::HexDisplay;
   use nom::{
     character::streaming::{digit1 as digit, space1 as space},
+    combinator::{complete, map, opt},
+    multi::many0,
     IResult,
   };
   use std::str;
 
-  named!(parse_ints<Vec<i32>>, many0!(spaces_or_int));
+  fn parse_ints(input: &[u8]) -> IResult<&[u8], Vec<i32>> {
+    many0(spaces_or_int)(input)
+  }
 
   fn spaces_or_int(input: &[u8]) -> IResult<&[u8], i32> {
     println!("{}", input.to_hex(8));
-    do_parse!(
-      input,
-      opt!(complete!(space))
-        >> res: map!(complete!(digit), |x| {
-          println!("x: {:?}", x);
-          let result = str::from_utf8(x).unwrap();
-          println!("Result: {}", result);
-          println!("int is empty?: {}", x.is_empty());
-          match result.parse() {
-            Ok(i) => i,
-            Err(e) => panic!("UH OH! NOT A DIGIT! {:?}", e),
-          }
-        })
-        >> (res)
-    )
+    let (i, _) = opt(complete(space))(input)?;
+    let (i, res) = map(complete(digit), |x| {
+      println!("x: {:?}", x);
+      let result = str::from_utf8(x).unwrap();
+      println!("Result: {}", result);
+      println!("int is empty?: {}", x.is_empty());
+      match result.parse() {
+        Ok(i) => i,
+        Err(e) => panic!("UH OH! NOT A DIGIT! {:?}", e),
+      }
+    })(i)?;
+
+    Ok((i, res))
   }
 
   #[test]
@@ -114,67 +64,34 @@ mod parse_int {
 
 #[test]
 fn usize_length_bytes_issue() {
+  use nom::multi::length_data;
   use nom::number::streaming::be_u16;
-  let _: IResult<&[u8], &[u8], (&[u8], ErrorKind)> = length_data!(b"012346", be_u16);
-}
-
-/*
- DOES NOT COMPILE
-#[test]
-fn issue_152() {
-  named!(take4, take!(4));
-  named!(xyz, tag!("XYZ"));
-  named!(abc, tag!("abc"));
-
-
-  named!(sw,
-    switch!(take4,
-      b"abcd" => xyz |
-      b"efgh" => abc
-    )
-  );
+  let _: IResult<&[u8], &[u8], (&[u8], ErrorKind)> = length_data(be_u16)(b"012346");
 }
-*/
 
 #[test]
 fn take_till_issue() {
-  named!(nothing, take_till!(call!(|_| true)));
+  use nom::bytes::streaming::take_till;
+
+  fn nothing(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    take_till(|_| true)(i)
+  }
 
   assert_eq!(nothing(b""), Err(Err::Incomplete(Needed::new(1))));
   assert_eq!(nothing(b"abc"), Ok((&b"abc"[..], &b""[..])));
 }
 
-named!(
-  issue_498<Vec<&[u8]>>,
-  separated_list1!(opt!(space), tag!("abcd"))
-);
-
-named!(issue_308(&str) -> bool,
-    do_parse! (
-        tag! ("foo") >>
-        b: alt! (
-            complete!(map! (tag! ("1"), |_: &str|->bool {true})) |
-            value! (false)
-        ) >>
-        (b) ));
-
-#[cfg(feature = "alloc")]
-fn issue_302(input: &[u8]) -> IResult<&[u8], Option<Vec<u64>>> {
-  do_parse!(input, entries: cond!(true, count!(le_u64, 3)) >> (entries))
-}
-
 #[test]
 fn issue_655() {
   use nom::character::streaming::{line_ending, not_line_ending};
-  named!(twolines(&str) -> (&str, &str),
-    do_parse!(
-      l1 : not_line_ending >>
-           line_ending >>
-      l2 : not_line_ending >>
-           line_ending >>
-      ((l1, l2))
-    )
-  );
+  fn twolines(i: &str) -> IResult<&str, (&str, &str)> {
+    let (i, l1) = not_line_ending(i)?;
+    let (i, _) = line_ending(i)?;
+    let (i, l2) = not_line_ending(i)?;
+    let (i, _) = line_ending(i)?;
+
+    Ok((i, (l1, l2)))
+  }
 
   assert_eq!(twolines("foo\nbar\n"), Ok(("", ("foo", "bar"))));
   assert_eq!(twolines("féo\nbar\n"), Ok(("", ("féo", "bar"))));
@@ -182,79 +99,19 @@ fn issue_655() {
   assert_eq!(twolines("foé\r\nbar\n"), Ok(("", ("foé", "bar"))));
 }
 
-#[test]
-fn issue_721() {
-  named!(f1<&str, u16>, parse_to!(u16));
-  named!(f2<&str, String>, parse_to!(String));
-  assert_eq!(f1("1234"), Ok(("", 1234)));
-  assert_eq!(f2("foo"), Ok(("", "foo".to_string())));
-  //assert_eq!(parse_to!("1234", u16), Ok(("", 1234)));
-  //assert_eq!(parse_to!("foo", String), Ok(("", "foo".to_string())));
-}
-
 #[cfg(feature = "alloc")]
-named!(issue_717<&[u8], Vec<&[u8]> >,
-  separated_list0!(tag!([0x0]), is_not!([0x0u8]))
-);
-
-struct NoPartialEq {
-  value: i32,
-}
-
-named!(issue_724<&str, i32>,
-  do_parse!(
-    metadata: permutation!(
-      map!(tag!("hello"), |_| NoPartialEq { value: 1 }),
-      map!(tag!("world"), |_| NoPartialEq { value: 2 })
-    ) >>
-    (metadata.0.value + metadata.1.value)
-  )
-);
-
-#[test]
-fn issue_752() {
-  assert_eq!(
-    Err::Error(("ab", nom::error::ErrorKind::ParseTo)),
-    parse_to!("ab", usize).unwrap_err()
-  )
-}
-
-fn atom_specials(c: u8) -> bool {
-  c == b'q'
-}
-
-named!(
-  capability<&str>,
-  do_parse!(tag!(" ") >> _atom: map_res!(take_till1!(atom_specials), std::str::from_utf8) >> ("a"))
-);
+fn issue_717(i: &[u8]) -> IResult<&[u8], Vec<&[u8]>> {
+  use nom::bytes::complete::{is_not, tag};
+  use nom::multi::separated_list0;
 
-#[test]
-fn issue_759() {
-  assert_eq!(capability(b" abcqd"), Ok((&b"qd"[..], "a")));
+  separated_list0(tag([0x0]), is_not([0x0u8]))(i)
 }
 
-named_args!(issue_771(count: usize)<Vec<u32>>,
-  length_count!(value!(count), call!(nom::number::streaming::be_u32))
-);
-
-/// This test is in a separate module to check that all required symbols are imported in
-/// `escaped_transform!()`. Without the module, the `use`-es of the current module would
-/// mask the error ('"Use of undeclared type or module `Needed`" in escaped_transform!').
-mod issue_780 {
-  named!(issue_780<&str, String>,
-    escaped_transform!(call!(::nom::character::streaming::alpha1), '\\', tag!("n"))
-  );
-}
-
-// issue 617
-named!(digits, take_while1!(is_digit));
-named!(multi_617<&[u8], () >, fold_many0!( digits, (), |_, _| {}));
-
-// Sad :(
-named!(multi_617_fails<&[u8], () >, fold_many0!( take_while1!( is_digit ), (), |_, _| {}));
-
 mod issue_647 {
-  use nom::{error::Error, number::streaming::be_f64, Err};
+  use nom::bytes::streaming::tag;
+  use nom::combinator::complete;
+  use nom::multi::separated_list0;
+  use nom::{error::Error, number::streaming::be_f64, Err, IResult};
   pub type Input<'a> = &'a [u8];
 
   #[derive(PartialEq, Debug, Clone)]
@@ -267,33 +124,34 @@ mod issue_647 {
     input: Input<'a>,
     _cs: &'b f64,
   ) -> Result<(Input<'a>, Vec<f64>), Err<Error<&'a [u8]>>> {
-    separated_list0!(input, complete!(tag!(",")), complete!(be_f64))
+    separated_list0(complete(tag(",")), complete(be_f64))(input)
   }
 
-  named!(data<Input,Data>, map!(
-      do_parse!(
-          c: be_f64 >>
-          tag!("\n") >>
-          v: call!(list,&c) >>
-          (c,v)
-      ), |(c,v)| {
-          Data {
-              c: c,
-              v: v
-          }
-      }
-  ));
+  fn data(input: Input<'_>) -> IResult<Input<'_>, Data> {
+    let (i, c) = be_f64(input)?;
+    let (i, _) = tag("\n")(i)?;
+    let (i, v) = list(i, &c)?;
+    Ok((i, Data { c, v }))
+  }
 }
 
-named!(issue_775, take_till1!(|_| true));
-
 #[test]
 fn issue_848_overflow_incomplete_bits_to_bytes() {
-  named!(take, take!(0x2000000000000000));
-  named!(parser<&[u8], &[u8]>, bits!(bytes!(take)));
+  fn take(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    use nom::bytes::streaming::take;
+    take(0x2000000000000000_usize)(i)
+  }
+  fn parser(i: &[u8]) -> IResult<&[u8], &[u8]> {
+    use nom::bits::{bits, bytes};
+
+    bits(bytes(take))(i)
+  }
   assert_eq!(
     parser(&b""[..]),
-    Err(Err::Failure(error_position!(&b""[..], ErrorKind::TooLarge)))
+    Err(Err::Failure(nom::error_position!(
+      &b""[..],
+      ErrorKind::TooLarge
+    )))
   );
 }
 
@@ -338,16 +196,6 @@ fn issue_1027_convert_error_panic_nonempty() {
   );
 }
 
-named!(issue_962<&[u8], Vec<&[u8]>>,
-    fold_many0!(
-        alt!(tag!("aaaa") | tag!("bbbb")),
-        Vec::new(), |mut acc: Vec<_>, item| {
-            acc.push(item);
-            acc
-        }
-    )
-);
-
 #[test]
 fn issue_1231_bits_expect_fn_closure() {
   use nom::bits::{bits, complete::take};
diff --git a/tests/named_args.rs b/tests/named_args.rs
deleted file mode 100644
index 9ba4b3a..0000000
--- a/tests/named_args.rs
+++ /dev/null
@@ -1,122 +0,0 @@
-#[macro_use]
-extern crate nom;
-
-use nom::{
-  branch::alt,
-  bytes::complete::tag,
-  character::complete::{digit1 as digit, space0 as space},
-  sequence::{delimited, pair, preceded},
-};
-
-// Parser definition
-
-use std::str;
-use std::str::FromStr;
-
-use self::Operator::*;
-
-enum Operator {
-  Slash,
-  Star,
-}
-
-impl Operator {
-  fn to_str(&self) -> &'static str {
-    match *self {
-      Slash => "/",
-      Star => "*",
-    }
-  }
-}
-
-// Parse the specified `Operator`.
-named_args!(operator(op: Operator) <&[u8], &[u8]>,
-    call!(tag(op.to_str()))
-);
-
-// We parse any expr surrounded by the tags `open_tag` and `close_tag`, ignoring all whitespaces around those
-named_args!(brackets<'a>(open_tag: &str, close_tag: &str) <&'a[u8], i64>,
-  call!(delimited(
-    space,
-    delimited(tag(open_tag), preceded(space, expr), preceded(space, tag(close_tag))),
-    space
-  ))
-);
-
-fn byte_slice_to_str<'a>(s: &'a [u8]) -> Result<&'a str, str::Utf8Error> {
-  str::from_utf8(s)
-}
-
-// We transform an integer string into a i64, ignoring surrounding whitespaces
-// We look for a digit suite, and try to convert it.
-// If either str::from_utf8 or FromStr::from_str fail,
-// we fallback to the brackets parser defined above
-named!(factor<&[u8], i64>, alt!(
-    map_res!(
-      map_res!(
-        call!(delimited(space, digit, space)),
-        byte_slice_to_str
-      ),
-      FromStr::from_str
-    )
-  | call!(brackets, "(", ")")
-  )
-);
-
-// We read an initial factor and for each time we find
-// a * or / operator followed by another factor, we do
-// the math by folding everything
-named!(term <&[u8], i64>, do_parse!(
-    init: factor >>
-    res:  fold_many0!(
-        pair!(alt!(call!(operator, Star) | call!(operator, Slash)), factor),
-        init,
-        |acc, (op, val): (&[u8], i64)| {
-            if (op[0] as char) == '*' { acc * val } else { acc / val }
-        }
-    ) >>
-    (res)
-  )
-);
-
-named!(expr <&[u8], i64>, do_parse!(
-    init: term >>
-    res:  fold_many0!(
-        call!(pair(alt((tag("+"), tag("-"))), term)),
-        init,
-        |acc, (op, val): (&[u8], i64)| {
-            if (op[0] as char) == '+' { acc + val } else { acc - val }
-        }
-    ) >>
-    (res)
-  )
-);
-
-#[test]
-fn factor_test() {
-  assert_eq!(factor(&b"3"[..]), Ok((&b""[..], 3)));
-  assert_eq!(factor(&b" 12"[..]), Ok((&b""[..], 12)));
-  assert_eq!(factor(&b"537  "[..]), Ok((&b""[..], 537)));
-  assert_eq!(factor(&b"  24   "[..]), Ok((&b""[..], 24)));
-}
-
-#[test]
-fn term_test() {
-  assert_eq!(term(&b" 12 *2 /  3"[..]), Ok((&b""[..], 8)));
-  assert_eq!(term(&b" 2* 3  *2 *2 /  3"[..]), Ok((&b""[..], 8)));
-  assert_eq!(term(&b" 48 /  3/2"[..]), Ok((&b""[..], 8)));
-}
-
-#[test]
-fn expr_test() {
-  assert_eq!(expr(&b" 1 +  2 "[..]), Ok((&b""[..], 3)));
-  assert_eq!(expr(&b" 12 + 6 - 4+  3"[..]), Ok((&b""[..], 17)));
-  assert_eq!(expr(&b" 1 + 2*3 + 4"[..]), Ok((&b""[..], 11)));
-}
-
-#[test]
-fn parens_test() {
-  assert_eq!(expr(&b" (  2 )"[..]), Ok((&b""[..], 2)));
-  assert_eq!(expr(&b" 2* (  3 + 4 ) "[..]), Ok((&b""[..], 14)));
-  assert_eq!(expr(&b"  2*2 / ( 5 - 1) + 3"[..]), Ok((&b""[..], 4)));
-}
diff --git a/tests/reborrow_fold.rs b/tests/reborrow_fold.rs
index b53555b..d356176 100644
--- a/tests/reborrow_fold.rs
+++ b/tests/reborrow_fold.rs
@@ -1,18 +1,31 @@
 #![allow(dead_code)]
-#![allow(unused_variables)]
-
-#[macro_use]
-extern crate nom;
+// #![allow(unused_variables)]
 
 use std::str;
 
-named_args!(atom<'a>(tomb: &'a mut ())<String>,
-            map!(map_res!(is_not!(" \t\r\n()"), str::from_utf8), ToString::to_string));
+use nom::bytes::complete::is_not;
+use nom::character::complete::char;
+use nom::combinator::{map, map_res};
+use nom::multi::fold_many0;
+use nom::sequence::delimited;
+use nom::IResult;
+
+fn atom<'a>(_tomb: &'a mut ()) -> impl FnMut(&'a [u8]) -> IResult<&'a [u8], String> {
+  move |input| {
+    map(
+      map_res(is_not(" \t\r\n"), str::from_utf8),
+      ToString::to_string,
+    )(input)
+  }
+}
 
-/*FIXME: should we support the use case of borrowing data mutably in a parser?
-named_args!(list<'a>(tomb: &'a mut ())<String>,
-  delimited!(
-    char!('('),
-    fold_many0!(call!(atom, tomb), "".to_string(), |acc: String, next: String| acc + next.as_str()),
-    char!(')')));
-*/
+// FIXME: should we support the use case of borrowing data mutably in a parser?
+fn list<'a>(i: &'a [u8], tomb: &'a mut ()) -> IResult<&'a [u8], String> {
+  delimited(
+    char('('),
+    fold_many0(atom(tomb), String::new(), |acc: String, next: String| {
+      acc + next.as_str()
+    }),
+    char(')'),
+  )(i)
+}