Skip to content

Commit d981854

Browse files
committed
nom 8, which 8, pinentry 0.8
1 parent fd4d551 commit d981854

File tree

12 files changed

+128
-158
lines changed

12 files changed

+128
-158
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ bech32 = "0.9"
4545

4646
# Parsing
4747
cookie-factory = "0.3.1"
48-
nom = { version = "7", default-features = false, features = ["alloc"] }
48+
nom = { version = "8", default-features = false, features = ["alloc"] }
4949

5050
# Secret management
51-
pinentry = "0.6"
51+
pinentry = "0.8"
5252
secrecy = "0.10"
5353
subtle = "2"
5454
zeroize = "1"

age-core/src/format.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub mod read {
163163
combinator::{map, map_opt, opt, verify},
164164
multi::{many_till, separated_list1},
165165
sequence::{pair, preceded, terminated},
166-
IResult,
166+
IResult, Parser,
167167
};
168168

169169
use super::{AgeStanza, STANZA_TAG};
@@ -211,7 +211,8 @@ pub mod read {
211211
map(take_while1(|c| (33..=126).contains(&c)), |bytes| {
212212
// Safety: ASCII bytes are valid UTF-8
213213
unsafe { std::str::from_utf8_unchecked(bytes) }
214-
})(input)
214+
})
215+
.parse(input)
215216
}
216217

217218
fn wrapped_encoded_data(input: &[u8]) -> IResult<&[u8], Vec<&[u8]>> {
@@ -240,7 +241,8 @@ pub mod read {
240241
chunks.push(partial_chunk);
241242
chunks
242243
},
243-
)(input)
244+
)
245+
.parse(input)
244246
}
245247

246248
fn legacy_wrapped_encoded_data(input: &[u8]) -> IResult<&[u8], Vec<&[u8]>> {
@@ -263,7 +265,8 @@ pub mod read {
263265
Some(chunks)
264266
}
265267
},
266-
)(input)
268+
)
269+
.parse(input)
267270
}
268271

269272
/// Reads an age stanza.
@@ -289,7 +292,8 @@ pub mod read {
289292
let tag = args.remove(0);
290293
AgeStanza { tag, args, body }
291294
},
292-
)(input)
295+
)
296+
.parse(input)
293297
}
294298

295299
fn legacy_age_stanza_inner(input: &[u8]) -> IResult<&[u8], AgeStanza<'_>> {
@@ -306,7 +310,8 @@ pub mod read {
306310
body: body.unwrap_or_else(|| vec![&[]]),
307311
}
308312
},
309-
)(input)
313+
)
314+
.parse(input)
310315
}
311316

312317
/// Reads a age stanza, allowing the legacy encoding of an body.
@@ -330,7 +335,7 @@ pub mod read {
330335
///
331336
/// [`grease_the_joint`]: super::grease_the_joint
332337
pub fn legacy_age_stanza(input: &[u8]) -> IResult<&[u8], AgeStanza<'_>> {
333-
alt((age_stanza, legacy_age_stanza_inner))(input)
338+
alt((age_stanza, legacy_age_stanza_inner)).parse(input)
334339
}
335340

336341
#[cfg(test)]

age/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ rpassword = { version = "7", optional = true }
7878

7979
[target.'cfg(any(unix, windows))'.dependencies]
8080
# Plugin management
81-
which = { version = "4", optional = true }
81+
which = { version = "8", optional = true }
8282
wsl = { version = "0.1", optional = true }
8383

8484
[dev-dependencies]

age/src/format.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ mod read {
261261
combinator::{map, map_opt},
262262
multi::many1,
263263
sequence::{pair, preceded, terminated},
264-
IResult,
264+
IResult, Parser,
265265
};
266266

267267
use super::*;
@@ -274,7 +274,7 @@ mod read {
274274
pair(
275275
many1(legacy_age_stanza),
276276
preceded(
277-
pair(tag(MAC_TAG), tag(b" ")),
277+
pair(tag(MAC_TAG), tag(" ")),
278278
terminated(
279279
map_opt(take(ENCODED_MAC_LENGTH), |tag| {
280280
base64_arg::<_, 32, 33>(&tag)
@@ -289,7 +289,8 @@ mod read {
289289
encoded_bytes: None,
290290
},
291291
),
292-
)(input)
292+
)
293+
.parse(input)
293294
}
294295

295296
/// From the age specification:
@@ -307,7 +308,8 @@ mod read {
307308
Header::Unknown(s.to_string())
308309
}),
309310
)),
310-
)(input)
311+
)
312+
.parse(input)
311313
}
312314
}
313315

0 commit comments

Comments
 (0)