From 2cec1b3e4c9ccac62c902d60c00de6d1549ccbe1 Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Sun, 26 Jan 2025 17:02:42 +0100 Subject: [PATCH] v8.0.0 (#1797) --- .github/workflows/codspeed.yml | 2 +- CHANGELOG.md | 67 +++++++++++++++++++++++++++++- Cargo.toml | 2 +- nom-language/Cargo.toml | 4 +- nom-language/src/precedence/mod.rs | 10 ++--- 5 files changed, 74 insertions(+), 11 deletions(-) diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index f35ed3738..ee20f6a41 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -26,7 +26,7 @@ jobs: run: cargo codspeed build -p benchmarks - name: Run the benchmarks - uses: CodSpeedHQ/action@v2 + uses: CodSpeedHQ/action@v3 with: run: cargo codspeed run -p benchmarks token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 71ee0cbb3..3e9c7e08f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,75 @@ # Change Log -## [Unreleased][unreleased] +## 8.0.0 2025-01-25 + +This versions represents a significant refactoring of nom to reduce the amount of code generated by prsers, and reduce the API surface. As such, it comes with some breaking changes, mostly around the move from closure based combinators to trait based ones. In practice, it means that instead of writing `combinator(arg)(input)`, we now write `combinator(arg).parse(input)`. + +This release also marks th introduction of the [nom-language](https://crates.io/crates/nom-language) crate, which will hold tools more focused on language parsing than the rest of nom, like the `VerboseError` type and the newly added precedence parsing combinators. ### Thanks +- @cky +- @5c077m4n +- @epage +- @Fumon +- @jtracey +- @OliveIsAWord +- @Xiretza +- @flier +- @cenodis +- @Shadow53 +- @@jmmaa +- @terror +- @zanedp +- @atouchet +- @CMDJojo +- @ackxolotl +- @xmakro +- @tfpk +- @WhyNotHugo +- @brollb +- @smheidrich +- @glittershark +- @GuillaumeGomez +- @LeoDog896 +- @fmiras +- @ttsugriy +- @McDostone +- @superboum +- @rruppy +- @thssuck +- @Chasing1020 +- @thatmarkenglishguy +- @ambiso +- @boxdot +- @krtab +- @code10129 +- @manunio +- @stuarth +- @mindeng +- @JonathanPlasse +- @nabilwadih +- @phoenixr-codes +- @gdennie +- @art049 +- @kstrohbeck + +### Added + +- `Parser::map_res` +- `Parser::map_opt` +- `many` and `fold` combinators using ranges +- `many` can collect into other types than `Vec` +- `Error` and `VerboseError` can be converted to owned versions + ### Removed - `nom::bits::*` is no longer re-exported at the crate root. This export caused frequent confusion, since e.g. `nom::complete::tag` referred to `nom::bits::complete::tag` instead of the much more commonly used `nom::bytes::complete::tag`. To migrate, change any imports of `nom::{complete::*, streaming::*, bits, bytes}` to `nom::bits::[...]`. +- `parse` combinator +- `InputIter`, `InputTakeAtPosition`, `InputLength`, `InputTake` and `Slice` are now merged in the `Input` trait ### Changed +- `Parser::map` and `Parser::flat_map` now take a `FnMut` as argument ## 7.1.2 - 2023-01-01 @@ -1479,7 +1540,9 @@ Considering the number of changes since the last release, this version can conta ## Compare code -* [unreleased](https://github.com/rust-bakery/nom/compare/7.1.2...HEAD) +* [unreleased](https://github.com/rust-bakery/nom/compare/8.0.0...HEAD) +* [8.0.0](https://github.com/rust-bakery/nom/compare/7.1.3...8.0.0) +* [7.1.3](https://github.com/rust-bakery/nom/compare/7.1.2...7.1.3) * [7.1.2](https://github.com/rust-bakery/nom/compare/7.1.1...7.1.2) * [7.1.1](https://github.com/rust-bakery/nom/compare/7.1.0...7.1.1) * [7.1.0](https://github.com/rust-bakery/nom/compare/7.0.0...7.1.0) diff --git a/Cargo.toml b/Cargo.toml index 80e065e7f..a57c047a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nom" -version = "8.0.0-beta.1" +version = "8.0.0" authors = ["contact@geoffroycouprie.com"] description = "A byte-oriented, zero-copy, parser combinators library" license = "MIT" diff --git a/nom-language/Cargo.toml b/nom-language/Cargo.toml index 3e592a42f..269cc53f0 100644 --- a/nom-language/Cargo.toml +++ b/nom-language/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nom-language" -version = "0.1.0-alpha.1" +version = "0.1.0" authors = ["contact@geoffroycouprie.com"] description = "Language parsing focused combinators for the nom parser library" edition = "2021" @@ -8,4 +8,4 @@ license = "MIT" repository = "https://github.com/rust-bakery/nom" [dependencies] -nom = { path = "..", version = "8.0.0-beta.1" } \ No newline at end of file +nom = { path = "..", version = "8.0.0" } \ No newline at end of file diff --git a/nom-language/src/precedence/mod.rs b/nom-language/src/precedence/mod.rs index 3cfc262ab..2330fd531 100644 --- a/nom-language/src/precedence/mod.rs +++ b/nom-language/src/precedence/mod.rs @@ -370,13 +370,13 @@ where /// Applies a parser multiple times separated by another parser. /// -/// It is similar to [`separated_list1`][crate::multi::separated_list1] but instead of collecting +/// It is similar to [`separated_list1`][nom::multi::separated_list1] but instead of collecting /// into a vector, you have a callback to build the output. /// /// In a LALR grammar a left recursive operator is usually built with a rule syntax such as: /// * A := A op B | B /// -/// If you try to parse that wth [`alt`][crate::branch::alt] it will fail with a stack overflow +/// If you try to parse that wth [`alt`][nom::branch::alt] it will fail with a stack overflow /// because the recusion is unlimited. This function solves this problem by converting the recusion /// into an iteration. /// @@ -387,8 +387,8 @@ where /// /// That can be written in `nom` trivially. /// -/// This stops when either parser returns [`err::error`] and returns the last built value. to instead chain an error up, see -/// [`cut`][crate::combinator::cut]. +/// This stops when either parser returns an error and returns the last built value. to instead chain an error up, see +/// [`cut`][nom::combinator::cut]. /// /// # Arguments /// * `child` The parser to apply. @@ -442,7 +442,7 @@ where } } -/// Parser implementation for the [separated_list1] combinator +/// Parser implementation for the [`separated_list1`][nom::multi::separated_list1] combinator pub struct LeftAssoc { child: F, operator: G,