From 8708d4c866216472c39d143ce3c0efffc4086bbe Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Thu, 21 Jun 2018 10:13:06 +0200 Subject: [PATCH] Revert "Bump nom to 4" This reverts commit a932cbe618a4b7127506f2a7bddc7e4c252bb70f. Signed-off-by: Igor Gnatenko --- 0001-update-to-nom-4.patch | 515 ------------ ...ByteSlice-input-type-to-fix-Incomple.patch | 737 ------------------ iso8601-0.2.0-fix-metadata.diff | 12 +- rust-iso8601.spec | 11 +- 4 files changed, 9 insertions(+), 1266 deletions(-) delete mode 100644 0001-update-to-nom-4.patch delete mode 100644 0002-use-the-CompleteByteSlice-input-type-to-fix-Incomple.patch diff --git a/0001-update-to-nom-4.patch b/0001-update-to-nom-4.patch deleted file mode 100644 index 7977e0e..0000000 --- a/0001-update-to-nom-4.patch +++ /dev/null @@ -1,515 +0,0 @@ -From 5b8d0174ec672706c132d19acf541352fcfed0ca Mon Sep 17 00:00:00 2001 -From: Geoffroy Couprie -Date: Sat, 17 Feb 2018 19:56:47 +0100 -Subject: [PATCH 1/2] update to nom 4 - ---- - src/lib.rs | 7 ++- - src/parsers.rs | 94 ++++++++++++++++---------------- - tests/lib.rs | 142 ++++++++++++++++++++++++------------------------- - 3 files changed, 120 insertions(+), 123 deletions(-) - -diff --git a/src/lib.rs b/src/lib.rs -index 5aa12ed..4d8c965 100644 ---- a/src/lib.rs -+++ b/src/lib.rs -@@ -17,7 +17,6 @@ - - #[macro_use] - extern crate nom; --use nom::IResult::*; - - use std::default::Default; - -@@ -101,7 +100,7 @@ impl Default for Date { - /// let date = iso8601::date("2015-11-02").unwrap(); - /// ``` - pub fn date(string: &str) -> Result { -- if let Done(_, parsed) = parsers::parse_date(string.as_bytes()) { -+ if let Ok((_, parsed)) = parsers::parse_date(string.as_bytes()) { - Ok(parsed) - } else { - Err(format!("Parser Error: {}", string)) -@@ -124,7 +123,7 @@ pub fn date(string: &str) -> Result { - /// let time = iso8601::time("21:56:42").unwrap(); - /// ``` - pub fn time(string: &str) -> Result { -- if let Done(_, parsed) = parsers::parse_time(string.as_bytes()) { -+ if let Ok((_, parsed)) = parsers::parse_time(string.as_bytes()) { - Ok(parsed) - } else { - Err(format!("Parser Error: {}", string)) -@@ -144,7 +143,7 @@ pub fn time(string: &str) -> Result { - /// let dt = iso8601::datetime("2015-11-03T21:56").unwrap(); - /// ``` - pub fn datetime(string: &str) -> Result { -- if let Done(_left_overs, parsed) = parsers::parse_datetime(string.as_bytes()) { -+ if let Ok((_left_overs, parsed)) = parsers::parse_datetime(string.as_bytes()) { - Ok(parsed) - } else { - Err(format!("Parser Error: {}", string)) -diff --git a/src/parsers.rs b/src/parsers.rs -index 8cd507a..ed87388 100644 ---- a/src/parsers.rs -+++ b/src/parsers.rs -@@ -16,12 +16,13 @@ use std::str::{self, FromStr}; - macro_rules! empty_or( - ($i:expr, $submac:ident!( $($args:tt)* )) => ( - if $i.len() == 0 { -- nom::IResult::Done($i, None) -+ Ok(($i, None)) - } else { - match $submac!($i, $($args)*) { -- nom::IResult::Done(i,o) => nom::IResult::Done(i, Some(o)), -- nom::IResult::Error(_) => nom::IResult::Done($i, None), -- nom::IResult::Incomplete(i) => nom::IResult::Incomplete(i) -+ Ok((i,o)) => Ok((i, Some(o))), -+ Err(nom::Err::Error(_)) => Ok(($i, None)), -+ Err(nom::Err::Failure(_)) => Ok(($i, None)), -+ Err(nom::Err::Incomplete(i)) => Err(nom::Err::Incomplete(i)) - - } - } -@@ -40,9 +41,9 @@ macro_rules! check( - } - } - if failed { -- nom::IResult::Error(nom::ErrorKind::Custom(20)) -+ Err(nom::Err::Error(error_position!($input, nom::ErrorKind::Custom(20u32)))) - } else { -- nom::IResult::Done(&b""[..], $input) -+ Ok((&b""[..], $input)) - } - } - ); -@@ -65,7 +66,7 @@ named!(take_4_digits, flat_map!(take!(4), check!(is_digit))); - // year - named!(year_prefix, alt!(tag!("+") | tag!("-"))); - named!(year , do_parse!( -- pref: opt!(complete!(year_prefix)) >> -+ pref: opt!(year_prefix) >> - year: call!(take_4_digits) >> - ( - match pref { -@@ -107,9 +108,9 @@ named!(ord_day , do_parse!( - // YYYY-MM-DD - named!(pub ymd_date , do_parse!( - y: year >> -- opt!(complete!(tag!("-"))) >> -+ opt!(tag!("-")) >> - m: month >> -- opt!(complete!(tag!("-"))) >> -+ opt!(tag!("-")) >> - d: day >> - ( Date::YMD{ year: y, month: m, day: d } ) - )); -@@ -117,7 +118,7 @@ named!(pub ymd_date , do_parse!( - // YYYY-MM-DD - named!(pub ordinal_date , do_parse!( - y: year >> -- opt!(complete!(tag!("-"))) >> -+ opt!(tag!("-")) >> - d: ord_day >> - ( Date::Ordinal{ year: y, ddd: d } ) - )); -@@ -125,10 +126,10 @@ named!(pub ordinal_date , do_parse!( - // YYYY-"W"WW-D - named!(pub iso_week_date , do_parse!( - y: year >> -- opt!(complete!(tag!("-"))) >> -+ opt!(tag!("-")) >> - tag!("W") >> - w: week >> -- opt!(complete!(tag!("-"))) >> -+ opt!(tag!("-")) >> - d: week_day >> - ( Date::Week{ year: y, ww: w, d: d } ) - )); -@@ -170,11 +171,11 @@ fn millisecond(fraction: f32) -> u32 { - // HH:MM:[SS][.(m*)][(Z|+...|-...)] - named!(pub parse_time