Skip to content

Commit

Permalink
Improve parsing error on invalid archive format
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementNerma committed Feb 19, 2025
1 parent 5633375 commit c92a76f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/repos/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,18 @@ pub fn repository() -> impl Parser<Repository> {
copy_as,
});

let archive_format = choice::<ArchiveFormat, _>((
just("archive(TarGz)").to(ArchiveFormat::TarGz),
just("archive(TarXz)").to(ArchiveFormat::TarXz),
just("archive(TarBz)").to(ArchiveFormat::TarBz),
just("archive(Zip)").to(ArchiveFormat::Zip),
))
.atomic_err("expected a valid archive format");
let archive_format = just("archive(")
.critical_auto_msg()
.ignore_then(
choice::<ArchiveFormat, _>((
just("TarGz").to(ArchiveFormat::TarGz),
just("TarXz").to(ArchiveFormat::TarXz),
just("TarBz").to(ArchiveFormat::TarBz),
just("Zip").to(ArchiveFormat::Zip),
))
.atomic_err("expected a valid archive format"),
)
.then_ignore(char(')').critical_auto_msg());

let asset_content = choice::<AssetType, _>((
just("as")
Expand Down

0 comments on commit c92a76f

Please sign in to comment.