Skip to content

Commit 57fe123

Browse files
authored
Merge pull request #107 from cakebaker/bump_nom
Bump `nom` & adapt to API changes
2 parents eda2422 + 2fe83ca commit 57fe123

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

Cargo.lock

Lines changed: 2 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ readme = "README.md"
1010
[dependencies]
1111
regex = "1.10.4"
1212
chrono = { version="0.4.38", default-features=false, features=["std", "alloc", "clock"] }
13-
nom = "7.1.3"
13+
nom = "8.0.0"

src/parse_timestamp.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ use nom::character::complete::{char, digit1};
1010
use nom::combinator::all_consuming;
1111
use nom::multi::fold_many0;
1212
use nom::sequence::preceded;
13-
use nom::sequence::tuple;
14-
use nom::{self, IResult};
13+
use nom::{self, IResult, Parser};
1514

1615
#[derive(Debug, PartialEq)]
1716
pub enum ParseTimestampError {
@@ -55,7 +54,7 @@ pub(crate) fn parse_timestamp(s: &str) -> Result<i64, ParseTimestampError> {
5554

5655
let res: IResult<&str, (char, &str)> = all_consuming(preceded(
5756
char('@'),
58-
tuple((
57+
(
5958
// Note: to stay compatible with gnu date this code allows
6059
// multiple + and - and only considers the last one
6160
fold_many0(
@@ -67,8 +66,9 @@ pub(crate) fn parse_timestamp(s: &str) -> Result<i64, ParseTimestampError> {
6766
|_, c| c,
6867
),
6968
digit1,
70-
)),
71-
))(s);
69+
),
70+
))
71+
.parse(s);
7272

7373
let (_, (sign, number_str)) = res?;
7474

src/parse_weekday.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use chrono::Weekday;
44
use nom::branch::alt;
55
use nom::bytes::complete::tag;
66
use nom::combinator::value;
7-
use nom::{self, IResult};
7+
use nom::{self, IResult, Parser};
88

99
// Helper macro to simplify tag matching
1010
macro_rules! tag_match {
@@ -25,7 +25,8 @@ pub(crate) fn parse_weekday(s: &str) -> Option<Weekday> {
2525
tag_match!(Weekday::Fri, "friday", "fri"),
2626
tag_match!(Weekday::Sat, "saturday", "sat"),
2727
tag_match!(Weekday::Sun, "sunday", "sun"),
28-
)))(s);
28+
)))
29+
.parse(s);
2930

3031
match parse_result {
3132
Ok((_, weekday)) => Some(weekday),

0 commit comments

Comments
 (0)